A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ie-dot11s-beacon-timing.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008,2009 IITP RAS
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Kirill Andreev <andreev@iitp.ru>
7 */
8
9#ifndef WIFI_TIMING_ELEMENT_H
10#define WIFI_TIMING_ELEMENT_H
11
12#include "ns3/mesh-information-element-vector.h"
13#include "ns3/nstime.h"
14
15#include <vector>
16
17namespace ns3
18{
19namespace dot11s
20{
21/**
22 * \ingroup dot11s
23 * \brief Information element describing one unit of beacon timing element
24 */
25class IeBeaconTimingUnit : public SimpleRefCount<IeBeaconTimingUnit>
26{
27 public:
29 /**
30 * Set AID value
31 * \param aid the AID
32 */
33 void SetAid(uint8_t aid);
34 /**
35 * Set last beacon value
36 * \param lastBeacon the last beacon
37 */
38 void SetLastBeacon(uint16_t lastBeacon);
39 /**
40 * Set beacon interval value
41 * \param beaconInterval the beacon interval
42 */
43 void SetBeaconInterval(uint16_t beaconInterval);
44
45 /**
46 * Get AID value
47 * \returns the AID
48 */
49 uint8_t GetAid() const;
50 /**
51 * Get last beacon value
52 * \returns the last beacon
53 */
54 uint16_t GetLastBeacon() const;
55 /**
56 * Get beacon interval
57 * \returns the beacon interval
58 */
59 uint16_t GetBeaconInterval() const;
60
61 private:
62 /// Least significant octet of AID:
63 uint8_t m_aid;
64 /// Last time we received a beacon in accordance with a local TSF measured in 256 microseconds
65 /// unit
66 uint16_t m_lastBeacon;
67 /// Beacon interval of remote mesh point
69 /**
70 * equality operator
71 *
72 * \param a lhs
73 * \param b rhs
74 * \returns true if equal
75 */
76 friend bool operator==(const IeBeaconTimingUnit& a, const IeBeaconTimingUnit& b);
77};
78
79/**
80 * \ingroup dot11s
81 * \brief See 7.3.2.89 of 802.11s draft 2.07
82 */
84{
85 public:
86 /**
87 * \ingroup dot11s
88 * This type is a list of timing elements obtained from neighbours with their beacons:
89 */
90 typedef std::vector<Ptr<IeBeaconTimingUnit>> NeighboursTimingUnitsList;
91
93 /**
94 * This methods are needed for beacon collision
95 * avoidance module:
96 * \returns the neighbor timing elements list
97 */
99 /**
100 * Add neighbors timing element unit
101 * \param aid the AID
102 * \param last_beacon the last beacon time
103 * \param beacon_interval the beacon interval
104 */
105 void AddNeighboursTimingElementUnit(uint16_t aid, Time last_beacon, Time beacon_interval);
106 /**
107 * Delete neighbors timing element unit
108 * \param aid the AID
109 * \param last_beacon the last beacon time
110 * \param beacon_interval the beacon interval
111 */
112 void DelNeighboursTimingElementUnit(uint16_t aid, Time last_beacon, Time beacon_interval);
113 /// Clear timing element
114 void ClearTimingElement();
115
116 // Inherited from WifiInformationElement
117 WifiInformationElementId ElementId() const override;
118 uint16_t GetInformationFieldSize() const override;
119 void SerializeInformationField(Buffer::Iterator i) const override;
120 uint16_t DeserializeInformationField(Buffer::Iterator i, uint16_t length) override;
121 void Print(std::ostream& os) const override;
122
123 /**
124 * equality operator
125 *
126 * \param a lhs
127 * \returns true if equal
128 */
129 bool operator==(const WifiInformationElement& a) const override;
130
131 private:
132 // Converters:
133 /**
134 * Timestamp to U16 function
135 * \param x the timestamp
136 * \returns the U16
137 */
138 static uint16_t TimestampToU16(Time x);
139 /**
140 * Beacon interval to U16 function
141 * \param x the beacon interval
142 * \returns the U16
143 */
144 static uint16_t BeaconIntervalToU16(Time x);
145 /**
146 * Aid to U8 function
147 * \param x the U16
148 * \returns the AID
149 */
150 static uint8_t AidToU8(uint16_t x);
151
153 /**
154 * Timing element parameters:
155 */
156 uint16_t m_numOfUnits;
157};
158
159bool operator==(const IeBeaconTimingUnit& a, const IeBeaconTimingUnit& b);
160std::ostream& operator<<(std::ostream& os, const IeBeaconTiming& beaconTiming);
161} // namespace dot11s
162} // namespace ns3
163#endif
iterator in a Buffer instance
Definition buffer.h:89
A template-based reference counting class.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
Information element, as defined in 802.11-2007 standard.
See 7.3.2.89 of 802.11s draft 2.07.
uint16_t GetInformationFieldSize() const override
Length of serialized information (i.e., the length of the body of the IE, not including the Element I...
void AddNeighboursTimingElementUnit(uint16_t aid, Time last_beacon, Time beacon_interval)
Add neighbors timing element unit.
static uint16_t BeaconIntervalToU16(Time x)
Beacon interval to U16 function.
void SerializeInformationField(Buffer::Iterator i) const override
Serialize information (i.e., the body of the IE, not including the Element ID and length octets)
bool operator==(const WifiInformationElement &a) const override
equality operator
uint16_t DeserializeInformationField(Buffer::Iterator i, uint16_t length) override
Deserialize information (i.e., the body of the IE, not including the Element ID and length octets)
void ClearTimingElement()
Clear timing element.
uint16_t m_numOfUnits
Timing element parameters:
NeighboursTimingUnitsList GetNeighboursTimingElementsList()
This methods are needed for beacon collision avoidance module:
static uint8_t AidToU8(uint16_t x)
Aid to U8 function.
WifiInformationElementId ElementId() const override
Get the wifi information element ID.
NeighboursTimingUnitsList m_neighbours
the neighbors
static uint16_t TimestampToU16(Time x)
Timestamp to U16 function.
void Print(std::ostream &os) const override
Generate human-readable form of IE.
void DelNeighboursTimingElementUnit(uint16_t aid, Time last_beacon, Time beacon_interval)
Delete neighbors timing element unit.
Information element describing one unit of beacon timing element.
uint16_t m_lastBeacon
Last time we received a beacon in accordance with a local TSF measured in 256 microseconds unit.
void SetBeaconInterval(uint16_t beaconInterval)
Set beacon interval value.
friend bool operator==(const IeBeaconTimingUnit &a, const IeBeaconTimingUnit &b)
equality operator
uint16_t m_beaconInterval
Beacon interval of remote mesh point.
uint16_t GetBeaconInterval() const
Get beacon interval.
void SetAid(uint8_t aid)
Set AID value.
void SetLastBeacon(uint16_t lastBeacon)
Set last beacon value.
uint16_t GetLastBeacon() const
Get last beacon value.
uint8_t GetAid() const
Get AID value.
uint8_t m_aid
Least significant octet of AID:
std::vector< Ptr< IeBeaconTimingUnit > > NeighboursTimingUnitsList
This type is a list of timing elements obtained from neighbours with their beacons:
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.