A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::olsr::MessageHeader Class Reference

#include <olsr-header.h>

+ Inheritance diagram for ns3::olsr::MessageHeader:
+ Collaboration diagram for ns3::olsr::MessageHeader:

Classes

struct  Hello
struct  Hna
struct  Mid
struct  Tc

Public Types

enum  MessageType { HELLO_MESSAGE = 1, TC_MESSAGE = 2, MID_MESSAGE = 3, HNA_MESSAGE = 4 }

Public Member Functions

 MessageHeader ()
virtual ~MessageHeader ()
virtual uint32_t Deserialize (Buffer::Iterator start)
HelloGetHello ()
const HelloGetHello () const
HnaGetHna ()
const HnaGetHna () const
uint8_t GetHopCount () const
virtual TypeId GetInstanceTypeId (void) const
uint16_t GetMessageSequenceNumber () const
MessageType GetMessageType () const
MidGetMid ()
const MidGetMid () const
Ipv4Address GetOriginatorAddress () const
virtual uint32_t GetSerializedSize (void) const
TcGetTc ()
const TcGetTc () const
uint8_t GetTimeToLive () const
Time GetVTime () const
virtual void Print (std::ostream &os) const
virtual void Serialize (Buffer::Iterator start) const
void SetHopCount (uint8_t hopCount)
void SetMessageSequenceNumber (uint16_t messageSequenceNumber)
void SetMessageType (MessageType messageType)
void SetOriginatorAddress (Ipv4Address originatorAddress)
void SetTimeToLive (uint8_t timeToLive)
void SetVTime (Time time)
- Public Member Functions inherited from ns3::Header
virtual ~Header ()

Static Public Member Functions

static TypeId GetTypeId (void)
 This method returns the TypeId associated to ns3::olsr::MessageHeader.

Private Attributes

uint8_t m_hopCount
struct {
   Hello   hello
   Hna   hna
   Mid   mid
   Tc   tc
m_message
uint16_t m_messageSequenceNumber
uint16_t m_messageSize
MessageType m_messageType
Ipv4Address m_originatorAddress
uint8_t m_timeToLive
uint8_t m_vTime

Additional Inherited Members

- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
virtual void NotifyConstructionCompleted (void)

Detailed Description

Definition at line 116 of file olsr-header.h.

Member Enumeration Documentation

Enumerator:
HELLO_MESSAGE 
TC_MESSAGE 
MID_MESSAGE 
HNA_MESSAGE 

Definition at line 120 of file olsr-header.h.

Constructor & Destructor Documentation

ns3::olsr::MessageHeader::MessageHeader ( )

Definition at line 156 of file olsr-header.cc.

ns3::olsr::MessageHeader::~MessageHeader ( )
virtual

Definition at line 161 of file olsr-header.cc.

Member Function Documentation

uint32_t ns3::olsr::MessageHeader::Deserialize ( Buffer::Iterator  start)
virtual
Parameters
startan iterator which points to where the header should written.
Returns
the number of bytes read.

This method is used by Packet::RemoveHeader to re-create a header from the byte buffer of a packet. The data read is expected to match bit-for-bit the representation of this header in real networks.

Implements ns3::Header.

Definition at line 244 of file olsr-header.cc.

References HELLO_MESSAGE, HNA_MESSAGE, m_hopCount, m_message, m_messageSequenceNumber, m_messageSize, m_messageType, m_originatorAddress, m_timeToLive, m_vTime, MID_MESSAGE, NS_ASSERT, OLSR_MSG_HEADER_SIZE, ns3::Buffer::Iterator::ReadNtohU16(), ns3::Buffer::Iterator::ReadNtohU32(), ns3::Buffer::Iterator::ReadU8(), visualizer.core::start(), and TC_MESSAGE.

+ Here is the call graph for this function:

Hello& ns3::olsr::MessageHeader::GetHello ( )
inline

Definition at line 370 of file olsr-header.h.

References HELLO_MESSAGE, m_message, m_messageType, and NS_ASSERT.

Referenced by ns3::OlsrHelloTestCase::DoRun(), ns3::olsr::RoutingProtocol::ProcessHello(), and ns3::olsr::RoutingProtocol::SendHello().

+ Here is the caller graph for this function:

const Hello& ns3::olsr::MessageHeader::GetHello ( ) const
inline

Definition at line 416 of file olsr-header.h.

References HELLO_MESSAGE, m_message, m_messageType, and NS_ASSERT.

Hna& ns3::olsr::MessageHeader::GetHna ( )
inline

Definition at line 396 of file olsr-header.h.

References HNA_MESSAGE, m_message, m_messageType, and NS_ASSERT.

Referenced by ns3::OlsrHnaTestCase::DoRun(), ns3::olsr::RoutingProtocol::ProcessHna(), and ns3::olsr::RoutingProtocol::SendHna().

+ Here is the caller graph for this function:

const Hna& ns3::olsr::MessageHeader::GetHna ( ) const
inline

Definition at line 428 of file olsr-header.h.

References HNA_MESSAGE, m_message, m_messageType, and NS_ASSERT.

uint8_t ns3::olsr::MessageHeader::GetHopCount ( void  ) const
inline

Definition at line 170 of file olsr-header.h.

References m_hopCount.

Referenced by ns3::olsr::RoutingProtocol::ForwardDefault().

+ Here is the caller graph for this function:

TypeId ns3::olsr::MessageHeader::GetInstanceTypeId ( void  ) const
virtual
Returns
the TypeId associated to the most-derived type of this instance.

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 175 of file olsr-header.cc.

References GetTypeId().

+ Here is the call graph for this function:

uint16_t ns3::olsr::MessageHeader::GetMessageSequenceNumber ( ) const
inline

Definition at line 179 of file olsr-header.h.

References m_messageSequenceNumber.

Referenced by ns3::OlsrMidTestCase::DoRun(), ns3::olsr::RoutingProtocol::ForwardDefault(), and ns3::olsr::RoutingProtocol::RecvOlsr().

+ Here is the caller graph for this function:

MessageType ns3::olsr::MessageHeader::GetMessageType ( void  ) const
inline

Definition at line 134 of file olsr-header.h.

References m_messageType.

Referenced by ns3::OlsrMidTestCase::DoRun(), and ns3::olsr::RoutingProtocol::RecvOlsr().

+ Here is the caller graph for this function:

Mid& ns3::olsr::MessageHeader::GetMid ( )
inline

Definition at line 357 of file olsr-header.h.

References m_message, m_messageType, MID_MESSAGE, and NS_ASSERT.

Referenced by ns3::OlsrMidTestCase::DoRun(), ns3::olsr::RoutingProtocol::ProcessMid(), and ns3::olsr::RoutingProtocol::SendMid().

+ Here is the caller graph for this function:

const Mid& ns3::olsr::MessageHeader::GetMid ( ) const
inline

Definition at line 410 of file olsr-header.h.

References m_message, m_messageType, MID_MESSAGE, and NS_ASSERT.

uint32_t ns3::olsr::MessageHeader::GetSerializedSize ( void  ) const
virtual
Returns
the expected size of the header.

This method is used by Packet::AddHeader to store a header into the byte buffer of a packet. This method should return the number of bytes which are needed to store the full header data by Serialize.

Implements ns3::Header.

Definition at line 181 of file olsr-header.cc.

References HELLO_MESSAGE, HNA_MESSAGE, m_message, m_messageType, MID_MESSAGE, NS_ASSERT, NS_LOG_DEBUG, OLSR_MSG_HEADER_SIZE, and TC_MESSAGE.

Referenced by ns3::olsr::MessageHeader::Mid::Deserialize(), ns3::OlsrMidTestCase::DoRun(), ns3::olsr::RoutingProtocol::RecvOlsr(), ns3::olsr::RoutingProtocol::SendHello(), and Serialize().

+ Here is the caller graph for this function:

Tc& ns3::olsr::MessageHeader::GetTc ( )
inline

Definition at line 383 of file olsr-header.h.

References m_message, m_messageType, NS_ASSERT, and TC_MESSAGE.

Referenced by ns3::OlsrTcTestCase::DoRun(), ns3::olsr::RoutingProtocol::ProcessTc(), and ns3::olsr::RoutingProtocol::SendTc().

+ Here is the caller graph for this function:

const Tc& ns3::olsr::MessageHeader::GetTc ( ) const
inline

Definition at line 422 of file olsr-header.h.

References m_message, m_messageType, NS_ASSERT, and TC_MESSAGE.

uint8_t ns3::olsr::MessageHeader::GetTimeToLive ( ) const
inline

Definition at line 161 of file olsr-header.h.

References m_timeToLive.

Referenced by ns3::OlsrMidTestCase::DoRun(), ns3::olsr::RoutingProtocol::ForwardDefault(), and ns3::olsr::RoutingProtocol::RecvOlsr().

+ Here is the caller graph for this function:

TypeId ns3::olsr::MessageHeader::GetTypeId ( void  )
static

This method returns the TypeId associated to ns3::olsr::MessageHeader.

No Attributes defined for this type.
No TraceSources defined for this type.

Reimplemented from ns3::Header.

Definition at line 166 of file olsr-header.cc.

References ns3::TypeId::SetParent().

Referenced by GetInstanceTypeId().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::MessageHeader::Print ( std::ostream &  os) const
virtual
Parameters
osoutput stream This method is used by Packet::Print to print the content of a trailer as ascii data to a c++ output stream. Although the trailer is free to format its output as it wishes, it is recommended to follow a few rules to integrate with the packet pretty printer: start with flags, small field values located between a pair of parens. Values should be separated by whitespace. Follow the parens with the important fields, separated by whitespace. i.e.: (field1 val1 field2 val2 field3 val3) field4 val4 field5 val5

Implements ns3::Header.

Definition at line 206 of file olsr-header.cc.

Referenced by ns3::olsr::operator<<().

+ Here is the caller graph for this function:

void ns3::olsr::MessageHeader::Serialize ( Buffer::Iterator  start) const
virtual
Parameters
startan iterator which points to where the header should be written.

This method is used by Packet::AddHeader to store a header into the byte buffer of a packet. The data written is expected to match bit-for-bit the representation of this header in a real network.

Implements ns3::Header.

Definition at line 212 of file olsr-header.cc.

References ns3::Ipv4Address::Get(), GetSerializedSize(), HELLO_MESSAGE, HNA_MESSAGE, m_hopCount, m_message, m_messageSequenceNumber, m_messageType, m_originatorAddress, m_timeToLive, m_vTime, MID_MESSAGE, NS_ASSERT, visualizer.core::start(), TC_MESSAGE, ns3::Buffer::Iterator::WriteHtonU16(), ns3::Buffer::Iterator::WriteHtonU32(), and ns3::Buffer::Iterator::WriteU8().

+ Here is the call graph for this function:

void ns3::olsr::MessageHeader::SetHopCount ( uint8_t  hopCount)
inline
void ns3::olsr::MessageHeader::SetMessageSequenceNumber ( uint16_t  messageSequenceNumber)
inline
void ns3::olsr::MessageHeader::SetMessageType ( MessageType  messageType)
inline

Definition at line 130 of file olsr-header.h.

References m_messageType.

Referenced by ns3::OlsrMidTestCase::DoRun().

+ Here is the caller graph for this function:

void ns3::olsr::MessageHeader::SetOriginatorAddress ( Ipv4Address  originatorAddress)
inline
void ns3::olsr::MessageHeader::SetTimeToLive ( uint8_t  timeToLive)
inline
void ns3::olsr::MessageHeader::SetVTime ( Time  time)
inline

Definition at line 139 of file olsr-header.h.

References ns3::Time::GetSeconds(), m_vTime, and ns3::olsr::SecondsToEmf().

Referenced by ns3::OlsrMidTestCase::DoRun(), ns3::olsr::RoutingProtocol::SendHello(), ns3::olsr::RoutingProtocol::SendHna(), ns3::olsr::RoutingProtocol::SendMid(), and ns3::olsr::RoutingProtocol::SendTc().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

Hello ns3::olsr::MessageHeader::hello

Definition at line 350 of file olsr-header.h.

Hna ns3::olsr::MessageHeader::hna

Definition at line 352 of file olsr-header.h.

uint8_t ns3::olsr::MessageHeader::m_hopCount
private

Definition at line 198 of file olsr-header.h.

Referenced by Deserialize(), GetHopCount(), Serialize(), and SetHopCount().

struct { ... } ns3::olsr::MessageHeader::m_message
uint16_t ns3::olsr::MessageHeader::m_messageSequenceNumber
private
uint16_t ns3::olsr::MessageHeader::m_messageSize
private

Definition at line 200 of file olsr-header.h.

Referenced by Deserialize().

MessageType ns3::olsr::MessageHeader::m_messageType
private
Ipv4Address ns3::olsr::MessageHeader::m_originatorAddress
private

Definition at line 196 of file olsr-header.h.

Referenced by Deserialize(), GetOriginatorAddress(), Serialize(), and SetOriginatorAddress().

uint8_t ns3::olsr::MessageHeader::m_timeToLive
private

Definition at line 197 of file olsr-header.h.

Referenced by Deserialize(), GetTimeToLive(), Serialize(), and SetTimeToLive().

uint8_t ns3::olsr::MessageHeader::m_vTime
private

Definition at line 195 of file olsr-header.h.

Referenced by Deserialize(), GetVTime(), Serialize(), and SetVTime().

Mid ns3::olsr::MessageHeader::mid

Definition at line 349 of file olsr-header.h.

Tc ns3::olsr::MessageHeader::tc

Definition at line 351 of file olsr-header.h.


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