From 6b94663b2455e212009a544ae23bb6a8c55407f8 Mon Sep 17 00:00:00 2001 From: Luca Muscariello Date: Thu, 9 Jun 2022 21:34:09 +0200 Subject: refactor(lib, hicn-light, vpp, hiperf): HICN-723 - move infra data structure into the shared lib - new packet cache using double hashing and lookup on prefix suffix - testing updates - authenticated requests using interest manifests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mauro Sardara Co-authored-by: Jordan Augé Co-authored-by: Michele Papalini Co-authored-by: Olivier Roques Co-authored-by: Enrico Loparco Change-Id: Iaddebfe6aa5279ea8553433b0f519578f6b9ccd9 Signed-off-by: Luca Muscariello --- .../includes/hicn/transport/core/connector.h | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'libtransport/includes/hicn/transport/core/connector.h') diff --git a/libtransport/includes/hicn/transport/core/connector.h b/libtransport/includes/hicn/transport/core/connector.h index b671a7d89..ad0d4f09d 100644 --- a/libtransport/includes/hicn/transport/core/connector.h +++ b/libtransport/includes/hicn/transport/core/connector.h @@ -30,6 +30,7 @@ #include #include +#include namespace transport { @@ -57,10 +58,10 @@ class Connector : public std::enable_shared_from_this { static constexpr std::uint16_t max_burst = 256; using Ptr = std::shared_ptr; + using ReceptionBuffer = std::vector; using PacketQueue = std::deque; - using PacketReceivedCallback = - std::function &, - const std::error_code &)>; + using PacketReceivedCallback = std::function; using PacketSentCallback = std::function; using OnCloseCallback = std::function; @@ -118,6 +119,14 @@ class Connector : public std::enable_shared_from_this { virtual void send(const utils::MemBuf::Ptr &buffer) = 0; + virtual void receive(const std::vector &buffers) { + receive_callback_(this, buffers, std::make_error_code(std::errc())); + } + + virtual void reconnect() { + on_reconnect_callback_(this, std::make_error_code(std::errc())); + } + virtual void close() = 0; virtual State state() { return state_; }; @@ -134,6 +143,11 @@ class Connector : public std::enable_shared_from_this { std::string getConnectorName() { return connector_name_; } + template + void setLocalEndpoint(EP &&endpoint) { + local_endpoint_ = std::forward(endpoint); + } + Endpoint getLocalEndpoint() { return local_endpoint_; } Endpoint getRemoteEndpoint() { return remote_endpoint_; } -- cgit 1.2.3-korg