summaryrefslogtreecommitdiffstats
path: root/libtransport/src/implementation/socket.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libtransport/src/implementation/socket.cc')
-rw-r--r--libtransport/src/implementation/socket.cc31
1 files changed, 30 insertions, 1 deletions
diff --git a/libtransport/src/implementation/socket.cc b/libtransport/src/implementation/socket.cc
index 2e21f2bc3..95941da07 100644
--- a/libtransport/src/implementation/socket.cc
+++ b/libtransport/src/implementation/socket.cc
@@ -14,13 +14,42 @@
*/
#include <core/global_configuration.h>
+#include <hicn/transport/interfaces/socket_options_default_values.h>
#include <implementation/socket.h>
namespace transport {
namespace implementation {
Socket::Socket(std::shared_ptr<core::Portal> &&portal)
- : portal_(std::move(portal)), is_async_(false) {}
+ : portal_(std::move(portal)),
+ is_async_(false),
+ packet_format_(interface::default_values::packet_format) {}
+
+int Socket::setSocketOption(int socket_option_key,
+ hicn_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;
+}
+
+int Socket::getSocketOption(int socket_option_key,
+ hicn_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;
+}
} // namespace implementation
} // namespace transport \ No newline at end of file