A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::PbbPacket Class Reference

Main PacketBB Packet object. More...

#include <packetbb.h>

+ Inheritance diagram for ns3::PbbPacket:
+ Collaboration diagram for ns3::PbbPacket:

Public Types

typedef std::list< Ptr
< PbbMessage >
>::const_iterator 
ConstMessageIterator
typedef std::list< Ptr< PbbTlv >
>::const_iterator 
ConstTlvIterator
typedef std::list< Ptr
< PbbMessage > >::iterator 
MessageIterator
typedef std::list< Ptr< PbbTlv >
>::iterator 
TlvIterator

Public Member Functions

 PbbPacket (void)
 ~PbbPacket (void)
virtual uint32_t Deserialize (Buffer::Iterator start)
 Deserializes a packet from the specified buffer.
TlvIterator Erase (TlvIterator position)
 Removes the packet TLV at the specified position.
TlvIterator Erase (TlvIterator first, TlvIterator last)
 Removes all packet TLVs from [first, last) (includes first, not includes last).
MessageIterator Erase (MessageIterator position)
 Removes the message at the specified position.
MessageIterator Erase (MessageIterator first, MessageIterator last)
 Removes all messages from [first, last) (includes first, not includes last).
virtual TypeId GetInstanceTypeId (void) const
uint16_t GetSequenceNumber (void) const
virtual uint32_t GetSerializedSize (void) const
uint8_t GetVersion (void) const
bool HasSequenceNumber (void) const
 Tests whether or not this packet has a sequence number.
Ptr< PbbMessageMessageBack (void)
const Ptr< PbbMessageMessageBack (void) const
MessageIterator MessageBegin (void)
ConstMessageIterator MessageBegin (void) const
void MessageClear (void)
 Removes all messages from this packet.
bool MessageEmpty (void) const
MessageIterator MessageEnd (void)
ConstMessageIterator MessageEnd (void) const
Ptr< PbbMessageMessageFront (void)
const Ptr< PbbMessageMessageFront (void) const
void MessagePopBack (void)
 Removes a message from the back of this packet.
void MessagePopFront (void)
 Removes a message from the front of this packet.
void MessagePushBack (Ptr< PbbMessage > message)
 Appends a message to the back of this packet.
void MessagePushFront (Ptr< PbbMessage > message)
 Prepends a message to the front of this packet.
int MessageSize (void) const
bool operator!= (const PbbPacket &other) const
bool operator== (const PbbPacket &other) const
virtual void Print (std::ostream &os) const
 Pretty-prints the contents of this block.
virtual void Serialize (Buffer::Iterator start) const
 Serializes this packet into the specified buffer.
void SetSequenceNumber (uint16_t number)
 Sets the sequence number of this packet.
Ptr< PbbTlvTlvBack (void)
const Ptr< PbbTlvTlvBack (void) const
TlvIterator TlvBegin (void)
ConstTlvIterator TlvBegin (void) const
void TlvClear (void)
 Removes all packet TLVs from this packet.
bool TlvEmpty (void) const
TlvIterator TlvEnd (void)
ConstTlvIterator TlvEnd (void) const
Ptr< PbbTlvTlvFront (void)
const Ptr< PbbTlvTlvFront (void) const
void TlvPopBack (void)
 Removes a packet TLV from the back of this block.
void TlvPopFront (void)
 Removes a packet TLV from the front of this packet.
void TlvPushBack (Ptr< PbbTlv > tlv)
 Appends a packet TLV to the back of this packet.
void TlvPushFront (Ptr< PbbTlv > tlv)
 Prepends a packet TLV to the front of this packet.
int TlvSize (void) const
- Public Member Functions inherited from ns3::SimpleRefCount< PbbPacket, Header >
 SimpleRefCount ()
 SimpleRefCount (const SimpleRefCount &o)
uint32_t GetReferenceCount (void) const
SimpleRefCountoperator= (const SimpleRefCount &o)
void Ref (void) const
void Unref (void) const
- Public Member Functions inherited from ns3::Header
virtual ~Header ()

Static Public Member Functions

static TypeId GetTypeId (void)
 This method returns the TypeId associated to ns3::PbbPacket.
- Static Public Member Functions inherited from ns3::SimpleRefCount< PbbPacket, Header >
static void Cleanup (void)

Private Attributes

bool m_hasseqnum
std::list< Ptr< PbbMessage > > m_messageList
uint16_t m_seqnum
PbbTlvBlock m_tlvList
uint8_t m_version

Additional Inherited Members

- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
virtual void NotifyConstructionCompleted (void)

Detailed Description

Main PacketBB Packet object.

A PacketBB packet is made up of zero or more packet TLVs (PbbTlv), and zero or more messages (PbbMessage).

See: http://tools.ietf.org/html/rfc5444 for details.

Definition at line 364 of file packetbb.h.

Member Typedef Documentation

Definition at line 370 of file packetbb.h.

Definition at line 368 of file packetbb.h.

Definition at line 369 of file packetbb.h.

Definition at line 367 of file packetbb.h.

Constructor & Destructor Documentation

ns3::PbbPacket::PbbPacket ( void  )

Definition at line 498 of file packetbb.cc.

References m_hasseqnum, m_version, and VERSION.

ns3::PbbPacket::~PbbPacket ( void  )

Definition at line 504 of file packetbb.cc.

References MessageClear().

+ Here is the call graph for this function:

Member Function Documentation

uint32_t ns3::PbbPacket::Deserialize ( Buffer::Iterator  start)
virtual

Deserializes a packet from the specified buffer.

Parameters
startstart offset
Returns
the number of bytes deserialized

If this returns a number smaller than the total number of bytes in the buffer, there was an error.

Implements ns3::Header.

Definition at line 826 of file packetbb.cc.

References ns3::PbbTlvBlock::Deserialize(), ns3::PbbMessage::DeserializeMessage(), ns3::Buffer::Iterator::GetDistanceFrom(), ns3::Buffer::Iterator::IsEnd(), m_tlvList, m_version, MessagePushBack(), PHAS_SEQ_NUM, PHAS_TLV, ns3::Buffer::Iterator::ReadNtohU16(), ns3::Buffer::Iterator::ReadU8(), SetSequenceNumber(), and visualizer.core::start().

Referenced by PbbTestCase::TestDeserialize().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PbbPacket::MessageIterator ns3::PbbPacket::Erase ( PbbPacket::TlvIterator  position)

Removes the packet TLV at the specified position.

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

Definition at line 622 of file packetbb.cc.

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

+ Here is the call graph for this function:

PbbPacket::MessageIterator ns3::PbbPacket::Erase ( PbbPacket::TlvIterator  first,
PbbPacket::TlvIterator  last 
)

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

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

Definition at line 628 of file packetbb.cc.

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

+ Here is the call graph for this function:

MessageIterator ns3::PbbPacket::Erase ( MessageIterator  position)

Removes the message at the specified position.

Parameters
positionan Iterator pointing to the message to erase.
Returns
an iterator pointing to the next message in the packet.
MessageIterator ns3::PbbPacket::Erase ( MessageIterator  first,
MessageIterator  last 
)

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

Parameters
firstan Iterator pointing to the first message to erase (inclusive).
lastan Iterator pointing to the element past the last message to erase.
Returns
an iterator pointing to the next message in the block.
TypeId ns3::PbbPacket::GetInstanceTypeId ( void  ) const
virtual
Returns
the TypeId associated to the most-derived type of this instance.

This method is typically implemented by ns3::Object::GetInstanceTypeId but some classes which derive from ns3::ObjectBase directly have to implement it themselves.

Implements ns3::ObjectBase.

Definition at line 760 of file packetbb.cc.

References GetTypeId().

+ Here is the call graph for this function:

uint16_t ns3::PbbPacket::GetSequenceNumber ( void  ) const
Returns
the sequence number of this packet.

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 523 of file packetbb.cc.

References HasSequenceNumber(), m_seqnum, and NS_ASSERT.

Referenced by operator==(), Print(), and Serialize().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32_t ns3::PbbPacket::GetSerializedSize ( void  ) const
virtual
Returns
The size (in bytes) needed to serialize this packet.

Implements ns3::Header.

Definition at line 766 of file packetbb.cc.

References ns3::PbbTlvBlock::GetSerializedSize(), HasSequenceNumber(), m_tlvList, MessageBegin(), MessageEnd(), and TlvEmpty().

Referenced by PbbTestCase::TestSerialize().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

TypeId ns3::PbbPacket::GetTypeId ( void  )
static

This method returns the TypeId associated to ns3::PbbPacket.

No Attributes defined for this type.
No TraceSources defined for this type.

Reimplemented from ns3::Header.

Definition at line 750 of file packetbb.cc.

References ns3::TypeId::SetParent().

Referenced by GetInstanceTypeId().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint8_t ns3::PbbPacket::GetVersion ( void  ) const
Returns
the version of PacketBB that constructed this packet.

This will always return 0 for packets constructed using this API.

Definition at line 510 of file packetbb.cc.

References m_version.

Referenced by operator==().

+ Here is the caller graph for this function:

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

Tests whether or not this packet has a sequence number.

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

This should be called before calling GetSequenceNumber to make sure there actually is one.

Definition at line 530 of file packetbb.cc.

References m_hasseqnum.

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

+ Here is the caller graph for this function:

Ptr< PbbMessage > ns3::PbbPacket::MessageBack ( void  )
Returns
a smart pointer to the last message in this packet.

Definition at line 690 of file packetbb.cc.

References m_messageList.

const Ptr< PbbMessage > ns3::PbbPacket::MessageBack ( void  ) const
Returns
a const smart pointer to the last message in this packet.

Definition at line 696 of file packetbb.cc.

References m_messageList.

PbbPacket::MessageIterator ns3::PbbPacket::MessageBegin ( void  )
Returns
an iterator to the first message in this packet.

Definition at line 642 of file packetbb.cc.

References m_messageList.

Referenced by GetSerializedSize(), MessageClear(), operator==(), Print(), and Serialize().

+ Here is the caller graph for this function:

PbbPacket::ConstMessageIterator ns3::PbbPacket::MessageBegin ( void  ) const
Returns
a const iterator to the first message in this packet.

Definition at line 648 of file packetbb.cc.

References m_messageList.

void ns3::PbbPacket::MessageClear ( void  )

Removes all messages from this packet.

Definition at line 739 of file packetbb.cc.

References m_messageList, MessageBegin(), and MessageEnd().

Referenced by ~PbbPacket().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::PbbPacket::MessageEmpty ( void  ) const
Returns
true if there are no messages in this packet, false otherwise.

Definition at line 672 of file packetbb.cc.

References m_messageList.

PbbPacket::MessageIterator ns3::PbbPacket::MessageEnd ( void  )
Returns
an iterator to the past-the-end element in this message block.

Definition at line 654 of file packetbb.cc.

References m_messageList.

Referenced by GetSerializedSize(), MessageClear(), operator==(), Print(), and Serialize().

+ Here is the caller graph for this function:

PbbPacket::ConstMessageIterator ns3::PbbPacket::MessageEnd ( void  ) const
Returns
a const iterator to the past-the-end element in this message block.

Definition at line 660 of file packetbb.cc.

References m_messageList.

Ptr< PbbMessage > ns3::PbbPacket::MessageFront ( void  )
Returns
a smart pointer to the first message in this packet.

Definition at line 678 of file packetbb.cc.

References m_messageList.

const Ptr< PbbMessage > ns3::PbbPacket::MessageFront ( void  ) const
Returns
a const smart pointer to the first message in this packet.

Definition at line 684 of file packetbb.cc.

References m_messageList.

void ns3::PbbPacket::MessagePopBack ( void  )

Removes a message from the back of this packet.

Definition at line 720 of file packetbb.cc.

References m_messageList.

void ns3::PbbPacket::MessagePopFront ( void  )

Removes a message from the front of this packet.

Definition at line 708 of file packetbb.cc.

References m_messageList.

void ns3::PbbPacket::MessagePushBack ( Ptr< PbbMessage message)

Appends a message to the back of this packet.

Parameters
messagea smart pointer to the message to append.

Definition at line 714 of file packetbb.cc.

References m_messageList.

Referenced by Deserialize(), and PbbTestSuite::PbbTestSuite().

+ Here is the caller graph for this function:

void ns3::PbbPacket::MessagePushFront ( Ptr< PbbMessage message)

Prepends a message to the front of this packet.

Parameters
messagea smart pointer to the message to prepend.

Definition at line 702 of file packetbb.cc.

References m_messageList.

int ns3::PbbPacket::MessageSize ( void  ) const
Returns
the number of messages in this packet.

Definition at line 666 of file packetbb.cc.

References m_messageList.

Referenced by operator==().

+ Here is the caller graph for this function:

bool ns3::PbbPacket::operator!= ( const PbbPacket other) const

Definition at line 925 of file packetbb.cc.

bool ns3::PbbPacket::operator== ( const PbbPacket other) const

Definition at line 883 of file packetbb.cc.

References GetSequenceNumber(), GetVersion(), HasSequenceNumber(), m_tlvList, MessageBegin(), MessageEnd(), and MessageSize().

+ Here is the call graph for this function:

void ns3::PbbPacket::Print ( std::ostream &  os) const
virtual

Pretty-prints the contents of this block.

Parameters
osa stream object to print to.

Implements ns3::Header.

Definition at line 859 of file packetbb.cc.

References GetSequenceNumber(), HasSequenceNumber(), m_tlvList, MessageBegin(), MessageEnd(), and ns3::PbbTlvBlock::Print().

+ Here is the call graph for this function:

void ns3::PbbPacket::Serialize ( Buffer::Iterator  start) const
virtual

Serializes this packet into the specified buffer.

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

Implements ns3::Header.

Definition at line 792 of file packetbb.cc.

References GetSequenceNumber(), HasSequenceNumber(), m_tlvList, MessageBegin(), MessageEnd(), ns3::Buffer::Iterator::Next(), PHAS_SEQ_NUM, PHAS_TLV, ns3::PbbTlvBlock::Serialize(), visualizer.core::start(), TlvEmpty(), VERSION, ns3::Buffer::Iterator::WriteHtonU16(), and ns3::Buffer::Iterator::WriteU8().

Referenced by PbbTestCase::TestSerialize().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::PbbPacket::SetSequenceNumber ( uint16_t  number)

Sets the sequence number of this packet.

Parameters
numberthe sequence number.

Definition at line 516 of file packetbb.cc.

References m_hasseqnum, and m_seqnum.

Referenced by Deserialize(), and PbbTestSuite::PbbTestSuite().

+ Here is the caller graph for this function:

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

Definition at line 586 of file packetbb.cc.

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

+ Here is the call graph for this function:

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

Definition at line 592 of file packetbb.cc.

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

+ Here is the call graph for this function:

PbbPacket::TlvIterator ns3::PbbPacket::TlvBegin ( void  )
Returns
an iterator to the first Packet TLV in this packet.

Definition at line 538 of file packetbb.cc.

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

+ Here is the call graph for this function:

PbbPacket::ConstTlvIterator ns3::PbbPacket::TlvBegin ( void  ) const
Returns
a const iterator to the first Packet TLV in this packet.

Definition at line 544 of file packetbb.cc.

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

+ Here is the call graph for this function:

void ns3::PbbPacket::TlvClear ( void  )

Removes all packet TLVs from this packet.

Definition at line 634 of file packetbb.cc.

References ns3::PbbTlvBlock::Clear(), and m_tlvList.

+ Here is the call graph for this function:

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

Definition at line 568 of file packetbb.cc.

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

Referenced by GetSerializedSize(), and Serialize().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 550 of file packetbb.cc.

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

+ Here is the call graph for this function:

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

Definition at line 556 of file packetbb.cc.

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

+ Here is the call graph for this function:

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

Definition at line 574 of file packetbb.cc.

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

+ Here is the call graph for this function:

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

Definition at line 580 of file packetbb.cc.

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

+ Here is the call graph for this function:

void ns3::PbbPacket::TlvPopBack ( void  )

Removes a packet TLV from the back of this block.

Definition at line 616 of file packetbb.cc.

References m_tlvList, and ns3::PbbTlvBlock::PopBack().

+ Here is the call graph for this function:

void ns3::PbbPacket::TlvPopFront ( void  )

Removes a packet TLV from the front of this packet.

Definition at line 604 of file packetbb.cc.

References m_tlvList, and ns3::PbbTlvBlock::PopFront().

+ Here is the call graph for this function:

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

Appends a packet TLV to the back of this packet.

Parameters
tlva smart pointer to the packet TLV to append.

Definition at line 610 of file packetbb.cc.

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

Referenced by PbbTestSuite::PbbTestSuite().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Prepends a packet TLV to the front of this packet.

Parameters
tlva smart pointer to the packet TLV to prepend.

Definition at line 598 of file packetbb.cc.

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

+ Here is the call graph for this function:

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

Definition at line 562 of file packetbb.cc.

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

+ Here is the call graph for this function:

Member Data Documentation

bool ns3::PbbPacket::m_hasseqnum
private

Definition at line 641 of file packetbb.h.

Referenced by HasSequenceNumber(), PbbPacket(), and SetSequenceNumber().

uint16_t ns3::PbbPacket::m_seqnum
private

Definition at line 642 of file packetbb.h.

Referenced by GetSequenceNumber(), and SetSequenceNumber().

uint8_t ns3::PbbPacket::m_version
private

Definition at line 639 of file packetbb.h.

Referenced by Deserialize(), GetVersion(), and PbbPacket().


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