NDN Interest and routines to serialize/deserialize. More...
#include <ndn-interest.h>
Public Types | |
enum | { NORMAL_INTEREST = 0, NACK_LOOP = 10, NACK_CONGESTION = 11, NACK_GIVEUP_PIT = 12 } |
NACK Type Specifies the type of Interest packet. | |
Public Member Functions | |
Interest () | |
Constructor. | |
Interest (const Interest &interest) | |
Copy constructor. | |
void | SetName (Ptr< Name > name) |
Set interest name. | |
const Name & | GetName () const |
Get interest name. | |
Ptr< const Name > | GetNamePtr () const |
Get smart pointer to the interest name (to avoid extra memory usage) | |
void | SetScope (int8_t scope) |
Set Scope Scope limits where the Interest may propagate. | |
int8_t | GetScope () const |
Get Scope value Scope limits where the Interest may propagate. | |
void | SetInterestLifetime (Time time) |
Set InterestLifetime InterestLifetime indicates the (approximate) time remaining before the interest times out. | |
Time | GetInterestLifetime () const |
Get InterestLifetime value InterestLifetime indicates the (approximate) time remaining before the interest times out. | |
void | SetNonce (uint32_t nonce) |
Set Nonce Nonce carries a randomly-genenerated bytestring that is used to detect and discard duplicate Interest messages. | |
uint32_t | GetNonce () const |
Get Nonce value Nonce carries a randomly-genenerated bytestring that is used to detect and discard duplicate Interest messages. | |
void | SetNack (uint8_t nackType) |
Mark the Interest as a Negative Acknowledgement Three types of NACKs are supported. | |
uint8_t | GetNack () const |
Get NACK type Returns NACK_LOOP, NACK_CONGESTION or NACK_GIVEUP_PIT. | |
virtual TypeId | GetInstanceTypeId (void) const |
Get TypeId of the instance. | |
virtual void | Print (std::ostream &os) const |
Print Interest packet. | |
virtual uint32_t | GetSerializedSize (void) const |
Get the size of Interest packet Returns the Interest packet size after serialization. | |
virtual void | Serialize (Buffer::Iterator start) const |
Serialize Interest packet Serializes Interest packet into Buffer::Iterator. | |
virtual uint32_t | Deserialize (Buffer::Iterator start) |
Deserialize Interest packet Deserializes Buffer::Iterator into Interest packet. | |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Get TypeId of the class. | |
static Ptr< Interest > | GetInterest (Ptr< Packet > packet) |
Cheat for python bindings. | |
NDN Interest and routines to serialize/deserialize.
Optimized and simplified formatting of Interest packets
Interest ::= Nonce Scope InterestLifetime Name Selectors Options
Minumum size of the Interest packet: 1 + 4 + 2 + 1 + (2 + 0) + (2 + 0) + (2 + 0) = 14
Maximum size of the Interest packet: 1 + 4 + 2 + 1 + (2 + 65535) + (2 + 65535) + (2 + 65535) = 196619
::
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Nonce | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Scope | Reserved | InterestLifetime | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length | |
|-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ~ ~ ~ Name ~ | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length | | |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ~ ~ ~ Selectors ~ | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length | | |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ~ ~ ~ Options ~ | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
This type is not accessible from the Config system.
No Attributes are defined for this type.
No TraceSources are defined for this type.
Definition at line 86 of file ndn-interest.h.
ns3::ndn::Interest::Interest | ( | ) |
|
virtual |
Deserialize Interest packet Deserializes Buffer::Iterator into Interest packet.
[in] | start | buffer that contains serialized Interest packet |
Definition at line 173 of file ndn-interest.cc.
References GetSerializedSize().
Time ns3::ndn::Interest::GetInterestLifetime | ( | ) | const |
Get InterestLifetime value InterestLifetime indicates the (approximate) time remaining before the interest times out.
The timeout is relative to the arrival time of the interest at the current node.
Definition at line 111 of file ndn-interest.cc.
Referenced by Print().
uint8_t ns3::ndn::Interest::GetNack | ( | ) | const |
Get NACK type Returns NACK_LOOP, NACK_CONGESTION or NACK_GIVEUP_PIT.
Otherwise, in case of normal interest packet, returns NORMAL_INTEREST (equals 0).
Definition at line 135 of file ndn-interest.cc.
Referenced by Print().
const Name & ns3::ndn::Interest::GetName | ( | ) | const |
Get interest name.
Gets name of the interest.
Definition at line 80 of file ndn-interest.cc.
Referenced by ns3::ndn::fib::FibImpl::LongestPrefixMatch(), ns3::ndn::pit::PitImpl< Policy >::Lookup(), and Print().
int8_t ns3::ndn::Interest::GetScope | ( | ) | const |
Get Scope value Scope limits where the Interest may propagate.
Scope 0 prevents propagation beyond the local ccnd (even to other applications on the same host). Scope 1 limits propagation to the applications on the originating host. Scope 2 limits propagation to no further than the next host. Other values are not defined, and will cause the Interest message to be dropped. Note that this is not a hop count - the value is not decremented as the interest is forwarded.
Definition at line 99 of file ndn-interest.cc.
Referenced by Print().
|
virtual |
Serialize Interest packet Serializes Interest packet into Buffer::Iterator.
[in] | start | buffer to contain serialized Interest packet |
Definition at line 150 of file ndn-interest.cc.
void ns3::ndn::Interest::SetInterestLifetime | ( | Time | time | ) |
Set InterestLifetime InterestLifetime indicates the (approximate) time remaining before the interest times out.
The timeout is relative to the arrival time of the interest at the current node.
[in] | time | interest lifetime |
Definition at line 105 of file ndn-interest.cc.
void ns3::ndn::Interest::SetNack | ( | uint8_t | nackType | ) |
Mark the Interest as a Negative Acknowledgement Three types of NACKs are supported.
[in] | nackType | NACK_LOOP or NACK_CONGESTION or NACK_GIVEUP_PIT or NORMAL_INTEREST |
Definition at line 129 of file ndn-interest.cc.
void ns3::ndn::Interest::SetName | ( | Ptr< Name > | name | ) |
Set interest name.
Sets name of the interest. For example, SetName( ndnName("prefix")("postfix") );
[in] | name | const pointer to ndnName object that contains an interest name |
Definition at line 74 of file ndn-interest.cc.
void ns3::ndn::Interest::SetNonce | ( | uint32_t | nonce | ) |
Set Nonce Nonce carries a randomly-genenerated bytestring that is used to detect and discard duplicate Interest messages.
[in] | nonce | Unique packet identification number |
Definition at line 117 of file ndn-interest.cc.
Referenced by ns3::ndn::Consumer::SendPacket().
void ns3::ndn::Interest::SetScope | ( | int8_t | scope | ) |
Set Scope Scope limits where the Interest may propagate.
Scope 0 prevents propagation beyond the local ccnd (even to other applications on the same host). Scope 1 limits propagation to the applications on the originating host. Scope 2 limits propagation to no further than the next host. Other values are not defined, and will cause the Interest message to be dropped. Note that this is not a hop count - the value is not decremented as the interest is forwarded.
[in] | scope | interest scope |
Definition at line 93 of file ndn-interest.cc.