A packet or message TLV. More...
#include <packetbb.h>
Public Member Functions | |
void | Deserialize (Buffer::Iterator &start) |
Deserializes a TLV from the specified buffer. More... | |
uint32_t | GetSerializedSize (void) const |
uint8_t | GetType (void) const |
uint8_t | GetTypeExt (void) const |
Buffer | GetValue (void) const |
bool | HasTypeExt (void) const |
Tests whether or not this TLV has a type extension. More... | |
bool | HasValue (void) const |
Tests whether or not this TLV has a value. More... | |
bool | operator!= (const PbbTlv &other) const |
bool | operator== (const PbbTlv &other) const |
void | Print (std::ostream &os) const |
Pretty-prints the contents of this TLV. More... | |
void | Print (std::ostream &os, int level) const |
Pretty-prints the contents of this TLV, with specified indentation. More... | |
void | Serialize (Buffer::Iterator &start) const |
Serializes this TLV into the specified buffer. More... | |
void | SetType (uint8_t type) |
Sets the type of this TLV. More... | |
void | SetTypeExt (uint8_t type) |
Sets the type extension of this TLV. More... | |
void | SetValue (Buffer start) |
Sets the value of this message to the specified buffer. More... | |
void | SetValue (const uint8_t *buffer, uint32_t size) |
Sets the value of this message to a buffer with the specified data. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< PbbTlv > | |
SimpleRefCount (const SimpleRefCount &o) | |
uint32_t | GetReferenceCount (void) const |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
void | Ref (void) const |
void | Unref (void) const |
Private Attributes | |
bool | m_hasIndexStart |
bool | m_hasIndexStop |
bool | m_hasTypeExt |
bool | m_hasValue |
uint8_t | m_indexStart |
uint8_t | m_indexStop |
bool | m_isMultivalue |
uint8_t | m_type |
uint8_t | m_typeExt |
Buffer | m_value |
Additional Inherited Members | |
Static Public Member Functions inherited from ns3::SimpleRefCount< PbbTlv > | |
static void | Cleanup (void) |
A packet or message TLV.
Definition at line 1505 of file packetbb.h.
void ns3::PbbTlv::Deserialize | ( | Buffer::Iterator & | start | ) |
Deserializes a TLV from the specified buffer.
start | a reference to the point in a buffer to begin deserializing. |
Users should not need to call this. TLVs will be deserialized by their containing blocks.
Definition at line 2888 of file packetbb.cc.
References ns3::Buffer::AddAtStart(), ns3::Buffer::Begin(), ns3::Buffer::Iterator::Next(), NS_LOG_FUNCTION, ns3::Buffer::Iterator::ReadNtohU16(), ns3::Buffer::Iterator::ReadU8(), SetType(), SetTypeExt(), and ns3::Buffer::Iterator::Write().
uint32_t ns3::PbbTlv::GetSerializedSize | ( | void | ) | const |
Definition at line 2793 of file packetbb.cc.
References ns3::Buffer::GetSize(), GetValue(), HasTypeExt(), HasValue(), and NS_LOG_FUNCTION.
uint8_t ns3::PbbTlv::GetType | ( | void | ) | const |
Definition at line 2671 of file packetbb.cc.
References NS_LOG_FUNCTION.
Referenced by Print(), and Serialize().
uint8_t ns3::PbbTlv::GetTypeExt | ( | void | ) | const |
Calling this while HasTypeExt is False is undefined. Make sure you check it first. This will be checked by an assert in debug builds.
Definition at line 2686 of file packetbb.cc.
References HasTypeExt(), NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by Print(), and Serialize().
Buffer ns3::PbbTlv::GetValue | ( | void | ) | const |
Calling this while HasValue is False is undefined. Make sure you check it first. This will be checked by an assert in debug builds.
Definition at line 2778 of file packetbb.cc.
References HasValue(), NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by GetSerializedSize(), Print(), and Serialize().
bool ns3::PbbTlv::HasTypeExt | ( | void | ) | const |
Tests whether or not this TLV has a type extension.
This should be called before calling GetTypeExt to make sure there actually is one.
Definition at line 2694 of file packetbb.cc.
References NS_LOG_FUNCTION.
Referenced by GetSerializedSize(), GetTypeExt(), Print(), and Serialize().
bool ns3::PbbTlv::HasValue | ( | void | ) | const |
Tests whether or not this TLV has a value.
This should be called before calling GetTypeExt to make sure there actually is one.
Definition at line 2786 of file packetbb.cc.
References NS_LOG_FUNCTION.
Referenced by GetSerializedSize(), GetValue(), Print(), and Serialize().
void ns3::PbbTlv::Print | ( | std::ostream & | os | ) | const |
Pretty-prints the contents of this TLV.
os | a stream object to print to. |
Definition at line 2933 of file packetbb.cc.
References NS_LOG_FUNCTION.
void ns3::PbbTlv::Print | ( | std::ostream & | os, |
int | level | ||
) | const |
Pretty-prints the contents of this TLV, with specified indentation.
os | a stream object to print to. |
level | level of indentation. |
This probably never needs to be called by users. This is used when recursively printing sub-objects.
Definition at line 2940 of file packetbb.cc.
References ns3::Buffer::GetSize(), GetType(), GetTypeExt(), GetValue(), HasTypeExt(), HasValue(), and NS_LOG_FUNCTION.
void ns3::PbbTlv::Serialize | ( | Buffer::Iterator & | start | ) | const |
Serializes this TLV into the specified buffer.
start | a reference to the point in a buffer to begin serializing. |
Users should not need to call this. TLVs will be serialized by their containing blocks.
Definition at line 2831 of file packetbb.cc.
References ns3::Buffer::GetSize(), GetType(), GetTypeExt(), GetValue(), HasTypeExt(), HasValue(), ns3::Buffer::Iterator::Next(), NS_LOG_FUNCTION, ns3::Buffer::Iterator::Write(), ns3::Buffer::Iterator::WriteHtonU16(), and ns3::Buffer::Iterator::WriteU8().
void ns3::PbbTlv::SetType | ( | uint8_t | type | ) |
Sets the type of this TLV.
type | the type value to set. |
Definition at line 2664 of file packetbb.cc.
References NS_LOG_FUNCTION.
Referenced by Deserialize().
void ns3::PbbTlv::SetTypeExt | ( | uint8_t | type | ) |
Sets the type extension of this TLV.
type | the type extension value to set. |
The type extension is like a sub-type used to further distinguish between TLVs of the same type.
Definition at line 2678 of file packetbb.cc.
References NS_LOG_FUNCTION.
Referenced by Deserialize().
void ns3::PbbTlv::SetValue | ( | Buffer | start | ) |
Sets the value of this message to the specified buffer.
start | a buffer instance. |
The buffer is not copied until this TLV is serialized. You should not change the contents of the buffer you pass in to this function.
Definition at line 2761 of file packetbb.cc.
References NS_LOG_FUNCTION.
void ns3::PbbTlv::SetValue | ( | const uint8_t * | buffer, |
uint32_t | size | ||
) |
Sets the value of this message to a buffer with the specified data.
buffer | a pointer to data to put in the TLVs buffer. |
size | the size of the buffer. |
The buffer is copied into a new buffer instance. You can free the data in the buffer provided anytime you wish.
Definition at line 2769 of file packetbb.cc.
References ns3::Buffer::AddAtStart(), ns3::Buffer::Begin(), NS_LOG_FUNCTION, and ns3::Buffer::Iterator::Write().