A Discrete-Event Network Simulator
API
ns3::PbbTlv Class Reference

A packet or message TLV. More...

#include "packetbb.h"

+ Inheritance diagram for ns3::PbbTlv:
+ Collaboration diagram for ns3::PbbTlv:

Public Member Functions

 PbbTlv ()
 
virtual ~PbbTlv ()
 
void Deserialize (Buffer::Iterator &start)
 Deserializes a TLV from the specified buffer. More...
 
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. More...
 
bool HasValue () const
 Tests whether or not this TLV has a value. More...
 
bool operator!= (const PbbTlv &other) const
 Inequality operator for PbbTlv. More...
 
bool operator== (const PbbTlv &other) const
 Equality operator for PbbTlv. More...
 
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 ()
 Default constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o[[maybe_unused]])
 Copy constructor. More...
 
uint32_t GetReferenceCount () const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o[[maybe_unused]])
 Assignment operator. More...
 
void Ref () const
 Increment the reference count. More...
 
void Unref () const
 Decrement the reference count. More...
 

Protected Member Functions

uint8_t GetIndexStart () const
 Get the starting point index. More...
 
uint8_t GetIndexStop () const
 Get the stop point index. More...
 
bool HasIndexStart () const
 Checks if there is a starting index. More...
 
bool HasIndexStop () const
 Checks if there is a stop index. More...
 
bool IsMultivalue () const
 Check the multivalue parameter. More...
 
void SetIndexStart (uint8_t index)
 Set an index as starting point. More...
 
void SetIndexStop (uint8_t index)
 Set an index as stop point. More...
 
void SetMultivalue (bool isMultivalue)
 Set the multivalue parameter. More...
 

Private Attributes

bool m_hasIndexStart
 Start index present. More...
 
bool m_hasIndexStop
 Stop index present. More...
 
bool m_hasTypeExt
 Extended type present. More...
 
bool m_hasValue
 Has value. More...
 
uint8_t m_indexStart
 Start index. More...
 
uint8_t m_indexStop
 Stop index. More...
 
bool m_isMultivalue
 Is multivalue. More...
 
uint8_t m_type
 Type of this TLV. More...
 
uint8_t m_typeExt
 Extended type. More...
 
Buffer m_value
 Value. More...
 

Detailed Description

A packet or message TLV.

Definition at line 1656 of file packetbb.h.

Constructor & Destructor Documentation

◆ PbbTlv()

ns3::PbbTlv::PbbTlv ( )

◆ ~PbbTlv()

ns3::PbbTlv::~PbbTlv ( )
virtual

Definition at line 2614 of file packetbb.cc.

References ns3::Buffer::GetSize(), m_value, NS_LOG_FUNCTION, and ns3::Buffer::RemoveAtEnd().

+ Here is the call graph for this function:

Member Function Documentation

◆ Deserialize()

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

Deserializes a TLV from the specified buffer.

Parameters
starta 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 2845 of file packetbb.cc.

References ns3::Buffer::AddAtStart(), ns3::Buffer::Begin(), m_hasValue, m_value, NS_LOG_FUNCTION, SetIndexStart(), SetIndexStop(), SetType(), SetTypeExt(), two-ray-to-three-gpp-ch-calibration::start, THAS_EXT_LEN, THAS_MULTI_INDEX, THAS_SINGLE_INDEX, THAS_TYPE_EXT, THAS_VALUE, and ns3::Buffer::Iterator::Write().

+ Here is the call graph for this function:

◆ GetIndexStart()

uint8_t ns3::PbbTlv::GetIndexStart ( ) const
protected

Get the starting point index.

Returns
the starting index

Definition at line 2666 of file packetbb.cc.

References HasIndexStart(), m_indexStart, NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by ns3::PbbAddressTlv::GetIndexStart(), Print(), and Serialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetIndexStop()

uint8_t ns3::PbbTlv::GetIndexStop ( ) const
protected

Get the stop point index.

Returns
the stop index

Definition at line 2689 of file packetbb.cc.

References HasIndexStop(), m_indexStop, NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by ns3::PbbAddressTlv::GetIndexStop(), Print(), and Serialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSerializedSize()

uint32_t ns3::PbbTlv::GetSerializedSize ( ) const
Returns
The size (in bytes) needed to serialize this TLV.

Definition at line 2750 of file packetbb.cc.

References ns3::Buffer::GetSize(), ns3::GetSize(), GetValue(), HasIndexStart(), HasIndexStop(), HasTypeExt(), HasValue(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ GetType()

uint8_t ns3::PbbTlv::GetType ( ) const
Returns
the type of this TLV.

Definition at line 2628 of file packetbb.cc.

References m_type, and NS_LOG_FUNCTION.

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

+ Here is the caller graph for this function:

◆ GetTypeExt()

uint8_t ns3::PbbTlv::GetTypeExt ( ) const
Returns
the type extension for this TLV.

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

References HasTypeExt(), m_typeExt, NS_ASSERT, and NS_LOG_FUNCTION.

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetValue()

Buffer ns3::PbbTlv::GetValue ( ) const
Returns
a Buffer pointing to the value of this TLV.

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

References HasValue(), m_value, NS_ASSERT, and NS_LOG_FUNCTION.

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasIndexStart()

bool ns3::PbbTlv::HasIndexStart ( ) const
protected

Checks if there is a starting index.

Returns
true if the start index has been set

Definition at line 2674 of file packetbb.cc.

References m_hasIndexStart, and NS_LOG_FUNCTION.

Referenced by GetIndexStart(), GetSerializedSize(), ns3::PbbAddressTlv::HasIndexStart(), Print(), and Serialize().

+ Here is the caller graph for this function:

◆ HasIndexStop()

bool ns3::PbbTlv::HasIndexStop ( ) const
protected

Checks if there is a stop index.

Returns
true if the stop index has been set

Definition at line 2697 of file packetbb.cc.

References m_hasIndexStop, and NS_LOG_FUNCTION.

Referenced by GetIndexStop(), GetSerializedSize(), ns3::PbbAddressTlv::HasIndexStop(), Print(), and Serialize().

+ Here is the caller graph for this function:

◆ HasTypeExt()

bool ns3::PbbTlv::HasTypeExt ( ) const

Tests whether or not this TLV has a type extension.

Returns
true if this TLV has a type extension, false otherwise.

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

Definition at line 2651 of file packetbb.cc.

References m_hasTypeExt, and NS_LOG_FUNCTION.

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

+ Here is the caller graph for this function:

◆ HasValue()

bool ns3::PbbTlv::HasValue ( ) const

Tests whether or not this TLV has a value.

Returns
true if this tlv has a TLV, false otherwise.

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

Definition at line 2743 of file packetbb.cc.

References m_hasValue, and NS_LOG_FUNCTION.

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

+ Here is the caller graph for this function:

◆ IsMultivalue()

bool ns3::PbbTlv::IsMultivalue ( ) const
protected

Check the multivalue parameter.

Returns
the multivalue status

Definition at line 2711 of file packetbb.cc.

References m_isMultivalue, and NS_LOG_FUNCTION.

Referenced by ns3::PbbAddressTlv::IsMultivalue(), Print(), and Serialize().

+ Here is the caller graph for this function:

◆ operator!=()

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

Inequality operator for PbbTlv.

Parameters
otherPbbTlv to compare to this one
Returns
true if PbbTlv are not equal

Definition at line 2980 of file packetbb.cc.

◆ operator==()

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

Equality operator for PbbTlv.

Parameters
otherPbbTlv to compare to this one
Returns
true if PbbTlv are equal

Definition at line 2935 of file packetbb.cc.

References ns3::Buffer::GetSize(), GetType(), GetTypeExt(), GetValue(), HasTypeExt(), HasValue(), and ns3::Buffer::PeekData().

+ Here is the call graph for this function:

◆ Print() [1/2]

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

Pretty-prints the contents of this TLV.

Parameters
osa stream object to print to.

Definition at line 2890 of file packetbb.cc.

References NS_LOG_FUNCTION.

◆ Print() [2/2]

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

Pretty-prints the contents of this TLV, 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 2897 of file packetbb.cc.

References GetIndexStart(), GetIndexStop(), ns3::Buffer::GetSize(), GetType(), GetTypeExt(), GetValue(), HasIndexStart(), HasIndexStop(), HasTypeExt(), HasValue(), IsMultivalue(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ Serialize()

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

Serializes this TLV into the specified buffer.

Parameters
starta 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 2788 of file packetbb.cc.

References GetIndexStart(), GetIndexStop(), ns3::Buffer::GetSize(), GetType(), GetTypeExt(), GetValue(), HasIndexStart(), HasIndexStop(), HasTypeExt(), HasValue(), IsMultivalue(), NS_LOG_FUNCTION, two-ray-to-three-gpp-ch-calibration::start, THAS_EXT_LEN, THAS_MULTI_INDEX, THAS_SINGLE_INDEX, THAS_TYPE_EXT, THAS_VALUE, TIS_MULTIVALUE, and ns3::Buffer::Iterator::WriteU8().

+ Here is the call graph for this function:

◆ SetIndexStart()

void ns3::PbbTlv::SetIndexStart ( uint8_t  index)
protected

Set an index as starting point.

Parameters
indexthe starting index

Definition at line 2658 of file packetbb.cc.

References m_hasIndexStart, m_indexStart, and NS_LOG_FUNCTION.

Referenced by Deserialize(), and ns3::PbbAddressTlv::SetIndexStart().

+ Here is the caller graph for this function:

◆ SetIndexStop()

void ns3::PbbTlv::SetIndexStop ( uint8_t  index)
protected

Set an index as stop point.

Parameters
indexthe stop index

Definition at line 2681 of file packetbb.cc.

References m_hasIndexStop, m_indexStop, and NS_LOG_FUNCTION.

Referenced by Deserialize(), and ns3::PbbAddressTlv::SetIndexStop().

+ Here is the caller graph for this function:

◆ SetMultivalue()

void ns3::PbbTlv::SetMultivalue ( bool  isMultivalue)
protected

Set the multivalue parameter.

Parameters
isMultivaluethe multivalue status

Definition at line 2704 of file packetbb.cc.

References m_isMultivalue, and NS_LOG_FUNCTION.

Referenced by ns3::PbbAddressTlv::SetMultivalue().

+ Here is the caller graph for this function:

◆ SetType()

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

Sets the type of this TLV.

Parameters
typethe type value to set.

Definition at line 2621 of file packetbb.cc.

References m_type, NS_LOG_FUNCTION, and check-style-clang-format::type.

Referenced by Deserialize().

+ Here is the caller graph for this function:

◆ SetTypeExt()

void ns3::PbbTlv::SetTypeExt ( uint8_t  type)

Sets the type extension of this TLV.

Parameters
typethe 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 2635 of file packetbb.cc.

References m_hasTypeExt, m_typeExt, and NS_LOG_FUNCTION.

Referenced by Deserialize().

+ Here is the caller graph for this function:

◆ SetValue() [1/2]

void ns3::PbbTlv::SetValue ( Buffer  start)

Sets the value of this message to the specified buffer.

Parameters
starta 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 2718 of file packetbb.cc.

References m_hasValue, m_value, NS_LOG_FUNCTION, and two-ray-to-three-gpp-ch-calibration::start.

◆ SetValue() [2/2]

void ns3::PbbTlv::SetValue ( const uint8_t *  buffer,
uint32_t  size 
)

Sets the value of this message to a buffer with the specified data.

Parameters
buffera pointer to data to put in the TLVs buffer.
sizethe 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 2726 of file packetbb.cc.

References ns3::Buffer::AddAtStart(), ns3::Buffer::Begin(), m_hasValue, m_value, NS_LOG_FUNCTION, and ns3::Buffer::Iterator::Write().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_hasIndexStart

bool ns3::PbbTlv::m_hasIndexStart
private

Start index present.

Definition at line 1838 of file packetbb.h.

Referenced by PbbTlv(), HasIndexStart(), and SetIndexStart().

◆ m_hasIndexStop

bool ns3::PbbTlv::m_hasIndexStop
private

Stop index present.

Definition at line 1841 of file packetbb.h.

Referenced by PbbTlv(), HasIndexStop(), and SetIndexStop().

◆ m_hasTypeExt

bool ns3::PbbTlv::m_hasTypeExt
private

Extended type present.

Definition at line 1835 of file packetbb.h.

Referenced by PbbTlv(), HasTypeExt(), and SetTypeExt().

◆ m_hasValue

bool ns3::PbbTlv::m_hasValue
private

Has value.

Definition at line 1845 of file packetbb.h.

Referenced by PbbTlv(), Deserialize(), HasValue(), and SetValue().

◆ m_indexStart

uint8_t ns3::PbbTlv::m_indexStart
private

Start index.

Definition at line 1839 of file packetbb.h.

Referenced by GetIndexStart(), and SetIndexStart().

◆ m_indexStop

uint8_t ns3::PbbTlv::m_indexStop
private

Stop index.

Definition at line 1842 of file packetbb.h.

Referenced by GetIndexStop(), and SetIndexStop().

◆ m_isMultivalue

bool ns3::PbbTlv::m_isMultivalue
private

Is multivalue.

Definition at line 1844 of file packetbb.h.

Referenced by PbbTlv(), IsMultivalue(), and SetMultivalue().

◆ m_type

uint8_t ns3::PbbTlv::m_type
private

Type of this TLV.

Definition at line 1833 of file packetbb.h.

Referenced by GetType(), and SetType().

◆ m_typeExt

uint8_t ns3::PbbTlv::m_typeExt
private

Extended type.

Definition at line 1836 of file packetbb.h.

Referenced by GetTypeExt(), and SetTypeExt().

◆ m_value

Buffer ns3::PbbTlv::m_value
private

Value.

Definition at line 1846 of file packetbb.h.

Referenced by ~PbbTlv(), Deserialize(), GetValue(), and SetValue().


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