diff options
Diffstat (limited to 'libtransport/includes/hicn/transport/core/interest.h')
-rw-r--r-- | libtransport/includes/hicn/transport/core/interest.h | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/libtransport/includes/hicn/transport/core/interest.h b/libtransport/includes/hicn/transport/core/interest.h index a5b9cf375..270ea7027 100644 --- a/libtransport/includes/hicn/transport/core/interest.h +++ b/libtransport/includes/hicn/transport/core/interest.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 Cisco and/or its affiliates. + * Copyright (c) 2021-2022 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -21,6 +21,10 @@ #include <set> +extern "C" { +#include <hicn/interest_manifest.h> +} + namespace transport { namespace core { @@ -29,46 +33,35 @@ const uint32_t MAX_AGGREGATED_INTEREST = 128; class Interest : public Packet /*, public std::enable_shared_from_this<Interest>*/ { - private: - struct InterestManifestHeader { - /* This can be 16 bits, but we use 32 bits for alignment */ - uint32_t n_suffixes; - /* Followed by the list of prefixes to ask */ - /* ... */ - }; - public: using Ptr = std::shared_ptr<Interest>; - Interest(Packet::Format format = HF_INET6_TCP, - std::size_t additional_header_size = 0); + Interest(Packet::Format format, std::size_t additional_header_size = 0); - Interest(const Name &interest_name, Packet::Format format = HF_INET6_TCP, + Interest(const Name &interest_name, Packet::Format format, std::size_t additional_header_size = 0); Interest(MemBuf &&buffer); template <typename... Args> - Interest(CopyBufferOp op, Args &&... args) + Interest(CopyBufferOp op, Args &&...args) : Packet(op, std::forward<Args>(args)...) { - if (hicn_interest_get_name(format_, packet_start_, - name_.getStructReference()) < 0) { + if (hicn_interest_get_name(&pkbuf_, &name_.getStructReference()) < 0) { throw errors::MalformedPacketException(); } } template <typename... Args> - Interest(WrapBufferOp op, Args &&... args) + Interest(WrapBufferOp op, Args &&...args) : Packet(op, std::forward<Args>(args)...) { - if (hicn_interest_get_name(format_, packet_start_, - name_.getStructReference()) < 0) { + if (hicn_interest_get_name(&pkbuf_, &name_.getStructReference()) < 0) { throw errors::MalformedPacketException(); } } template <typename... Args> - Interest(CreateOp op, Args &&... args) - : Packet(op, std::forward<Args>(args)...) {} + Interest(CreateOp op, Args &&...args) + : Packet(op, HICN_PACKET_TYPE_INTEREST, std::forward<Args>(args)...) {} /* Move constructor */ Interest(Interest &&other_interest); @@ -87,24 +80,36 @@ class Interest void setName(const Name &name) override; - void setLocator(const ip_address_t &ip_address) override; + void setLocator(const hicn_ip_address_t &ip_address) override; - ip_address_t getLocator() const override; + hicn_ip_address_t getLocator() const override; void setLifetime(uint32_t lifetime) override; uint32_t getLifetime() const override; - bool hasManifest(); + bool hasManifest() const; void appendSuffix(std::uint32_t suffix); void encodeSuffixes(); + void serializeSuffixes(); + + void deserializeSuffixes(); + uint32_t *firstSuffix(); uint32_t numberOfSuffixes(); + hicn_uword *getRequestBitmap(); + + interest_manifest_header_t *getIntManifestHeader(); + + void setRequestBitmap(const uint32_t *request_bitmap); + + bool isValid(); + auto shared_from_this() { return utils::shared_from(this); } private: |