This header can store HELP, TC, MID and HNA messages. More...
#include "olsr-header.h"
Classes | |
struct | Hello |
HELLO Message Format. More... | |
struct | Hna |
HNA (Host Network Association) Message Format. More... | |
struct | Mid |
MID Message Format. More... | |
struct | Tc |
TC Message Format. More... | |
Public Types | |
enum | MessageType { HELLO_MESSAGE = 1 , TC_MESSAGE = 2 , MID_MESSAGE = 3 , HNA_MESSAGE = 4 } |
Message type. More... | |
Public Member Functions | |
MessageHeader () | |
virtual | ~MessageHeader () |
virtual uint32_t | Deserialize (Buffer::Iterator start) |
Hello & | GetHello () |
Set the message type to HELLO and return the message content. More... | |
const Hello & | GetHello () const |
Get the HELLO message. More... | |
Hna & | GetHna () |
Set the message type to HNA and return the message content. More... | |
const Hna & | GetHna () const |
Get the HNA message. More... | |
uint8_t | GetHopCount () const |
Get the hop count. More... | |
virtual TypeId | GetInstanceTypeId (void) const |
Get the most derived TypeId for this Object. More... | |
uint16_t | GetMessageSequenceNumber () const |
Get the message sequence number. More... | |
MessageType | GetMessageType () const |
Get the message type. More... | |
Mid & | GetMid () |
Set the message type to MID and return the message content. More... | |
const Mid & | GetMid () const |
Get the MID message. More... | |
Ipv4Address | GetOriginatorAddress () const |
Get the originator address. More... | |
virtual uint32_t | GetSerializedSize (void) const |
Tc & | GetTc () |
Set the message type to TC and return the message content. More... | |
const Tc & | GetTc () const |
Get the TC message. More... | |
uint8_t | GetTimeToLive () const |
Get the time to live. More... | |
Time | GetVTime () const |
Get the validity time. More... | |
virtual void | Print (std::ostream &os) const |
virtual void | Serialize (Buffer::Iterator start) const |
void | SetHopCount (uint8_t hopCount) |
Set the hop count. More... | |
void | SetMessageSequenceNumber (uint16_t messageSequenceNumber) |
Set the message sequence number. More... | |
void | SetMessageType (MessageType messageType) |
Set the message type. More... | |
void | SetOriginatorAddress (Ipv4Address originatorAddress) |
Set the originator address. More... | |
void | SetTimeToLive (uint8_t timeToLive) |
Set the time to live. More... | |
void | SetVTime (Time time) |
Set the validity time. More... | |
Public Member Functions inherited from ns3::Header | |
virtual | ~Header () |
virtual uint32_t | Deserialize (Buffer::Iterator start)=0 |
Deserialize the object from a buffer iterator. More... | |
virtual uint32_t | Deserialize (Buffer::Iterator start, Buffer::Iterator end) |
Deserialize the object from a buffer iterator. More... | |
Public Member Functions inherited from ns3::Chunk | |
virtual uint32_t | Deserialize (Buffer::Iterator start, Buffer::Iterator end) |
Deserialize the object from a buffer iterator. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. More... | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising erros. More... | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. More... | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. More... | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. More... | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. More... | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. More... | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Header | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Chunk | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Private Attributes | |
uint8_t | m_hopCount |
The hop count. More... | |
struct { | |
Hello hello | |
HELLO message (optional). More... | |
Hna hna | |
HNA message (optional). More... | |
Mid mid | |
MID message (optional). More... | |
Tc tc | |
TC message (optional). More... | |
} | m_message |
Structure holding the message content. More... | |
uint16_t | m_messageSequenceNumber |
The message sequence number. More... | |
uint16_t | m_messageSize |
The message size. More... | |
MessageType | m_messageType |
The message type. More... | |
Ipv4Address | m_originatorAddress |
The originator address. More... | |
uint8_t | m_timeToLive |
The time to live. More... | |
uint8_t | m_vTime |
The validity time. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. More... | |
virtual void | NotifyConstructionCompleted (void) |
Notifier called once the ObjectBase is fully constructed. More... | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid (void) |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
This header can store HELP, TC, MID and HNA messages.
Introspection did not find any typical Config paths.
The header size is variable, and depends on the actual message type.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Message Type | Vtime | Message Size | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Originator Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Time To Live | Hop Count | Message Sequence Number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | : MESSAGE : | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
No Attributes are defined for this type.
No TraceSources are defined for this type.
Size of this type is 144 bytes (on a 64-bit architecture).
Definition at line 157 of file olsr-header.h.
Message type.
Enumerator | |
---|---|
HELLO_MESSAGE | |
TC_MESSAGE | |
MID_MESSAGE | |
HNA_MESSAGE |
Definition at line 163 of file olsr-header.h.
ns3::olsr::MessageHeader::MessageHeader | ( | ) |
Definition at line 163 of file olsr-header.cc.
|
virtual |
Definition at line 168 of file olsr-header.cc.
|
virtual |
start | an iterator which points to where the header should read from. |
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.
Note that data is not actually removed from the buffer to which the iterator points. Both Packet::RemoveHeader() and Packet::PeekHeader() call Deserialize(), but only the RemoveHeader() has additional statements to remove the header bytes from the underlying buffer and associated metadata.
Implements ns3::Header.
Definition at line 291 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.
|
inline |
Set the message type to HELLO and return the message content.
Definition at line 591 of file olsr-header.h.
References HELLO_MESSAGE, m_message, m_messageType, and NS_ASSERT.
Referenced by ns3::olsr::RoutingProtocol::ProcessHello(), ns3::olsr::HelloRegressionTest::ReceivePktProbeA(), ns3::olsr::TcRegressionTest::ReceivePktProbeA(), ns3::olsr::HelloRegressionTest::ReceivePktProbeB(), ns3::olsr::TcRegressionTest::ReceivePktProbeB(), ns3::olsr::TcRegressionTest::ReceivePktProbeC(), and ns3::olsr::RoutingProtocol::SendHello().
|
inline |
Get the HELLO message.
Definition at line 653 of file olsr-header.h.
References HELLO_MESSAGE, m_message, m_messageType, and NS_ASSERT.
|
inline |
Set the message type to HNA and return the message content.
Definition at line 625 of file olsr-header.h.
References HNA_MESSAGE, m_message, m_messageType, and NS_ASSERT.
Referenced by ns3::olsr::RoutingProtocol::ProcessHna(), and ns3::olsr::RoutingProtocol::SendHna().
|
inline |
Get the HNA message.
Definition at line 673 of file olsr-header.h.
References HNA_MESSAGE, m_message, m_messageType, and NS_ASSERT.
|
inline |
Get the hop count.
Definition at line 254 of file olsr-header.h.
References m_hopCount.
Referenced by ns3::olsr::RoutingProtocol::ForwardDefault().
|
virtual |
Get the most derived TypeId for this Object.
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 183 of file olsr-header.cc.
References GetTypeId().
|
inline |
Get the message sequence number.
Definition at line 271 of file olsr-header.h.
References m_messageSequenceNumber.
Referenced by ns3::olsr::RoutingProtocol::ForwardDefault(), and ns3::olsr::RoutingProtocol::RecvOlsr().
|
inline |
Get the message type.
Definition at line 186 of file olsr-header.h.
References m_messageType.
Referenced by ns3::olsr::RoutingProtocol::RecvOlsr().
|
inline |
Set the message type to MID and return the message content.
Definition at line 574 of file olsr-header.h.
References m_message, m_messageType, MID_MESSAGE, and NS_ASSERT.
Referenced by ns3::olsr::RoutingProtocol::ProcessMid(), and ns3::olsr::RoutingProtocol::SendMid().
|
inline |
Get the MID message.
Definition at line 643 of file olsr-header.h.
References m_message, m_messageType, MID_MESSAGE, and NS_ASSERT.
|
inline |
Get the originator address.
Definition at line 220 of file olsr-header.h.
References m_originatorAddress.
Referenced by ns3::olsr::RoutingProtocol::ForwardDefault(), ns3::olsr::RoutingProtocol::PopulateMprSelectorSet(), ns3::olsr::RoutingProtocol::PopulateNeighborSet(), ns3::olsr::RoutingProtocol::PopulateTwoHopNeighborSet(), ns3::olsr::RoutingProtocol::ProcessHna(), ns3::olsr::RoutingProtocol::ProcessMid(), ns3::olsr::RoutingProtocol::ProcessTc(), ns3::olsr::HelloRegressionTest::ReceivePktProbeA(), ns3::olsr::TcRegressionTest::ReceivePktProbeA(), ns3::olsr::HelloRegressionTest::ReceivePktProbeB(), ns3::olsr::TcRegressionTest::ReceivePktProbeB(), ns3::olsr::TcRegressionTest::ReceivePktProbeC(), and ns3::olsr::RoutingProtocol::RecvOlsr().
|
virtual |
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 189 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::olsr::RoutingProtocol::RecvOlsr(), ns3::olsr::RoutingProtocol::SendHello(), and Serialize().
|
inline |
Set the message type to TC and return the message content.
Definition at line 608 of file olsr-header.h.
References m_message, m_messageType, NS_ASSERT, and TC_MESSAGE.
Referenced by ns3::olsr::RoutingProtocol::ProcessTc(), ns3::olsr::TcRegressionTest::ReceivePktProbeA(), ns3::olsr::TcRegressionTest::ReceivePktProbeC(), and ns3::olsr::RoutingProtocol::SendTc().
|
inline |
Get the TC message.
Definition at line 663 of file olsr-header.h.
References m_message, m_messageType, NS_ASSERT, and TC_MESSAGE.
|
inline |
Get the time to live.
Definition at line 237 of file olsr-header.h.
References m_timeToLive.
Referenced by ns3::olsr::RoutingProtocol::ForwardDefault(), and ns3::olsr::RoutingProtocol::RecvOlsr().
|
static |
Get the type ID.
Definition at line 173 of file olsr-header.cc.
References ns3::TypeId::SetParent().
Referenced by GetInstanceTypeId().
|
inline |
Get the validity time.
Definition at line 203 of file olsr-header.h.
References ns3::olsr::EmfToSeconds(), m_vTime, and ns3::Seconds().
Referenced by ns3::olsr::RoutingProtocol::LinkSensing(), ns3::olsr::RoutingProtocol::PopulateMprSelectorSet(), ns3::olsr::RoutingProtocol::PopulateTwoHopNeighborSet(), ns3::olsr::RoutingProtocol::ProcessHna(), ns3::olsr::RoutingProtocol::ProcessMid(), and ns3::olsr::RoutingProtocol::ProcessTc().
|
virtual |
os | output stream This method is used by Packet::Print to print the content of a header as ascii data to a c++ output stream. Although the header 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 214 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, and TC_MESSAGE.
Referenced by ns3::olsr::operator<<().
|
virtual |
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 259 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().
|
inline |
Set the hop count.
hopCount | The hop count. |
Definition at line 246 of file olsr-header.h.
References m_hopCount.
Referenced by ns3::olsr::RoutingProtocol::ForwardDefault(), ns3::olsr::RoutingProtocol::SendHello(), ns3::olsr::RoutingProtocol::SendHna(), ns3::olsr::RoutingProtocol::SendMid(), and ns3::olsr::RoutingProtocol::SendTc().
|
inline |
Set the message sequence number.
messageSequenceNumber | The message sequence number. |
Definition at line 263 of file olsr-header.h.
References m_messageSequenceNumber.
Referenced by ns3::olsr::RoutingProtocol::SendHello(), ns3::olsr::RoutingProtocol::SendHna(), ns3::olsr::RoutingProtocol::SendMid(), and ns3::olsr::RoutingProtocol::SendTc().
|
inline |
Set the message type.
messageType | The message type. |
Definition at line 178 of file olsr-header.h.
References m_messageType.
|
inline |
Set the originator address.
originatorAddress | The originator address. |
Definition at line 212 of file olsr-header.h.
References m_originatorAddress.
Referenced by ns3::olsr::RoutingProtocol::SendHello(), ns3::olsr::RoutingProtocol::SendHna(), ns3::olsr::RoutingProtocol::SendMid(), and ns3::olsr::RoutingProtocol::SendTc().
|
inline |
Set the time to live.
timeToLive | The time to live. |
Definition at line 229 of file olsr-header.h.
References m_timeToLive.
Referenced by ns3::olsr::RoutingProtocol::ForwardDefault(), ns3::olsr::RoutingProtocol::SendHello(), ns3::olsr::RoutingProtocol::SendHna(), ns3::olsr::RoutingProtocol::SendMid(), and ns3::olsr::RoutingProtocol::SendTc().
|
inline |
Set the validity time.
time | The validity time. |
Definition at line 195 of file olsr-header.h.
References ns3::Time::GetSeconds(), m_vTime, and ns3::olsr::SecondsToEmf().
Referenced by ns3::olsr::RoutingProtocol::SendHello(), ns3::olsr::RoutingProtocol::SendHna(), ns3::olsr::RoutingProtocol::SendMid(), and ns3::olsr::RoutingProtocol::SendTc().
Hello ns3::olsr::MessageHeader::hello |
HELLO message (optional).
Definition at line 564 of file olsr-header.h.
Hna ns3::olsr::MessageHeader::hna |
HNA message (optional).
Definition at line 566 of file olsr-header.h.
|
private |
The hop count.
Definition at line 281 of file olsr-header.h.
Referenced by Deserialize(), GetHopCount(), Print(), Serialize(), and SetHopCount().
struct { ... } ns3::olsr::MessageHeader::m_message |
Structure holding the message content.
The actual message being carried.
Referenced by Deserialize(), GetHello(), GetHna(), GetMid(), GetSerializedSize(), GetTc(), Print(), and Serialize().
|
private |
The message sequence number.
Definition at line 282 of file olsr-header.h.
Referenced by Deserialize(), GetMessageSequenceNumber(), Print(), Serialize(), and SetMessageSequenceNumber().
|
private |
The message size.
Definition at line 283 of file olsr-header.h.
Referenced by Deserialize(), and Print().
|
private |
The message type.
Definition at line 277 of file olsr-header.h.
Referenced by Deserialize(), GetHello(), GetHna(), GetMessageType(), GetMid(), GetSerializedSize(), GetTc(), Print(), Serialize(), and SetMessageType().
|
private |
The originator address.
Definition at line 279 of file olsr-header.h.
Referenced by Deserialize(), GetOriginatorAddress(), Print(), Serialize(), and SetOriginatorAddress().
|
private |
The time to live.
Definition at line 280 of file olsr-header.h.
Referenced by Deserialize(), GetTimeToLive(), Print(), Serialize(), and SetTimeToLive().
|
private |
The validity time.
Definition at line 278 of file olsr-header.h.
Referenced by Deserialize(), GetVTime(), Print(), Serialize(), and SetVTime().
Mid ns3::olsr::MessageHeader::mid |
MID message (optional).
Definition at line 563 of file olsr-header.h.
Tc ns3::olsr::MessageHeader::tc |
TC message (optional).
Definition at line 565 of file olsr-header.h.