diff options
author | Angelo Mantellini <manangel@cisco.com> | 2019-05-17 15:49:27 +0200 |
---|---|---|
committer | Angelo Mantellini <manangel@cisco.com> | 2019-05-17 18:35:06 +0200 |
commit | 90256e9929e11ef720d9e9c6afc4342acacae654 (patch) | |
tree | affef7a37285207d337d592142930e99bab83b23 /libtransport/src | |
parent | c4ead399d98d0f9084d6be1c3a44e27e8158b26a (diff) |
[HICN-200] Minor issue Android
Change-Id: Iaa24bb5568bc458967b13f51b9c91c8163b2ce52
Signed-off-by: Angelo Mantellini <manangel@cisco.com>
Diffstat (limited to 'libtransport/src')
-rw-r--r-- | libtransport/src/hicn/transport/core/content_object.cc | 6 | ||||
-rw-r--r-- | libtransport/src/hicn/transport/core/interest.cc | 5 | ||||
-rw-r--r-- | libtransport/src/hicn/transport/core/packet.cc | 5 |
3 files changed, 14 insertions, 2 deletions
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<hicn_header_t *>(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."); } |