32 #include "ns3/assert.h"
34 #include "ns3/header.h"
35 #include "dsr-option-header.h"
36 #include "ns3/ipv4-address.h"
37 #include "ns3/address-utils.h"
38 #include "ns3/packet.h"
45 NS_OBJECT_ENSURE_REGISTERED (DsrOptionHeader);
93 os <<
"( type = " << (uint32_t)
m_type <<
" length = " << (uint32_t)
m_length <<
" )";
137 static TypeId tid =
TypeId (
"ns3::dsr::DsrOptionPad1Header")
139 .SetParent<DsrOptionHeader> ()
160 os <<
"( type = " << (uint32_t)
GetType () <<
" )";
188 static TypeId tid =
TypeId (
"ns3::dsr::DsrOptionPadnHeader")
190 .SetParent<DsrOptionHeader> ()
203 NS_ASSERT_MSG (pad >= 2,
"PadN must be at least 2 bytes long");
213 os <<
"( type = " << (uint32_t)
GetType () <<
" length = " << (uint32_t)
GetLength () <<
" )";
228 for (
int padding = 0; padding <
GetLength (); padding++)
248 static TypeId tid =
TypeId (
"ns3::dsr::DsrOptionRreqHeader")
250 .SetParent<DsrOptionHeader> ()
331 os <<
"( type = " << (uint32_t)
GetType () <<
" length = " << (uint32_t)
GetLength () <<
"";
354 WriteTo (i, m_target);
358 it->Serialize (buff);
371 ReadFrom (i, m_target);
395 static TypeId tid =
TypeId (
"ns3::dsr::DsrOptionRrepHeader")
397 .SetParent<DsrOptionHeader> ()
445 Ipv4Address DsrOptionRrepHeader::GetTargetAddress (std::vector<Ipv4Address> ipv4Address)
const
452 os <<
"( type = " << (uint32_t)
GetType () <<
" length = " << (uint32_t)
GetLength () <<
"";
479 it->Serialize (buff);
516 static TypeId tid =
TypeId (
"ns3::dsr::DsrOptionSRHeader")
518 .SetParent<DsrOptionHeader> ()
529 : m_segmentsLeft (0),
540 void DsrOptionSRHeader::SetSegmentsLeft (uint8_t segmentsLeft)
545 uint8_t DsrOptionSRHeader::GetSegmentsLeft ()
const
550 void DsrOptionSRHeader::SetSalvage (uint8_t salvage)
555 uint8_t DsrOptionSRHeader::GetSalvage ()
const
587 uint8_t DsrOptionSRHeader::GetNodeListSize ()
const
594 os <<
"( type = " << (uint32_t)
GetType () <<
" length = " << (uint32_t)
GetLength () <<
"";
621 it->Serialize (buff);
658 static TypeId tid =
TypeId (
"ns3::dsr::DsrOptionRerrHeader")
660 .SetParent<DsrOptionHeader> ()
661 .AddAttribute (
"ErrorType",
"Type of route errors",
664 MakeEnumChecker (NODE_UNREACHABLE,
"Node unreachable",
665 FLOW_STATE_NOT_SUPPORTED,
"Flow state not supported",
666 OPTION_NOT_SUPPORTED,
"Option not supported"))
732 os <<
"( type = " << (uint32_t)
GetType () <<
" length = " << (uint32_t)
GetLength ()
787 static TypeId tid =
TypeId (
"ns3::dsr::DsrOptionRerrUnreachHeader")
789 .SetParent<DsrOptionRerrHeader> ()
864 os <<
"( type = " << (uint32_t)
GetType () <<
" length = " << (uint32_t)
GetLength ()
915 static TypeId tid =
TypeId (
"ns3::dsr::DsrOptionRerrUnsupportHeader")
917 .SetParent<DsrOptionRerrHeader> ()
982 os <<
"( type = " << (uint32_t)
GetType () <<
" length = " << (uint32_t)
GetLength ()
985 <<
" unsupported option = " <<
m_unsupport <<
" )";
1033 static TypeId tid =
TypeId (
"ns3::dsr::DsrOptionAckReqHeader")
1035 .SetParent<DsrOptionHeader> ()
1046 : m_identification (0)
1059 m_identification = identification;
1064 return m_identification;
1069 os <<
"( type = " << (uint32_t)
GetType () <<
" length = " << (uint32_t)
GetLength ()
1070 <<
" id = " << m_identification <<
" )";
1093 m_identification = i.
ReadU16 ();
1108 static TypeId tid =
TypeId (
"ns3::dsr::DsrOptionAckHeader")
1110 .SetParent<DsrOptionHeader> ()
1121 : m_identification (0)
1163 os <<
"( type = " << (uint32_t)
GetType () <<
" length = " << (uint32_t)
GetLength ()
static Ipv4Address Deserialize(const uint8_t buf[4])
TypeId AddConstructor(void)
automatically resized byte buffer
#define NS_LOG_COMPONENT_DEFINE(name)
iterator in a Buffer instance
hold variables of type 'enum'
void WriteU16(uint16_t data)
void WriteHtonU16(uint16_t data)
Buffer::Iterator End(void) const
Buffer::Iterator Begin(void) const
void Read(uint8_t *buffer, uint32_t size)
bool AddAtEnd(uint32_t end)
#define NS_ASSERT_MSG(condition, message)
Ipv4 addresses are stored in host order in this class.
void WriteU8(uint8_t data)
void Write(uint8_t const *buffer, uint32_t size)
uint16_t ReadNtohU16(void)
a unique identifier for an interface.