From 6b94663b2455e212009a544ae23bb6a8c55407f8 Mon Sep 17 00:00:00 2001 From: Luca Muscariello Date: Thu, 9 Jun 2022 21:34:09 +0200 Subject: refactor(lib, hicn-light, vpp, hiperf): HICN-723 - move infra data structure into the shared lib - new packet cache using double hashing and lookup on prefix suffix - testing updates - authenticated requests using interest manifests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mauro Sardara Co-authored-by: Jordan Augé Co-authored-by: Michele Papalini Co-authored-by: Olivier Roques Co-authored-by: Enrico Loparco Change-Id: Iaddebfe6aa5279ea8553433b0f519578f6b9ccd9 Signed-off-by: Luca Muscariello --- libtransport/src/core/content_object.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'libtransport/src/core/content_object.cc') diff --git a/libtransport/src/core/content_object.cc b/libtransport/src/core/content_object.cc index 643e0388e..e66b2a6cd 100644 --- a/libtransport/src/core/content_object.cc +++ b/libtransport/src/core/content_object.cc @@ -15,6 +15,7 @@ #include #include +#include #include extern "C" { @@ -46,7 +47,7 @@ ContentObject::ContentObject(const Name &name, Packet::Format format, } if (TRANSPORT_EXPECT_FALSE(hicn_data_get_name(format_, packet_start_, - name_.getStructReference()) < + &name_.getStructReference()) < 0)) { throw errors::MalformedPacketException(); } @@ -91,7 +92,7 @@ ContentObject::~ContentObject() {} const Name &ContentObject::getName() const { if (!name_) { if (hicn_data_get_name(format_, packet_start_, - (hicn_name_t *)name_.getConstStructReference()) < + (hicn_name_t *)&name_.getConstStructReference()) < 0) { throw errors::MalformedPacketException(); } @@ -104,11 +105,11 @@ Name &ContentObject::getWritableName() { return const_cast(getName()); } void ContentObject::setName(const Name &name) { if (hicn_data_set_name(format_, packet_start_, - name.getConstStructReference()) < 0) { + &name.getConstStructReference()) < 0) { throw errors::RuntimeException("Error setting content object name."); } - if (hicn_data_get_name(format_, packet_start_, name_.getStructReference()) < + if (hicn_data_get_name(format_, packet_start_, &name_.getStructReference()) < 0) { throw errors::MalformedPacketException(); } @@ -121,11 +122,11 @@ uint32_t ContentObject::getPathLabel() const { "Error retrieving the path label from content object"); } - return ntohl(path_label); + return portability::net_to_host(path_label); } ContentObject &ContentObject::setPathLabel(uint32_t path_label) { - path_label = htonl(path_label); + path_label = portability::host_to_net(path_label); if (hicn_data_set_path_label((hicn_header_t *)packet_start_, path_label) < 0) { throw errors::RuntimeException( -- cgit 1.2.3-korg