diff options
author | Mauro Sardara <msardara@cisco.com> | 2019-02-20 14:32:42 +0100 |
---|---|---|
committer | Mauro Sardara <msardara@cisco.com> | 2019-03-05 11:42:39 +0100 |
commit | 9d0002e5cb97d939f2f74ab1e635b616d634e7db (patch) | |
tree | 730e4240a637264f859b3b7efeeb8fb83d476f3d /libtransport/src/hicn/transport/core/interest.cc | |
parent | 6d7704c1b497341fd6dd3c27e3f64d0db062ccc2 (diff) |
[HICN-73] Performance improvements of interest/data transmission and reception at low level in the stack (portal.h)
Change-Id: I1525726f52040f1609e284bb9b995ea8794c5d5e
Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'libtransport/src/hicn/transport/core/interest.cc')
-rw-r--r-- | libtransport/src/hicn/transport/core/interest.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/libtransport/src/hicn/transport/core/interest.cc b/libtransport/src/hicn/transport/core/interest.cc index 49d452d19..85f24bb25 100644 --- a/libtransport/src/hicn/transport/core/interest.cc +++ b/libtransport/src/hicn/transport/core/interest.cc @@ -68,6 +68,15 @@ Interest::Interest(Interest &&other_interest) Interest::~Interest() {} +void Interest::replace(MemBufPtr &&buffer) { + Packet::replace(std::move(buffer)); + + if (hicn_interest_get_name(format_, (hicn_header_t *)packet_start_, + name_.getStructReference()) < 0) { + throw errors::MalformedPacketException(); + } +} + const Name &Interest::getName() const { if (!name_) { if (hicn_interest_get_name(format_, (hicn_header_t *)packet_start_, @@ -81,7 +90,7 @@ const Name &Interest::getName() const { Name &Interest::getWritableName() { return const_cast<Name &>(getName()); } -Interest &Interest::setName(const Name &name) { +void Interest::setName(const Name &name) { if (hicn_interest_set_name(format_, (hicn_header_t *)packet_start_, name.getStructReference()) < 0) { throw errors::RuntimeException("Error setting interest name."); @@ -91,11 +100,9 @@ Interest &Interest::setName(const Name &name) { name_.getStructReference()) < 0) { throw errors::MalformedPacketException(); } - - return *this; } -Interest &Interest::setName(Name &&name) { +void Interest::setName(Name &&name) { if (hicn_interest_set_name(format_, (hicn_header_t *)packet_start_, name.getStructReference()) < 0) { throw errors::RuntimeException("Error setting interest name."); @@ -105,8 +112,6 @@ Interest &Interest::setName(Name &&name) { name_.getStructReference()) < 0) { throw errors::MalformedPacketException(); } - - return *this; } void Interest::setLocator(const ip_address_t &ip_address) { |