A packet or message TLV. More...
#include "packetbb.h"
Public Member Functions | |
PbbTlv () | |
virtual | ~PbbTlv () |
void | Deserialize (Buffer::Iterator &start) |
Deserializes a TLV from the specified buffer. | |
uint32_t | GetSerializedSize () const |
uint8_t | GetType () const |
uint8_t | GetTypeExt () const |
Buffer | GetValue () const |
bool | HasTypeExt () const |
Tests whether or not this TLV has a type extension. | |
bool | HasValue () const |
Tests whether or not this TLV has a value. | |
bool | operator!= (const PbbTlv &other) const |
Inequality operator for PbbTlv. | |
bool | operator== (const PbbTlv &other) const |
Equality operator for PbbTlv. | |
void | Print (std::ostream &os) const |
Pretty-prints the contents of this TLV. | |
void | Print (std::ostream &os, int level) const |
Pretty-prints the contents of this TLV, with specified indentation. | |
void | Serialize (Buffer::Iterator &start) const |
Serializes this TLV into the specified buffer. | |
void | SetType (uint8_t type) |
Sets the type of this TLV. | |
void | SetTypeExt (uint8_t type) |
Sets the type extension of this TLV. | |
void | SetValue (Buffer start) |
Sets the value of this message to the specified buffer. | |
void | SetValue (const uint8_t *buffer, uint32_t size) |
Sets the value of this message to a buffer with the specified data. | |
Public Member Functions inherited from ns3::SimpleRefCount< PbbTlv > | |
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. | |
Protected Member Functions | |
uint8_t | GetIndexStart () const |
Get the starting point index. | |
uint8_t | GetIndexStop () const |
Get the stop point index. | |
bool | HasIndexStart () const |
Checks if there is a starting index. | |
bool | HasIndexStop () const |
Checks if there is a stop index. | |
bool | IsMultivalue () const |
Check the multivalue parameter. | |
void | SetIndexStart (uint8_t index) |
Set an index as starting point. | |
void | SetIndexStop (uint8_t index) |
Set an index as stop point. | |
void | SetMultivalue (bool isMultivalue) |
Set the multivalue parameter. | |
Private Attributes | |
bool | m_hasIndexStart |
Start index present. | |
bool | m_hasIndexStop |
Stop index present. | |
bool | m_hasTypeExt |
Extended type present. | |
bool | m_hasValue |
Has value. | |
uint8_t | m_indexStart |
Start index. | |
uint8_t | m_indexStop |
Stop index. | |
bool | m_isMultivalue |
Is multivalue. | |
uint8_t | m_type |
Type of this TLV. | |
uint8_t | m_typeExt |
Extended type. | |
Buffer | m_value |
Value. | |
A packet or message TLV.
Definition at line 1657 of file packetbb.h.
ns3::PbbTlv::PbbTlv | ( | ) |
Definition at line 2601 of file packetbb.cc.
References m_hasIndexStart, m_hasIndexStop, m_hasTypeExt, m_hasValue, m_isMultivalue, and NS_LOG_FUNCTION.
|
virtual |
Definition at line 2611 of file packetbb.cc.
References ns3::Buffer::GetSize(), m_value, NS_LOG_FUNCTION, and ns3::Buffer::RemoveAtEnd().
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 2842 of file packetbb.cc.
References ns3::Buffer::AddAtStart(), ns3::Buffer::Begin(), m_hasValue, m_value, ns3::Buffer::Iterator::Next(), NS_LOG_FUNCTION, SetIndexStart(), SetIndexStop(), SetType(), SetTypeExt(), THAS_EXT_LEN, THAS_MULTI_INDEX, THAS_SINGLE_INDEX, THAS_TYPE_EXT, THAS_VALUE, and ns3::Buffer::Iterator::Write().
|
protected |
Get the starting point index.
Definition at line 2663 of file packetbb.cc.
References HasIndexStart(), m_indexStart, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ns3::PbbAddressTlv::GetIndexStart(), Print(), and Serialize().
|
protected |
Get the stop point index.
Definition at line 2686 of file packetbb.cc.
References HasIndexStop(), m_indexStop, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ns3::PbbAddressTlv::GetIndexStop(), Print(), and Serialize().
uint32_t ns3::PbbTlv::GetSerializedSize | ( | ) | const |
Definition at line 2747 of file packetbb.cc.
References ns3::Buffer::GetSize(), ns3::GetSize(), GetValue(), HasIndexStart(), HasIndexStop(), HasTypeExt(), HasValue(), and NS_LOG_FUNCTION.
uint8_t ns3::PbbTlv::GetType | ( | ) | const |
Definition at line 2625 of file packetbb.cc.
References m_type, and NS_LOG_FUNCTION.
Referenced by operator==(), Print(), and Serialize().
uint8_t ns3::PbbTlv::GetTypeExt | ( | ) | 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 2640 of file packetbb.cc.
References HasTypeExt(), m_typeExt, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by operator==(), Print(), and Serialize().
Buffer ns3::PbbTlv::GetValue | ( | ) | 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 2732 of file packetbb.cc.
References HasValue(), m_value, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by GetSerializedSize(), operator==(), Print(), and Serialize().
|
protected |
Checks if there is a starting index.
Definition at line 2671 of file packetbb.cc.
References m_hasIndexStart, and NS_LOG_FUNCTION.
Referenced by GetIndexStart(), GetSerializedSize(), ns3::PbbAddressTlv::HasIndexStart(), Print(), and Serialize().
|
protected |
Checks if there is a stop index.
Definition at line 2694 of file packetbb.cc.
References m_hasIndexStop, and NS_LOG_FUNCTION.
Referenced by GetIndexStop(), GetSerializedSize(), ns3::PbbAddressTlv::HasIndexStop(), Print(), and Serialize().
bool ns3::PbbTlv::HasTypeExt | ( | ) | 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 2648 of file packetbb.cc.
References m_hasTypeExt, and NS_LOG_FUNCTION.
Referenced by GetSerializedSize(), GetTypeExt(), operator==(), Print(), and Serialize().
bool ns3::PbbTlv::HasValue | ( | ) | 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 2740 of file packetbb.cc.
References m_hasValue, and NS_LOG_FUNCTION.
Referenced by GetSerializedSize(), GetValue(), operator==(), Print(), and Serialize().
|
protected |
Check the multivalue parameter.
Definition at line 2708 of file packetbb.cc.
References m_isMultivalue, and NS_LOG_FUNCTION.
Referenced by ns3::PbbAddressTlv::IsMultivalue(), Print(), and Serialize().
bool ns3::PbbTlv::operator!= | ( | const PbbTlv & | other | ) | const |
Inequality operator for PbbTlv.
other | PbbTlv to compare to this one |
Definition at line 2977 of file packetbb.cc.
bool ns3::PbbTlv::operator== | ( | const PbbTlv & | other | ) | const |
Equality operator for PbbTlv.
other | PbbTlv to compare to this one |
Definition at line 2932 of file packetbb.cc.
References ns3::Buffer::GetSize(), GetType(), GetTypeExt(), GetValue(), HasTypeExt(), HasValue(), and ns3::Buffer::PeekData().
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 2887 of file packetbb.cc.
References NS_LOG_FUNCTION, and Print().
Referenced by Print().
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 2894 of file packetbb.cc.
References GetIndexStart(), GetIndexStop(), ns3::Buffer::GetSize(), GetType(), GetTypeExt(), GetValue(), HasIndexStart(), HasIndexStop(), HasTypeExt(), HasValue(), IsMultivalue(), 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 2785 of file packetbb.cc.
References GetIndexStart(), GetIndexStop(), ns3::Buffer::GetSize(), GetType(), GetTypeExt(), GetValue(), HasIndexStart(), HasIndexStop(), HasTypeExt(), HasValue(), IsMultivalue(), ns3::Buffer::Iterator::Next(), NS_LOG_FUNCTION, THAS_EXT_LEN, THAS_MULTI_INDEX, THAS_SINGLE_INDEX, THAS_TYPE_EXT, THAS_VALUE, TIS_MULTIVALUE, and ns3::Buffer::Iterator::WriteU8().
|
protected |
Set an index as starting point.
index | the starting index |
Definition at line 2655 of file packetbb.cc.
References m_hasIndexStart, m_indexStart, and NS_LOG_FUNCTION.
Referenced by Deserialize(), and ns3::PbbAddressTlv::SetIndexStart().
|
protected |
Set an index as stop point.
index | the stop index |
Definition at line 2678 of file packetbb.cc.
References m_hasIndexStop, m_indexStop, and NS_LOG_FUNCTION.
Referenced by Deserialize(), and ns3::PbbAddressTlv::SetIndexStop().
|
protected |
Set the multivalue parameter.
isMultivalue | the multivalue status |
Definition at line 2701 of file packetbb.cc.
References m_isMultivalue, and NS_LOG_FUNCTION.
Referenced by ns3::PbbAddressTlv::SetMultivalue().
void ns3::PbbTlv::SetType | ( | uint8_t | type | ) |
Sets the type of this TLV.
type | the type value to set. |
Definition at line 2618 of file packetbb.cc.
References m_type, and 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 2632 of file packetbb.cc.
References m_hasTypeExt, m_typeExt, and 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 2715 of file packetbb.cc.
References m_hasValue, m_value, and 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 2723 of file packetbb.cc.
References ns3::Buffer::AddAtStart(), ns3::Buffer::Begin(), m_hasValue, m_value, NS_LOG_FUNCTION, and ns3::Buffer::Iterator::Write().
|
private |
Start index present.
Definition at line 1839 of file packetbb.h.
Referenced by PbbTlv(), HasIndexStart(), and SetIndexStart().
|
private |
Stop index present.
Definition at line 1842 of file packetbb.h.
Referenced by PbbTlv(), HasIndexStop(), and SetIndexStop().
|
private |
Extended type present.
Definition at line 1836 of file packetbb.h.
Referenced by PbbTlv(), HasTypeExt(), and SetTypeExt().
|
private |
Has value.
Definition at line 1846 of file packetbb.h.
Referenced by PbbTlv(), Deserialize(), HasValue(), SetValue(), and SetValue().
|
private |
Start index.
Definition at line 1840 of file packetbb.h.
Referenced by GetIndexStart(), and SetIndexStart().
|
private |
Stop index.
Definition at line 1843 of file packetbb.h.
Referenced by GetIndexStop(), and SetIndexStop().
|
private |
Is multivalue.
Definition at line 1845 of file packetbb.h.
Referenced by PbbTlv(), IsMultivalue(), and SetMultivalue().
|
private |
Type of this TLV.
Definition at line 1834 of file packetbb.h.
|
private |
Extended type.
Definition at line 1837 of file packetbb.h.
Referenced by GetTypeExt(), and SetTypeExt().
|
private |
Value.
Definition at line 1847 of file packetbb.h.
Referenced by ~PbbTlv(), Deserialize(), GetValue(), SetValue(), and SetValue().