aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/core/packet.cc
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2021-02-10 14:26:52 +0000
committerGerrit Code Review <gerrit@fd.io>2021-02-10 14:26:52 +0000
commit71a5c399d8064e2aa97a047e23174bb784eea399 (patch)
tree740bae933895ab6c40db1eb14fcd84a67536df06 /libtransport/src/core/packet.cc
parentdb76bbc76c8d2cb2d817df8c9233937d230a1ff2 (diff)
parent8d08f8dd79ac12874ba0da6b26973f5a33163131 (diff)
Merge "[HICN-679] Do not throw exception when receiving corrupted/not-hicn packet from network layer"v21.01-rc0
Diffstat (limited to 'libtransport/src/core/packet.cc')
-rw-r--r--libtransport/src/core/packet.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/libtransport/src/core/packet.cc b/libtransport/src/core/packet.cc
index 6815868f0..cd2c5aa69 100644
--- a/libtransport/src/core/packet.cc
+++ b/libtransport/src/core/packet.cc
@@ -50,7 +50,8 @@ Packet::Packet(MemBufPtr &&buffer)
packet_start_(reinterpret_cast<hicn_header_t *>(packet_->writableData())),
header_head_(packet_.get()),
payload_head_(nullptr),
- format_(getFormatFromBuffer(packet_->writableData())) {}
+ format_(getFormatFromBuffer(packet_->writableData(), packet_->length())) {
+}
Packet::Packet(const uint8_t *buffer, std::size_t size)
: Packet(MemBufPtr(utils::MemBuf::copyBuffer(buffer, size).release())) {}
@@ -210,13 +211,13 @@ const std::shared_ptr<utils::MemBuf> Packet::acquireMemBufReference() const {
void Packet::dump() const {
const_cast<Packet *>(this)->separateHeaderPayload();
- std::cout << "HEADER -- Length: " << headerSize() << std::endl;
+ TRANSPORT_LOGI("HEADER -- Length: %zu", headerSize());
hicn_packet_dump((uint8_t *)header_head_->data(), headerSize());
- std::cout << std::endl << "PAYLOAD -- Length: " << payloadSize() << std::endl;
+ TRANSPORT_LOGI("PAYLOAD -- Length: %zu", payloadSize());
for (utils::MemBuf *current = payload_head_;
current && current != header_head_; current = current->next()) {
- std::cout << "MemBuf Length: " << current->length() << std::endl;
+ TRANSPORT_LOGI("MemBuf Length: %zu", current->length());
hicn_packet_dump((uint8_t *)current->data(), current->length());
}
}