A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
wifi-mac-header.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2006, 2009 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 WIFI_MAC_HEADER_H
23 #define WIFI_MAC_HEADER_H
24 
25 #include "ns3/header.h"
26 #include "ns3/mac48-address.h"
27 #include "ns3/nstime.h"
28 #include <stdint.h>
29 
30 namespace ns3 {
31 
33 {
40 
54 
70 };
71 
77 class WifiMacHeader : public Header
78 {
79 public:
81  {
83  NO_ACK = 1,
85  BLOCK_ACK = 3,
86  };
87 
89  {
94  };
95 
96  WifiMacHeader ();
97  ~WifiMacHeader ();
98 
99  static TypeId GetTypeId (void);
100  virtual TypeId GetInstanceTypeId (void) const;
101  virtual void Print (std::ostream &os) const;
102  virtual uint32_t GetSerializedSize (void) const;
103  virtual void Serialize (Buffer::Iterator start) const;
104  virtual uint32_t Deserialize (Buffer::Iterator start);
105 
106 
107  void SetAssocReq (void);
108  void SetAssocResp (void);
109  void SetProbeReq (void);
110  void SetProbeResp (void);
111  void SetBeacon (void);
112  void SetTypeData (void);
113  void SetAction ();
114  void SetBlockAckReq (void);
115  void SetBlockAck (void);
116  void SetMultihopAction ();
117  void SetDsFrom (void);
118  void SetDsNotFrom (void);
119  void SetDsTo (void);
120  void SetDsNotTo (void);
125  void SetType (enum WifiMacType type);
126  void SetRawDuration (uint16_t duration);
127  void SetDuration (Time duration);
128  void SetId (uint16_t id);
129  void SetSequenceNumber (uint16_t seq);
130  void SetFragmentNumber (uint8_t frag);
131  void SetNoMoreFragments (void);
132  void SetMoreFragments (void);
133  void SetRetry (void);
134  void SetNoRetry (void);
135  void SetQosTid (uint8_t tid);
136  void SetQosEosp ();
137  void SetQosNoEosp ();
138  void SetQosAckPolicy (enum QosAckPolicy);
139  void SetQosNormalAck (void);
140  void SetQosBlockAck (void);
141  void SetQosNoAck (void);
142  void SetQosAmsdu (void);
143  void SetQosNoAmsdu (void);
144  void SetQosTxopLimit (uint8_t txop);
145  void SetOrder (void);
146  void SetNoOrder (void);
147 
148  Mac48Address GetAddr1 (void) const;
149  Mac48Address GetAddr2 (void) const;
150  Mac48Address GetAddr3 (void) const;
151  Mac48Address GetAddr4 (void) const;
152  enum WifiMacType GetType (void) const;
153  bool IsFromDs (void) const;
154  bool IsToDs (void) const;
155  bool IsData (void) const;
156  bool IsQosData (void) const;
157  bool IsCtl (void) const;
158  bool IsMgt (void) const;
159  bool IsCfpoll (void) const;
160  bool IsRts (void) const;
161  bool IsCts (void) const;
162  bool IsAck (void) const;
163  bool IsBlockAckReq (void) const;
164  bool IsBlockAck (void) const;
165  bool IsAssocReq (void) const;
166  bool IsAssocResp (void) const;
167  bool IsReassocReq (void) const;
168  bool IsReassocResp (void) const;
169  bool IsProbeReq (void) const;
170  bool IsProbeResp (void) const;
171  bool IsBeacon (void) const;
172  bool IsDisassociation (void) const;
173  bool IsAuthentication (void) const;
174  bool IsDeauthentication (void) const;
175  bool IsAction () const;
176  bool IsMultihopAction () const;
177  uint16_t GetRawDuration (void) const;
178  Time GetDuration (void) const;
179  uint16_t GetSequenceControl (void) const;
180  uint16_t GetSequenceNumber (void) const;
181  uint16_t GetFragmentNumber (void) const;
182  bool IsRetry (void) const;
183  bool IsMoreFragments (void) const;
184  bool IsQosBlockAck (void) const;
185  bool IsQosNoAck (void) const;
186  bool IsQosAck (void) const;
187  bool IsQosEosp (void) const;
188  bool IsQosAmsdu (void) const;
189  uint8_t GetQosTid (void) const;
190  enum QosAckPolicy GetQosAckPolicy (void) const;
191  uint8_t GetQosTxopLimit (void) const;
192 
193  uint32_t GetSize (void) const;
194  const char * GetTypeString (void) const;
195 
196 
197 private:
198  uint16_t GetFrameControl (void) const;
199  uint16_t GetQosControl (void) const;
200  void SetFrameControl (uint16_t control);
201  void SetSequenceControl (uint16_t seq);
202  void SetQosControl (uint16_t qos);
203  void PrintFrameControl (std::ostream &os) const;
204 
205  uint8_t m_ctrlType;
206  uint8_t m_ctrlSubtype;
207  uint8_t m_ctrlToDs;
208  uint8_t m_ctrlFromDs;
209  uint8_t m_ctrlMoreFrag;
210  uint8_t m_ctrlRetry;
211  uint8_t m_ctrlMoreData;
212  uint8_t m_ctrlWep;
213  uint8_t m_ctrlOrder;
214  uint16_t m_duration;
218  uint8_t m_seqFrag;
219  uint16_t m_seqSeq;
221  uint8_t m_qosTid;
222  uint8_t m_qosEosp;
223  uint8_t m_qosAckPolicy;
224  uint8_t m_amsduPresent;
225  uint16_t m_qosStuff;
226 };
227 
228 } // namespace ns3
229 
230 
231 
232 #endif /* WIFI_MAC_HEADER_H */
Protocol header serialization and deserialization.
Definition: header.h:42
bool IsBeacon(void) const
void SetMoreFragments(void)
keep track of time values and allow control of global simulation resolution
Definition: nstime.h:81
uint32_t GetSize(void) const
uint16_t GetFragmentNumber(void) const
void SetRawDuration(uint16_t duration)
void SetFrameControl(uint16_t control)
bool IsReassocResp(void) const
uint16_t GetRawDuration(void) const
void SetDuration(Time duration)
bool IsAction() const
Mac48Address m_addr2
Mac48Address GetAddr3(void) const
void SetNoMoreFragments(void)
Mac48Address GetAddr4(void) const
enum WifiMacType GetType(void) const
void SetId(uint16_t id)
bool IsAssocReq(void) const
uint16_t GetQosControl(void) const
bool IsBlockAck(void) const
bool IsAssocResp(void) const
void SetQosControl(uint16_t qos)
uint16_t GetFrameControl(void) const
bool IsCtl(void) const
bool IsQosAmsdu(void) const
bool IsProbeResp(void) const
Mac48Address m_addr1
Mac48Address m_addr3
iterator in a Buffer instance
Definition: buffer.h:98
void SetQosAckPolicy(enum QosAckPolicy)
bool IsCfpoll(void) const
bool IsMoreFragments(void) const
Time GetDuration(void) const
uint8_t GetQosTid(void) const
bool IsReassocReq(void) const
virtual uint32_t GetSerializedSize(void) const
uint8_t GetQosTxopLimit(void) const
void SetAddr1(Mac48Address address)
void SetAddr3(Mac48Address address)
void SetAddr4(Mac48Address address)
uint16_t GetSequenceControl(void) const
bool IsProbeReq(void) const
virtual void Print(std::ostream &os) const
bool IsAuthentication(void) const
bool IsQosBlockAck(void) const
Mac48Address m_addr4
bool IsMgt(void) const
void SetQosTid(uint8_t tid)
virtual TypeId GetInstanceTypeId(void) const
void SetSequenceControl(uint16_t seq)
bool IsToDs(void) const
bool IsDisassociation(void) const
void SetAddr2(Mac48Address address)
an EUI-48 address
Definition: mac48-address.h:41
void PrintFrameControl(std::ostream &os) const
const char * GetTypeString(void) const
void SetQosTxopLimit(uint8_t txop)
void SetSequenceNumber(uint16_t seq)
bool IsData(void) const
bool IsQosData(void) const
bool IsBlockAckReq(void) const
void SetQosNormalAck(void)
virtual void Serialize(Buffer::Iterator start) const
bool IsFromDs(void) const
bool IsQosEosp(void) const
virtual uint32_t Deserialize(Buffer::Iterator start)
bool IsMultihopAction() const
void SetType(enum WifiMacType type)
bool IsCts(void) const
Mac48Address GetAddr1(void) const
tuple address
Definition: first.py:37
bool IsDeauthentication(void) const
bool IsRts(void) const
bool IsAck(void) const
static TypeId GetTypeId(void)
void SetFragmentNumber(uint8_t frag)
a unique identifier for an interface.
Definition: type-id.h:49
enum QosAckPolicy GetQosAckPolicy(void) const
bool IsRetry(void) const
Mac48Address GetAddr2(void) const
bool IsQosNoAck(void) const
bool IsQosAck(void) const
uint16_t GetSequenceNumber(void) const