diff options
author | Mauro Sardara <msardara@cisco.com> | 2020-02-21 11:52:28 +0100 |
---|---|---|
committer | Mauro Sardara <msardara@cisco.com> | 2020-02-26 13:19:16 +0100 |
commit | f4433f28b509a9f67ca85d79000ccf9c2f4b7a24 (patch) | |
tree | 0f754bc9d8222f3ace11849165753acd85be3b38 /utils | |
parent | 0e7669445b6be1163189521eabed7dd0124043c8 (diff) |
[HICN-534] Major rework on libtransport organization
Change-Id: I361b83a18b4fd59be136d5f0817fc28e17e89884
Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'utils')
-rw-r--r-- | utils/CMakeLists.txt | 3 | ||||
-rw-r--r-- | utils/src/hiperf.cc | 18 | ||||
-rw-r--r-- | utils/src/ping_client.cc | 10 | ||||
-rw-r--r-- | utils/src/ping_server.cc | 26 |
4 files changed, 36 insertions, 21 deletions
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 <hicn/transport/config.h> +#include <hicn/transport/core/content_object.h> +#include <hicn/transport/core/interest.h> #include <hicn/transport/interfaces/rtc_socket_producer.h> #include <hicn/transport/interfaces/socket_consumer.h> #include <hicn/transport/interfaces/socket_producer.h> +#include <hicn/transport/security/identity.h> +#include <hicn/transport/security/signer.h> #include <hicn/transport/utils/chrono_typedefs.h> -#include <hicn/transport/utils/identity.h> -#include <hicn/transport/utils/signer.h> +#include <hicn/transport/utils/literals.h> #ifdef SECURE_HICNTRANSPORT #include <hicn/transport/interfaces/p2psecure_socket_consumer.h> @@ -29,8 +32,9 @@ #ifndef _WIN32 #include <hicn/transport/utils/daemonizator.h> #endif -#include <hicn/transport/utils/literals.h> +#include <asio.hpp> +#include <cmath> #include <fstream> #include <iomanip> #include <unordered_set> @@ -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<utils::Verifier> verifier = std::make_shared<utils::Verifier>(); 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 <hicn/transport/interfaces/socket.h> -#include <hicn/transport/utils/verifier.h> +#include <hicn/transport/core/interest.h> +#include <hicn/transport/security/verifier.h> + +#include <implementation/socket_consumer.h> // 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 <openssl/applink.c> #endif -#include <hicn/transport/utils/identity.h> -#include <hicn/transport/utils/signer.h> + +#include <hicn/transport/core/content_object.h> +#include <hicn/transport/core/interest.h> +#include <hicn/transport/security/identity.h> +#include <hicn/transport/security/signer.h> #include <hicn/transport/utils/string_tokenizer.h> +#include <unistd.h> +#include <asio.hpp> + 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(); |