From 90256e9929e11ef720d9e9c6afc4342acacae654 Mon Sep 17 00:00:00 2001 From: Angelo Mantellini Date: Fri, 17 May 2019 15:49:27 +0200 Subject: [HICN-200] Minor issue Android Change-Id: Iaa24bb5568bc458967b13f51b9c91c8163b2ce52 Signed-off-by: Angelo Mantellini --- libtransport/src/hicn/transport/core/content_object.cc | 6 ++++++ libtransport/src/hicn/transport/core/interest.cc | 5 +++++ libtransport/src/hicn/transport/core/packet.cc | 5 +++-- 3 files changed, 14 insertions(+), 2 deletions(-) (limited to 'libtransport') diff --git a/libtransport/src/hicn/transport/core/content_object.cc b/libtransport/src/hicn/transport/core/content_object.cc index 107ab8567..764d753cd 100644 --- a/libtransport/src/hicn/transport/core/content_object.cc +++ b/libtransport/src/hicn/transport/core/content_object.cc @@ -33,6 +33,7 @@ namespace core { ContentObject::ContentObject(const Name &name, Packet::Format format) : Packet(format) { + if (TRANSPORT_EXPECT_FALSE( hicn_data_set_name(format, packet_start_, name.getStructReference()) < 0)) { @@ -46,8 +47,13 @@ ContentObject::ContentObject(const Name &name, Packet::Format format) } } +#ifdef __ANDROID__ +ContentObject::ContentObject(hicn_format_t format) + : ContentObject(Name("0::0|0"), format) {} +#else ContentObject::ContentObject(hicn_format_t format) : ContentObject(Packet::base_name, format) {} +#endif ContentObject::ContentObject(const Name &name, hicn_format_t format, const uint8_t *payload, std::size_t size) diff --git a/libtransport/src/hicn/transport/core/interest.cc b/libtransport/src/hicn/transport/core/interest.cc index bd7b57422..e7d47d565 100644 --- a/libtransport/src/hicn/transport/core/interest.cc +++ b/libtransport/src/hicn/transport/core/interest.cc @@ -44,7 +44,12 @@ Interest::Interest(const Name &interest_name, Packet::Format format) } } + +#ifdef __ANDROID__ +Interest::Interest(hicn_format_t format) : Interest(Name("0::0|0"), format) {} +#else Interest::Interest(hicn_format_t format) : Interest(base_name, format) {} +#endif Interest::Interest(const uint8_t *buffer, std::size_t size) : Packet(buffer, size) { diff --git a/libtransport/src/hicn/transport/core/packet.cc b/libtransport/src/hicn/transport/core/packet.cc index 954266664..04ec74660 100644 --- a/libtransport/src/hicn/transport/core/packet.cc +++ b/libtransport/src/hicn/transport/core/packet.cc @@ -29,7 +29,7 @@ namespace transport { namespace core { -const core::Name Packet::base_name("0::0|0"); + const core::Name Packet::base_name("0::0|0"); Packet::Packet(Format format) : packet_(utils::MemBuf::create(getHeaderSizeFromFormat(format, 256)) @@ -37,7 +37,8 @@ Packet::Packet(Format format) packet_start_(reinterpret_cast(packet_->writableData())), header_head_(packet_.get()), payload_head_(nullptr), - format_(format) { + format_(format){ + if (hicn_packet_init_header(format, packet_start_) < 0) { throw errors::RuntimeException("Unexpected error initializing the packet."); } -- cgit 1.2.3-korg