A Discrete-Event Network Simulator
API
ie-dot11s-beacon-timing.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_TIMING_ELEMENT_H
22 #define WIFI_TIMING_ELEMENT_H
23 
24 #include <vector>
25 #include "ns3/nstime.h"
26 #include "ns3/mesh-information-element-vector.h"
27 
28 namespace ns3 {
29 namespace dot11s {
34 class IeBeaconTimingUnit : public SimpleRefCount<IeBeaconTimingUnit>
35 {
36 public:
42  void SetAid (uint8_t aid);
47  void SetLastBeacon (uint16_t lastBeacon);
52  void SetBeaconInterval (uint16_t beaconInterval);
53 
58  uint8_t GetAid () const;
63  uint16_t GetLastBeacon () const;
68  uint16_t GetBeaconInterval () const;
69 
70 private:
72  uint8_t m_aid;
74  uint16_t m_lastBeacon;
76  uint16_t m_beaconInterval;
84  friend bool operator== (const IeBeaconTimingUnit & a, const IeBeaconTimingUnit & b);
85 };
86 
92 {
93 public:
98  typedef std::vector< Ptr<IeBeaconTimingUnit> > NeighboursTimingUnitsList;
99 
100  IeBeaconTiming ();
114  uint16_t aid,
115  Time last_beacon,
116  Time beacon_interval
117  );
125  uint16_t aid,
126  Time last_beacon,
127  Time beacon_interval
128  );
130  void ClearTimingElement ();
131 
132  // Inherited from WifiInformationElement
133  virtual WifiInformationElementId ElementId () const;
134  virtual uint8_t GetInformationFieldSize () const;
135  virtual void SerializeInformationField (Buffer::Iterator i) const;
136  virtual uint8_t DeserializeInformationField (Buffer::Iterator i, uint8_t length);
137  virtual void Print (std::ostream& os) const;
138 
145  bool operator== (WifiInformationElement const & a) const;
146 private:
147  // Converters:
153  static uint16_t TimestampToU16 (Time x);
159  static uint16_t BeaconIntervalToU16 (Time x);
165  static uint8_t AidToU8 (uint16_t x);
166 
168 
171  uint16_t m_numOfUnits;
172 };
173 bool operator== (const IeBeaconTimingUnit & a, const IeBeaconTimingUnit & b);
174 std::ostream &operator << (std::ostream &os, const IeBeaconTiming &beaconTiming);
175 } // namespace dot11s
176 } // namespace ns3
177 #endif
uint8_t m_aid
Least significant octet of AID:
uint8_t GetAid() const
Get AID value.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
NeighboursTimingUnitsList m_neighbours
the neighbors
uint16_t GetBeaconInterval() const
Get beacon interval.
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) ...
uint16_t m_lastBeacon
Last time we received a beacon in accordance with a local TSF measured in 256 microseconds unit...
virtual void Print(std::ostream &os) const
Generate human-readable form of IE.
NeighboursTimingUnitsList GetNeighboursTimingElementsList()
This methods are needed for beacon collision avoidance module:
bool operator==(const MeshHeader &a, const MeshHeader &b)
std::vector< Ptr< IeBeaconTimingUnit > > NeighboursTimingUnitsList
This type is a list of timing elements obtained from neighbours with their beacons: ...
iterator in a Buffer instance
Definition: buffer.h:98
void SetBeaconInterval(uint16_t beaconInterval)
Set beacon interval value.
Information element, as defined in 802.11-2007 standardThe IEEE 802.11 standard includes the notion o...
void ClearTimingElement()
Clear timing 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...
static uint16_t BeaconIntervalToU16(Time x)
Beacon interval to U16 function.
See 7.3.2.89 of 802.11s draft 2.07.
uint16_t m_numOfUnits
Timing element parameters:
uint16_t GetLastBeacon() const
Get last beacon value.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual WifiInformationElementId ElementId() const
bool operator==(WifiInformationElement const &a) const
equality operator
friend bool operator==(const IeBeaconTimingUnit &a, const IeBeaconTimingUnit &b)
equality operator
static uint16_t TimestampToU16(Time x)
Timestamp to U16 function.
uint16_t m_beaconInterval
Beacon interval of remote mesh point.
void DelNeighboursTimingElementUnit(uint16_t aid, Time last_beacon, Time beacon_interval)
Delete neighbors timing element unit.
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.
void AddNeighboursTimingElementUnit(uint16_t aid, Time last_beacon, Time beacon_interval)
Add neighbors timing element unit.
void SetLastBeacon(uint16_t lastBeacon)
Set last beacon value.
A template-based reference counting class.
std::ostream & operator<<(std::ostream &os, const IeBeaconTiming &a)
void SetAid(uint8_t aid)
Set AID value.
Information element describing one unit of beacon timing element.
static uint8_t AidToU8(uint16_t x)
Aid to U8 function.
virtual void SerializeInformationField(Buffer::Iterator i) const
Serialize information (i.e., the body of the IE, not including the Element ID and length octets) ...