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 ();
116  void AddDestinationAddressElement (
117  bool doFlag,
118  bool rfFlag,
119  Mac48Address dest_address,
120  uint32_t dest_seq_number
121  );
126  void DelDestinationAddressElement (Mac48Address dest_address);
128  void ClearDestinationAddressElements ();
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;
214  Mac48Address GetOriginatorAddress () 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 
void SetFlags(bool doFlag, bool rfFlag, bool usnFlag)
Set flags function.
friend bool operator==(const DestinationAddressUnit &a, const DestinationAddressUnit &b)
equality operator
std::vector< Ptr< DestinationAddressUnit > > m_destinations
the destinations
uint8_t m_destCount
destination count
uint32_t m_destSeqNumber
destination sequence number
uint8_t m_hopCount
hop count
uint32_t m_originatorSeqNumber
originator sequence number
void SetDestSeqNumber(uint32_t dest_seq_number)
Set destination sequence number.
iterator in a Buffer instance
Definition: buffer.h:98
Mac48Address m_originatorAddress
originator address
Information element, as defined in 802.11-2007 standardThe IEEE 802.11 standard includes the notion o...
Mac48Address m_destinationAddress
destination address
See 7.3.2.96 of 802.11s draft 2.07.
uint32_t m_preqId
PREQ ID.
uint32_t m_metric
metric
Every class exported by the ns3 library is enclosed in the ns3 namespace.
an EUI-48 address
Definition: mac48-address.h:43
uint32_t GetDestSeqNumber() const
Get destination sequence number.
uint8_t m_maxSize
how many destinations we support
void Print(ComponentCarrier cc)
Mac48Address GetDestinationAddress() const
Get destination address function.
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.
uint8_t m_flags
flags
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.
std::ostream & operator<<(std::ostream &os, const IeBeaconTiming &a)
plr SetMetric(metricLocal)
uint32_t m_lifetime
lifetime