aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/core
diff options
context:
space:
mode:
authorAngelo Mantellini <angelo.mantellini@cisco.com>2020-02-27 16:06:50 +0000
committerGerrit Code Review <gerrit@fd.io>2020-02-27 16:06:50 +0000
commitee91ccd88a2fe1de74e4128ef84840e58ec70295 (patch)
tree9a435acaee53a8d455b1c1f8212f20ffb9a4de70 /libtransport/src/core
parent0fe06328d8bb8a174f0e9a246b437e5eaf2a7628 (diff)
parent443f9e81c2f721898c1e7edf2940172fef6f55fe (diff)
Merge "[HICN-539] Expose portal APIs to applications"
Diffstat (limited to 'libtransport/src/core')
-rw-r--r--libtransport/src/core/pending_interest.h7
-rw-r--r--libtransport/src/core/portal.h54
2 files changed, 7 insertions, 54 deletions
diff --git a/libtransport/src/core/pending_interest.h b/libtransport/src/core/pending_interest.h
index 87fed5073..d9ec2ed40 100644
--- a/libtransport/src/core/pending_interest.h
+++ b/libtransport/src/core/pending_interest.h
@@ -19,6 +19,7 @@
#include <hicn/transport/core/content_object.h>
#include <hicn/transport/core/interest.h>
#include <hicn/transport/core/name.h>
+#include <hicn/transport/interfaces/portal.h>
#include <hicn/transport/portability/portability.h>
#include <utils/deadline_timer.h>
@@ -36,10 +37,8 @@ class RawSocketInterface;
template <typename ForwarderInt>
class Portal;
-typedef std::function<void(Interest::Ptr &&, ContentObject::Ptr &&)>
- OnContentObjectCallback;
-typedef std::function<void(Interest::Ptr &&)> OnInterestTimeoutCallback;
-typedef std::function<void(const std::error_code &)> TimerCallback;
+using OnContentObjectCallback = interface::Portal::OnContentObjectCallback;
+using OnInterestTimeoutCallback = interface::Portal::OnInterestTimeoutCallback;
class PendingInterest {
friend class Portal<HicnForwarderInterface>;
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 <hicn/transport/core/name.h>
#include <hicn/transport/core/prefix.h>
#include <hicn/transport/errors/errors.h>
+#include <hicn/transport/interfaces/portal.h>
#include <hicn/transport/portability/portability.h>
#include <hicn/transport/utils/log.h>
@@ -39,8 +40,6 @@
#include <queue>
#include <unordered_map>
-#define UNSET_CALLBACK 0
-
namespace transport {
namespace core {
@@ -230,36 +229,7 @@ class Pool {
using PendingInterestHashTable =
std::unordered_map<uint32_t, PendingInterest::Ptr>;
-template <typename PrefixType>
-class BasicBindConfig {
- static_assert(std::is_same<Prefix, PrefixType>::value,
- "Prefix must be a Prefix type.");
-
- const uint32_t standard_cs_reserved = 5000;
-
- public:
- template <typename T>
- BasicBindConfig(T &&prefix)
- : prefix_(std::forward<T &&>(prefix)),
- content_store_reserved_(standard_cs_reserved) {}
-
- template <typename T>
- BasicBindConfig(T &&prefix, uint32_t cs_reserved)
- : prefix_(std::forward<T &&>(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<Prefix>;
+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_) {}