aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorLuca Muscariello <muscariello@ieee.org>2022-08-04 16:06:34 +0200
committerLuca Muscariello <muscariello@ieee.org>2022-08-04 16:31:51 +0200
commit6d22a0db96aa7f8e3102ae44d00c09e36a2e9c57 (patch)
tree79546bbf09f6fbf74db7bc89117843f06ce937ea /apps
parent012843b1c0bc0838e69085ed83a79ec8b6f97360 (diff)
feat: Due to the deep modifications related to names and packet format,
this task cover a large part of the codebase and involves several changes: - the library provides a name data structure (hicn_name_t ), which is composed of a name prefix (hicn_name_prefix_t) and a name suffix (hicn_name_suffix_t), and it has been extended to provide all support functions required for name manipulation, including common prefix computation, as required for the Longest Prefix Match (LPM)in the forwarder, in addition to Exact Prefix Match (EPM). - all code has been rewritten to use this data structure instead of having for instance the forwarder define its own name class (used to be Name and NameBitVector) the code has been refactored to minimize name allocations and copies, one remaining aspect is the difference of name storage between PIT and CS entries (respectively in the PIT entry, and in the message buffer), which causes the packet cache index to be updated when a PIT entry is converted into a CS entry. By storing the name in the PIT/CS entry everytime, we might save on this operation). - hicn-light FIB has been rewritten : code has been refactored and should now be shorter and documented; unit tests have been drafted but more would be required to cover all cases and match the algorithms to add/remove nodes, as specified in the doc. all protocol details and hICN header formats are now abstracted by the library for the forwarder (and thus header.h and  protocols/*.h have been removed from public includes, and replaced by packet.h providing protocol agnostic packet level functions, completely replacing the compat.h header that used to provide similar functions. - this works by exposing a opaque buffer to the application (a kind of socket buffer) which is used by the lib to cache the packet format and offsets of the different layers in the buffer and provider efficient operations (the packet format is either defined for packet construction, or guessed at ingress, and this structure is updated accordingly only once). Co-authored-by: Jordan Augé <jordan.auge+fdio@cisco.com> Signed-off-by: Luca Muscariello <muscariello@ieee.org> Change-Id: I31e321897f85f0267fe8ba4720363c180564492f
Diffstat (limited to 'apps')
-rw-r--r--apps/hiperf/src/common.h10
-rw-r--r--apps/hiperf/src/main.cc10
-rw-r--r--apps/http-proxy/CMakeLists.txt3
-rw-r--r--apps/http-proxy/includes/hicn/http-proxy/forwarder_interface.h3
-rw-r--r--apps/http-proxy/includes/hicn/http-proxy/http_session.h2
-rw-r--r--apps/http-proxy/includes/hicn/http-proxy/icn_receiver.h2
-rw-r--r--apps/http-proxy/src/forwarder_interface.cc28
-rw-r--r--apps/ping/src/ping_client.cc67
-rw-r--r--apps/ping/src/ping_server.cc177
9 files changed, 109 insertions, 193 deletions
diff --git a/apps/hiperf/src/common.h b/apps/hiperf/src/common.h
index 5143afe31..29cc05c71 100644
--- a/apps/hiperf/src/common.h
+++ b/apps/hiperf/src/common.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Cisco and/or its affiliates.
+ * Copyright (c) 2021-2022 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -178,11 +178,13 @@ class PayloadSize {
bool ah = false) {
switch (prefix.getAddressFamily()) {
case AF_INET:
- return ah ? HF_INET_TCP_AH : HF_INET_TCP;
+ return ah ? HICN_PACKET_FORMAT_IPV4_TCP_AH
+ : HICN_PACKET_FORMAT_IPV4_TCP;
case AF_INET6:
- return ah ? HF_INET6_TCP_AH : HF_INET6_TCP;
+ return ah ? HICN_PACKET_FORMAT_IPV6_TCP_AH
+ : HICN_PACKET_FORMAT_IPV6_TCP;
default:
- return HF_UNSPEC;
+ return HICN_PACKET_FORMAT_NONE;
}
}
diff --git a/apps/hiperf/src/main.cc b/apps/hiperf/src/main.cc
index 85cadd677..74724209b 100644
--- a/apps/hiperf/src/main.cc
+++ b/apps/hiperf/src/main.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Cisco and/or its affiliates.
+ * Copyright (c) 2021-2022 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -33,7 +33,7 @@ void usage() {
std::cerr << "-f\t<filename>\t\t\t"
<< "Log file" << std::endl;
std::cerr << "-z\t<io_module>\t\t\t"
- << "IO module to use. Default: hicnlightng_module" << std::endl;
+ << "IO module to use. Default: hicnlight_module" << std::endl;
std::cerr << "-F\t<conf_file>\t\t\t"
<< "Path to optional configuration file for libtransport"
<< std::endl;
@@ -214,7 +214,7 @@ int main(int argc, char *argv[]) {
char *log_file = nullptr;
transport::interface::global_config::IoModuleConfiguration config;
std::string conf_file;
- config.name = "hicnlightng_module";
+ config.name = "hicnlight_module";
// Consumer
ClientConfiguration client_configuration;
@@ -290,8 +290,8 @@ int main(int argc, char *argv[]) {
break;
}
case 'w': {
- client_configuration.packet_format_ = Packet::Format::HF_INET6_UDP;
- server_configuration.packet_format_ = Packet::Format::HF_INET6_UDP;
+ client_configuration.packet_format_ = HICN_PACKET_FORMAT_IPV6_UDP;
+ server_configuration.packet_format_ = HICN_PACKET_FORMAT_IPV6_UDP;
break;
}
case 'k': {
diff --git a/apps/http-proxy/CMakeLists.txt b/apps/http-proxy/CMakeLists.txt
index dbe9bc51c..5acf09c19 100644
--- a/apps/http-proxy/CMakeLists.txt
+++ b/apps/http-proxy/CMakeLists.txt
@@ -15,7 +15,7 @@
# Compiler options
##############################################################
set(COMPILER_OPTIONS
- ${DEFAULT_COMPILER_OPTIONS}
+ PRIVATE ${DEFAULT_COMPILER_OPTIONS}
)
# -Wno-c99-designator issue
@@ -94,5 +94,6 @@ if (NOT DISABLE_EXECUTABLES)
DEPENDS ${LIBHTTP_PROXY_STATIC}
COMPONENT ${HICN_APPS}
LINK_FLAGS ${LINK_FLAGS}
+ COMPILE_OPTIONS ${COMPILER_OPTIONS}
)
endif ()
diff --git a/apps/http-proxy/includes/hicn/http-proxy/forwarder_interface.h b/apps/http-proxy/includes/hicn/http-proxy/forwarder_interface.h
index 0741099df..c60e26c63 100644
--- a/apps/http-proxy/includes/hicn/http-proxy/forwarder_interface.h
+++ b/apps/http-proxy/includes/hicn/http-proxy/forwarder_interface.h
@@ -28,8 +28,7 @@ extern "C" {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshorten-64-to-32"
#endif
-#include <asio.hpp>
-#include <asio/steady_timer.hpp>
+#include <hicn/transport/core/asio_wrapper.h>
#ifdef __APPLE__
#pragma clang diagnostic pop
#endif
diff --git a/apps/http-proxy/includes/hicn/http-proxy/http_session.h b/apps/http-proxy/includes/hicn/http-proxy/http_session.h
index 43d10e156..1563431dc 100644
--- a/apps/http-proxy/includes/hicn/http-proxy/http_session.h
+++ b/apps/http-proxy/includes/hicn/http-proxy/http_session.h
@@ -21,7 +21,7 @@
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshorten-64-to-32"
#endif
-#include <asio.hpp>
+#include <hicn/transport/core/asio_wrapper.h>
#ifdef __APPLE__
#pragma clang diagnostic pop
#endif
diff --git a/apps/http-proxy/includes/hicn/http-proxy/icn_receiver.h b/apps/http-proxy/includes/hicn/http-proxy/icn_receiver.h
index ab90fab07..a402d44cf 100644
--- a/apps/http-proxy/includes/hicn/http-proxy/icn_receiver.h
+++ b/apps/http-proxy/includes/hicn/http-proxy/icn_receiver.h
@@ -14,12 +14,12 @@
*/
#include <hicn/http-proxy/http_session.h>
+#include <hicn/transport/core/asio_wrapper.h>
#include <hicn/transport/core/prefix.h>
#include <hicn/transport/interfaces/publication_options.h>
#include <hicn/transport/interfaces/socket_producer.h>
#include <hicn/transport/utils/spinlock.h>
-#include <asio.hpp>
#include <cassert>
#include <cstring>
#include <queue>
diff --git a/apps/http-proxy/src/forwarder_interface.cc b/apps/http-proxy/src/forwarder_interface.cc
index 1c034f60f..5566eb6ff 100644
--- a/apps/http-proxy/src/forwarder_interface.cc
+++ b/apps/http-proxy/src/forwarder_interface.cc
@@ -27,7 +27,7 @@ namespace transport {
ForwarderInterface::~ForwarderInterface() {}
int ForwarderInterface::connectToForwarder() {
- sock_ = hc_sock_create();
+ sock_ = hc_sock_create(FORWARDER_TYPE_HICNLIGHT, NULL);
if (!sock_) return -1;
if (hc_sock_connect(sock_) < 0) {
@@ -96,7 +96,8 @@ void ForwarderInterface::internalRemoveConnectedUser(uint32_t route_id) {
std::vector<hc_route_t *> routes_to_remove;
foreach_route(r, data) {
char remote_addr[INET6_ADDRSTRLEN];
- int ret = ip_address_ntop(&r->remote_addr, remote_addr, r->len, r->family);
+ int ret =
+ hicn_ip_address_ntop(&r->remote_addr, remote_addr, r->len, r->family);
if (ret < 0) continue;
std::string route_addr(remote_addr);
@@ -201,8 +202,9 @@ int ForwarderInterface::tryToCreateFaceAndRoute(route_info_t *route_info) {
if (interface.compare("lo") != 0) {
found = true;
- ip_address_t remote_ip;
- if (ip_address_pton(route_info->remote_addr.c_str(), &remote_ip) < 0) {
+ hicn_ip_address_t remote_ip;
+ if (hicn_ip_address_pton(route_info->remote_addr.c_str(), &remote_ip) <
+ 0) {
hc_data_free(data);
return -1;
}
@@ -210,14 +212,14 @@ int ForwarderInterface::tryToCreateFaceAndRoute(route_info_t *route_info) {
hc_face_t face;
memset(&face, 0, sizeof(hc_face_t));
- face.face.type = FACE_TYPE_UDP;
- face.face.family = route_info->family;
- face.face.local_addr = l->local_addr;
- face.face.remote_addr = remote_ip;
- face.face.local_port = l->local_port;
- face.face.remote_port = route_info->remote_port;
+ face.type = FACE_TYPE_UDP;
+ face.family = route_info->family;
+ face.local_addr = l->local_addr;
+ face.remote_addr = remote_ip;
+ face.local_port = l->local_port;
+ face.remote_port = route_info->remote_port;
- if (netdevice_set_name(&face.face.netdevice, l->interface_name) < 0) {
+ if (netdevice_set_name(&face.netdevice, l->interface_name) < 0) {
hc_data_free(data);
return -1;
}
@@ -237,10 +239,10 @@ int ForwarderInterface::tryToCreateFaceAndRoute(route_info_t *route_info) {
return -1;
}
- ip_address_t route_ip;
+ hicn_ip_address_t route_ip;
hc_route_t route;
- if (ip_address_pton(route_info->route_addr.c_str(), &route_ip) < 0) {
+ if (hicn_ip_address_pton(route_info->route_addr.c_str(), &route_ip) < 0) {
hc_data_free(data);
return -1;
}
diff --git a/apps/ping/src/ping_client.cc b/apps/ping/src/ping_client.cc
index 2371e4453..6cc6de548 100644
--- a/apps/ping/src/ping_client.cc
+++ b/apps/ping/src/ping_client.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Cisco and/or its affiliates.
+ * Copyright (c) 2021-2022 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -53,9 +53,6 @@ class Configuration {
bool verbose_;
bool dump_;
bool jump_;
- bool open_;
- bool always_syn_;
- bool always_ack_;
bool quiet_;
uint32_t jump_freq_;
uint32_t jump_size_;
@@ -73,9 +70,6 @@ class Configuration {
verbose_ = false;
dump_ = false;
jump_ = false;
- open_ = false;
- always_syn_ = false;
- always_ack_ = false;
quiet_ = false;
jump_freq_ = 0;
jump_size_ = 0;
@@ -155,12 +149,10 @@ class Client : interface::Portal::TransportCallback {
std::cout << "<<< interest name: " << interest.getName()
<< " (n_suffixes=" << interest.numberOfSuffixes() << ")"
<< " src port: " << interest.getSrcPort()
- << " dst port: " << interest.getDstPort()
- << " flags: " << interest.printFlags() << std::endl;
+ << " dst port: " << interest.getDstPort() << std::endl;
std::cout << "<<< object name: " << object.getName()
<< " src port: " << object.getSrcPort()
- << " dst port: " << object.getDstPort()
- << " flags: " << object.printFlags() << " path label "
+ << " dst port: " << object.getDstPort() << " path label "
<< object.getPathLabel() << " ("
<< (object.getPathLabel() >> 24) << ")"
<< " TTL: " << (int)object.getTTL() << std::endl;
@@ -185,12 +177,6 @@ class Client : interface::Portal::TransportCallback {
if (!config_->quiet_) std::cout << std::endl;
- if (!config_->always_syn_) {
- if (object.testSyn() && object.testAck() && state_ == SYN_STATE) {
- state_ = ACK_STATE;
- }
- }
-
received_++;
processed_++;
if (processed_ >= config_->maxPing_) {
@@ -202,8 +188,7 @@ class Client : interface::Portal::TransportCallback {
if (config_->verbose_) {
std::cout << "### timeout for " << name
<< " src port: " << interest->getSrcPort()
- << " dst port: " << interest->getDstPort()
- << " flags: " << interest->printFlags() << std::endl;
+ << " dst port: " << interest->getDstPort() << std::endl;
} else if (!config_->quiet_) {
std::cout << "### timeout for " << name << std::endl;
}
@@ -231,11 +216,11 @@ class Client : interface::Portal::TransportCallback {
void doPing() {
const Name interest_name(config_->name_, (uint32_t)sequence_number_);
- hicn_format_t format;
+ hicn_packet_format_t format;
if (interest_name.getAddressFamily() == AF_INET) {
- format = signer_ ? HF_INET_TCP_AH : HF_INET_TCP;
+ format = HICN_PACKET_FORMAT_IPV4_TCP;
} else {
- format = signer_ ? HF_INET6_TCP_AH : HF_INET6_TCP;
+ format = HICN_PACKET_FORMAT_IPV6_TCP;
}
size_t additional_header_size = 0;
@@ -244,17 +229,6 @@ class Client : interface::Portal::TransportCallback {
additional_header_size);
interest->setLifetime(uint32_t(config_->interestLifetime_));
- if (!signer_) interest->resetFlags();
-
- if (config_->open_ || config_->always_syn_) {
- if (state_ == SYN_STATE) {
- interest->setSyn();
- } else if (state_ == ACK_STATE) {
- interest->setAck();
- }
- } else if (config_->always_ack_) {
- interest->setAck();
- }
interest->setSrcPort(config_->srcPort_);
interest->setDstPort(config_->dstPort_);
@@ -270,7 +244,6 @@ class Client : interface::Portal::TransportCallback {
std::cout << ">>> send interest " << interest->getName()
<< " src port: " << interest->getSrcPort()
<< " dst port: " << interest->getDstPort()
- << " flags: " << interest->printFlags()
<< " TTL: " << (int)interest->getTTL()
<< " suffixes in manifest: "
<< config_->num_int_manifest_suffixes_ << std::endl;
@@ -362,13 +335,6 @@ void help() {
std::cout << " e.g. '-m 6 -a -2' sends two interest (0 and "
"3) with 2 suffixes each (1,2 and 4,5 respectively)"
<< std::endl;
- std::cout << "-O open tcp connection (three way handshake) "
- "(default false)"
- << std::endl;
- std::cout << "-S send always syn messages (default false)"
- << std::endl;
- std::cout << "-A send always ack messages (default false)"
- << std::endl;
std::cout << "HICN options" << std::endl;
std::cout << "-n <val> hicn name (default b001::1)" << std::endl;
std::cout
@@ -383,7 +349,7 @@ void help() {
<< std::endl;
std::cout << "-q quiet, not prints (default false)"
<< std::endl;
- std::cerr << "-z <io_module> IO module to use. Default: hicnlightng_module"
+ std::cerr << "-z <io_module> IO module to use. Default: hicnlight_module"
<< std::endl;
std::cerr << "-F <conf_file> Path to optional configuration file for "
"libtransport"
@@ -405,7 +371,7 @@ int main(int argc, char *argv[]) {
std::string conf_file;
transport::interface::global_config::IoModuleConfiguration io_config;
- io_config.name = "hicnlightng_module";
+ io_config.name = "hicnlight_module";
while ((opt = getopt(argc, argv, "a:j::t:i:m:s:d:n:l:f:c:SAOqVDHz:F:")) !=
-1) {
@@ -445,21 +411,6 @@ int main(int argc, char *argv[]) {
case 'D':
c->dump_ = true;
break;
- case 'O':
- c->always_syn_ = false;
- c->always_ack_ = false;
- c->open_ = true;
- break;
- case 'S':
- c->always_syn_ = true;
- c->always_ack_ = false;
- c->open_ = false;
- break;
- case 'A':
- c->always_syn_ = false;
- c->always_ack_ = true;
- c->open_ = false;
- break;
case 'q':
c->quiet_ = true;
c->verbose_ = false;
diff --git a/apps/ping/src/ping_server.cc b/apps/ping/src/ping_server.cc
index dd7d23b5e..876efd133 100644
--- a/apps/ping/src/ping_server.cc
+++ b/apps/ping/src/ping_server.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Cisco and/or its affiliates.
+ * Copyright (c) 2021-2022 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -42,18 +42,15 @@ class CallbackContainer {
public:
CallbackContainer(const Name &prefix, uint32_t object_size, bool verbose,
- bool dump, bool quite, bool flags, bool reset, uint8_t ttl,
- auth::Signer *signer, bool sign, std::string passphrase,
- uint32_t lifetime)
+ bool dump, bool quiet, uint8_t ttl, auth::Signer *signer,
+ bool sign, std::string passphrase, uint32_t lifetime)
: buffer_(object_size, 'X'),
content_objects_((std::uint32_t)(1 << log2_content_object_buffer_size)),
mask_((std::uint16_t)(1 << log2_content_object_buffer_size) - 1),
content_objects_index_(0),
verbose_(verbose),
dump_(dump),
- quite_(quite),
- flags_(flags),
- reset_(reset),
+ quiet_(quiet),
ttl_(ttl),
signer_(signer),
sign_(sign) {
@@ -63,14 +60,14 @@ class CallbackContainer {
core::Packet::Format format;
if (prefix.getAddressFamily() == AF_INET) {
- format = core::Packet::Format::HF_INET_TCP;
+ format = HICN_PACKET_FORMAT_IPV4_TCP;
if (sign_) {
- format = core::Packet::Format::HF_INET_TCP_AH;
+ format = HICN_PACKET_FORMAT_IPV4_TCP_AH;
}
} else {
- format = core::Packet::Format::HF_INET6_TCP;
+ format = HICN_PACKET_FORMAT_IPV6_TCP;
if (sign_) {
- format = core::Packet::Format::HF_INET6_TCP_AH;
+ format = HICN_PACKET_FORMAT_IPV6_TCP_AH;
}
}
@@ -99,11 +96,10 @@ class CallbackContainer {
std::cout << "<<< received interest " << interest.getName()
<< " src port: " << interest.getSrcPort()
<< " dst port: " << interest.getDstPort()
- << " flags: " << interest.printFlags()
<< "TTL: " << (int)interest.getTTL()
<< " suffixes in manifest: " << interest.numberOfSuffixes()
<< std::endl;
- } else if (!quite_) {
+ } else if (!quiet_) {
std::cout << "<<< received interest " << interest.getName() << std::endl;
}
@@ -113,78 +109,60 @@ class CallbackContainer {
std::cout << "-------------------------" << std::endl;
}
- if (interest.testRst()) {
- std::cout << "!!!got a reset, I don't reply" << std::endl;
- } else {
- uint32_t *suffix = interest.firstSuffix();
- uint32_t n_suffixes_in_manifest = interest.numberOfSuffixes();
- uint32_t *request_bitmap = interest.getRequestBitmap();
- if (!interest.isValid()) throw std::runtime_error("Bad interest format");
-
- Name name = interest.getName();
- uint32_t pos = 0; // Position of current suffix in manifest
- do {
- // If suffix can be processed, i.e. no manifest with bitmap excluding it
- if (!interest.hasManifest() || is_bit_set(request_bitmap, pos)) {
- auto &content_object =
- content_objects_[content_objects_index_++ & mask_];
-
- content_object->setName(interest.getName());
- content_object->setLifetime(lifetime);
- content_object->setLocator(interest.getLocator());
- content_object->setSrcPort(interest.getDstPort());
- content_object->setDstPort(interest.getSrcPort());
- content_object->setTTL(ttl_);
-
- if (!sign_) {
- content_object->resetFlags();
- }
-
- if (flags_) {
- if (interest.testSyn()) {
- content_object->setSyn();
- content_object->setAck();
- } else if (interest.testAck()) {
- content_object->setAck();
- } // here I may need to handle the FIN flag;
- } else if (reset_) {
- content_object->setRst();
- }
-
- if (verbose_) {
- std::cout << ">>> send object " << content_object->getName()
- << " src port: " << content_object->getSrcPort()
- << " dst port: " << content_object->getDstPort()
- << " flags: " << content_object->printFlags()
- << " TTL: " << (int)content_object->getTTL() << std::endl;
- } else if (!quite_) {
- std::cout << ">>> send object " << content_object->getName()
- << std::endl;
- }
-
- if (dump_) {
- std::cout << "----- object dump -----" << std::endl;
- content_object->dump();
- std::cout << "-----------------------" << std::endl;
- }
-
- if (sign_ && signer_) {
- signer_->signPacket(content_object.get());
- }
-
- p.produce(*content_object);
+ uint32_t *suffix = interest.firstSuffix();
+ uint32_t n_suffixes_in_manifest = interest.numberOfSuffixes();
+ hicn_uword *request_bitmap = interest.getRequestBitmap();
+ if (!interest.isValid()) throw std::runtime_error("Bad interest format");
+
+ Name name = interest.getName();
+ uint32_t pos = 0; // Position of current suffix in manifest
+ do {
+ // If suffix can be processed, i.e. no manifest with bitmap excluding it
+ if (!interest.hasManifest() ||
+ bitmap_is_set_no_check(request_bitmap, pos)) {
+ auto &content_object =
+ content_objects_[content_objects_index_++ & mask_];
+
+ content_object->setName(interest.getName());
+ content_object->setLifetime(lifetime);
+ content_object->setLocator(interest.getLocator());
+ content_object->setSrcPort(interest.getDstPort());
+ content_object->setDstPort(interest.getSrcPort());
+ content_object->setTTL(ttl_);
+
+ if (verbose_) {
+ std::cout << ">>> send object " << content_object->getName()
+ << " src port: " << content_object->getSrcPort()
+ << " dst port: " << content_object->getDstPort()
+ << " TTL: " << (int)content_object->getTTL() << std::endl;
+ } else if (!quiet_) {
+ std::cout << ">>> send object " << content_object->getName()
+ << std::endl;
}
- if (interest.hasManifest()) {
- uint32_t seq = *suffix;
- suffix++;
+ if (dump_) {
+ std::cout << "----- object dump -----" << std::endl;
+ content_object->dump();
+ std::cout << "-----------------------" << std::endl;
+ }
- interest.setName(name.setSuffix(seq));
+ if (sign_ && signer_) {
+ signer_->signPacket(content_object.get());
}
- } while (pos++ < n_suffixes_in_manifest);
- if (!quite_) std::cout << std::endl;
- }
+ p.produce(*content_object);
+ }
+
+ if (interest.hasManifest()) {
+ uint32_t seq = *suffix;
+ suffix++;
+
+ Name name = interest.getName();
+ interest.setName(name.setSuffix(seq));
+ }
+ } while (pos++ < n_suffixes_in_manifest);
+
+ if (!quiet_) std::cout << std::endl;
}
private:
@@ -194,9 +172,7 @@ class CallbackContainer {
std::uint16_t content_objects_index_;
bool verbose_;
bool dump_;
- bool quite_;
- bool flags_;
- bool reset_;
+ bool quiet_;
uint8_t ttl_;
auth::Signer *signer_;
bool sign_;
@@ -209,13 +185,7 @@ void help() {
std::cout << "-s <val> object content size (default 1350B)"
<< std::endl;
std::cout << "-n <val> hicn name (default b001::/64)" << std::endl;
- std::cout << "-f set tcp flags according to the flag received "
- " (default false)"
- << std::endl;
std::cout << "-l data lifetime" << std::endl;
- std::cout
- << "-r always reply with a reset flag (default false)"
- << std::endl;
std::cout << "-t set ttl (default 64)" << std::endl;
std::cout << "OUTPUT options" << std::endl;
std::cout << "-V verbose, prints statistics about the "
@@ -225,9 +195,9 @@ void help() {
std::cout << "-D dump, dumps sent and received packets "
"(default false)"
<< std::endl;
- std::cout << "-q quite, not prints (default false)"
+ std::cout << "-q quiet, not prints (default false)"
<< std::endl;
- std::cerr << "-z <io_module> IO module to use. Default: hicnlightng_module"
+ std::cerr << "-z <io_module> IO module to use. Default: hicnlight_module"
<< std::endl;
std::cerr << "-F <conf_file> Path to optional configuration file for "
"libtransport"
@@ -250,9 +220,7 @@ int main(int argc, char **argv) {
std::string delimiter = "/";
bool verbose = false;
bool dump = false;
- bool quite = false;
- bool flags = false;
- bool reset = false;
+ bool quiet = false;
uint32_t object_size = 1250;
uint8_t ttl = 64;
std::string keystore_path = "./rsa_crypto_material.p12";
@@ -263,7 +231,7 @@ int main(int argc, char **argv) {
std::string conf_file;
transport::interface::global_config::IoModuleConfiguration io_config;
- io_config.name = "hicnlightng_module";
+ io_config.name = "hicnlight_module";
int opt;
#ifndef _WIN32
@@ -296,19 +264,13 @@ int main(int argc, char **argv) {
case 'q':
verbose = false;
dump = false;
- quite = true;
+ quiet = true;
break;
#ifndef _WIN32
case 'd':
daemon = true;
break;
#endif
- case 'f':
- flags = true;
- break;
- case 'r':
- reset = true;
- break;
case 'k':
keystore_path = optarg;
sign = true;
@@ -359,14 +321,13 @@ int main(int argc, char **argv) {
if (sign) {
signer = std::make_unique<auth::AsymmetricSigner>(keystore_path,
keystore_password);
- stubs = new CallbackContainer(n, object_size, verbose, dump, quite, flags,
- reset, ttl, signer.get(), sign, passphrase,
- data_lifetime);
+ stubs =
+ new CallbackContainer(n, object_size, verbose, dump, quiet, ttl,
+ signer.get(), sign, passphrase, data_lifetime);
} else {
auth::Signer *signer = nullptr;
- stubs = new CallbackContainer(n, object_size, verbose, dump, quite, flags,
- reset, ttl, signer, sign, passphrase,
- data_lifetime);
+ stubs = new CallbackContainer(n, object_size, verbose, dump, quiet, ttl,
+ signer, sign, passphrase, data_lifetime);
}
ProducerSocket p;