A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 (void)
virtual ~PbbTlv (void)
void Deserialize (Buffer::Iterator &start)
 Deserializes a TLV from the specified buffer.
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.
bool HasValue (void) const
 Tests whether or not this TLV has a value.
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.
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 ()
 SimpleRefCount (const SimpleRefCount &o)
uint32_t GetReferenceCount (void) const
SimpleRefCountoperator= (const SimpleRefCount &o)
void Ref (void) const
void Unref (void) const

Protected Member Functions

uint8_t GetIndexStart (void) const
uint8_t GetIndexStop (void) const
bool HasIndexStart (void) const
bool HasIndexStop (void) const
bool IsMultivalue (void) const
void SetIndexStart (uint8_t index)
void SetIndexStop (uint8_t index)
void SetMultivalue (bool isMultivalue)

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)

Detailed Description

A packet or message TLV.

Definition at line 1505 of file packetbb.h.

Constructor & Destructor Documentation

ns3::PbbTlv::PbbTlv ( void  )

Definition at line 2413 of file packetbb.cc.

References m_hasIndexStart, m_hasIndexStop, m_hasTypeExt, m_hasValue, and m_isMultivalue.

ns3::PbbTlv::~PbbTlv ( void  )
virtual

Definition at line 2422 of file packetbb.cc.

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

+ Here is the call graph for this function:

Member Function Documentation

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

References ns3::Buffer::AddAtStart(), ns3::Buffer::Begin(), m_hasValue, m_value, ns3::Buffer::Iterator::Next(), ns3::Buffer::Iterator::ReadNtohU16(), ns3::Buffer::Iterator::ReadU8(), SetIndexStart(), SetIndexStop(), SetType(), SetTypeExt(), visualizer.core::start(), THAS_EXT_LEN, THAS_MULTI_INDEX, THAS_SINGLE_INDEX, THAS_TYPE_EXT, THAS_VALUE, and ns3::Buffer::Iterator::Write().

Referenced by ns3::PbbTlvBlock::Deserialize(), and ns3::PbbAddressTlvBlock::Deserialize().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Reimplemented in ns3::PbbAddressTlv.

Definition at line 2467 of file packetbb.cc.

References HasIndexStart(), m_indexStart, and NS_ASSERT.

Referenced by Print(), and Serialize().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Reimplemented in ns3::PbbAddressTlv.

Definition at line 2487 of file packetbb.cc.

References HasIndexStop(), m_indexStop, and NS_ASSERT.

Referenced by Print(), and Serialize().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 2540 of file packetbb.cc.

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

+ Here is the call graph for this function:

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

Definition at line 2434 of file packetbb.cc.

References m_type.

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

+ Here is the caller graph for this function:

uint8_t ns3::PbbTlv::GetTypeExt ( void  ) 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 2447 of file packetbb.cc.

References HasTypeExt(), m_typeExt, 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:

Buffer ns3::PbbTlv::GetValue ( void  ) 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 2527 of file packetbb.cc.

References HasValue(), m_value, and NS_ASSERT.

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Reimplemented in ns3::PbbAddressTlv.

Definition at line 2474 of file packetbb.cc.

References m_hasIndexStart.

Referenced by GetIndexStart(), GetSerializedSize(), Print(), and Serialize().

+ Here is the caller graph for this function:

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

Reimplemented in ns3::PbbAddressTlv.

Definition at line 2494 of file packetbb.cc.

References m_hasIndexStop.

Referenced by GetIndexStop(), GetSerializedSize(), Print(), and Serialize().

+ Here is the caller graph for this function:

bool ns3::PbbTlv::HasTypeExt ( void  ) 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 2454 of file packetbb.cc.

References m_hasTypeExt.

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

+ Here is the caller graph for this function:

bool ns3::PbbTlv::HasValue ( void  ) 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 2534 of file packetbb.cc.

References m_hasValue.

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

+ Here is the caller graph for this function:

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

Reimplemented in ns3::PbbAddressTlv.

Definition at line 2506 of file packetbb.cc.

References m_isMultivalue.

Referenced by Print(), and Serialize().

+ Here is the caller graph for this function:

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

Definition at line 2765 of file packetbb.cc.

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

Definition at line 2720 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:

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

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

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

+ Here is the call graph for this function:

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

References GetIndexStart(), GetIndexStop(), ns3::Buffer::GetSize(), GetType(), GetTypeExt(), GetValue(), HasIndexStart(), HasIndexStop(), HasTypeExt(), HasValue(), IsMultivalue(), ns3::Buffer::Iterator::Next(), visualizer.core::start(), THAS_EXT_LEN, THAS_MULTI_INDEX, THAS_SINGLE_INDEX, THAS_TYPE_EXT, THAS_VALUE, TIS_MULTIVALUE, ns3::Buffer::Iterator::Write(), ns3::Buffer::Iterator::WriteHtonU16(), and ns3::Buffer::Iterator::WriteU8().

+ Here is the call graph for this function:

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

Reimplemented in ns3::PbbAddressTlv.

Definition at line 2460 of file packetbb.cc.

References m_hasIndexStart, and m_indexStart.

Referenced by Deserialize().

+ Here is the caller graph for this function:

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

Reimplemented in ns3::PbbAddressTlv.

Definition at line 2480 of file packetbb.cc.

References m_hasIndexStop, and m_indexStop.

Referenced by Deserialize().

+ Here is the caller graph for this function:

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

Reimplemented in ns3::PbbAddressTlv.

Definition at line 2500 of file packetbb.cc.

References m_isMultivalue.

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

Sets the type of this TLV.

Parameters
typethe type value to set.

Definition at line 2428 of file packetbb.cc.

References m_type.

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

+ Here is the caller graph for this function:

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

References m_hasTypeExt, and m_typeExt.

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

+ Here is the caller graph for this function:

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

References m_hasValue, m_value, and visualizer.core::start().

Referenced by PbbTestSuite::PbbTestSuite().

+ Here is the call graph for this function:

+ Here is the caller graph for this 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.

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

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

+ Here is the call graph for this function:

Member Data Documentation

bool ns3::PbbTlv::m_hasIndexStart
private

Definition at line 1644 of file packetbb.h.

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

bool ns3::PbbTlv::m_hasIndexStop
private

Definition at line 1647 of file packetbb.h.

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

bool ns3::PbbTlv::m_hasTypeExt
private

Definition at line 1641 of file packetbb.h.

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

bool ns3::PbbTlv::m_hasValue
private

Definition at line 1651 of file packetbb.h.

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

uint8_t ns3::PbbTlv::m_indexStart
private

Definition at line 1645 of file packetbb.h.

Referenced by GetIndexStart(), and SetIndexStart().

uint8_t ns3::PbbTlv::m_indexStop
private

Definition at line 1648 of file packetbb.h.

Referenced by GetIndexStop(), and SetIndexStop().

bool ns3::PbbTlv::m_isMultivalue
private

Definition at line 1650 of file packetbb.h.

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

uint8_t ns3::PbbTlv::m_type
private

Definition at line 1639 of file packetbb.h.

Referenced by GetType(), and SetType().

uint8_t ns3::PbbTlv::m_typeExt
private

Definition at line 1642 of file packetbb.h.

Referenced by GetTypeExt(), and SetTypeExt().

Buffer ns3::PbbTlv::m_value
private

Definition at line 1652 of file packetbb.h.

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


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