aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/hicn/transport/core/pending_interest.h
diff options
context:
space:
mode:
authormichele papalini <micpapal+fdio@cisco.com>2019-01-25 14:58:31 +0100
committerMichele Papalini <micpapal+fdio@cisco.com>2019-01-25 14:08:11 +0000
commit03371e2e47523dcbadb9a4a79969ecd225b3ff3d (patch)
treee30073c89c084880bc080dae398f3825c3538e2e /libtransport/src/hicn/transport/core/pending_interest.h
parente718d5b93c9856d38b358fbb256327c8c76d387f (diff)
[HICN-13] sendInterest with customized callbacks
Change-Id: Ie4b2aac7f5f356f8afc7aaf83b723596dcbb4532 Signed-off-by: michele papalini <micpapal+fdio@cisco.com>
Diffstat (limited to 'libtransport/src/hicn/transport/core/pending_interest.h')
-rw-r--r--libtransport/src/hicn/transport/core/pending_interest.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/libtransport/src/hicn/transport/core/pending_interest.h b/libtransport/src/hicn/transport/core/pending_interest.h
index cbcafb5d9..58b51db79 100644
--- a/libtransport/src/hicn/transport/core/pending_interest.h
+++ b/libtransport/src/hicn/transport/core/pending_interest.h
@@ -34,6 +34,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;
class PendingInterest {
@@ -47,9 +49,12 @@ class PendingInterest {
PendingInterest(Interest::Ptr &&interest,
std::unique_ptr<asio::steady_timer> &&timer);
- ~PendingInterest();
+ PendingInterest(Interest::Ptr &&interest,
+ const OnContentObjectCallback &&on_content_object,
+ const OnInterestTimeoutCallback &&on_interest_timeout,
+ std::unique_ptr<asio::steady_timer> &&timer);
- bool isReceived() const;
+ ~PendingInterest();
template <typename Handler>
TRANSPORT_ALWAYS_INLINE void startCountdown(Handler &&cb) {
@@ -62,17 +67,23 @@ class PendingInterest {
void setReceived();
+ bool isReceived() const;
+
Interest::Ptr &&getInterest();
- void setReceived(bool received);
+ const OnContentObjectCallback &getOnDataCallback() const;
+
+ void setOnDataCallback(const OnContentObjectCallback &on_content_object);
- bool isValid() const;
+ const OnInterestTimeoutCallback &getOnTimeoutCallback() const;
- void setValid(bool valid);
+ void setOnTimeoutCallback(const OnInterestTimeoutCallback &on_interest_timeout);
private:
Interest::Ptr interest_;
std::unique_ptr<asio::steady_timer> timer_;
+ OnContentObjectCallback on_content_object_callback_;
+ OnInterestTimeoutCallback on_interest_timeout_callback_;
bool received_;
};