NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::lp::Packet Class Reference

#include <packet.hpp>

Classes

class  Error
 

Public Member Functions

 Packet ()
 
 Packet (const Block &wire)
 
template<encoding::Tag TAG>
size_t wireEncode (EncodingImpl< TAG > &encoder) const
 append packet to encoder More...
 
Block wireEncode () const
 encode packet into wire format More...
 
void wireDecode (const Block &wire)
 decode packet from wire format More...
 
template<typename FIELD >
bool has () const
 
template<typename FIELD >
size_t count () const
 
template<typename FIELD >
FIELD::ValueType get (size_t index=0) const
 
template<typename FIELD >
std::vector< typename FIELD::ValueType > list () const
 
template<typename FIELD >
Packetset (const typename FIELD::ValueType &value)
 remove all occurrences of FIELD, and add a FIELD with value More...
 
template<typename FIELD >
Packetadd (const typename FIELD::ValueType &value)
 add a FIELD with value More...
 
template<typename FIELD >
Packetremove (size_t index=0)
 remove the index-th occurrence of FIELD More...
 
template<typename FIELD >
Packetclear ()
 remove all occurrences of FIELD More...
 

Detailed Description

Definition at line 30 of file packet.hpp.

Constructor & Destructor Documentation

§ Packet() [1/2]

ndn::lp::Packet::Packet ( )

Definition at line 30 of file packet.cpp.

Referenced by ndn::lp::Packet::Error::Error().

§ Packet() [2/2]

ndn::lp::Packet::Packet ( const Block wire)
explicit

Definition at line 35 of file packet.cpp.

References wireDecode().

Member Function Documentation

§ wireEncode() [1/2]

§ wireEncode() [2/2]

Block ndn::lp::Packet::wireEncode ( ) const

encode packet into wire format

Definition at line 67 of file packet.cpp.

References ndn::Block::elements(), and ndn::Block::hasWire().

Referenced by ndn::lp::Packet::Error::Error().

§ wireDecode()

void ndn::lp::Packet::wireDecode ( const Block wire)

§ has()

template<typename FIELD >
bool ndn::lp::Packet::has ( ) const
inline
Returns
true if FIELD occurs one or more times

This is equivalent to count() > 0

Definition at line 75 of file packet.hpp.

Referenced by ndn::extractLpLocalFields(), nfd::face::LpFragmenter::fragmentPacket(), nfd::face::GenericLinkService::GenericLinkService(), and nfd::face::LpReassembler::receiveFragment().

§ count()

template<typename FIELD >
size_t ndn::lp::Packet::count ( ) const
inline
Returns
number of occurrences of FIELD

Definition at line 85 of file packet.hpp.

Referenced by get(), and remove().

§ get()

template<typename FIELD >
FIELD::ValueType ndn::lp::Packet::get ( size_t  index = 0) const
inline
Returns
value of index-th occurrence of FIELD
Exceptions
std::out_of_rangeif index>=count()

Definition at line 100 of file packet.hpp.

References count(), and ndn::Block::elements().

Referenced by ndn::extractLpLocalFields(), nfd::face::LpFragmenter::fragmentPacket(), nfd::face::GenericLinkService::GenericLinkService(), and nfd::face::LpReassembler::receiveFragment().

§ list()

template<typename FIELD >
std::vector<typename FIELD::ValueType> ndn::lp::Packet::list ( ) const
inline
Returns
values of all occurrences of FIELD

Definition at line 122 of file packet.hpp.

References ndn::Block::elements().

§ set()

template<typename FIELD >
Packet& ndn::lp::Packet::set ( const typename FIELD::ValueType &  value)
inline

remove all occurrences of FIELD, and add a FIELD with value

This equivalent to clear() followed by add(value)

Definition at line 144 of file packet.hpp.

Referenced by nfd::face::LpFragmenter::fragmentPacket(), and nfd::face::GenericLinkService::GenericLinkService().

§ add()

template<typename FIELD >
Packet& ndn::lp::Packet::add ( const typename FIELD::ValueType &  value)
inline

§ remove()

template<typename FIELD >
Packet& ndn::lp::Packet::remove ( size_t  index = 0)
inline

remove the index-th occurrence of FIELD

Exceptions
std::out_of_rangeif index>=count()

Definition at line 183 of file packet.hpp.

References count().

Referenced by clear().

§ clear()

template<typename FIELD >
Packet& ndn::lp::Packet::clear ( )
inline

remove all occurrences of FIELD

Definition at line 207 of file packet.hpp.

References remove().


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