22 #include "ns3/address-utils.h"
23 #include "ns3/assert.h"
24 #include "ns3/packet.h"
32 m_do (false), m_rf (false), m_usn (false), m_destinationAddress (
Mac48Address ()), m_destSeqNumber (0)
90 m_maxSize (32), m_flags (0), m_hopCount (0), m_ttl (0), m_preqId (0), m_originatorAddress (
91 Mac48Address::GetBroadcast ()), m_originatorSeqNumber (0), m_lifetime (0), m_metric (0),
243 WriteTo (i, (*j)->GetDestinationAddress ());
270 bool usnFlag =
false;
271 uint8_t flags = i.
ReadU8 ();
272 if (flags & (1 << 0))
276 if (flags & (1 << 1))
280 if (flags & (1 << 2))
284 new_element->SetFlags (doFlag, rfFlag, usnFlag);
287 new_element->SetDestinationAddress (addr);
319 os << std::endl <<
"<information_element id=" <<
ElementId () <<
">" << std::endl;
321 os <<
" TTL = " << (uint16_t)
m_ttl << std::endl;
322 os <<
" hop count = " << (uint16_t)
m_hopCount << std::endl;
323 os <<
" metric = " <<
m_metric << std::endl;
325 os <<
" lifetime = " <<
m_lifetime << std::endl;
326 os <<
" preq ID = " <<
m_preqId << std::endl;
327 os <<
" Destinations are:" << std::endl;
330 os <<
" " <<
m_destinations[j]->GetDestinationAddress () << std::endl;
332 os <<
"</information_element>" << std::endl;
334 std::vector<Ptr<DestinationAddressUnit> >
341 uint32_t dest_seq_number)
346 if ((*i)->GetDestinationAddress () == dest_address)
353 new_element->SetFlags (doFlag, rfFlag, (dest_seq_number == 0));
354 new_element->SetDestinationAddress (dest_address);
355 new_element->SetDestSeqNumber (dest_seq_number);
365 if ((*i)->GetDestinationAddress () == dest_address)
void SetPreqID(uint32_t id)
void SetFlags(bool doFlag, bool rfFlag, bool usnFlag)
smart pointer class similar to boost::intrusive_ptr
uint8_t GetHopCount() const
void ReadFrom(Buffer::Iterator &i, Ipv4Address &ad)
Read an Ipv4Address from a Buffer.
std::vector< Ptr< DestinationAddressUnit > > m_destinations
#define NS_ASSERT(condition)
void WriteTo(Buffer::Iterator &i, Ipv4Address ad)
Write an Ipv4Address to a Buffer.
uint32_t GetLifetime() const
uint32_t m_originatorSeqNumber
bool operator==(const MeshHeader &a, const MeshHeader &b)
uint32_t GetDistanceFrom(Iterator const &o) const
void SetDestSeqNumber(uint32_t dest_seq_number)
iterator in a Buffer instance
void SetLifetime(uint32_t lifetime)
Mac48Address m_originatorAddress
Mac48Address GetOriginatorAddress() const
void DecrementTtl()
Handle TTL and Metric:
Mac48Address m_destinationAddress
virtual void Print(std::ostream &os) const
In addition, a subclass may optionally override the following...
void IncrementMetric(uint32_t metric)
void SetDestCount(uint8_t dest_count)
virtual WifiInformationElementId ElementId() const
Own unique Element ID.
See 7.3.2.96 of 802.11s draft 2.07.
void ClearDestinationAddressElements()
Clear PREQ: remove all destinations.
T * PeekPointer(const Ptr< T > &p)
static Mac48Address GetBroadcast(void)
virtual uint8_t DeserializeInformationField(Buffer::Iterator i, uint8_t length)
Deserialize information (i.e., the body of the IE, not including the Element ID and length octets) ...
uint32_t GetOriginatorSeqNumber() const
void SetOriginatorAddress(Mac48Address originator_address)
void SetOriginatorSeqNumber(uint32_t originator_seq_number)
void SetMetric(uint32_t metric)
void AddDestinationAddressElement(bool doFlag, bool rfFlag, Mac48Address dest_address, uint32_t dest_seq_number)
Add a destination address unit: flags, destination and sequence number.
void DelDestinationAddressElement(Mac48Address dest_address)
Delete a destination address unit by destination.
virtual void SerializeInformationField(Buffer::Iterator i) const
Serialize information (i.e., the body of the IE, not including the Element ID and length octets) ...
bool IsNeedNotPrep() const
uint32_t GetDestSeqNumber() const
uint8_t GetDestCount() const
std::vector< Ptr< DestinationAddressUnit > > GetDestinationList()
Get all destinations, which are stored in PREQ:
void SetUnicastPreq()
SetProper flags which indicate that PREQ is unicast.
bool MayAddAddress(Mac48Address originator)
uint8_t m_maxSize
how many destinations we support
void WriteU8(uint8_t data)
bool IsUnicastPreq() const
virtual uint8_t GetInformationFieldSize() const
Length of serialized information (i.e., the length of the body of the IE, not including the Element I...
uint32_t GetPreqID() const
Mac48Address GetDestinationAddress() const
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.
uint8_t m_flags
Fields of information element:
uint32_t GetMetric() const
Describes an address unit in PREQ information element See 7.3.2.96 for more details.
void SetDestinationAddress(Mac48Address dest_address)
std::ostream & operator<<(std::ostream &os, const IeBeaconTiming &a)
uint32_t ReadLsbtohU32(void)
void SetHopcount(uint8_t hopcount)
void WriteHtolsbU32(uint32_t data)