A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ns3::PbbMessage Class Referenceabstract

A message within a PbbPacket packet. More...

#include <packetbb.h>

+ Inheritance diagram for ns3::PbbMessage:

Public Types

typedef std::list< Ptr
< PbbAddressBlock >
>::iterator 
AddressBlockIterator
 
typedef std::list< Ptr
< PbbAddressBlock >
>::const_iterator 
ConstAddressBlockIterator
 
typedef std::list< Ptr< PbbTlv >
>::const_iterator 
ConstTlvIterator
 
typedef std::list< Ptr< PbbTlv >
>::iterator 
TlvIterator
 

Public Member Functions

Ptr< PbbAddressBlockAddressBlockBack (void)
 
const Ptr< PbbAddressBlockAddressBlockBack (void) const
 
AddressBlockIterator AddressBlockBegin ()
 
ConstAddressBlockIterator AddressBlockBegin () const
 
void AddressBlockClear (void)
 Removes all address blocks from this message.
 
bool AddressBlockEmpty (void) const
 
AddressBlockIterator AddressBlockEnd ()
 
ConstAddressBlockIterator AddressBlockEnd () const
 
AddressBlockIterator AddressBlockErase (AddressBlockIterator position)
 Removes the address block at the specified position. More...
 
AddressBlockIterator AddressBlockErase (AddressBlockIterator first, AddressBlockIterator last)
 Removes all address blocks from [first, last) (includes first, not includes last). More...
 
Ptr< PbbAddressBlockAddressBlockFront (void)
 
const Ptr< PbbAddressBlockAddressBlockFront (void) const
 
void AddressBlockPopBack (void)
 Removes an address block from the back of this message.
 
void AddressBlockPopFront (void)
 Removes an address block from the front of this message.
 
void AddressBlockPushBack (Ptr< PbbAddressBlock > block)
 Appends an address block to the front of this message. More...
 
void AddressBlockPushFront (Ptr< PbbAddressBlock > block)
 Prepends an address block to the front of this message. More...
 
int AddressBlockSize (void) const
 
void Deserialize (Buffer::Iterator &start)
 Deserializes a message from the specified buffer. More...
 
uint8_t GetHopCount (void) const
 
uint8_t GetHopLimit (void) const
 
Address GetOriginatorAddress (void) const
 
uint16_t GetSequenceNumber (void) const
 
uint32_t GetSerializedSize (void) const
 
uint8_t GetType (void) const
 
bool HasHopCount (void) const
 Tests whether or not this message has a hop count. More...
 
bool HasHopLimit (void) const
 Tests whether or not this message has a hop limit. More...
 
bool HasOriginatorAddress (void) const
 Tests whether or not this message has an originator address. More...
 
bool HasSequenceNumber (void) const
 Tests whether or not this message has a sequence number. More...
 
bool operator!= (const PbbMessage &other) const
 
bool operator== (const PbbMessage &other) const
 
void Print (std::ostream &os) const
 Pretty-prints the contents of this message. More...
 
void Print (std::ostream &os, int level) const
 Pretty-prints the contents of this message, with specified indentation. More...
 
void Serialize (Buffer::Iterator &start) const
 Serializes this message into the specified buffer. More...
 
void SetHopCount (uint8_t hopcount)
 Sets the current number of hops this message has traveled. More...
 
void SetHopLimit (uint8_t hoplimit)
 Sets the maximum number of hops this message should travel. More...
 
void SetOriginatorAddress (Address address)
 Sets the address for the node that created this packet. More...
 
void SetSequenceNumber (uint16_t seqnum)
 Sets the sequence number of this message. More...
 
void SetType (uint8_t type)
 Sets the type for this message. More...
 
Ptr< PbbTlvTlvBack (void)
 
const Ptr< PbbTlvTlvBack (void) const
 
TlvIterator TlvBegin ()
 
ConstTlvIterator TlvBegin () const
 
void TlvClear (void)
 Removes all message TLVs from this block.
 
bool TlvEmpty (void) const
 
TlvIterator TlvEnd ()
 
ConstTlvIterator TlvEnd () const
 
TlvIterator TlvErase (TlvIterator position)
 Removes the message TLV at the specified position. More...
 
TlvIterator TlvErase (TlvIterator first, TlvIterator last)
 Removes all message TLVs from [first, last) (includes first, not includes last). More...
 
Ptr< PbbTlvTlvFront (void)
 
const Ptr< PbbTlvTlvFront (void) const
 
void TlvPopBack (void)
 Removes a message TLV from the back of this message.
 
void TlvPopFront (void)
 Removes a message TLV from the front of this message.
 
void TlvPushBack (Ptr< PbbTlv > tlv)
 Appends a message TLV to the back of this message. More...
 
void TlvPushFront (Ptr< PbbTlv > tlv)
 Prepends a message TLV to the front of this message. More...
 
int TlvSize (void) const
 
- Public Member Functions inherited from ns3::SimpleRefCount< PbbMessage >
 SimpleRefCount (const SimpleRefCount &o)
 
uint32_t GetReferenceCount (void) const
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 
void Ref (void) const
 
void Unref (void) const
 

Static Public Member Functions

static Ptr< PbbMessageDeserializeMessage (Buffer::Iterator &start)
 Deserializes a message, returning the correct object depending on whether it is an IPv4 message or an IPv6 message. More...
 
- Static Public Member Functions inherited from ns3::SimpleRefCount< PbbMessage >
static void Cleanup (void)
 

Protected Member Functions

virtual Ptr< PbbAddressBlockAddressBlockDeserialize (Buffer::Iterator &start) const =0
 
virtual Address DeserializeOriginatorAddress (Buffer::Iterator &start) const =0
 
virtual PbbAddressLength GetAddressLength (void) const =0
 
virtual void PrintOriginatorAddress (std::ostream &os) const =0
 
virtual void SerializeOriginatorAddress (Buffer::Iterator &start) const =0
 

Private Attributes

std::list< Ptr< PbbAddressBlock > > m_addressBlockList
 
PbbAddressLength m_addrSize
 
bool m_hasHopCount
 
bool m_hasHopLimit
 
bool m_hasOriginatorAddress
 
bool m_hasSequenceNumber
 
uint8_t m_hopCount
 
uint8_t m_hopLimit
 
Address m_originatorAddress
 
uint16_t m_sequenceNumber
 
PbbTlvBlock m_tlvList
 
uint8_t m_type
 

Detailed Description

A message within a PbbPacket packet.

There may be any number of messages in one packet packet. This is a pure virtual base class, when creating a message, you should instantiate either PbbMessageIpv4 or PbbMessageIpv6.

Definition at line 652 of file packetbb.h.

Member Function Documentation

Ptr< PbbAddressBlock > ns3::PbbMessage::AddressBlockBack ( void  )
Returns
a smart pointer to the last address block in this message.

Definition at line 1334 of file packetbb.cc.

References NS_LOG_FUNCTION.

const Ptr< PbbAddressBlock > ns3::PbbMessage::AddressBlockBack ( void  ) const
Returns
a const smart pointer to the last address block in this message.

Definition at line 1341 of file packetbb.cc.

References NS_LOG_FUNCTION.

PbbMessage::AddressBlockIterator ns3::PbbMessage::AddressBlockBegin ( void  )
Returns
an iterator to the first address block in this message.

Definition at line 1278 of file packetbb.cc.

References NS_LOG_FUNCTION.

Referenced by AddressBlockClear(), GetSerializedSize(), Print(), and Serialize().

PbbMessage::ConstAddressBlockIterator ns3::PbbMessage::AddressBlockBegin ( void  ) const
Returns
a const iterator to the first address block in this message.

Definition at line 1285 of file packetbb.cc.

References NS_LOG_FUNCTION.

bool ns3::PbbMessage::AddressBlockEmpty ( void  ) const
Returns
true if there are no address blocks in this message, false otherwise.

Definition at line 1313 of file packetbb.cc.

References NS_LOG_FUNCTION.

PbbMessage::AddressBlockIterator ns3::PbbMessage::AddressBlockEnd ( void  )
Returns
an iterator to the past-the-end address block element in this message.

Definition at line 1292 of file packetbb.cc.

References NS_LOG_FUNCTION.

Referenced by AddressBlockClear(), GetSerializedSize(), Print(), and Serialize().

PbbMessage::ConstAddressBlockIterator ns3::PbbMessage::AddressBlockEnd ( void  ) const
Returns
a const iterator to the past-the-end address block element in this message.

Definition at line 1299 of file packetbb.cc.

References NS_LOG_FUNCTION.

PbbMessage::AddressBlockIterator ns3::PbbMessage::AddressBlockErase ( PbbMessage::AddressBlockIterator  position)

Removes the address block at the specified position.

Parameters
positionan Iterator pointing to the address block to erase.
Returns
an iterator pointing to the next address block in the message.

Definition at line 1376 of file packetbb.cc.

References NS_LOG_FUNCTION.

PbbMessage::AddressBlockIterator ns3::PbbMessage::AddressBlockErase ( PbbMessage::AddressBlockIterator  first,
PbbMessage::AddressBlockIterator  last 
)

Removes all address blocks from [first, last) (includes first, not includes last).

Parameters
firstan Iterator pointing to the first address block to erase (inclusive).
lastan Iterator pointing to the element past the last address block to erase.
Returns
an iterator pointing to the next address block in the message.

Definition at line 1383 of file packetbb.cc.

References NS_LOG_FUNCTION.

Ptr< PbbAddressBlock > ns3::PbbMessage::AddressBlockFront ( void  )
Returns
a smart pointer to the first address block in this message.

Definition at line 1320 of file packetbb.cc.

References NS_LOG_FUNCTION.

const Ptr< PbbAddressBlock > ns3::PbbMessage::AddressBlockFront ( void  ) const
Returns
a const smart pointer to the first address block in this message.

Definition at line 1327 of file packetbb.cc.

References NS_LOG_FUNCTION.

void ns3::PbbMessage::AddressBlockPushBack ( Ptr< PbbAddressBlock block)

Appends an address block to the front of this message.

Parameters
blocka smart pointer to the address block to append.

Definition at line 1362 of file packetbb.cc.

References NS_LOG_FUNCTION.

Referenced by Deserialize().

void ns3::PbbMessage::AddressBlockPushFront ( Ptr< PbbAddressBlock block)

Prepends an address block to the front of this message.

Parameters
blocka smart pointer to the address block to prepend.

Definition at line 1348 of file packetbb.cc.

References NS_LOG_FUNCTION.

int ns3::PbbMessage::AddressBlockSize ( void  ) const
Returns
the number of address blocks in this message.

Definition at line 1306 of file packetbb.cc.

References NS_LOG_FUNCTION.

void ns3::PbbMessage::Deserialize ( Buffer::Iterator start)

Deserializes a message from the specified buffer.

Parameters
starta reference to the point in a buffer to begin deserializing.

Users should not need to call this. Blocks will be deserialized by their containing packet.

Definition at line 1533 of file packetbb.cc.

References AddressBlockPushBack(), ns3::PbbTlvBlock::Deserialize(), ns3::Buffer::Iterator::GetDistanceFrom(), NS_LOG_FUNCTION, ns3::Buffer::Iterator::ReadNtohU16(), ns3::Buffer::Iterator::ReadU8(), SetHopCount(), SetHopLimit(), SetOriginatorAddress(), SetSequenceNumber(), and SetType().

Ptr< PbbMessage > ns3::PbbMessage::DeserializeMessage ( Buffer::Iterator start)
static

Deserializes a message, returning the correct object depending on whether it is an IPv4 message or an IPv6 message.

Parameters
starta reference to the point in a buffer to begin deserializing.
Returns
A pointer to the deserialized message, or 0 on error.

Users should not need to call this. Blocks will be deserialized by their containing packet.

Definition at line 1500 of file packetbb.cc.

References ns3::Buffer::Iterator::Next(), NS_LOG_FUNCTION, ns3::Buffer::Iterator::Prev(), and ns3::Buffer::Iterator::ReadU8().

Referenced by ns3::PbbPacket::Deserialize().

uint8_t ns3::PbbMessage::GetHopCount ( void  ) const
Returns
the current number of hops this message has traveled.

Calling this while HasHopCount is False is undefined. Make sure you check it first. This will be checked by an assert in debug builds.

Definition at line 1117 of file packetbb.cc.

References HasHopCount(), NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by Print(), and Serialize().

uint8_t ns3::PbbMessage::GetHopLimit ( void  ) const
Returns
the maximum number of hops this message should travel.

Calling this while HasHopLimit is False is undefined. Make sure you check it first. This will be checked by an assert in debug builds.

Definition at line 1094 of file packetbb.cc.

References HasHopLimit(), NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by Print(), and Serialize().

Address ns3::PbbMessage::GetOriginatorAddress ( void  ) const
Returns
the address of the node that created this packet.

Calling this while HasOriginatorAddress is False is undefined. Make sure you check it first. This will be checked by an assert in debug builds.

Definition at line 1071 of file packetbb.cc.

References HasOriginatorAddress(), NS_ASSERT, and NS_LOG_FUNCTION.

uint16_t ns3::PbbMessage::GetSequenceNumber ( void  ) const
Returns
the sequence number of this message.

Calling this while HasSequenceNumber is False is undefined. Make sure you check it first. This will be checked by an assert in debug builds.

Definition at line 1140 of file packetbb.cc.

References HasSequenceNumber(), NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by Print(), and Serialize().

uint32_t ns3::PbbMessage::GetSerializedSize ( void  ) const
Returns
The size (in bytes) needed to serialize this message.

Definition at line 1404 of file packetbb.cc.

References AddressBlockBegin(), AddressBlockEnd(), ns3::PbbTlvBlock::GetSerializedSize(), HasHopCount(), HasHopLimit(), HasOriginatorAddress(), HasSequenceNumber(), and NS_LOG_FUNCTION.

uint8_t ns3::PbbMessage::GetType ( void  ) const
Returns
the type assigned to this packet

Definition at line 1049 of file packetbb.cc.

References NS_LOG_FUNCTION.

Referenced by Print(), and Serialize().

bool ns3::PbbMessage::HasHopCount ( void  ) const

Tests whether or not this message has a hop count.

Returns
true if this message has a hop limit, false otherwise.

Definition at line 1125 of file packetbb.cc.

References NS_LOG_FUNCTION.

Referenced by GetHopCount(), GetSerializedSize(), Print(), and Serialize().

bool ns3::PbbMessage::HasHopLimit ( void  ) const

Tests whether or not this message has a hop limit.

Returns
true if this message has a hop limit, false otherwise.

If this is set, messages should not hop further than this limit.

Definition at line 1102 of file packetbb.cc.

References NS_LOG_FUNCTION.

Referenced by GetHopLimit(), GetSerializedSize(), Print(), and Serialize().

bool ns3::PbbMessage::HasOriginatorAddress ( void  ) const

Tests whether or not this message has an originator address.

Returns
true if this message has an originator address, false otherwise.

Definition at line 1079 of file packetbb.cc.

References NS_LOG_FUNCTION.

Referenced by GetOriginatorAddress(), GetSerializedSize(), Print(), and Serialize().

bool ns3::PbbMessage::HasSequenceNumber ( void  ) const

Tests whether or not this message has a sequence number.

Returns
true if this message has a sequence number, false otherwise.

Definition at line 1148 of file packetbb.cc.

References NS_LOG_FUNCTION.

Referenced by GetSequenceNumber(), GetSerializedSize(), Print(), and Serialize().

void ns3::PbbMessage::Print ( std::ostream &  os) const

Pretty-prints the contents of this message.

Parameters
osa stream object to print to.

Definition at line 1575 of file packetbb.cc.

References NS_LOG_FUNCTION.

void ns3::PbbMessage::Print ( std::ostream &  os,
int  level 
) const

Pretty-prints the contents of this message, with specified indentation.

Parameters
osa stream object to print to.
levellevel of indentation.

This probably never needs to be called by users. This is used when recursively printing sub-objects.

Definition at line 1582 of file packetbb.cc.

References AddressBlockBegin(), AddressBlockEnd(), GetHopCount(), GetHopLimit(), GetSequenceNumber(), GetType(), HasHopCount(), HasHopLimit(), HasOriginatorAddress(), HasSequenceNumber(), NS_LOG_FUNCTION, and ns3::PbbTlvBlock::Print().

void ns3::PbbMessage::Serialize ( Buffer::Iterator start) const

Serializes this message into the specified buffer.

Parameters
starta reference to the point in a buffer to begin serializing.

Users should not need to call this. Blocks will be deserialized by their containing packet.

Definition at line 1443 of file packetbb.cc.

References AddressBlockBegin(), AddressBlockEnd(), ns3::Buffer::Iterator::GetDistanceFrom(), GetHopCount(), GetHopLimit(), GetSequenceNumber(), GetType(), HasHopCount(), HasHopLimit(), HasOriginatorAddress(), HasSequenceNumber(), ns3::Buffer::Iterator::Next(), NS_LOG_FUNCTION, ns3::PbbTlvBlock::Serialize(), ns3::Buffer::Iterator::WriteHtonU16(), and ns3::Buffer::Iterator::WriteU8().

void ns3::PbbMessage::SetHopCount ( uint8_t  hopcount)

Sets the current number of hops this message has traveled.

Parameters
hopcountthe current number of hops

Definition at line 1109 of file packetbb.cc.

References NS_LOG_FUNCTION.

Referenced by Deserialize().

void ns3::PbbMessage::SetHopLimit ( uint8_t  hoplimit)

Sets the maximum number of hops this message should travel.

Parameters
hoplimitthe limit to set

Definition at line 1086 of file packetbb.cc.

References NS_LOG_FUNCTION.

Referenced by Deserialize().

void ns3::PbbMessage::SetOriginatorAddress ( Address  address)

Sets the address for the node that created this packet.

Parameters
addressthe originator address.

Definition at line 1063 of file packetbb.cc.

References NS_LOG_FUNCTION.

Referenced by Deserialize().

void ns3::PbbMessage::SetSequenceNumber ( uint16_t  seqnum)

Sets the sequence number of this message.

Parameters
seqnumthe sequence number to set.

Definition at line 1132 of file packetbb.cc.

References NS_LOG_FUNCTION.

Referenced by Deserialize().

void ns3::PbbMessage::SetType ( uint8_t  type)

Sets the type for this message.

Parameters
typethe type to set.

Definition at line 1042 of file packetbb.cc.

References NS_LOG_FUNCTION.

Referenced by Deserialize().

Ptr< PbbTlv > ns3::PbbMessage::TlvBack ( void  )
Returns
a smart pointer to the last message TLV in this message.

Definition at line 1213 of file packetbb.cc.

References ns3::PbbTlvBlock::Back(), and NS_LOG_FUNCTION.

const Ptr< PbbTlv > ns3::PbbMessage::TlvBack ( void  ) const
Returns
a const smart pointer to the last message TLV in this message.

Definition at line 1220 of file packetbb.cc.

References ns3::PbbTlvBlock::Back(), and NS_LOG_FUNCTION.

PbbMessage::TlvIterator ns3::PbbMessage::TlvBegin ( void  )
Returns
an iterator to the first message TLV in this message.

Definition at line 1157 of file packetbb.cc.

References ns3::PbbTlvBlock::Begin(), and NS_LOG_FUNCTION.

PbbMessage::ConstTlvIterator ns3::PbbMessage::TlvBegin ( void  ) const
Returns
a const iterator to the first message TLV in this message.

Definition at line 1164 of file packetbb.cc.

References ns3::PbbTlvBlock::Begin(), and NS_LOG_FUNCTION.

bool ns3::PbbMessage::TlvEmpty ( void  ) const
Returns
true if there are no message TLVs in this message, false otherwise.

Definition at line 1192 of file packetbb.cc.

References ns3::PbbTlvBlock::Empty(), and NS_LOG_FUNCTION.

PbbMessage::TlvIterator ns3::PbbMessage::TlvEnd ( void  )
Returns
an iterator to the past-the-end message TLV element in this message.

Definition at line 1171 of file packetbb.cc.

References ns3::PbbTlvBlock::End(), and NS_LOG_FUNCTION.

PbbMessage::ConstTlvIterator ns3::PbbMessage::TlvEnd ( void  ) const
Returns
a const iterator to the past-the-end message TLV element in this message.

Definition at line 1178 of file packetbb.cc.

References ns3::PbbTlvBlock::End(), and NS_LOG_FUNCTION.

PbbMessage::TlvIterator ns3::PbbMessage::TlvErase ( PbbMessage::TlvIterator  position)

Removes the message TLV at the specified position.

Parameters
positionan Iterator pointing to the message TLV to erase.
Returns
an iterator pointing to the next TLV in the block.

Definition at line 1255 of file packetbb.cc.

References ns3::PbbTlvBlock::Erase(), and NS_LOG_FUNCTION.

PbbMessage::TlvIterator ns3::PbbMessage::TlvErase ( PbbMessage::TlvIterator  first,
PbbMessage::TlvIterator  last 
)

Removes all message TLVs from [first, last) (includes first, not includes last).

Parameters
firstan Iterator pointing to the first message TLV to erase (inclusive).
lastan Iterator pointing to the element past the last message TLV to erase.
Returns
an iterator pointing to the next message TLV in the message.

Definition at line 1262 of file packetbb.cc.

References ns3::PbbTlvBlock::Erase(), and NS_LOG_FUNCTION.

Ptr< PbbTlv > ns3::PbbMessage::TlvFront ( void  )
Returns
a smart pointer to the first message TLV in this message.

Definition at line 1199 of file packetbb.cc.

References ns3::PbbTlvBlock::Front(), and NS_LOG_FUNCTION.

const Ptr< PbbTlv > ns3::PbbMessage::TlvFront ( void  ) const
Returns
a const smart pointer to the first message TLV in this message.

Definition at line 1206 of file packetbb.cc.

References ns3::PbbTlvBlock::Front(), and NS_LOG_FUNCTION.

void ns3::PbbMessage::TlvPushBack ( Ptr< PbbTlv tlv)

Appends a message TLV to the back of this message.

Parameters
tlva smart pointer to the message TLV to append.

Definition at line 1241 of file packetbb.cc.

References NS_LOG_FUNCTION, and ns3::PbbTlvBlock::PushBack().

void ns3::PbbMessage::TlvPushFront ( Ptr< PbbTlv tlv)

Prepends a message TLV to the front of this message.

Parameters
tlva smart pointer to the message TLV to prepend.

Definition at line 1227 of file packetbb.cc.

References NS_LOG_FUNCTION, and ns3::PbbTlvBlock::PushFront().

int ns3::PbbMessage::TlvSize ( void  ) const
Returns
the number of message TLVs in this message.

Definition at line 1185 of file packetbb.cc.

References NS_LOG_FUNCTION, and ns3::PbbTlvBlock::Size().


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