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 
iterator in a Buffer instance
Definition: buffer.h:99
an EUI-48 address
Definition: mac48-address.h:44
A template-based reference counting class.
Information element, as defined in 802.11-2007 standard.
Describes an address unit in PREQ information element See 7.3.2.96 for more details.
uint32_t GetDestSeqNumber() const
Get destination sequence number.
friend bool operator==(const DestinationAddressUnit &a, const DestinationAddressUnit &b)
equality operator
void SetDestSeqNumber(uint32_t dest_seq_number)
Set destination sequence number.
Mac48Address m_destinationAddress
destination address
uint32_t m_destSeqNumber
destination sequence number
Mac48Address GetDestinationAddress() const
Get destination address function.
void SetFlags(bool doFlag, bool rfFlag, bool usnFlag)
Set flags function.
void SetDestinationAddress(Mac48Address dest_address)
Set destination address function.
See 7.3.2.96 of 802.11s draft 2.07.
uint32_t GetOriginatorSeqNumber() const
Get originator sequence numnber value.
uint32_t m_originatorSeqNumber
originator sequence number
void DelDestinationAddressElement(Mac48Address dest_address)
Delete a destination address unit by destination.
uint8_t m_destCount
destination count
void SetHopcount(uint8_t hopcount)
Set number of hops from originator to mesh STA transmitting this element.
virtual uint8_t GetInformationFieldSize() const
Length of serialized information (i.e., the length of the body of the IE, not including the Element I...
uint8_t GetDestCount() const
Get destination count.
void SetNeedNotPrep()
Set Proactive PREP subfield to off.
bool IsUnicastPreq() const
Is unicast PREQ function.
uint8_t GetHopCount() const
Get hop count value.
void SetUnicastPreq()
Set flag indicating that PREQ is unicast.
std::vector< Ptr< DestinationAddressUnit > > GetDestinationList()
Get all destinations, which are stored in PREQ:
void SetOriginatorSeqNumber(uint32_t originator_seq_number)
Set originator sequence number.
uint32_t GetMetric() const
Get metric value.
void SetTTL(uint8_t ttl)
Set remaining number of hops allowed for this element.
uint32_t m_preqId
PREQ ID.
void SetOriginatorAddress(Mac48Address originator_address)
Set originator address value.
friend bool operator==(const IePreq &a, const IePreq &b)
equality operator
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)
virtual WifiInformationElementId ElementId() const
Mac48Address GetOriginatorAddress() const
Get originator address value.
void DecrementTtl()
Handle TTL.
uint32_t GetPreqID() const
Get path discovery id field.
uint8_t m_hopCount
hop count
void ClearDestinationAddressElements()
Clear PREQ: remove all destinations.
void SetDestCount(uint8_t dest_count)
Set destination count value.
virtual void Print(std::ostream &os) const
Generate human-readable form of IE.
void SetMetric(uint32_t metric)
Set metric value.
bool IsFull() const
Is full function.
uint8_t m_flags
flags
bool MayAddAddress(Mac48Address originator)
Checks that preq's originator address equals to originator, and this preq is not proactive.
virtual void SerializeInformationField(Buffer::Iterator i) const
Serialize information (i.e., the body of the IE, not including the Element ID and length octets)
uint32_t m_metric
metric
uint8_t GetTtl() const
Get TTL value.
void SetPreqID(uint32_t id)
Set path discovery id field.
void IncrementMetric(uint32_t metric)
Handle Metric:
Mac48Address m_originatorAddress
originator address
uint8_t m_maxSize
how many destinations we support
uint32_t GetLifetime() const
Get lifetime value.
std::vector< Ptr< DestinationAddressUnit > > m_destinations
the destinations
void AddDestinationAddressElement(bool doFlag, bool rfFlag, Mac48Address dest_address, uint32_t dest_seq_number)
Add a destination address unit: flags, destination and sequence number.
bool IsNeedNotPrep() const
Check whether Proactive PREP subfield to off.
void SetLifetime(uint32_t lifetime)
Set lifetime in TUs for the forwarding information to be considered valid.
uint32_t m_lifetime
lifetime
bool operator==(const MeshHeader &a, const MeshHeader &b)
std::ostream & operator<<(std::ostream &os, const IeBeaconTiming &a)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.