A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
mgt-headers.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2006 INRIA
4  * Copyright (c) 2009 MIRKO BANCHI
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  * Author: Mirko Banchi <mk.banchi@gmail.com>
21  */
22 #ifndef MGT_HEADERS_H
23 #define MGT_HEADERS_H
24 
25 #include <stdint.h>
26 
27 #include "ns3/header.h"
28 #include "status-code.h"
29 #include "capability-information.h"
30 #include "supported-rates.h"
31 #include "ssid.h"
32 
33 namespace ns3 {
34 
40 {
41 public:
44 
45  void SetSsid (Ssid ssid);
46  void SetSupportedRates (SupportedRates rates);
47  void SetListenInterval (uint16_t interval);
48 
49  Ssid GetSsid (void) const;
50  SupportedRates GetSupportedRates (void) const;
51  uint16_t GetListenInterval (void) const;
52 
53  static TypeId GetTypeId (void);
54  virtual TypeId GetInstanceTypeId (void) const;
55  virtual void Print (std::ostream &os) const;
56  virtual uint32_t GetSerializedSize (void) const;
57  virtual void Serialize (Buffer::Iterator start) const;
58  virtual uint32_t Deserialize (Buffer::Iterator start);
59 
60 private:
64  uint16_t m_listenInterval;
65 };
66 
67 
73 {
74 public:
77 
80 
81  void SetSupportedRates (SupportedRates rates);
82  void SetStatusCode (StatusCode code);
83 
84  static TypeId GetTypeId (void);
85  virtual TypeId GetInstanceTypeId (void) const;
86  virtual void Print (std::ostream &os) const;
87  virtual uint32_t GetSerializedSize (void) const;
88  virtual void Serialize (Buffer::Iterator start) const;
89  virtual uint32_t Deserialize (Buffer::Iterator start);
90 
91 private:
95  uint16_t m_aid;
96 };
97 
98 
104 {
105 public:
107 
108  void SetSsid (Ssid ssid);
109  void SetSupportedRates (SupportedRates rates);
110  Ssid GetSsid (void) const;
111  SupportedRates GetSupportedRates (void) const;
112 
113  static TypeId GetTypeId (void);
114  virtual TypeId GetInstanceTypeId (void) const;
115  virtual void Print (std::ostream &os) const;
116  virtual uint32_t GetSerializedSize (void) const;
117  virtual void Serialize (Buffer::Iterator start) const;
118  virtual uint32_t Deserialize (Buffer::Iterator start);
119 private:
122 };
123 
124 
130 {
131 public:
134 
135  Ssid GetSsid (void) const;
136  uint64_t GetBeaconIntervalUs (void) const;
137  SupportedRates GetSupportedRates (void) const;
138 
139  void SetSsid (Ssid ssid);
140  void SetBeaconIntervalUs (uint64_t us);
141  void SetSupportedRates (SupportedRates rates);
142  uint64_t GetTimestamp ();
143  static TypeId GetTypeId (void);
144  virtual TypeId GetInstanceTypeId (void) const;
145  virtual void Print (std::ostream &os) const;
146  virtual uint32_t GetSerializedSize (void) const;
147  virtual void Serialize (Buffer::Iterator start) const;
148  virtual uint32_t Deserialize (Buffer::Iterator start);
149 
150 private:
151  uint64_t m_timestamp;
156 };
157 
158 
164 {
165 };
166 
167 /****************************
168 * Action frames
169 *****************************/
170 
178 class WifiActionHeader : public Header
179 {
180 public:
181  WifiActionHeader ();
183 
184  /* Compatible with open80211s implementation */
185  enum CategoryValue //table 7-24 staring from 4
186  {
194  };
195  /* Compatible with open80211s implementation */
197  {
201  };
203  {
206  };
207  /* Compatible with open80211s implementation */
209  {
211  };
213  {
215  };
217  {
228  };
230  {
234  };
235  typedef union
236  {
243  } ActionValue;
244  void SetAction (enum CategoryValue type,ActionValue action);
245 
248  static TypeId GetTypeId (void);
249  virtual TypeId GetInstanceTypeId () const;
250  virtual void Print (std::ostream &os) const;
251  virtual uint32_t GetSerializedSize () const;
252  virtual void Serialize (Buffer::Iterator start) const;
253  virtual uint32_t Deserialize (Buffer::Iterator start);
254 private:
255  uint8_t m_category;
256  uint8_t m_actionValue;
257 };
258 
264 {
265 public:
267 
268  static TypeId GetTypeId (void);
269  virtual TypeId GetInstanceTypeId (void) const;
270  virtual void Print (std::ostream &os) const;
271  virtual uint32_t GetSerializedSize (void) const;
272  virtual void Serialize (Buffer::Iterator start) const;
273  virtual uint32_t Deserialize (Buffer::Iterator start);
274 
275  void SetDelayedBlockAck ();
276  void SetImmediateBlockAck ();
277  void SetTid (uint8_t tid);
278  void SetTimeout (uint16_t timeout);
279  void SetBufferSize (uint16_t size);
280  void SetStartingSequence (uint16_t seq);
281  void SetAmsduSupport (bool supported);
282 
283  uint16_t GetStartingSequence (void) const;
284  uint8_t GetTid (void) const;
285  bool IsImmediateBlockAck (void) const;
286  uint16_t GetTimeout (void) const;
287  uint16_t GetBufferSize (void) const;
288  bool IsAmsduSupported (void) const;
289 
290 private:
291  uint16_t GetParameterSet (void) const;
292  void SetParameterSet (uint16_t params);
293  uint16_t GetStartingSequenceControl (void) const;
294  void SetStartingSequenceControl (uint16_t seqControl);
295 
296  uint8_t m_dialogToken; /* Not used for now */
297  uint8_t m_amsduSupport;
298  uint8_t m_policy;
299  uint8_t m_tid;
300  uint16_t m_bufferSize;
301  uint16_t m_timeoutValue;
302  uint16_t m_startingSeq;
303 };
304 
305 
311 {
312 public:
314 
315  static TypeId GetTypeId (void);
316  virtual TypeId GetInstanceTypeId (void) const;
317  virtual void Print (std::ostream &os) const;
318  virtual uint32_t GetSerializedSize (void) const;
319  virtual void Serialize (Buffer::Iterator start) const;
320  virtual uint32_t Deserialize (Buffer::Iterator start);
321 
322  void SetDelayedBlockAck ();
323  void SetImmediateBlockAck ();
324  void SetTid (uint8_t tid);
325  void SetTimeout (uint16_t timeout);
326  void SetBufferSize (uint16_t size);
327  void SetStatusCode (StatusCode code);
328  void SetAmsduSupport (bool supported);
329 
330  StatusCode GetStatusCode (void) const;
331  uint8_t GetTid (void) const;
332  bool IsImmediateBlockAck (void) const;
333  uint16_t GetTimeout (void) const;
334  uint16_t GetBufferSize (void) const;
335  bool IsAmsduSupported (void) const;
336 
337 private:
338  uint16_t GetParameterSet (void) const;
339  void SetParameterSet (uint16_t params);
340 
341  uint8_t m_dialogToken; /* Not used for now */
343  uint8_t m_amsduSupport;
344  uint8_t m_policy;
345  uint8_t m_tid;
346  uint16_t m_bufferSize;
347  uint16_t m_timeoutValue;
348 };
349 
350 
355 class MgtDelBaHeader : public Header
356 {
357 public:
358  MgtDelBaHeader ();
359 
360  static TypeId GetTypeId (void);
361  virtual TypeId GetInstanceTypeId (void) const;
362  virtual void Print (std::ostream &os) const;
363  virtual uint32_t GetSerializedSize (void) const;
364  virtual void Serialize (Buffer::Iterator start) const;
365  virtual uint32_t Deserialize (Buffer::Iterator start);
366 
367  bool IsByOriginator (void) const;
368  uint8_t GetTid (void) const;
369  void SetTid (uint8_t);
370  void SetByOriginator (void);
371  void SetByRecipient (void);
372 
373 private:
374  uint16_t GetParameterSet (void) const;
375  void SetParameterSet (uint16_t params);
376 
377  uint16_t m_initiator;
378  uint16_t m_tid;
379  /* Not used for now.
380  Always set to 1: "Unspecified reason" */
381  uint16_t m_reasonCode;
382 };
383 
384 } // namespace ns3
385 
386 #endif /* MGT_HEADERS_H */