summaryrefslogtreecommitdiffstats
path: root/libtransport/src/implementation
diff options
context:
space:
mode:
authorJordan Augé <jordan.auge+fdio@cisco.com>2022-09-21 17:11:22 +0200
committerJordan Augé <jordan.auge+fdio@cisco.com>2022-09-30 09:17:13 +0200
commit3476dd9ddecc87d9212c3bf56a5be52079e27def (patch)
tree3c7ea2664e8f99fc4fd4588b9e4493f0dc9bbb93 /libtransport/src/implementation
parent29647f687c8dadc90e2ba4d3a772eee09a1a4f1b (diff)
feat: support for new packet format in hicn-light
Ref: HICN-792 Change-Id: I3204006bd2dd2be6504c33035c6578ec0292455a Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Diffstat (limited to 'libtransport/src/implementation')
-rw-r--r--libtransport/src/implementation/socket.cc21
-rw-r--r--libtransport/src/implementation/socket.h1
-rw-r--r--libtransport/src/implementation/socket_consumer.h11
-rw-r--r--libtransport/src/implementation/socket_producer.h10
4 files changed, 22 insertions, 21 deletions
diff --git a/libtransport/src/implementation/socket.cc b/libtransport/src/implementation/socket.cc
index 8e9760a5d..c554d09d3 100644
--- a/libtransport/src/implementation/socket.cc
+++ b/libtransport/src/implementation/socket.cc
@@ -23,34 +23,17 @@ namespace implementation {
Socket::Socket(std::shared_ptr<core::Portal> &&portal)
: portal_(std::move(portal)),
is_async_(false),
- packet_format_(interface::default_values::packet_format),
signer_(std::make_shared<auth::VoidSigner>()),
verifier_(std::make_shared<auth::VoidVerifier>()) {}
int Socket::setSocketOption(int socket_option_key,
hicn_packet_format_t packet_format) {
- switch (socket_option_key) {
- case interface::GeneralTransportOptions::PACKET_FORMAT:
- packet_format_ = packet_format;
- break;
- default:
- return SOCKET_OPTION_NOT_SET;
- }
-
- return SOCKET_OPTION_SET;
+ return SOCKET_OPTION_NOT_SET;
}
int Socket::getSocketOption(int socket_option_key,
hicn_packet_format_t &packet_format) {
- switch (socket_option_key) {
- case interface::GeneralTransportOptions::PACKET_FORMAT:
- packet_format = packet_format_;
- break;
- default:
- return SOCKET_OPTION_NOT_GET;
- }
-
- return SOCKET_OPTION_GET;
+ return SOCKET_OPTION_NOT_GET;
}
} // namespace implementation
diff --git a/libtransport/src/implementation/socket.h b/libtransport/src/implementation/socket.h
index 55132eb75..d0d2ba2ac 100644
--- a/libtransport/src/implementation/socket.h
+++ b/libtransport/src/implementation/socket.h
@@ -71,7 +71,6 @@ class Socket {
protected:
std::shared_ptr<core::Portal> portal_;
bool is_async_;
- hicn_packet_format_t packet_format_;
std::shared_ptr<auth::Signer> signer_;
std::shared_ptr<auth::Verifier> verifier_;
};
diff --git a/libtransport/src/implementation/socket_consumer.h b/libtransport/src/implementation/socket_consumer.h
index 4721f426c..3117e21e7 100644
--- a/libtransport/src/implementation/socket_consumer.h
+++ b/libtransport/src/implementation/socket_consumer.h
@@ -39,6 +39,7 @@ class ConsumerSocket : public Socket {
std::shared_ptr<core::Portal> &&portal)
: Socket(std::move(portal)),
consumer_interface_(consumer),
+ packet_format_(default_values::packet_format),
interest_lifetime_(default_values::interest_lifetime),
min_window_size_(default_values::min_window_size),
max_window_size_(default_values::max_window_size),
@@ -273,6 +274,10 @@ class ConsumerSocket : public Socket {
manifest_factor_alert_ = socket_option_value;
break;
+ case GeneralTransportOptions::PACKET_FORMAT:
+ packet_format_ = socket_option_value;
+ break;
+
default:
return SOCKET_OPTION_NOT_SET;
}
@@ -318,7 +323,6 @@ class ConsumerSocket : public Socket {
on_content_object_input_ = VOID_HANDLER;
break;
}
-
default:
return SOCKET_OPTION_NOT_SET;
}
@@ -602,6 +606,10 @@ class ConsumerSocket : public Socket {
socket_option_value = manifest_factor_alert_;
break;
+ case GeneralTransportOptions::PACKET_FORMAT:
+ socket_option_value = packet_format_;
+ break;
+
default:
return SOCKET_OPTION_NOT_GET;
}
@@ -854,6 +862,7 @@ class ConsumerSocket : public Socket {
// set from the consume
Name network_name_;
+ hicn_packet_format_t packet_format_;
int interest_lifetime_;
double min_window_size_;
diff --git a/libtransport/src/implementation/socket_producer.h b/libtransport/src/implementation/socket_producer.h
index 53ce28766..c5e0929b2 100644
--- a/libtransport/src/implementation/socket_producer.h
+++ b/libtransport/src/implementation/socket_producer.h
@@ -48,6 +48,7 @@ class ProducerSocket : public Socket {
std::shared_ptr<core::Portal> &&portal)
: Socket(std::move(portal)),
producer_interface_(producer_socket),
+ packet_format_(default_values::packet_format),
data_packet_size_(default_values::content_object_packet_size),
max_segment_size_(default_values::content_object_packet_size),
content_object_expiry_time_(default_values::content_object_expiry_time),
@@ -199,6 +200,10 @@ class ProducerSocket : public Socket {
content_object_expiry_time_ = socket_option_value;
break;
+ case GeneralTransportOptions::PACKET_FORMAT:
+ packet_format_ = socket_option_value;
+ break;
+
default:
return SOCKET_OPTION_NOT_SET;
}
@@ -490,6 +495,10 @@ class ProducerSocket : public Socket {
socket_option_value = content_object_expiry_time_;
break;
+ case GeneralTransportOptions::PACKET_FORMAT:
+ socket_option_value = packet_format_;
+ break;
+
default:
return SOCKET_OPTION_NOT_SET;
}
@@ -758,6 +767,7 @@ class ProducerSocket : public Socket {
// Threads
protected:
interface::ProducerSocket *producer_interface_;
+ std::atomic<hicn_packet_format_t> packet_format_;
std::atomic<size_t> data_packet_size_;
std::atomic<size_t> max_segment_size_;
std::atomic<uint32_t> content_object_expiry_time_;