|
andreev@5139
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
|
andreev@5139
|
2 |
/*
|
|
andreev@5139
|
3 |
* Copyright (c) 2009 IITP RAS
|
|
andreev@5139
|
4 |
*
|
|
andreev@5139
|
5 |
* This program is free software; you can redistribute it and/or modify
|
|
andreev@5139
|
6 |
* it under the terms of the GNU General Public License version 2 as
|
|
andreev@5139
|
7 |
* published by the Free Software Foundation;
|
|
andreev@5139
|
8 |
*
|
|
andreev@5139
|
9 |
* This program is distributed in the hope that it will be useful,
|
|
andreev@5139
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
andreev@5139
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
andreev@5139
|
12 |
* GNU General Public License for more details.
|
|
andreev@5139
|
13 |
*
|
|
andreev@5139
|
14 |
* You should have received a copy of the GNU General Public License
|
|
andreev@5139
|
15 |
* along with this program; if not, write to the Free Software
|
|
andreev@5139
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
andreev@5139
|
17 |
*
|
|
andreev@5161
|
18 |
* Authors: Kirill Andreev <andreev@iitp.ru>
|
|
andreev@5161
|
19 |
* Pavel Boyko <boyko.iitp.ru>
|
|
andreev@5139
|
20 |
*/
|
|
andreev@5139
|
21 |
|
|
andreev@5139
|
22 |
#ifndef IE_VECTOR_H
|
|
andreev@5139
|
23 |
#define IE_VECTOR_H
|
|
andreev@5139
|
24 |
|
|
andreev@5158
|
25 |
#include "ns3/header.h"
|
|
mathieu@5505
|
26 |
#include "ns3/simple-ref-count.h"
|
|
andreev@5139
|
27 |
|
|
andreev@5139
|
28 |
namespace ns3 {
|
|
andreev@5139
|
29 |
class Packet;
|
|
andreev@5139
|
30 |
/**
|
|
andreev@5139
|
31 |
* \ingroup mesh
|
|
andreev@5139
|
32 |
*
|
|
andreev@5161
|
33 |
* \brief Enum of all known information element id (aka tags).
|
|
andreev@5161
|
34 |
*
|
|
andreev@5161
|
35 |
* For now only 802.11s (mesh) related elements are supported here (so 11S prefix),
|
|
andreev@5161
|
36 |
* but this can change in future.
|
|
andreev@5161
|
37 |
*
|
|
andreev@5161
|
38 |
* Note that 802.11s element ids are not yet officially assigned, we use ones
|
|
andreev@5161
|
39 |
* compatible with open80211s (http://o11s.org/) implementation.
|
|
andreev@5161
|
40 |
*/
|
|
andreev@5161
|
41 |
enum WifiElementId {
|
|
andreev@5161
|
42 |
/* begin of open80211s-compatible IDs */
|
|
andreev@5161
|
43 |
IE11S_MESH_CONFIGURATION = 51,
|
|
andreev@5161
|
44 |
IE11S_MESH_ID = 52,
|
|
andreev@5161
|
45 |
/* end of open80211s-compatible IDs */
|
|
andreev@5161
|
46 |
IE11S_LINK_METRIC_REPORT = 20,
|
|
andreev@5161
|
47 |
IE11S_CONGESTION_NOTIFICATION,
|
|
andreev@5161
|
48 |
/* begin of open80211s-compatible IDs */
|
|
andreev@5161
|
49 |
IE11S_PEERING_MANAGEMENT = 55,
|
|
andreev@5161
|
50 |
/* end of open80211s-compatible IDs */
|
|
andreev@5161
|
51 |
IE11S_SUPP_MBSS_REG_CLASSES_CHANNELS = 23,
|
|
andreev@5161
|
52 |
IE11S_MESH_CHANNEL_SWITCH_ANNOUNCEMENT,
|
|
andreev@5161
|
53 |
IE11S_MESH_TIM,
|
|
andreev@5161
|
54 |
IE11S_AWAKE_WINDOW,
|
|
andreev@5161
|
55 |
IE11S_BEACON_TIMING,
|
|
andreev@5161
|
56 |
IE11S_MCCAOP_SETUP_REQUEST,
|
|
andreev@5161
|
57 |
IE11S_MCCAOP_SETUP_REPLY,
|
|
andreev@5161
|
58 |
IE11S_MCCAOP_ADVERTISEMENT,
|
|
andreev@5161
|
59 |
IE11S_MCCAOP_RESERVATION_TEARDOWN,
|
|
andreev@5161
|
60 |
IE11S_PORTAL_ANNOUNCEMENT,
|
|
andreev@5161
|
61 |
IE11S_RANN = 67,
|
|
andreev@5161
|
62 |
/* begin of open80211s-compatible IDs */
|
|
andreev@5161
|
63 |
IE11S_PREQ = 68,
|
|
andreev@5161
|
64 |
IE11S_PREP = 69,
|
|
andreev@5161
|
65 |
IE11S_PERR = 70,
|
|
andreev@5161
|
66 |
/* end of open80211s-compatible IDs */
|
|
andreev@5161
|
67 |
IE11S_PROXY_UPDATE = 37,
|
|
andreev@5161
|
68 |
IE11S_PROXY_UPDATE_CONFIRMATION,
|
|
andreev@5161
|
69 |
IE11S_ABBREVIATED_HANDSHAKE,
|
|
andreev@5161
|
70 |
IE11S_MESH_PEERING_PROTOCOL_VERSION = 74,
|
|
andreev@5161
|
71 |
};
|
|
andreev@5161
|
72 |
|
|
andreev@5161
|
73 |
/**
|
|
andreev@5161
|
74 |
* \ingroup mesh
|
|
andreev@5161
|
75 |
*
|
|
andreev@5161
|
76 |
* \brief Information element, as defined in 802.11-2007 standard
|
|
andreev@5161
|
77 |
*
|
|
andreev@5161
|
78 |
* Elements are defined to have a common general format consisting of a 1 octet Element ID field, a 1 octet
|
|
andreev@5161
|
79 |
* length field, and a variable-length element-specific information field. Each element is assigned a unique
|
|
andreev@5161
|
80 |
* Element ID as defined in this standard. The Length field specifies the number of octets in the Information
|
|
andreev@5161
|
81 |
* field.
|
|
andreev@5161
|
82 |
*/
|
|
mathieu@5505
|
83 |
class WifiInformationElement : public SimpleRefCount<WifiInformationElement>
|
|
andreev@5161
|
84 |
{
|
|
andreev@5161
|
85 |
public:
|
|
mathieu@5505
|
86 |
virtual ~WifiInformationElement ();
|
|
andreev@5161
|
87 |
///\name Each subclass must implement
|
|
andreev@5161
|
88 |
//\{
|
|
andreev@5162
|
89 |
virtual void Print (std::ostream &os) const = 0;
|
|
andreev@5161
|
90 |
/// Own unique Element ID
|
|
andreev@5161
|
91 |
virtual WifiElementId ElementId () const = 0;
|
|
andreev@5161
|
92 |
/// Length of serialized information
|
|
andreev@5161
|
93 |
virtual uint8_t GetInformationSize () const = 0;
|
|
andreev@5161
|
94 |
/// Serialize information
|
|
andreev@5161
|
95 |
virtual void SerializeInformation (Buffer::Iterator start) const = 0;
|
|
andreev@5161
|
96 |
/// Deserialize information
|
|
andreev@5161
|
97 |
virtual uint8_t DeserializeInformation (Buffer::Iterator start, uint8_t length) = 0;
|
|
andreev@5161
|
98 |
//\}
|
|
andreev@5161
|
99 |
|
|
andreev@5161
|
100 |
/// Compare information elements using Element ID
|
|
andreev@5161
|
101 |
friend bool operator< (WifiInformationElement const & a, WifiInformationElement const & b);
|
|
boyko@5184
|
102 |
///
|
|
boyko@5184
|
103 |
virtual bool operator== (WifiInformationElement const & a) { return false; }
|
|
andreev@5161
|
104 |
};
|
|
andreev@5161
|
105 |
|
|
andreev@5161
|
106 |
/// Compare information elements using Element ID
|
|
andreev@5161
|
107 |
bool operator< (WifiInformationElement const & a, WifiInformationElement const & b);
|
|
andreev@5161
|
108 |
|
|
andreev@5161
|
109 |
/**
|
|
andreev@5161
|
110 |
* \ingroup mesh
|
|
andreev@5161
|
111 |
*
|
|
andreev@5139
|
112 |
* \brief Information element vector
|
|
andreev@5139
|
113 |
*
|
|
andreev@5139
|
114 |
* Implements a vector of WifiInformationElement's
|
|
andreev@5139
|
115 |
*/
|
|
andreev@5158
|
116 |
class WifiInformationElementVector : public Header
|
|
andreev@5139
|
117 |
{
|
|
andreev@5139
|
118 |
public:
|
|
andreev@5139
|
119 |
WifiInformationElementVector ();
|
|
andreev@5139
|
120 |
~WifiInformationElementVector ();
|
|
andreev@5158
|
121 |
///\name Inherited from Header
|
|
andreev@5158
|
122 |
//\{
|
|
andreev@5158
|
123 |
static TypeId GetTypeId ();
|
|
andreev@5158
|
124 |
TypeId GetInstanceTypeId () const;
|
|
andreev@5158
|
125 |
virtual uint32_t GetSerializedSize () const;
|
|
andreev@5158
|
126 |
virtual void Serialize (Buffer::Iterator start) const;
|
|
andreev@5167
|
127 |
/**
|
|
andreev@5167
|
128 |
* \attention When you use RemoveHeader, WifiInformationElementVector supposes, that
|
|
andreev@5167
|
129 |
* all buffer consists of information elements
|
|
andreev@5167
|
130 |
* @param start
|
|
andreev@5167
|
131 |
* @return
|
|
andreev@5167
|
132 |
*/
|
|
andreev@5158
|
133 |
virtual uint32_t Deserialize (Buffer::Iterator start);
|
|
andreev@5158
|
134 |
virtual void Print (std::ostream &os) const;
|
|
andreev@5158
|
135 |
//\}
|
|
andreev@5158
|
136 |
/**
|
|
andreev@5158
|
137 |
* \brief Needed when you try to deserialize a lonely IE inside other header
|
|
andreev@5158
|
138 |
* \param start is the start of the buffer
|
|
andreev@5158
|
139 |
* \return deserialized bytes
|
|
andreev@5158
|
140 |
*/
|
|
andreev@5158
|
141 |
virtual uint32_t DeserializeSingleIe (Buffer::Iterator start);
|
|
andreev@5167
|
142 |
///Set maximum size to control overflow of the max packet length
|
|
andreev@5139
|
143 |
void SetMaxSize (uint16_t size);
|
|
andreev@5139
|
144 |
typedef std::vector<Ptr<WifiInformationElement> >::iterator Iterator;
|
|
andreev@5139
|
145 |
Iterator Begin ();
|
|
andreev@5139
|
146 |
Iterator End ();
|
|
andreev@5139
|
147 |
bool AddInformationElement (Ptr<WifiInformationElement> element);
|
|
andreev@5139
|
148 |
Ptr<WifiInformationElement> FindFirst (enum WifiElementId id) const;
|
|
andreev@5139
|
149 |
private:
|
|
andreev@5177
|
150 |
typedef std::vector<Ptr<WifiInformationElement> > IE_VECTOR;
|
|
andreev@5139
|
151 |
uint32_t GetSize () const;
|
|
andreev@5139
|
152 |
IE_VECTOR m_elements;
|
|
andreev@5139
|
153 |
/// Size in bytes (actually, max packet length)
|
|
andreev@5139
|
154 |
uint16_t m_maxSize;
|
|
andreev@5140
|
155 |
friend bool operator== (const WifiInformationElementVector & a, const WifiInformationElementVector & b);
|
|
andreev@5139
|
156 |
};
|
|
andreev@5140
|
157 |
bool operator== (const WifiInformationElementVector & a, const WifiInformationElementVector & b);
|
|
andreev@5139
|
158 |
}
|
|
andreev@5139
|
159 |
#endif
|