aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/hicn/transport/core/pending_interest.cc
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.cc
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.cc')
-rw-r--r--libtransport/src/hicn/transport/core/pending_interest.cc40
1 files changed, 34 insertions, 6 deletions
diff --git a/libtransport/src/hicn/transport/core/pending_interest.cc b/libtransport/src/hicn/transport/core/pending_interest.cc
index 8f6de1839..a2df9ba44 100644
--- a/libtransport/src/hicn/transport/core/pending_interest.cc
+++ b/libtransport/src/hicn/transport/core/pending_interest.cc
@@ -20,12 +20,28 @@ namespace transport {
namespace core {
PendingInterest::PendingInterest()
- : interest_(nullptr, nullptr), timer_(), received_(false) {}
+ : interest_(nullptr, nullptr),
+ timer_(),
+ on_content_object_callback_(),
+ on_interest_timeout_callback_(),
+ received_(false) {}
PendingInterest::PendingInterest(Interest::Ptr &&interest,
std::unique_ptr<asio::steady_timer> &&timer)
: interest_(std::move(interest)),
timer_(std::move(timer)),
+ on_content_object_callback_(),
+ on_interest_timeout_callback_(),
+ received_(false) {}
+
+PendingInterest::PendingInterest(Interest::Ptr &&interest,
+ const OnContentObjectCallback &&on_content_object,
+ const OnInterestTimeoutCallback &&on_interest_timeout,
+ std::unique_ptr<asio::steady_timer> &&timer)
+ : interest_(std::move(interest)),
+ timer_(std::move(timer)),
+ on_content_object_callback_(std::move(on_content_object)),
+ on_interest_timeout_callback_(std::move(on_interest_timeout)),
received_(false) {}
PendingInterest::~PendingInterest() {
@@ -34,16 +50,28 @@ PendingInterest::~PendingInterest() {
void PendingInterest::cancelTimer() { timer_->cancel(); }
-bool PendingInterest::isReceived() const { return received_; }
-
void PendingInterest::setReceived() { received_ = true; }
+bool PendingInterest::isReceived() const { return received_; }
+
Interest::Ptr &&PendingInterest::getInterest() { return std::move(interest_); }
-void PendingInterest::setReceived(bool received) {
- PendingInterest::received_ = received;
+const OnContentObjectCallback &PendingInterest::getOnDataCallback() const {
+ return on_content_object_callback_;
+}
+
+void PendingInterest::setOnDataCallback(const OnContentObjectCallback &on_content_object) {
+ PendingInterest::on_content_object_callback_ = on_content_object;
+}
+
+const OnInterestTimeoutCallback &PendingInterest::getOnTimeoutCallback() const {
+ return on_interest_timeout_callback_;
+}
+
+void PendingInterest::setOnTimeoutCallback(const OnInterestTimeoutCallback &on_interest_timeout) {
+ PendingInterest::on_interest_timeout_callback_ = on_interest_timeout;
}
} // end namespace core
-} // end namespace transport \ No newline at end of file
+} // end namespace transport