A Discrete-Event Network Simulator
API
ie-dot11s-preq.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2008,2009 IITP RAS
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Kirill Andreev <andreev@iitp.ru>
19  */
20 
21 #ifndef WIFI_PREQ_INFORMATION_ELEMENT_H
22 #define WIFI_PREQ_INFORMATION_ELEMENT_H
23 
24 #include <vector>
25 
26 #include "ns3/mac48-address.h"
27 #include "ns3/mesh-information-element-vector.h"
28 
29 namespace ns3 {
30 namespace dot11s {
36 class DestinationAddressUnit : public SimpleRefCount<DestinationAddressUnit>
37 {
38 public:
46  void SetFlags (bool doFlag, bool rfFlag, bool usnFlag);
51  void SetDestinationAddress (Mac48Address dest_address);
56  void SetDestSeqNumber (uint32_t dest_seq_number);
61  bool IsDo ();
66  bool IsRf ();
71  bool IsUsn ();
81  uint32_t GetDestSeqNumber () const;
82 private:
83  bool m_do;
84  bool m_rf;
85  bool m_usn;
87  uint32_t m_destSeqNumber;
88 
96  friend bool operator== (const DestinationAddressUnit & a, const DestinationAddressUnit & b);
97 };
103 {
104 public:
105  IePreq ();
106  ~IePreq ();
117  bool doFlag,
118  bool rfFlag,
119  Mac48Address dest_address,
120  uint32_t dest_seq_number
121  );
126  void DelDestinationAddressElement (Mac48Address dest_address);
133  std::vector<Ptr<DestinationAddressUnit> > GetDestinationList ();
135  void SetUnicastPreq ();
139  void SetNeedNotPrep ();
140 
141  // Setters for fields:
147  void SetHopcount (uint8_t hopcount);
152  void SetTTL (uint8_t ttl);
157  void SetPreqID (uint32_t id);
162  void SetOriginatorAddress (Mac48Address originator_address);
167  void SetOriginatorSeqNumber (uint32_t originator_seq_number);
172  void SetLifetime (uint32_t lifetime);
177  void SetMetric (uint32_t metric);
182  void SetDestCount (uint8_t dest_count);
183 
184  // Getters for fields:
189  bool IsUnicastPreq () const;
194  bool IsNeedNotPrep () const;
199  uint8_t GetHopCount () const;
204  uint8_t GetTtl () const;
209  uint32_t GetPreqID () const;
219  uint32_t GetOriginatorSeqNumber () const;
224  uint32_t GetLifetime () const;
229  uint32_t GetMetric () const;
234  uint8_t GetDestCount () const;
235 
237  void DecrementTtl ();
242  void IncrementMetric (uint32_t metric);
249  bool MayAddAddress (Mac48Address originator);
254  bool IsFull () const;
255 
256  // Inherited from WifiInformationElement
257  virtual WifiInformationElementId ElementId () const;
258  virtual void SerializeInformationField (Buffer::Iterator i) const;
259  virtual uint8_t DeserializeInformationField (Buffer::Iterator i, uint8_t length);
260  virtual uint8_t GetInformationFieldSize () const;
261  virtual void Print (std::ostream& os) const;
262 
263 private:
268  uint8_t m_maxSize;
269 
270  uint8_t m_flags;
271  uint8_t m_hopCount;
272  uint8_t m_ttl;
273  uint32_t m_preqId;
276  uint32_t m_lifetime;
277  uint32_t m_metric;
278  uint8_t m_destCount;
279  std::vector<Ptr<DestinationAddressUnit> > m_destinations;
280 
288  friend bool operator== (const IePreq & a, const IePreq & b);
289 };
290 
292 bool operator== (const IePreq & a, const IePreq & b);
293 std::ostream &operator << (std::ostream &os, const IePreq &preq);
294 
295 } // namespace dot11s
296 } // namespace ns3
297 #endif
298 
virtual uint8_t GetInformationFieldSize() const
Length of serialized information (i.e., the length of the body of the IE, not including the Element I...
void SetPreqID(uint32_t id)
Set path discovery id field.
void SetFlags(bool doFlag, bool rfFlag, bool usnFlag)
Set flags function.
friend bool operator==(const DestinationAddressUnit &a, const DestinationAddressUnit &b)
equality operator
void SetTTL(uint8_t ttl)
Set remaining number of hops allowed for this element.
Mac48Address GetOriginatorAddress() const
Get originator address value.
std::vector< Ptr< DestinationAddressUnit > > m_destinations
the destinations
uint32_t GetOriginatorSeqNumber() const
Get originator sequence numnber value.
uint8_t m_destCount
destination count
uint32_t m_destSeqNumber
destination sequence number
uint8_t m_hopCount
hop count
virtual void SerializeInformationField(Buffer::Iterator i) const
Serialize information (i.e., the body of the IE, not including the Element ID and length octets) ...
uint8_t GetDestCount() const
Get destination count.
uint32_t m_originatorSeqNumber
originator sequence number
bool operator==(const MeshHeader &a, const MeshHeader &b)
void SetDestSeqNumber(uint32_t dest_seq_number)
Set destination sequence number.
void SetNeedNotPrep()
Set Proactive PREP subfield to off.
iterator in a Buffer instance
Definition: buffer.h:98
void SetLifetime(uint32_t lifetime)
Set lifetime in TUs for the forwarding information to be considered valid.
bool IsUnicastPreq() const
Is unicast PREQ function.
Mac48Address m_originatorAddress
originator address
Information element, as defined in 802.11-2007 standardThe IEEE 802.11 standard includes the notion o...
void DecrementTtl()
Handle TTL.
Mac48Address m_destinationAddress
destination address
void IncrementMetric(uint32_t metric)
Handle Metric:
void SetDestCount(uint8_t dest_count)
Set destination count value.
virtual WifiInformationElementId ElementId() const
See 7.3.2.96 of 802.11s draft 2.07.
uint32_t m_preqId
PREQ ID.
void ClearDestinationAddressElements()
Clear PREQ: remove all destinations.
virtual void Print(std::ostream &os) const
Generate human-readable form of IE.
uint32_t m_metric
metric
bool IsFull() const
Is full function.
uint8_t GetTtl() const
Get TTL value.
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) ...
void SetOriginatorAddress(Mac48Address originator_address)
Set originator address value.
void SetOriginatorSeqNumber(uint32_t originator_seq_number)
Set originator sequence number.
Mac48Address GetDestinationAddress() const
Get destination address function.
void SetMetric(uint32_t metric)
Set metric value.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void AddDestinationAddressElement(bool doFlag, bool rfFlag, Mac48Address dest_address, uint32_t dest_seq_number)
Add a destination address unit: flags, destination and sequence number.
uint32_t GetLifetime() const
Get lifetime value.
void DelDestinationAddressElement(Mac48Address dest_address)
Delete a destination address unit by destination.
an EUI-48 address
Definition: mac48-address.h:43
std::vector< Ptr< DestinationAddressUnit > > GetDestinationList()
Get all destinations, which are stored in PREQ:
void SetUnicastPreq()
Set flag indicating that PREQ is unicast.
bool MayAddAddress(Mac48Address originator)
Checks that preq&#39;s originator address equals to originator, and this preq is not proactive.
bool IsNeedNotPrep() const
Check whether Proactive PREP subfield to off.
uint8_t m_maxSize
how many destinations we support
uint32_t GetMetric() const
Get metric value.
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.
uint8_t m_flags
flags
uint32_t GetDestSeqNumber() const
Get destination sequence number.
uint32_t GetPreqID() const
Get path discovery id field.
Describes an address unit in PREQ information element See 7.3.2.96 for more details.
void SetDestinationAddress(Mac48Address dest_address)
Set destination address function.
A template-based reference counting class.
friend bool operator==(const IePreq &a, const IePreq &b)
equality operator
std::ostream & operator<<(std::ostream &os, const IeBeaconTiming &a)
void SetHopcount(uint8_t hopcount)
Set number of hops from originator to mesh STA transmitting this element.
uint8_t GetHopCount() const
Get hop count value.
uint32_t m_lifetime
lifetime