|
mazo@4793
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
|
mazo@4793
|
2 |
/*
|
|
mazo@4793
|
3 |
* Copyright (c) 2008,2009 IITP RAS
|
|
mazo@4793
|
4 |
*
|
|
mazo@4793
|
5 |
* This program is free software; you can redistribute it and/or modify
|
|
mazo@4812
|
6 |
* it under the terms of the GNU General Public License version 2 as
|
|
mazo@4793
|
7 |
* published by the Free Software Foundation;
|
|
mazo@4793
|
8 |
*
|
|
mazo@4793
|
9 |
* This program is distributed in the hope that it will be useful,
|
|
mazo@4793
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
mazo@4793
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
mazo@4793
|
12 |
* GNU General Public License for more details.
|
|
mazo@4793
|
13 |
*
|
|
mazo@4793
|
14 |
* You should have received a copy of the GNU General Public License
|
|
mazo@4793
|
15 |
* along with this program; if not, write to the Free Software
|
|
mazo@4793
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
mazo@4793
|
17 |
*
|
|
mazo@4793
|
18 |
* Author: Kirill Andreev <andreev@iitp.ru>
|
|
mazo@4793
|
19 |
*/
|
|
mazo@4793
|
20 |
|
|
mazo@4812
|
21 |
#ifndef WIFI_TIMING_ELEMENT_H
|
|
mazo@4812
|
22 |
#define WIFI_TIMING_ELEMENT_H
|
|
mazo@4793
|
23 |
|
|
andreev@4951
|
24 |
#include <vector>
|
|
mazo@4812
|
25 |
#include "ns3/nstime.h"
|
|
andreev@5161
|
26 |
#include "ns3/wifi-information-element-vector.h"
|
|
boyko@4862
|
27 |
|
|
andreev@5132
|
28 |
namespace ns3 {
|
|
andreev@5132
|
29 |
namespace dot11s {
|
|
boyko@4807
|
30 |
/**
|
|
boyko@4851
|
31 |
* \ingroup dot11s
|
|
andreev@4850
|
32 |
* \brief Describes one unit of beacon timing element
|
|
boyko@4807
|
33 |
*/
|
|
mathieu@5505
|
34 |
class IeBeaconTimingUnit : public SimpleRefCount<IeBeaconTimingUnit>
|
|
mazo@4793
|
35 |
{
|
|
mazo@4812
|
36 |
public:
|
|
andreev@4876
|
37 |
IeBeaconTimingUnit ();
|
|
mazo@4852
|
38 |
void SetAid (uint8_t aid);
|
|
boyko@5184
|
39 |
void SetLastBeacon (uint16_t lastBeacon);
|
|
boyko@5184
|
40 |
void SetBeaconInterval (uint16_t beaconInterval);
|
|
mazo@4793
|
41 |
|
|
andreev@4951
|
42 |
uint8_t GetAid () const;
|
|
andreev@4951
|
43 |
uint16_t GetLastBeacon () const;
|
|
andreev@4951
|
44 |
uint16_t GetBeaconInterval () const;
|
|
andreev@5129
|
45 |
|
|
boyko@5063
|
46 |
private:
|
|
boyko@5063
|
47 |
/// Least significant octet of AID:
|
|
andreev@4850
|
48 |
uint8_t m_aid;
|
|
boyko@5063
|
49 |
/// Last time we received a beacon in accordance with a local TSF measured in 256 microseconds unit
|
|
andreev@4850
|
50 |
uint16_t m_lastBeacon;
|
|
boyko@5063
|
51 |
/// Beacon interval of remote mesh point
|
|
andreev@4850
|
52 |
uint16_t m_beaconInterval;
|
|
andreev@4951
|
53 |
friend bool operator== (const IeBeaconTimingUnit & a, const IeBeaconTimingUnit & b);
|
|
mazo@4793
|
54 |
};
|
|
boyko@4807
|
55 |
|
|
boyko@4807
|
56 |
/**
|
|
boyko@4851
|
57 |
* \ingroup dot11s
|
|
andreev@4850
|
58 |
* \brief See 7.3.2.89 of 802.11s draft 2.07
|
|
boyko@4807
|
59 |
*/
|
|
andreev@4876
|
60 |
class IeBeaconTiming : public WifiInformationElement
|
|
mazo@4793
|
61 |
{
|
|
mazo@4812
|
62 |
public:
|
|
andreev@4831
|
63 |
/**
|
|
boyko@4851
|
64 |
* \ingroup dot11s
|
|
andreev@4831
|
65 |
* This type is a list of timing elements obtained from neigbours with their beacons:
|
|
andreev@4831
|
66 |
*/
|
|
andreev@4951
|
67 |
typedef std::vector< Ptr<IeBeaconTimingUnit> > NeighboursTimingUnitsList;
|
|
andreev@4831
|
68 |
|
|
andreev@4876
|
69 |
IeBeaconTiming ();
|
|
andreev@4847
|
70 |
/**
|
|
andreev@4847
|
71 |
* This methods are needed for beacon collision
|
|
andreev@4847
|
72 |
* avoidance module:
|
|
andreev@4847
|
73 |
*/
|
|
mazo@4852
|
74 |
NeighboursTimingUnitsList GetNeighboursTimingElementsList ();
|
|
mazo@4852
|
75 |
void AddNeighboursTimingElementUnit (
|
|
mazo@4812
|
76 |
uint16_t aid,
|
|
andreev@4847
|
77 |
Time last_beacon,
|
|
andreev@4847
|
78 |
Time beacon_interval
|
|
mazo@4812
|
79 |
);
|
|
mazo@4852
|
80 |
void DelNeighboursTimingElementUnit (
|
|
mazo@4812
|
81 |
uint16_t aid,
|
|
andreev@4847
|
82 |
Time last_beacon,
|
|
andreev@4847
|
83 |
Time beacon_interval
|
|
mazo@4812
|
84 |
);
|
|
mazo@4852
|
85 |
void ClearTimingElement ();
|
|
andreev@5159
|
86 |
/**
|
|
andreev@5159
|
87 |
* \name Inherited from WifiInformationElement
|
|
andreev@5159
|
88 |
* \{
|
|
andreev@5159
|
89 |
*/
|
|
andreev@5156
|
90 |
virtual WifiElementId ElementId () const;
|
|
andreev@5156
|
91 |
virtual uint8_t GetInformationSize () const;
|
|
andreev@5156
|
92 |
virtual void SerializeInformation (Buffer::Iterator i) const;
|
|
andreev@5156
|
93 |
virtual uint8_t DeserializeInformation (Buffer::Iterator i, uint8_t length);
|
|
andreev@5162
|
94 |
virtual void Print (std::ostream& os) const;
|
|
andreev@5159
|
95 |
///\}
|
|
boyko@5184
|
96 |
bool operator== (WifiInformationElement const & a);
|
|
andreev@5159
|
97 |
private:
|
|
andreev@4850
|
98 |
/**
|
|
andreev@4850
|
99 |
* Converters:
|
|
andreev@4850
|
100 |
*/
|
|
mazo@4852
|
101 |
static uint16_t TimestampToU16 (Time x);
|
|
mazo@4852
|
102 |
static uint16_t BeaconIntervalToU16 (Time x);
|
|
mazo@4852
|
103 |
static uint8_t AidToU8 (uint16_t x);
|
|
andreev@4850
|
104 |
|
|
mazo@4812
|
105 |
NeighboursTimingUnitsList m_neighbours;
|
|
andreev@4850
|
106 |
/**
|
|
andreev@4850
|
107 |
* Timing element parameters:
|
|
andreev@4850
|
108 |
*/
|
|
mazo@4812
|
109 |
uint16_t m_numOfUnits;
|
|
mazo@4793
|
110 |
};
|
|
andreev@4951
|
111 |
bool operator== (const IeBeaconTimingUnit & a, const IeBeaconTimingUnit & b);
|
|
andreev@5162
|
112 |
std::ostream &operator << (std::ostream &os, const IeBeaconTiming &beaconTiming);
|
|
andreev@4872
|
113 |
} // namespace dot11s
|
|
andreev@4872
|
114 |
} //namespace ns3
|
|
mazo@4793
|
115 |
#endif
|