ns3::olsr::MessageHeader Class Reference

#include <olsr-header.h>

Inheritance diagram for ns3::olsr::MessageHeader:
Inheritance graph
[legend]
Collaboration diagram for ns3::olsr::MessageHeader:
Collaboration graph
[legend]

List of all members.

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 ()
void SetMessageType (MessageType messageType)
MessageType GetMessageType () const
void SetVTime (Time time)
Time GetVTime () const
void SetOriginatorAddress (Ipv4Address originatorAddress)
Ipv4Address GetOriginatorAddress () const
void SetTimeToLive (uint8_t timeToLive)
uint8_t GetTimeToLive () const
void SetHopCount (uint8_t hopCount)
uint8_t GetHopCount () const
void SetMessageSequenceNumber (uint16_t messageSequenceNumber)
uint16_t GetMessageSequenceNumber () const
virtual TypeId GetInstanceTypeId (void) const
virtual void Print (std::ostream &os) const
virtual uint32_t GetSerializedSize (void) const
virtual void Serialize (Buffer::Iterator start) const
virtual uint32_t Deserialize (Buffer::Iterator start)
MidGetMid ()
HelloGetHello ()
TcGetTc ()
HnaGetHna ()
const MidGetMid () const
const HelloGetHello () const
const TcGetTc () const
const HnaGetHna () const

Static Public Member Functions

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

Private Attributes

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

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

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

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


Member Function Documentation

uint32_t ns3::olsr::MessageHeader::Deserialize ( Buffer::Iterator  start  )  [virtual]
Parameters:
start an 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 240 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(), and TC_MESSAGE.

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.

Hello& ns3::olsr::MessageHeader::GetHello (  )  [inline]
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.

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::OlsrHeaderTest::RunTests().

uint8_t ns3::olsr::MessageHeader::GetHopCount (  )  const [inline]

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

References m_hopCount.

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

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

References GetTypeId().

uint16_t ns3::olsr::MessageHeader::GetMessageSequenceNumber (  )  const [inline]
MessageType ns3::olsr::MessageHeader::GetMessageType (  )  const [inline]

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

References m_messageType.

Referenced by ns3::olsr::AgentImpl::RecvOlsr(), and ns3::OlsrHeaderTest::RunTests().

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.

Mid& ns3::olsr::MessageHeader::GetMid (  )  [inline]
Ipv4Address ns3::olsr::MessageHeader::GetOriginatorAddress (  )  const [inline]
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 177 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::AgentImpl::RecvOlsr(), ns3::OlsrHeaderTest::RunTests(), ns3::olsr::AgentImpl::SendHello(), and Serialize().

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.

Tc& ns3::olsr::MessageHeader::GetTc (  )  [inline]
uint8_t ns3::olsr::MessageHeader::GetTimeToLive (  )  const [inline]
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 162 of file olsr-header.cc.

References ns3::TypeId::SetParent().

Referenced by GetInstanceTypeId().

Time ns3::olsr::MessageHeader::GetVTime (  )  const [inline]
void ns3::olsr::MessageHeader::Print ( std::ostream &  os  )  const [virtual]

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

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

void ns3::olsr::MessageHeader::Serialize ( Buffer::Iterator  start  )  const [virtual]
Parameters:
start an 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 208 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, TC_MESSAGE, ns3::Buffer::Iterator::WriteHtonU16(), ns3::Buffer::Iterator::WriteHtonU32(), and ns3::Buffer::Iterator::WriteU8().

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::OlsrHeaderTest::RunTests().

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]

Member Data Documentation

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

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

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

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

struct { ... } ns3::olsr::MessageHeader::m_message [private]

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

Referenced by Deserialize().

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

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

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

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

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

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

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

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


The documentation for this class was generated from the following files:
Generated on Thu Dec 3 14:12:22 2009 for NS-3 by  doxygen 1.6.3