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

Helper to encode CCNb blocks. More...

#include <wire-ccnb.h>

Public Member Functions

template<class T >
size_t AppendTaggedBlob (Buffer::Iterator &start, uint32_t dtag, const T &data)
 

Static Public Member Functions

static size_t AppendBlockHeader (Buffer::Iterator &start, size_t value, uint32_t block_type)
 Append CCNB block header. More...
 
static size_t EstimateBlockHeader (size_t value)
 Estimate size of the CCNB block header. More...
 
static size_t AppendNumber (Buffer::Iterator &start, uint32_t number)
 Add number in CCNB encoding. More...
 
static size_t EstimateNumber (uint32_t number)
 Estimate size of the number in CCNB encoding. More...
 
static size_t AppendCloser (Buffer::Iterator &start)
 Append CCNB closer tag (estimated size is 1) More...
 
static size_t AppendTimestampBlob (Buffer::Iterator &start, const Time &time)
 Append a binary timestamp as a BLOB using the ccn binary Timestamp representation (12-bit fraction). More...
 
static size_t EstimateTimestampBlob (const Time &time)
 Estimate size of a binary timestamp as a BLOB using CCNB enconding. More...
 
static size_t AppendTaggedBlob (Buffer::Iterator &start, uint32_t dtag, const uint8_t *data, size_t size)
 Append a tagged BLOB. More...
 
static size_t EstimateTaggedBlob (uint32_t dtag, size_t size)
 Estimate size of a tagged BLOB in CCNB enconding. More...
 
template<class T >
static size_t AppendTaggedBlob (Buffer::Iterator &start, uint32_t dtag, const T &data)
 Append value as a tagged BLOB (templated version) More...
 
static size_t AppendString (Buffer::Iterator &start, uint32_t dtag, const std::string &string)
 Append a tagged string (should be a valid UTF-8 coded string) More...
 
static size_t EstimateString (uint32_t dtag, const std::string &string)
 Estimate size of the string in CCNB encoding. More...
 
static size_t SerializeName (Buffer::Iterator &start, const Name &name)
 Append Name in CCNB encoding. More...
 
static size_t SerializedSizeName (const Name &name)
 Estimate size of Name in CCNB encoding. More...
 
static Ptr< Name > DeserializeName (Buffer::Iterator &start)
 Deserialize Name from CCNB encodeing. More...
 

Detailed Description

Helper to encode CCNb blocks.

Definition at line 38 of file wire-ccnb.h.

Member Function Documentation

size_t wire::Ccnb::AppendBlockHeader ( Buffer::Iterator &  start,
size_t  value,
uint32_t  block_type 
)
static

Append CCNB block header.

Parameters
startBuffer to store serialized
valuedictionary id of the block header
block_typeType of CCNB block
Returns
written length

Definition at line 43 of file wire-ccnb.cc.

Referenced by AppendNumber(), AppendString(), AppendTaggedBlob(), and AppendTimestampBlob().

size_t wire::Ccnb::AppendCloser ( Buffer::Iterator &  start)
static

Append CCNB closer tag (estimated size is 1)

Parameters
startBuffer to store serialized Interest
Returns
written length

Definition at line 97 of file wire-ccnb.cc.

Referenced by AppendString(), and AppendTaggedBlob().

size_t wire::Ccnb::AppendNumber ( Buffer::Iterator &  start,
uint32_t  number 
)
static

Add number in CCNB encoding.

Parameters
startBuffer to store serialized NdnInterest
numberNumber to be written
Returns
written length

Definition at line 75 of file wire-ccnb.cc.

References AppendBlockHeader(), and wire::CcnbParser::CCN_UDATA.

size_t wire::Ccnb::AppendString ( Buffer::Iterator &  start,
uint32_t  dtag,
const std::string &  string 
)
static

Append a tagged string (should be a valid UTF-8 coded string)

This is a ccnb-encoded element with containing UDATA as content

Parameters
startstart iterator of the buffer to append to.
dtagis the element's dtab
stringUTF-8 string to be written
Returns
written length

Definition at line 170 of file wire-ccnb.cc.

References AppendBlockHeader(), AppendCloser(), wire::CcnbParser::CCN_DTAG, and wire::CcnbParser::CCN_UDATA.

size_t wire::Ccnb::AppendTaggedBlob ( Buffer::Iterator &  start,
uint32_t  dtag,
const uint8_t *  data,
size_t  size 
)
static

Append a tagged BLOB.

This is a ccnb-encoded element with containing the BLOB as content

Parameters
startstart iterator of the buffer to append to.
dtagis the element's dtab
datapoints to the binary data
sizeis the size of the data, in bytes
Returns
written length

Definition at line 142 of file wire-ccnb.cc.

References AppendBlockHeader(), AppendCloser(), wire::CcnbParser::CCN_BLOB, and wire::CcnbParser::CCN_DTAG.

Referenced by SerializeName().

template<class T >
static size_t wire::Ccnb::AppendTaggedBlob ( Buffer::Iterator &  start,
uint32_t  dtag,
const T &  data 
)
inlinestatic

Append value as a tagged BLOB (templated version)

This is a ccnb-encoded element with containing the BLOB as content

Data will be reinterpret_cast<const uint8_t*> and size will be obtained using sizeof

Parameters
startstart iterator of the buffer to append to.
dtagis the element's dtab
dataa value to add
Returns
written length
size_t wire::Ccnb::AppendTimestampBlob ( Buffer::Iterator &  start,
const Time &  time 
)
static

Append a binary timestamp as a BLOB using the ccn binary Timestamp representation (12-bit fraction).

Parameters
startstart iterator of the buffer to append to.
time- Time object
Returns
written length

Definition at line 104 of file wire-ccnb.cc.

References AppendBlockHeader(), and wire::CcnbParser::CCN_BLOB.

Ptr< Name > wire::Ccnb::DeserializeName ( Buffer::Iterator &  start)
static

Deserialize Name from CCNB encodeing.

Parameters
startBuffer that stores serialized Interest
nameName object

Definition at line 214 of file wire-ccnb.cc.

References wire::CcnbParser::Block::ParseBlock().

Referenced by Wire::ToName().

size_t wire::Ccnb::EstimateBlockHeader ( size_t  value)
static

Estimate size of the CCNB block header.

Parameters
valuedictionary id of the block header
Returns
estimated length

Definition at line 62 of file wire-ccnb.cc.

Referenced by EstimateNumber(), EstimateString(), EstimateTaggedBlob(), and EstimateTimestampBlob().

size_t wire::Ccnb::EstimateNumber ( uint32_t  number)
static

Estimate size of the number in CCNB encoding.

Parameters
numberNumber to be written
Returns
estimated length

Definition at line 89 of file wire-ccnb.cc.

References EstimateBlockHeader().

size_t wire::Ccnb::EstimateString ( uint32_t  dtag,
const std::string &  string 
)
static

Estimate size of the string in CCNB encoding.

Parameters
dtagis the element's dtab
stringUTF-8 string to be written
Returns
estimated length

Definition at line 185 of file wire-ccnb.cc.

References EstimateBlockHeader().

size_t wire::Ccnb::EstimateTaggedBlob ( uint32_t  dtag,
size_t  size 
)
static

Estimate size of a tagged BLOB in CCNB enconding.

Parameters
dtagis the element's dtab
sizeis the size of the data, in bytes
Returns
estimated length

Definition at line 161 of file wire-ccnb.cc.

References EstimateBlockHeader().

Referenced by SerializedSizeName().

size_t wire::Ccnb::EstimateTimestampBlob ( const Time &  time)
static

Estimate size of a binary timestamp as a BLOB using CCNB enconding.

Parameters
time- Time object
Returns
estimated length

Definition at line 131 of file wire-ccnb.cc.

References EstimateBlockHeader().

size_t wire::Ccnb::SerializedSizeName ( const Name &  name)
static

Estimate size of Name in CCNB encoding.

Parameters
nameconstant reference to Name object
Returns
estimated length

Definition at line 203 of file wire-ccnb.cc.

References EstimateTaggedBlob().

size_t wire::Ccnb::SerializeName ( Buffer::Iterator &  start,
const Name &  name 
)
static

Append Name in CCNB encoding.

Parameters
startBuffer to store serialized Interest
nameconstant reference to Name object
Returns
written length

Definition at line 191 of file wire-ccnb.cc.

References AppendTaggedBlob().

Referenced by Wire::FromName().


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