28 #include "aodv-packet.h"
29 #include "ns3/address-utils.h"
30 #include "ns3/packet.h"
37 NS_OBJECT_ENSURE_REGISTERED (TypeHeader);
40 m_type (t), m_valid (true)
45 TypeHeader::GetTypeId ()
49 .AddConstructor<TypeHeader> ()
76 uint8_t type = i.
ReadU8 ();
83 case AODVTYPE_RREP_ACK:
85 m_type = (MessageType) type;
116 case AODVTYPE_RREP_ACK:
122 os <<
"UNKNOWN_TYPE";
127 TypeHeader::operator== (
TypeHeader const & o)
const
129 return (m_type == o.m_type && m_valid == o.m_valid);
133 operator<< (std::ostream & os, TypeHeader
const & h)
143 uint32_t dstSeqNo,
Ipv4Address origin, uint32_t originSeqNo, uint16_t channel) :
144 m_flags (flags), m_reserved (reserved), m_hopCount (hopCount), m_requestID (requestID), m_dst (dst),
145 m_dstSeqNo (dstSeqNo), m_origin (origin), m_originSeqNo (originSeqNo), m_channelNo (channel)
152 RreqHeader::GetTypeId ()
156 .AddConstructor<RreqHeader> ()
210 <<
" sequence number " <<
m_dstSeqNo <<
" source: ipv4 "
213 <<
" flags:" <<
" Gratuitous RREP " << (*this).GetGratiousRrep ()
214 <<
" Destination only " << (*this).GetDestinationOnly ()
215 <<
" Unknown sequence number " << (*this).GetUnknownSeqno ();
226 RreqHeader::SetGratiousRrep (
bool f)
235 RreqHeader::GetGratiousRrep ()
const
241 RreqHeader::SetDestinationOnly (
bool f)
250 RreqHeader::GetDestinationOnly ()
const
256 RreqHeader::SetUnknownSeqno (
bool f)
265 RreqHeader::GetUnknownSeqno ()
const
271 RreqHeader::operator== (RreqHeader
const & o)
const
284 uint32_t dstSeqNo,
Ipv4Address origin,
Time lifeTime, uint16_t channel) :
285 m_flags (0), m_prefixSize (prefixSize), m_hopCount (hopCount),
286 m_dst (dst), m_dstSeqNo (dstSeqNo), m_origin (origin), m_channelNo (channel)
294 RrepHeader::GetTypeId ()
298 .AddConstructor<RrepHeader> ()
350 os <<
"destination: ipv4 " <<
m_dst <<
" sequence number " <<
m_dstSeqNo;
357 <<
" acknowledgment required flag " << (*this).GetAckRequired ();
361 RrepHeader::SetLifeTime (
Time t)
367 RrepHeader::GetLifeTime ()
const
374 RrepHeader::SetAckRequired (
bool f)
383 RrepHeader::GetAckRequired ()
const
389 RrepHeader::SetPrefixSize (uint8_t sz)
395 RrepHeader::GetPrefixSize ()
const
401 RrepHeader::operator== (RrepHeader
const & o)
const
438 RrepAckHeader::GetTypeId ()
442 .AddConstructor<RrepAckHeader> ()
483 return m_reserved == o.m_reserved;
487 operator<< (std::ostream & os, RrepAckHeader
const & h )
497 m_flag (0), m_reserved (0)
504 RerrHeader::GetTypeId ()
508 .AddConstructor<RerrHeader> ()
531 std::map<Ipv4Address, uint32_t>::const_iterator j;
534 WriteTo (i, (*j).first);
545 uint8_t dest = i.
ReadU8 ();
549 for (uint8_t k = 0; k < dest; ++k)
551 ReadFrom (i, address);
564 os <<
"Unreachable destination (ipv4 address, seq. number):";
565 std::map<Ipv4Address, uint32_t>::const_iterator j;
568 os << (*j).first <<
", " << (*j).second;
570 os <<
"No delete flag " << (*this).GetNoDelete ();
574 RerrHeader::SetNoDelete (
bool f )
583 RerrHeader::GetNoDelete ()
const
585 return (
m_flag & (1 << 0));
619 RerrHeader::operator== (
RerrHeader const & o )
const
628 if ((j->first != k->first) || (j->second != k->second))
638 operator<< (std::ostream & os, RerrHeader
const & h )
#define NS_ASSERT(condition)
uint32_t ReadNtohU32(void)
uint32_t GetDistanceFrom(Iterator const &o) const
iterator in a Buffer instance
void WriteU16(uint16_t data)
std::ostream & operator<<(std::ostream &os, const Angles &a)
void WriteHtonU32(uint32_t data)
Ipv4 addresses are stored in host order in this class.
void WriteU8(uint8_t data)
Time MilliSeconds(uint64_t ms)
create ns3::Time instances in units of milliseconds.
a unique identifier for an interface.
int64_t GetMilliSeconds(void) const
TypeId SetParent(TypeId tid)