NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: 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)
 
Block wireEncode () const
 encode packet into wire format More...
 
void wireDecode (const Block &wire)
 decode packet from wire format More...
 
bool empty () const
 
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

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

Definition at line 120 of file packet.cpp.

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

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

Definition at line 125 of file packet.cpp.

References wireDecode().

Member Function Documentation

Block ndn::lp::Packet::wireEncode ( ) const
void ndn::lp::Packet::wireDecode ( const Block wire)
bool ndn::lp::Packet::empty ( ) const
inline
Return values
truepacket has no field
falsepacket has one or more fields

Definition at line 66 of file packet.hpp.

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

Definition at line 88 of file packet.hpp.

Referenced by get(), and remove().

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

Definition at line 121 of file packet.hpp.

References websocketpp::utf8_validator::decode(), and ndn::Block::elements().

Referenced by nfd::face::LpReliability::processIncomingPacket().

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 141 of file packet.hpp.

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

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

add a FIELD with value

Exceptions
std::length_errorif field already exists and is not repeatable

Definition at line 153 of file packet.hpp.

References ndn::Block::insert().

Referenced by ndn::addFieldFromTag(), face::Face::Impl::asyncPutNack(), nfd::face::LpFragmenter::fragmentPacket(), nfd::face::LpReliability::piggyback(), ndn::util::DummyClientFace::receive(), and nfd::face::GenericLinkService::setOptions().

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 178 of file packet.hpp.

References count().

Referenced by clear().

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

remove all occurrences of FIELD

Definition at line 199 of file packet.hpp.

References remove().


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