A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
wimax-mac-header.h
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007,2008, 2009 INRIA, UDcast
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
19  * Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
20  */
21 
22 #ifndef MAC_HEADER_TYPE_H
23 #define MAC_HEADER_TYPE_H
24 
25 #include <stdint.h>
26 #include "ns3/header.h"
27 
28 namespace ns3 {
29 
34 class MacHeaderType : public Header
35 {
41 public:
43  {
44  HEADER_TYPE_GENERIC, HEADER_TYPE_BANDWIDTH
45  };
46 
47  MacHeaderType (void);
48  MacHeaderType (uint8_t type);
49  virtual ~MacHeaderType (void);
50  void SetType (uint8_t type);
51  uint8_t GetType (void) const;
52 
53  std::string GetName (void) const;
54  static TypeId GetTypeId (void);
55  virtual TypeId GetInstanceTypeId (void) const;
56  void Print (std::ostream &os) const;
57  uint32_t GetSerializedSize (void) const;
58  void Serialize (Buffer::Iterator start) const;
59  uint32_t Deserialize (Buffer::Iterator start);
60 private:
61  uint8_t m_type;
62 };
63 
64 } // namespace ns3
65 
66 #endif /* MAC_HEADER_TYPE_H */
67 
68 // ----------------------------------------------------------------------------------------------------------
69 
70 #ifndef GENERIC_MAC_HEADER_H
71 #define GENERIC_MAC_HEADER_H
72 
73 #include <stdint.h>
74 #include "ns3/header.h"
75 #include "cid.h"
76 
77 namespace ns3 {
78 
84 class GenericMacHeader : public Header
85 {
86 public:
87  GenericMacHeader (void);
88  ~GenericMacHeader (void);
89 
90  void SetEc (uint8_t ec);
91  void SetType (uint8_t type);
92  void SetCi (uint8_t ci);
93  void SetEks (uint8_t eks);
94  void SetLen (uint16_t len);
95  void SetCid (Cid cid);
96  void SetHcs (uint8_t hcs);
97  void SetHt (uint8_t HT);
98 
99  uint8_t GetEc (void) const;
100  uint8_t GetType (void) const;
101  uint8_t GetCi (void) const;
102  uint8_t GetEks (void) const;
103  uint16_t GetLen (void) const;
104  Cid GetCid (void) const;
105  uint8_t GetHcs (void) const;
106  uint8_t GetHt (void) const;
107  std::string GetName (void) const;
108  static TypeId GetTypeId (void);
109  virtual TypeId GetInstanceTypeId (void) const;
110  void Print (std::ostream &os) const;
111  uint32_t GetSerializedSize (void) const;
112  void Serialize (Buffer::Iterator start) const;
113  uint32_t Deserialize (Buffer::Iterator start);
114  bool check_hcs (void) const;
115 private:
116  uint8_t m_ht; // Header type
117  uint8_t m_ec; // Encryption Control
118  uint8_t m_type;
119  uint8_t m_esf;
120  uint8_t m_ci; // CRC Indicator
121  uint8_t m_eks; // Encryption Key Sequence
122  uint8_t m_rsv1;
123  uint16_t m_len;
124  Cid m_cid;
125  uint8_t m_hcs; // Header Check Sequence
126  uint8_t c_hcs; // calculated header check sequence; this is used to check if the received header is correct or not
127 
128 
129 };
130 
131 } // namespace ns3
132 
133 #endif /* GENERIC_MAC_HEADER */
134 
135 // ----------------------------------------------------------------------------------------------------------
136 
137 #ifndef BANDWIDTH_REQUEST_HEADER_H
138 #define BANDWIDTH_REQUEST_HEADER_H
139 
140 #include <stdint.h>
141 #include "ns3/header.h"
142 #include "cid.h"
143 
144 namespace ns3 {
151 {
152 public:
153  enum HeaderType
154  {
155  HEADER_TYPE_INCREMENTAL, HEADER_TYPE_AGGREGATE
156  };
157 
158  BandwidthRequestHeader (void);
159  ~BandwidthRequestHeader (void);
160 
161  void SetHt (uint8_t HT);
162  void SetEc (uint8_t ec);
163  void SetType (uint8_t type);
164  void SetBr (uint32_t br);
165  void SetCid (Cid cid);
166  void SetHcs (uint8_t hcs);
167 
168  uint8_t GetHt (void) const;
169  uint8_t GetEc (void) const;
170  uint8_t GetType (void) const;
171  uint32_t GetBr (void) const;
172  Cid GetCid (void) const;
173  uint8_t GetHcs (void) const;
174 
175  std::string GetName (void) const;
176  static TypeId GetTypeId (void);
177  virtual TypeId GetInstanceTypeId (void) const;
178  void Print (std::ostream &os) const;
179  uint32_t GetSerializedSize (void) const;
180  void Serialize (Buffer::Iterator start) const;
181  uint32_t Deserialize (Buffer::Iterator start);
182  bool check_hcs (void) const;
183 private:
184  uint8_t m_ht; // Header type
185  uint8_t m_ec; // Encryption Control
186  uint8_t m_type;
187  uint32_t m_br; // Bandwidth Request
188  Cid m_cid; // Connection identifier
189  uint8_t m_hcs; // Header Check Sequence
190  uint8_t c_hcs; // calculated header check sequence; this is used to check if the received header is correct or not
191 
192 };
193 
194 } // namespace ns3
195 
196 #endif /* BANDWIDTH_REQUEST_HEADER_H */
197 
198 // ----------------------------------------------------------------------------------------------------------
199 
200 #ifndef GRANT_MANAGEMENT_SUBHEADER_H
201 #define GRANT_MANAGEMENT_SUBHEADER_H
202 
203 #include <stdint.h>
204 #include "ns3/header.h"
205 
206 namespace ns3 {
207 
209 {
216 public:
218  ~GrantManagementSubheader (void);
219 
220  void SetSi (uint8_t si);
221  void SetPm (uint8_t pm);
222  void SetPbr (uint16_t pbr);
223 
224  uint8_t GetSi (void) const;
225  uint8_t GetPm (void) const;
226  uint16_t GetPbr (void) const;
227 
228  std::string GetName (void) const;
229  static TypeId GetTypeId (void);
230  virtual TypeId GetInstanceTypeId (void) const;
231  void Print (std::ostream &os) const;
232  uint32_t GetSerializedSize (void) const;
233  void Serialize (Buffer::Iterator start) const;
234  uint32_t Deserialize (Buffer::Iterator start);
235 
236 private:
237  // size of the Grant Management Subheader shall actually be 2 bytes
238 
239  uint8_t m_si; // Slip Indicator
240  uint8_t m_pm; // Poll-Me bit (byte in this case)
241  uint16_t m_pbr; // PiggyBack Request
242 };
243 
244 } // namespace ns3
245 
246 #endif /* GRANT_MANAGEMENT_SUBHEADER_H */
247 
248 // ----------------------------------------------------------------------------------------------------------
249 
250 #ifndef FRAGMENTATION_SUBHEADER_H
251 #define FRAGMENTATION_SUBHEADER_H
252 
253 #include <stdint.h>
254 #include "ns3/header.h"
255 
256 namespace ns3 {
265 {
266 public:
267  FragmentationSubheader (void);
268  ~FragmentationSubheader (void);
269 
270  void SetFc (uint8_t fc);
271  void SetFsn (uint8_t fsn);
272 
273  uint8_t GetFc (void) const;
274  uint8_t GetFsn (void) const;
275 
276  std::string GetName (void) const;
277  static TypeId GetTypeId (void);
278  virtual TypeId GetInstanceTypeId (void) const;
279  void Print (std::ostream &os) const;
280  uint32_t GetSerializedSize (void) const;
281  void Serialize (Buffer::Iterator start) const;
282  uint32_t Deserialize (Buffer::Iterator start);
283 
284 private:
285  uint8_t m_fc; // Fragment Control
286  uint8_t m_fsn; // Fragment Sequence Number
287 };
288 } // namespace ns3
289 
290 #endif /* FRAGMENTATION_SUBHEADER_H */
Protocol header serialization and deserialization.
Definition: header.h:42
void Print(std::ostream &os) const
HeaderType
this class implements the mac header type field.
virtual TypeId GetInstanceTypeId(void) const
void Serialize(Buffer::Iterator start) const
GrantManagementSubheader(void)
this class implements the grant management sub-header as described by IEEE Standard for Local and met...
uint32_t Deserialize(Buffer::Iterator start)
uint32_t Deserialize(Buffer::Iterator start)
virtual TypeId GetInstanceTypeId(void) const
virtual TypeId GetInstanceTypeId(void) const
this class implements the Generic mac Header as described by IEEE Standard for Local and metropolitan...
iterator in a Buffer instance
Definition: buffer.h:98
uint32_t GetSerializedSize(void) const
void Print(std::ostream &os) const
uint32_t Deserialize(Buffer::Iterator start)
uint32_t GetSerializedSize(void) const
uint32_t Deserialize(Buffer::Iterator start)
void Print(std::ostream &os) const
void Serialize(Buffer::Iterator start) const
Represents the HT (Header Type) field of generic MAC and bandwidth request headers.
this class implements the bandwidth-request mac Header as described by IEEE Standard for Local and me...
Definition: cid.h:35
void Print(std::ostream &os) const
uint32_t GetSerializedSize(void) const
this class implements the fragmentation sub-header as described by IEEE Standard for Local and metrop...
void Serialize(Buffer::Iterator start) const
void Serialize(Buffer::Iterator start) const
void Serialize(Buffer::Iterator start) const
uint32_t GetSerializedSize(void) const
uint32_t Deserialize(Buffer::Iterator start)
virtual TypeId GetInstanceTypeId(void) const
a unique identifier for an interface.
Definition: type-id.h:44
uint32_t GetSerializedSize(void) const
void Print(std::ostream &os) const
virtual TypeId GetInstanceTypeId(void) const