Main PacketBB Packet object. More...
#include "packetbb.h"
Public Types | |
typedef std::list< Ptr< PbbMessage > >::const_iterator | ConstMessageIterator |
PbbMessage Const Iterator for PbbPacket. | |
typedef std::list< Ptr< PbbTlv > >::const_iterator | ConstTlvIterator |
PbbTlv const iterator for PbbPacket. | |
typedef std::list< Ptr< PbbMessage > >::iterator | MessageIterator |
PbbMessage Iterator for PbbPacket. | |
typedef std::list< Ptr< PbbTlv > >::iterator | TlvIterator |
PbbTlv iterator for PbbPacket. | |
Public Member Functions | |
PbbPacket () | |
~PbbPacket () override | |
uint32_t | Deserialize (Buffer::Iterator start) override |
Deserializes a packet from the specified buffer. | |
MessageIterator | Erase (MessageIterator first, MessageIterator last) |
Removes all messages from [first, last) (includes first, not includes last). | |
MessageIterator | Erase (MessageIterator position) |
Removes the message at the specified position. | |
TlvIterator | Erase (TlvIterator first, TlvIterator last) |
Removes all packet TLVs from [first, last) (includes first, not includes last). | |
TlvIterator | Erase (TlvIterator position) |
Removes the packet TLV at the specified position. | |
void | ForceTlv (bool forceTlv) |
Forces a packet to write a TLV list even if it's empty, ignoring the phastlv bit. | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. | |
uint16_t | GetSequenceNumber () const |
uint32_t | GetSerializedSize () const override |
uint8_t | GetVersion () const |
bool | HasSequenceNumber () const |
Tests whether or not this packet has a sequence number. | |
Ptr< PbbMessage > | MessageBack () |
const Ptr< PbbMessage > | MessageBack () const |
MessageIterator | MessageBegin () |
ConstMessageIterator | MessageBegin () const |
void | MessageClear () |
Removes all messages from this packet. | |
bool | MessageEmpty () const |
MessageIterator | MessageEnd () |
ConstMessageIterator | MessageEnd () const |
Ptr< PbbMessage > | MessageFront () |
const Ptr< PbbMessage > | MessageFront () const |
void | MessagePopBack () |
Removes a message from the back of this packet. | |
void | MessagePopFront () |
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 () const |
bool | operator!= (const PbbPacket &other) const |
Inequality operator for PbbPacket. | |
bool | operator== (const PbbPacket &other) const |
Equality operator for PbbPacket. | |
void | Print (std::ostream &os) const override |
Pretty-prints the contents of this block. | |
void | Serialize (Buffer::Iterator start) const override |
Serializes this packet into the specified buffer. | |
void | SetSequenceNumber (uint16_t number) |
Sets the sequence number of this packet. | |
Ptr< PbbTlv > | TlvBack () |
const Ptr< PbbTlv > | TlvBack () const |
TlvIterator | TlvBegin () |
ConstTlvIterator | TlvBegin () const |
void | TlvClear () |
Removes all packet TLVs from this packet. | |
bool | TlvEmpty () const |
TlvIterator | TlvEnd () |
ConstTlvIterator | TlvEnd () const |
Ptr< PbbTlv > | TlvFront () |
const Ptr< PbbTlv > | TlvFront () const |
void | TlvPopBack () |
Removes a packet TLV from the back of this block. | |
void | TlvPopFront () |
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 () const |
Public Member Functions inherited from ns3::SimpleRefCount< PbbPacket, Header > | |
SimpleRefCount () | |
Default constructor. | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. | |
void | Ref () const |
Increment the reference count. | |
void | Unref () const |
Decrement the reference count. | |
Public Member Functions inherited from ns3::Header | |
~Header () override | |
virtual uint32_t | Deserialize (Buffer::Iterator start, Buffer::Iterator end) |
Deserialize the object from a buffer iterator. | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. | |
void | GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const |
Get the value of an attribute, raising fatal errors if unsuccessful. | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::Header | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::Chunk | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. | |
Private Attributes | |
bool | m_forceTlv |
Force writing a TLV list (even if it's empty) | |
bool | m_hasseqnum |
Sequence number present. | |
std::list< Ptr< PbbMessage > > | m_messageList |
PbbTlvBlock container. | |
uint16_t | m_seqnum |
Sequence number. | |
PbbTlvBlock | m_tlvList |
PbbTlv container. | |
uint8_t | m_version |
version | |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. | |
Related Symbols inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
Main PacketBB Packet object.
A PacketBB packet is made up of zero or more packet TLVs (PbbTlv), and zero or more messages (PbbMessage).
See: RFC 5444 for details.
Definition at line 379 of file packetbb.h.
typedef std::list<Ptr<PbbMessage>>::const_iterator ns3::PbbPacket::ConstMessageIterator |
PbbMessage Const Iterator for PbbPacket.
Definition at line 389 of file packetbb.h.
typedef std::list<Ptr<PbbTlv>>::const_iterator ns3::PbbPacket::ConstTlvIterator |
PbbTlv const iterator for PbbPacket.
Definition at line 385 of file packetbb.h.
typedef std::list<Ptr<PbbMessage>>::iterator ns3::PbbPacket::MessageIterator |
PbbMessage Iterator for PbbPacket.
Definition at line 387 of file packetbb.h.
typedef std::list<Ptr<PbbTlv>>::iterator ns3::PbbPacket::TlvIterator |
PbbTlv iterator for PbbPacket.
Definition at line 383 of file packetbb.h.
ns3::PbbPacket::PbbPacket | ( | ) |
Definition at line 532 of file packetbb.cc.
References m_forceTlv, m_hasseqnum, m_version, NS_LOG_FUNCTION, and ns3::VERSION.
|
override |
Definition at line 540 of file packetbb.cc.
References MessageClear(), and NS_LOG_FUNCTION.
|
overridevirtual |
Deserializes a packet from the specified buffer.
start | start offset |
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 904 of file packetbb.cc.
References ns3::PbbTlvBlock::Deserialize(), ns3::PbbMessage::DeserializeMessage(), m_tlvList, m_version, MessagePushBack(), NS_LOG_FUNCTION, PHAS_SEQ_NUM, PHAS_TLV, ns3::Buffer::Iterator::ReadU8(), and SetSequenceNumber().
MessageIterator ns3::PbbPacket::Erase | ( | MessageIterator | first, |
MessageIterator | last ) |
Removes all messages from [first, last) (includes first, not includes last).
first | an Iterator pointing to the first message to erase (inclusive). |
last | an Iterator pointing to the element past the last message to erase. |
MessageIterator ns3::PbbPacket::Erase | ( | MessageIterator | position | ) |
Removes the message at the specified position.
position | an Iterator pointing to the message to erase. |
PbbPacket::MessageIterator ns3::PbbPacket::Erase | ( | PbbPacket::TlvIterator | first, |
PbbPacket::TlvIterator | last ) |
Removes all packet TLVs from [first, last) (includes first, not includes last).
first | an Iterator pointing to the first packet TLV to erase (inclusive). |
last | an Iterator pointing to the element past the last packet TLV to erase. |
Definition at line 691 of file packetbb.cc.
References ns3::PbbTlvBlock::Erase(), m_tlvList, and NS_LOG_FUNCTION.
PbbPacket::MessageIterator ns3::PbbPacket::Erase | ( | PbbPacket::TlvIterator | position | ) |
Removes the packet TLV at the specified position.
position | an Iterator pointing to the packet TLV to erase. |
Definition at line 684 of file packetbb.cc.
References ns3::PbbTlvBlock::Erase(), m_tlvList, and NS_LOG_FUNCTION.
void ns3::PbbPacket::ForceTlv | ( | bool | forceTlv | ) |
Forces a packet to write a TLV list even if it's empty, ignoring the phastlv bit.
This is mainly used to check the Deserialization of a questionable but correct packet (see test 3).
forceTlv | true will force TLV to be written even if no TLV is set. |
Definition at line 577 of file packetbb.cc.
References m_forceTlv, and NS_LOG_FUNCTION.
|
overridevirtual |
Get the most derived TypeId for this Object.
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 840 of file packetbb.cc.
References GetTypeId().
uint16_t ns3::PbbPacket::GetSequenceNumber | ( | ) | const |
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 562 of file packetbb.cc.
References HasSequenceNumber(), m_seqnum, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by operator==(), Print(), and Serialize().
|
overridevirtual |
Implements ns3::Header.
Definition at line 846 of file packetbb.cc.
References ns3::PbbTlvBlock::GetSerializedSize(), HasSequenceNumber(), m_forceTlv, m_tlvList, MessageBegin(), MessageEnd(), NS_LOG_FUNCTION, and TlvEmpty().
|
static |
Get the type ID.
Definition at line 830 of file packetbb.cc.
References ns3::TypeId::SetParent().
Referenced by GetInstanceTypeId().
uint8_t ns3::PbbPacket::GetVersion | ( | ) | const |
This will always return 0 for packets constructed using this API.
Definition at line 547 of file packetbb.cc.
References m_version, and NS_LOG_FUNCTION.
Referenced by operator==().
bool ns3::PbbPacket::HasSequenceNumber | ( | ) | const |
Tests whether or not this packet has a sequence number.
This should be called before calling GetSequenceNumber to make sure there actually is one.
Definition at line 570 of file packetbb.cc.
References m_hasseqnum, and NS_LOG_FUNCTION.
Referenced by GetSequenceNumber(), GetSerializedSize(), operator==(), Print(), and Serialize().
Ptr< PbbMessage > ns3::PbbPacket::MessageBack | ( | ) |
Definition at line 763 of file packetbb.cc.
References m_messageList, and NS_LOG_FUNCTION.
const Ptr< PbbMessage > ns3::PbbPacket::MessageBack | ( | ) | const |
Definition at line 770 of file packetbb.cc.
References m_messageList, and NS_LOG_FUNCTION.
PbbPacket::MessageIterator ns3::PbbPacket::MessageBegin | ( | ) |
Definition at line 707 of file packetbb.cc.
References m_messageList, and NS_LOG_FUNCTION.
Referenced by GetSerializedSize(), MessageClear(), operator==(), Print(), and Serialize().
PbbPacket::ConstMessageIterator ns3::PbbPacket::MessageBegin | ( | ) | const |
Definition at line 714 of file packetbb.cc.
References m_messageList, and NS_LOG_FUNCTION.
void ns3::PbbPacket::MessageClear | ( | ) |
Removes all messages from this packet.
Definition at line 819 of file packetbb.cc.
References m_messageList, MessageBegin(), MessageEnd(), and NS_LOG_FUNCTION.
Referenced by ~PbbPacket().
bool ns3::PbbPacket::MessageEmpty | ( | ) | const |
Definition at line 742 of file packetbb.cc.
References m_messageList, and NS_LOG_FUNCTION.
PbbPacket::MessageIterator ns3::PbbPacket::MessageEnd | ( | ) |
Definition at line 721 of file packetbb.cc.
References m_messageList, and NS_LOG_FUNCTION.
Referenced by GetSerializedSize(), MessageClear(), operator==(), Print(), and Serialize().
PbbPacket::ConstMessageIterator ns3::PbbPacket::MessageEnd | ( | ) | const |
Definition at line 728 of file packetbb.cc.
References m_messageList, and NS_LOG_FUNCTION.
Ptr< PbbMessage > ns3::PbbPacket::MessageFront | ( | ) |
Definition at line 749 of file packetbb.cc.
References m_messageList, and NS_LOG_FUNCTION.
const Ptr< PbbMessage > ns3::PbbPacket::MessageFront | ( | ) | const |
Definition at line 756 of file packetbb.cc.
References m_messageList, and NS_LOG_FUNCTION.
void ns3::PbbPacket::MessagePopBack | ( | ) |
Removes a message from the back of this packet.
Definition at line 798 of file packetbb.cc.
References m_messageList, and NS_LOG_FUNCTION.
void ns3::PbbPacket::MessagePopFront | ( | ) |
Removes a message from the front of this packet.
Definition at line 784 of file packetbb.cc.
References m_messageList, and NS_LOG_FUNCTION.
void ns3::PbbPacket::MessagePushBack | ( | Ptr< PbbMessage > | message | ) |
Appends a message to the back of this packet.
message | a smart pointer to the message to append. |
Definition at line 791 of file packetbb.cc.
References m_messageList, and NS_LOG_FUNCTION.
Referenced by Deserialize().
void ns3::PbbPacket::MessagePushFront | ( | Ptr< PbbMessage > | message | ) |
Prepends a message to the front of this packet.
message | a smart pointer to the message to prepend. |
Definition at line 777 of file packetbb.cc.
References m_messageList, and NS_LOG_FUNCTION.
int ns3::PbbPacket::MessageSize | ( | ) | const |
Definition at line 735 of file packetbb.cc.
References m_messageList, and NS_LOG_FUNCTION.
Referenced by operator==().
bool ns3::PbbPacket::operator!= | ( | const PbbPacket & | other | ) | const |
Inequality operator for PbbPacket.
other | PbbPacket to compare to this one |
Definition at line 1006 of file packetbb.cc.
bool ns3::PbbPacket::operator== | ( | const PbbPacket & | other | ) | const |
Equality operator for PbbPacket.
other | PbbPacket to compare to this one |
Definition at line 961 of file packetbb.cc.
References GetSequenceNumber(), GetVersion(), HasSequenceNumber(), m_tlvList, MessageBegin(), MessageEnd(), and MessageSize().
|
overridevirtual |
Pretty-prints the contents of this block.
os | a stream object to print to. |
Implements ns3::Header.
Definition at line 938 of file packetbb.cc.
References GetSequenceNumber(), HasSequenceNumber(), m_tlvList, MessageBegin(), MessageEnd(), NS_LOG_FUNCTION, and ns3::PbbTlvBlock::Print().
|
overridevirtual |
Serializes this packet into the specified buffer.
start | a reference to the point in a buffer to begin serializing. |
Implements ns3::Header.
Definition at line 871 of file packetbb.cc.
References GetSequenceNumber(), HasSequenceNumber(), m_forceTlv, m_tlvList, MessageBegin(), MessageEnd(), ns3::Buffer::Iterator::Next(), NS_LOG_FUNCTION, PHAS_SEQ_NUM, PHAS_TLV, ns3::PbbTlvBlock::Serialize(), TlvEmpty(), ns3::VERSION, and ns3::Buffer::Iterator::WriteU8().
void ns3::PbbPacket::SetSequenceNumber | ( | uint16_t | number | ) |
Sets the sequence number of this packet.
number | the sequence number. |
Definition at line 554 of file packetbb.cc.
References m_hasseqnum, m_seqnum, and NS_LOG_FUNCTION.
Referenced by Deserialize().
Definition at line 642 of file packetbb.cc.
References ns3::PbbTlvBlock::Back(), m_tlvList, and NS_LOG_FUNCTION.
Definition at line 649 of file packetbb.cc.
References ns3::PbbTlvBlock::Back(), m_tlvList, and NS_LOG_FUNCTION.
PbbPacket::TlvIterator ns3::PbbPacket::TlvBegin | ( | ) |
Definition at line 586 of file packetbb.cc.
References ns3::PbbTlvBlock::Begin(), m_tlvList, and NS_LOG_FUNCTION.
PbbPacket::ConstTlvIterator ns3::PbbPacket::TlvBegin | ( | ) | const |
Definition at line 593 of file packetbb.cc.
References ns3::PbbTlvBlock::Begin(), m_tlvList, and NS_LOG_FUNCTION.
void ns3::PbbPacket::TlvClear | ( | ) |
Removes all packet TLVs from this packet.
Definition at line 698 of file packetbb.cc.
References ns3::PbbTlvBlock::Clear(), m_tlvList, and NS_LOG_FUNCTION.
bool ns3::PbbPacket::TlvEmpty | ( | ) | const |
Definition at line 621 of file packetbb.cc.
References ns3::PbbTlvBlock::Empty(), m_tlvList, and NS_LOG_FUNCTION.
Referenced by GetSerializedSize(), and Serialize().
PbbPacket::TlvIterator ns3::PbbPacket::TlvEnd | ( | ) |
Definition at line 600 of file packetbb.cc.
References ns3::PbbTlvBlock::End(), m_tlvList, and NS_LOG_FUNCTION.
PbbPacket::ConstTlvIterator ns3::PbbPacket::TlvEnd | ( | ) | const |
Definition at line 607 of file packetbb.cc.
References ns3::PbbTlvBlock::End(), m_tlvList, and NS_LOG_FUNCTION.
Definition at line 628 of file packetbb.cc.
References ns3::PbbTlvBlock::Front(), m_tlvList, and NS_LOG_FUNCTION.
Definition at line 635 of file packetbb.cc.
References ns3::PbbTlvBlock::Front(), m_tlvList, and NS_LOG_FUNCTION.
void ns3::PbbPacket::TlvPopBack | ( | ) |
Removes a packet TLV from the back of this block.
Definition at line 677 of file packetbb.cc.
References m_tlvList, NS_LOG_FUNCTION, and ns3::PbbTlvBlock::PopBack().
void ns3::PbbPacket::TlvPopFront | ( | ) |
Removes a packet TLV from the front of this packet.
Definition at line 663 of file packetbb.cc.
References m_tlvList, NS_LOG_FUNCTION, and ns3::PbbTlvBlock::PopFront().
Appends a packet TLV to the back of this packet.
tlv | a smart pointer to the packet TLV to append. |
Definition at line 670 of file packetbb.cc.
References m_tlvList, NS_LOG_FUNCTION, and ns3::PbbTlvBlock::PushBack().
Prepends a packet TLV to the front of this packet.
tlv | a smart pointer to the packet TLV to prepend. |
Definition at line 656 of file packetbb.cc.
References m_tlvList, NS_LOG_FUNCTION, and ns3::PbbTlvBlock::PushFront().
int ns3::PbbPacket::TlvSize | ( | ) | const |
Definition at line 614 of file packetbb.cc.
References m_tlvList, NS_LOG_FUNCTION, and ns3::PbbTlvBlock::Size().
|
private |
Force writing a TLV list (even if it's empty)
Definition at line 686 of file packetbb.h.
Referenced by PbbPacket(), ForceTlv(), GetSerializedSize(), and Serialize().
|
private |
Sequence number present.
Definition at line 684 of file packetbb.h.
Referenced by PbbPacket(), HasSequenceNumber(), and SetSequenceNumber().
|
private |
PbbTlvBlock container.
Definition at line 680 of file packetbb.h.
Referenced by MessageBack(), MessageBack(), MessageBegin(), MessageBegin(), MessageClear(), MessageEmpty(), MessageEnd(), MessageEnd(), MessageFront(), MessageFront(), MessagePopBack(), MessagePopFront(), MessagePushBack(), MessagePushFront(), and MessageSize().
|
private |
Sequence number.
Definition at line 685 of file packetbb.h.
Referenced by GetSequenceNumber(), and SetSequenceNumber().
|
private |
PbbTlv container.
Definition at line 679 of file packetbb.h.
Referenced by Deserialize(), Erase(), Erase(), GetSerializedSize(), operator==(), Print(), Serialize(), TlvBack(), TlvBack(), TlvBegin(), TlvBegin(), TlvClear(), TlvEmpty(), TlvEnd(), TlvEnd(), TlvFront(), TlvFront(), TlvPopBack(), TlvPopFront(), TlvPushBack(), TlvPushFront(), and TlvSize().
|
private |
version
Definition at line 682 of file packetbb.h.
Referenced by PbbPacket(), Deserialize(), and GetVersion().