From f4433f28b509a9f67ca85d79000ccf9c2f4b7a24 Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Fri, 21 Feb 2020 11:52:28 +0100 Subject: [HICN-534] Major rework on libtransport organization Change-Id: I361b83a18b4fd59be136d5f0817fc28e17e89884 Signed-off-by: Mauro Sardara --- utils/CMakeLists.txt | 3 +++ utils/src/hiperf.cc | 18 ++++++++++-------- utils/src/ping_client.cc | 10 ++++++---- utils/src/ping_server.cc | 26 +++++++++++++++++--------- 4 files changed, 36 insertions(+), 21 deletions(-) (limited to 'utils') diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index f52fec6c0..3e99fbae2 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -65,6 +65,7 @@ if (NOT DISABLE_EXECUTABLES) build_executable(hiperf SOURCES src/hiperf.cc LINK_LIBRARIES ${LIBTRANSPORT_LIBRARIES} ${WSOCK32_LIBRARY} ${WS2_32_LIBRARY} + INCLUDE_DIRS ${LIBTRANSPORT_INCLUDE_DIRS} DEPENDS ${DEPENDENCIES} COMPONENT ${HICN_UTILS} DEFINITIONS ${COMPILER_DEFINITIONS} @@ -74,6 +75,7 @@ if (NOT DISABLE_EXECUTABLES) build_executable(hicn-ping-server SOURCES src/ping_server.cc LINK_LIBRARIES ${LIBTRANSPORT_LIBRARIES} ${WSOCK32_LIBRARY} ${WS2_32_LIBRARY} + INCLUDE_DIRS ${LIBTRANSPORT_INCLUDE_DIRS} DEPENDS ${DEPENDENCIES} COMPONENT ${HICN_UTILS} DEFINITIONS ${COMPILER_DEFINITIONS} @@ -83,6 +85,7 @@ if (NOT DISABLE_EXECUTABLES) build_executable(hicn-ping-client SOURCES src/ping_client.cc LINK_LIBRARIES ${LIBTRANSPORT_LIBRARIES} ${WSOCK32_LIBRARY} ${WS2_32_LIBRARY} + INCLUDE_DIRS ${LIBTRANSPORT_INCLUDE_DIRS} DEPENDS ${DEPENDENCIES} COMPONENT ${HICN_UTILS} DEFINITIONS ${COMPILER_DEFINITIONS} diff --git a/utils/src/hiperf.cc b/utils/src/hiperf.cc index dd6ed0840..15bcb7405 100644 --- a/utils/src/hiperf.cc +++ b/utils/src/hiperf.cc @@ -14,12 +14,15 @@ */ #include +#include +#include #include #include #include +#include +#include #include -#include -#include +#include #ifdef SECURE_HICNTRANSPORT #include @@ -29,8 +32,9 @@ #ifndef _WIN32 #include #endif -#include +#include +#include #include #include #include @@ -294,7 +298,7 @@ class HIperfClient { void processLeavingInterest(ConsumerSocket &c, const Interest &interest) {} void handleTimerExpiration(ConsumerSocket &c, - const protocol::TransportStatistics &stats) { + const TransportStatistics &stats) { if (configuration_.rtc_) return; const char separator = ' '; @@ -642,9 +646,10 @@ class HIperfClient { void readSuccess(std::size_t total_size) noexcept override { std::cout << "Key size: " << total_size << " bytes" << std::endl; + afterRead(); } - void afterRead() override { + void afterRead() { std::shared_ptr verifier = std::make_shared(); verifier->addKeyFromPassphrase(*key_, utils::CryptoSuite::HMAC_SHA256); @@ -1355,9 +1360,6 @@ int main(int argc, char *argv[]) { case 'B': { auto str = std::string(optarg); std::transform(str.begin(), str.end(), str.begin(), ::tolower); - std::cout << "---------------------------------------------------------" - "---------------------->" - << str << std::endl; server_configuration.production_rate_ = str; options = -1; break; diff --git a/utils/src/ping_client.cc b/utils/src/ping_client.cc index cdf786cba..6dea17418 100644 --- a/utils/src/ping_client.cc +++ b/utils/src/ping_client.cc @@ -13,8 +13,10 @@ * limitations under the License. */ -#include -#include +#include +#include + +#include // Let's make the linker happy #if !TRANSPORT_LOG_EXTERN_GLOBAL_OUTPUT_LEVEL @@ -81,7 +83,7 @@ class Configuration { } }; -class Client : interface::BasePortal::ConsumerCallback { +class Client : implementation::BasePortal::ConsumerCallback { public: Client(Configuration *c) : portal_(), signals_(portal_.getIoService(), SIGINT) { @@ -296,7 +298,7 @@ class Client : interface::BasePortal::ConsumerCallback { private: SendTimeMap send_timestamps_; - interface::BasePortal portal_; + implementation::BasePortal portal_; asio::signal_set signals_; uint64_t sequence_number_; uint64_t last_jump_; diff --git a/utils/src/ping_server.cc b/utils/src/ping_server.cc index cd51ce5c3..d766e2811 100644 --- a/utils/src/ping_server.cc +++ b/utils/src/ping_server.cc @@ -19,10 +19,16 @@ #else #include #endif -#include -#include + +#include +#include +#include +#include #include +#include +#include + namespace transport { namespace interface { @@ -81,7 +87,8 @@ class CallbackContainer { } } - void processInterest(ProducerSocket &p, const Interest &interest, uint32_t lifetime) { + void processInterest(ProducerSocket &p, const Interest &interest, + uint32_t lifetime) { if (verbose_) { std::cout << "<<< received interest " << interest.getName() << " src port: " << interest.getSrcPort() @@ -230,8 +237,8 @@ int main(int argc, char **argv) { ttl = (uint8_t)std::stoi(optarg); break; case 'l': - data_lifetime = std::stoi(optarg); - break; + data_lifetime = std::stoi(optarg); + break; case 'V': verbose = true; break; @@ -299,10 +306,11 @@ int main(int argc, char **argv) { p.registerPrefix(producer_namespace); p.setSocketOption(GeneralTransportOptions::OUTPUT_BUFFER_SIZE, 0U); - p.setSocketOption(ProducerCallbacksOptions::CACHE_MISS, - (ProducerInterestCallback)bind( - &CallbackContainer::processInterest, stubs, - std::placeholders::_1, std::placeholders::_2, data_lifetime)); + p.setSocketOption( + ProducerCallbacksOptions::CACHE_MISS, + (ProducerInterestCallback)bind(&CallbackContainer::processInterest, stubs, + std::placeholders::_1, + std::placeholders::_2, data_lifetime)); p.connect(); -- cgit 1.2.3-korg