From 6d7704c1b497341fd6dd3c27e3f64d0db062ccc2 Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Mon, 4 Feb 2019 11:06:18 +0100 Subject: [HICN-11] Rework on transport protocols improving components modularity Change-Id: I6683ec5b494238dc93591c103d25275e89b9f267 Signed-off-by: Mauro Sardara --- libtransport/src/hicn/transport/core/manifest.h | 37 ++++++------------------- 1 file changed, 9 insertions(+), 28 deletions(-) (limited to 'libtransport/src/hicn/transport/core/manifest.h') diff --git a/libtransport/src/hicn/transport/core/manifest.h b/libtransport/src/hicn/transport/core/manifest.h index 558a96804..9f7dc5984 100644 --- a/libtransport/src/hicn/transport/core/manifest.h +++ b/libtransport/src/hicn/transport/core/manifest.h @@ -38,39 +38,28 @@ class Manifest : public Base { using Encoder = typename FormatTraits::Encoder; using Decoder = typename FormatTraits::Decoder; - Manifest() - : packet_(new Base(HF_INET6_TCP_AH), nullptr), - encoder_(*packet_), - decoder_(*packet_) { + Manifest(std::size_t signature_size = 0) + : Base(HF_INET6_TCP_AH), + encoder_(*this, signature_size), + decoder_(*this) { Base::setPayloadType(PayloadType::MANIFEST); } - Manifest(const core::Name &name) - : packet_(new Base(name, HF_INET6_TCP_AH), nullptr), - encoder_(*packet_), - decoder_(*packet_) { - Base::setPayloadType(PayloadType::MANIFEST); - } - - Manifest(typename Base::Ptr &&base) - : packet_(std::move(base)), encoder_(*packet_), decoder_(*packet_) { + Manifest(const core::Name &name, std::size_t signature_size = 0) + : Base(name, HF_INET6_TCP_AH), + encoder_(*this, signature_size), + decoder_(*this) { Base::setPayloadType(PayloadType::MANIFEST); } template Manifest(T &&base) - : packet_(new Base(std::move(base)), nullptr), - encoder_(*packet_), - decoder_(*packet_) { + : Base(std::forward(base)), encoder_(*this), decoder_(*this) { Base::setPayloadType(PayloadType::MANIFEST); } virtual ~Manifest() = default; - bool operator==(const Manifest &other) { - return this->packet_ == other.packet_; - } - std::size_t estimateManifestSize(std::size_t additional_entries = 0) { return static_cast(*this).estimateManifestSizeImpl( additional_entries); @@ -142,15 +131,7 @@ class Manifest : public Base { return *this; } - void setSignatureSize(std::size_t size_bits) { - Packet::setSignatureSize(size_bits); - encoder_.update(); - } - - typename Base::Ptr &&getPacket() { return std::move(packet_); } - protected: - typename Base::Ptr packet_; ManifestType manifest_type_; HashAlgorithm hash_algorithm_; bool is_last_; -- cgit 1.2.3-korg