18 #include <hicn/transport/core/asio_wrapper.h>
19 #include <hicn/transport/core/content_object.h>
20 #include <hicn/transport/core/interest.h>
21 #include <hicn/transport/core/prefix.h>
25 #define UNSET_CALLBACK 0
31 template <
typename PrefixType>
33 static_assert(std::is_same<core::Prefix, PrefixType>::value,
34 "Prefix must be a Prefix type.");
36 const uint32_t standard_cs_reserved = 5000;
41 : prefix_(std::forward<T &&>(prefix)),
42 content_store_reserved_(standard_cs_reserved) {}
46 : prefix_(std::forward<T &&>(prefix)),
47 content_store_reserved_(cs_reserved) {}
49 TRANSPORT_ALWAYS_INLINE
const PrefixType &prefix()
const {
return prefix_; }
51 TRANSPORT_ALWAYS_INLINE uint32_t csReserved()
const {
52 return content_store_reserved_;
57 uint32_t content_store_reserved_;
71 virtual void onTimeout(core::Interest::Ptr &i,
const core::Name &n) = 0;
72 virtual void onError(std::error_code ec) = 0;
82 virtual void onError(std::error_code ec) = 0;
85 using OnContentObjectCallback =
87 using OnInterestTimeoutCallback =
88 std::function<void(core::Interest::Ptr &,
const core::Name &)>;
92 Portal(asio::io_service &io_service);
114 void connect(
bool is_consumer =
true);
143 core::Interest::Ptr &&interest,
144 OnContentObjectCallback &&on_content_object_callback = UNSET_CALLBACK,
145 OnInterestTimeoutCallback &&on_interest_timeout_callback =
156 void runEventsLoop();
199 void *implementation_;