Class implementing functionality to detect Ndn packet type and create the corresponding object. More...
#include <ndn-header-helper.h>
Public Types | |
enum | Type { INTEREST_CCNB, CONTENT_OBJECT_CCNB, INTEREST_NDNSIM, CONTENT_OBJECT_NDNSIM } |
enum for Ndn packet types | |
Static Public Member Functions | |
static Type | GetNdnHeaderType (Ptr< const Packet > packet) |
Packet ::= Version PacketType (Interest | Data) More... | |
Class implementing functionality to detect Ndn packet type and create the corresponding object.
Ndn doesn't really have a header, so we need this class to determine type of Ndn packet and return corresponent header class, Interest or Data
Throws UnknownHeaderException if header type couldn't be determined
Definition at line 48 of file ndn-header-helper.h.
|
static |
Packet ::= Version PacketType (Interest | Data)
0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Version | PacketType | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
For ccnb-encoding compatibility, Version
/ PacketType
has two reserved values to denote ccnb-encoded packet:
Version 0x01, PacketType 0xD2 — ccnb-encoded Interest
packet Version 0x04, PacketType 0x82 — ccnb-encoded Data
packet
It peeks first 2 bytes of a packet.
All interests start with +--------------—+ +—+------—+----—+ | 0 0 0 0 0 0 0 1 | | 1 | 1 0 1 0 | 0 1 0 | (0x01 0xD2) +--------------—+ +—+------—+----—+
All content objects start with +--------------—+ +—+------—+----—+ | 0 0 0 0 0 1 0 0 | | 1 | 0 0 0 0 | 0 1 0 | (0x04 0x82) +--------------—+ +—+------—+----—+ ^ ^^^^^ | | terminator DTAG (Dictionary TAG)
Definition at line 44 of file ndn-header-helper.cc.
Referenced by ns3::ndn::Face::Receive().