NS-3 based Named Data Networking (NDN) simulator
ndnSIM: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
ns3::ndn::HeaderHelper Class Reference

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...
 

Detailed Description

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.

Member Function Documentation

HeaderHelper::Type ns3::ndn::HeaderHelper::GetNdnHeaderType ( Ptr< const Packet >  packet)
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)

See also
http://www.ccnx.org/releases/latest/doc/technical/BinaryEncoding.html

Definition at line 44 of file ndn-header-helper.cc.

Referenced by ns3::ndn::Face::Receive().


The documentation for this class was generated from the following files: