From 443f9e81c2f721898c1e7edf2940172fef6f55fe Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Thu, 27 Feb 2020 16:47:49 +0100 Subject: [HICN-539] Expose portal APIs to applications Change-Id: Icbaad69981193119714f5689faf3518d2e152e11 Signed-off-by: Mauro Sardara --- libtransport/src/core/portal.h | 54 ++++-------------------------------------- 1 file changed, 4 insertions(+), 50 deletions(-) (limited to 'libtransport/src/core/portal.h') diff --git a/libtransport/src/core/portal.h b/libtransport/src/core/portal.h index d7c463dfd..cf1010068 100644 --- a/libtransport/src/core/portal.h +++ b/libtransport/src/core/portal.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -39,8 +40,6 @@ #include #include -#define UNSET_CALLBACK 0 - namespace transport { namespace core { @@ -230,36 +229,7 @@ class Pool { using PendingInterestHashTable = std::unordered_map; -template -class BasicBindConfig { - static_assert(std::is_same::value, - "Prefix must be a Prefix type."); - - const uint32_t standard_cs_reserved = 5000; - - public: - template - BasicBindConfig(T &&prefix) - : prefix_(std::forward(prefix)), - content_store_reserved_(standard_cs_reserved) {} - - template - BasicBindConfig(T &&prefix, uint32_t cs_reserved) - : prefix_(std::forward(prefix)), - content_store_reserved_(cs_reserved) {} - - TRANSPORT_ALWAYS_INLINE const PrefixType &prefix() const { return prefix_; } - - TRANSPORT_ALWAYS_INLINE uint32_t csReserved() const { - return content_store_reserved_; - } - - private: - PrefixType prefix_; - uint32_t content_store_reserved_; -}; - -using BindConfig = BasicBindConfig; +using interface::BindConfig; /** * Portal is a opaque class which is used for sending/receiving interest/data @@ -290,24 +260,8 @@ class Portal { "ForwarderInt must inherit from ForwarderInterface!"); public: - /** - * Consumer callback is an abstract class containing two methods to be - * implemented by a consumer application. - */ - class ConsumerCallback { - public: - virtual void onContentObject(Interest::Ptr &&i, ContentObject::Ptr &&c) = 0; - virtual void onTimeout(Interest::Ptr &&i) = 0; - }; - - /** - * Producer callback is an abstract class containing two methods to be - * implemented by a producer application. - */ - class ProducerCallback { - public: - virtual void onInterest(Interest::Ptr &&i) = 0; - }; + using ConsumerCallback = interface::Portal::ConsumerCallback; + using ProducerCallback = interface::Portal::ProducerCallback; Portal() : Portal(internal_io_service_) {} -- cgit 1.2.3-korg