diff options
author | Alberto Compagno <acompagn+fdio@cisco.com> | 2019-02-18 10:56:49 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2019-02-18 10:56:49 +0000 |
commit | 2fd90aea1831942cda49d6635e95c86d8e494966 (patch) | |
tree | d7182493aa06976f252a0bdce34228e39ee8d050 /libtransport/src/hicn/transport/core/hicn_forwarder_interface.h | |
parent | 7465d7ee3fbae80d24342930ad78682a6e674bb9 (diff) | |
parent | 79e0d4f89c4d532189aae06cc5dfbc14e3269703 (diff) |
Merge "[HICN-50] Added udp application connector."
Diffstat (limited to 'libtransport/src/hicn/transport/core/hicn_forwarder_interface.h')
-rw-r--r-- | libtransport/src/hicn/transport/core/hicn_forwarder_interface.h | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/libtransport/src/hicn/transport/core/hicn_forwarder_interface.h b/libtransport/src/hicn/transport/core/hicn_forwarder_interface.h index e57fae105..b11841b69 100644 --- a/libtransport/src/hicn/transport/core/hicn_forwarder_interface.h +++ b/libtransport/src/hicn/transport/core/hicn_forwarder_interface.h @@ -17,7 +17,7 @@ #include <hicn/transport/core/forwarder_interface.h> #include <hicn/transport/core/prefix.h> -#include <hicn/transport/core/socket_connector.h> +#include <hicn/transport/core/udp_socket_connector.h> #include <deque> @@ -26,7 +26,10 @@ namespace transport { namespace core { class HicnForwarderInterface - : public ForwarderInterface<HicnForwarderInterface, SocketConnector> { + : public ForwarderInterface<HicnForwarderInterface, UdpSocketConnector> { + static constexpr uint8_t ack_code = 0xc2; + static constexpr uint8_t nack_code = 0xc3; + public: union addressLight { uint32_t ipv4; @@ -46,9 +49,9 @@ class HicnForwarderInterface }; using route_to_self_command = struct route_to_self_command; - using ConnectorType = SocketConnector; + using ConnectorType = UdpSocketConnector; - HicnForwarderInterface(SocketConnector &connector); + HicnForwarderInterface(UdpSocketConnector &connector); ~HicnForwarderInterface(); @@ -58,6 +61,21 @@ class HicnForwarderInterface std::uint16_t getMtu() { return interface_mtu; } + TRANSPORT_ALWAYS_INLINE static bool isControlMessageImpl( + const uint8_t *message) { + return message[0] == ack_code || message[0] == nack_code; + } + + TRANSPORT_ALWAYS_INLINE void processControlMessageReplyImpl( + Packet::MemBufPtr &&packet_buffer) { + if (packet_buffer->data()[0] == nack_code) { + throw errors::RuntimeException( + "Received Nack message from hicn light forwarder."); + } + } + + void closeConnection(); + private: static constexpr std::uint16_t interface_mtu = 1500; }; |