From 978041a9a21ea4c2e500284fc2249259ed78649e Mon Sep 17 00:00:00 2001 From: Matias Fontanini Date: Fri, 16 Oct 2015 10:04:42 -0700 Subject: [PATCH] Define default constructor for PKTAP Fixes #106 --- src/pktap.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/pktap.cpp b/src/pktap.cpp index 95d9411..c76359f 100644 --- a/src/pktap.cpp +++ b/src/pktap.cpp @@ -35,8 +35,11 @@ namespace Tins { -PKTAP::PKTAP(const uint8_t* buffer, uint32_t total_sz) -{ +PKTAP::PKTAP() { + memset(&header_, 0, sizeof(header_)); +} + +PKTAP::PKTAP(const uint8_t* buffer, uint32_t total_sz) { if (total_sz < sizeof(pktap_header)) { throw malformed_packet(); } @@ -58,13 +61,11 @@ PKTAP::PKTAP(const uint8_t* buffer, uint32_t total_sz) } } -uint32_t PKTAP::header_size() const -{ +uint32_t PKTAP::header_size() const { return sizeof(header_); } -void PKTAP::write_serialization(uint8_t *buffer, uint32_t total_sz, const PDU *parent) -{ +void PKTAP::write_serialization(uint8_t *buffer, uint32_t total_sz, const PDU *parent) { throw std::runtime_error("PKTAP cannot be serialized"); }