A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wimax-mac-header.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007,2008, 2009 INRIA, UDcast
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
18 * Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
19 */
20
21#ifndef MAC_HEADER_TYPE_H
22#define MAC_HEADER_TYPE_H
23
24#include "ns3/header.h"
25
26#include <stdint.h>
27
28namespace ns3
29{
30
31/**
32 * \ingroup wimax
33 * This class Represents the HT (Header Type) field of generic MAC and bandwidth request headers
34 * \see GenericMacHeader
35 * \see BandwidthRequestHeader
36 */
37class MacHeaderType : public Header
38{
39 public:
40 /// Header type enumeration
42 {
45 };
46
47 /**
48 * Constructor
49 */
51 /**
52 * Constructor
53 *
54 * \param type MAC header type
55 */
56 MacHeaderType(uint8_t type);
57 ~MacHeaderType() override;
58 /**
59 * Set type field
60 * \param type the type
61 */
62 void SetType(uint8_t type);
63 /**
64 * Get type field
65 * \returns the type
66 */
67 uint8_t GetType() const;
68
69 /**
70 * Get name field
71 * \returns the name
72 */
73 std::string GetName() const;
74 /**
75 * \brief Get the type ID.
76 * \return the object TypeId
77 */
78 static TypeId GetTypeId();
79 TypeId GetInstanceTypeId() const override;
80 void Print(std::ostream& os) const override;
81 uint32_t GetSerializedSize() const override;
82 void Serialize(Buffer::Iterator start) const override;
84
85 private:
86 uint8_t m_type; ///< MAC header type
87};
88
89} // namespace ns3
90
91#endif /* MAC_HEADER_TYPE_H */
92
93// ----------------------------------------------------------------------------------------------------------
94
95#ifndef GENERIC_MAC_HEADER_H
96#define GENERIC_MAC_HEADER_H
97
98#include "cid.h"
99
100#include "ns3/header.h"
101
102#include <stdint.h>
103
104namespace ns3
105{
106
107/**
108 * \ingroup wimax
109 * This class implements the Generic mac Header as described by IEEE Standard for
110 * Local and metropolitan area networks Part 16: Air Interface for Fixed Broadband Wireless Access
111 * Systems 6.3.2.1.1 Generic MAC header, page 36
112 */
114{
115 public:
117 ~GenericMacHeader() override;
118
119 /**
120 * Set EC field
121 * \param ec the EC
122 */
123 void SetEc(uint8_t ec);
124 /**
125 * Set type field
126 * \param type the type
127 */
128 void SetType(uint8_t type);
129 /**
130 * Set CI field
131 * \param ci the CI
132 */
133 void SetCi(uint8_t ci);
134 /**
135 * Set EKS field
136 * \param eks the EKS
137 */
138 void SetEks(uint8_t eks);
139 /**
140 * Set length field
141 * \param len the length
142 */
143 void SetLen(uint16_t len);
144 /**
145 * Set CID field
146 * \param cid the CID
147 */
148 void SetCid(Cid cid);
149 /**
150 * Set HCS field
151 * \param hcs the HCS
152 */
153 void SetHcs(uint8_t hcs);
154 /**
155 * Set HT field
156 * \param ht the HT
157 */
158 void SetHt(uint8_t ht);
159
160 /**
161 * Get EC field
162 * \returns the EC
163 */
164 uint8_t GetEc() const;
165 /**
166 * Get type field
167 * \returns the type
168 */
169 uint8_t GetType() const;
170 /**
171 * Get CI field
172 * \returns the CI
173 */
174 uint8_t GetCi() const;
175 /**
176 * Get EKS field
177 * \returns the EKS
178 */
179 uint8_t GetEks() const;
180 /**
181 * Get length field
182 * \returns the length
183 */
184 uint16_t GetLen() const;
185 /**
186 * Get CID field
187 * \returns the CID
188 */
189 Cid GetCid() const;
190 /**
191 * Get HCS field
192 * \returns the HCS
193 */
194 uint8_t GetHcs() const;
195 /**
196 * Get HT field
197 * \returns the HT
198 */
199 uint8_t GetHt() const;
200 /**
201 * Get name field
202 * \returns the name
203 */
204 std::string GetName() const;
205 /**
206 * \brief Get the type ID.
207 * \return the object TypeId
208 */
209 static TypeId GetTypeId();
210 TypeId GetInstanceTypeId() const override;
211 void Print(std::ostream& os) const override;
212 uint32_t GetSerializedSize() const override;
213 void Serialize(Buffer::Iterator start) const override;
214 uint32_t Deserialize(Buffer::Iterator start) override;
215 /**
216 * Check HCS
217 * \returns true if HCS is validated
218 */
219 bool check_hcs() const;
220
221 private:
222 uint8_t m_ht; ///< Header type
223 uint8_t m_ec; ///< Encryption Control
224 uint8_t m_type; ///< type
225 uint8_t m_esf; ///< ESF
226 uint8_t m_ci; ///< CRC Indicator
227 uint8_t m_eks; ///< Encryption Key Sequence
228 uint8_t m_rsv1; ///< RSV
229 uint16_t m_len; ///< length
230 Cid m_cid; ///< CID
231 uint8_t m_hcs; ///< Header Check Sequence
232 uint8_t c_hcs; ///< calculated header check sequence; this is used to check if the received
233 ///< header is correct or not
234};
235
236} // namespace ns3
237
238#endif /* GENERIC_MAC_HEADER */
239
240// ----------------------------------------------------------------------------------------------------------
241
242#ifndef BANDWIDTH_REQUEST_HEADER_H
243#define BANDWIDTH_REQUEST_HEADER_H
244
245#include "cid.h"
246
247#include "ns3/header.h"
248
249#include <stdint.h>
250
251namespace ns3
252{
253/**
254 * \ingroup wimax
255 * This class implements the bandwidth-request mac Header as described by IEEE Standard for
256 * Local and metropolitan area networks Part 16: Air Interface for Fixed Broadband Wireless Access
257 * Systems 6.3.2.1.2 Bandwidth request header, page 38
258 */
260{
261 public:
262 /// Header type enumeration
264 {
267 };
268
270 ~BandwidthRequestHeader() override;
271
272 /**
273 * Set HT field
274 * \param ht the HT
275 */
276 void SetHt(uint8_t ht);
277 /**
278 * Set EC field
279 * \param ec the EC
280 */
281 void SetEc(uint8_t ec);
282 /**
283 * Set type field
284 * \param type the type
285 */
286 void SetType(uint8_t type);
287 /**
288 * Set BR field
289 * \param br the BR
290 */
291 void SetBr(uint32_t br);
292 /**
293 * Set CID field
294 * \param cid the CID
295 */
296 void SetCid(Cid cid);
297 /**
298 * Set HCS field
299 * \param hcs the HCS
300 */
301 void SetHcs(uint8_t hcs);
302
303 /**
304 * Get HT field
305 * \returns the HT
306 */
307 uint8_t GetHt() const;
308 /**
309 * Get EC field
310 * \returns the EC
311 */
312 uint8_t GetEc() const;
313 /**
314 * Get type field
315 * \returns the type
316 */
317 uint8_t GetType() const;
318 /**
319 * Get BR field
320 * \returns the BR
321 */
322 uint32_t GetBr() const;
323 /**
324 * Get CID field
325 * \returns the CID
326 */
327 Cid GetCid() const;
328 /**
329 * Get HCS field
330 * \returns the HCS
331 */
332 uint8_t GetHcs() const;
333
334 /**
335 * Get name field
336 * \returns the name
337 */
338 std::string GetName() const;
339 /**
340 * \brief Get the type ID.
341 * \return the object TypeId
342 */
343 static TypeId GetTypeId();
344 TypeId GetInstanceTypeId() const override;
345 void Print(std::ostream& os) const override;
346 uint32_t GetSerializedSize() const override;
347 void Serialize(Buffer::Iterator start) const override;
348 uint32_t Deserialize(Buffer::Iterator start) override;
349 /**
350 * Check HCS
351 * \returns true if HCS is validated
352 */
353 bool check_hcs() const;
354
355 private:
356 uint8_t m_ht; ///< Header type
357 uint8_t m_ec; ///< Encryption Control
358 uint8_t m_type; ///< type
359 uint32_t m_br; ///< Bandwidth Request
360 Cid m_cid; ///< Connection identifier
361 uint8_t m_hcs; ///< Header Check Sequence
362 uint8_t c_hcs; ///< calculated header check sequence; this is used to check if the received
363 ///< header is correct or not
364};
365
366} // namespace ns3
367
368#endif /* BANDWIDTH_REQUEST_HEADER_H */
369
370// ----------------------------------------------------------------------------------------------------------
371
372#ifndef GRANT_MANAGEMENT_SUBHEADER_H
373#define GRANT_MANAGEMENT_SUBHEADER_H
374
375#include "ns3/header.h"
376
377#include <stdint.h>
378
379namespace ns3
380{
381
382/**
383 * \ingroup wimax
384 * This class implements the grant management sub-header as described by IEEE Standard for
385 * Local and metropolitan area networks Part 16: Air Interface for Fixed Broadband Wireless Access
386 * Systems 6.3.2.2.2 Grant Management subheader, page 40
387 */
389{
390 public:
392 ~GrantManagementSubheader() override;
393
394 /**
395 * Set SI field
396 * \param si the SI
397 */
398 void SetSi(uint8_t si);
399 /**
400 * Set PM field
401 * \param pm the PM
402 */
403 void SetPm(uint8_t pm);
404 /**
405 * Set PRR field
406 * \param pbr the PBR
407 */
408 void SetPbr(uint16_t pbr);
409
410 /**
411 * Get SI field
412 * \returns the SI
413 */
414 uint8_t GetSi() const;
415 /**
416 * Get PM field
417 * \returns the PM
418 */
419 uint8_t GetPm() const;
420 /**
421 * Get PBR field
422 * \returns the PBR
423 */
424 uint16_t GetPbr() const;
425
426 /**
427 * Get name field
428 * \returns the name
429 */
430 std::string GetName() const;
431 /**
432 * \brief Get the type ID.
433 * \return the object TypeId
434 */
435 static TypeId GetTypeId();
436 TypeId GetInstanceTypeId() const override;
437 void Print(std::ostream& os) const override;
438 uint32_t GetSerializedSize() const override;
439 void Serialize(Buffer::Iterator start) const override;
440 uint32_t Deserialize(Buffer::Iterator start) override;
441
442 private:
443 // size of the Grant Management Subheader shall actually be 2 bytes
444
445 uint8_t m_si; ///< Slip Indicator
446 uint8_t m_pm; ///< Poll-Me bit (byte in this case)
447 uint16_t m_pbr; ///< PiggyBack Request
448};
449
450} // namespace ns3
451
452#endif /* GRANT_MANAGEMENT_SUBHEADER_H */
453
454// ----------------------------------------------------------------------------------------------------------
455
456#ifndef FRAGMENTATION_SUBHEADER_H
457#define FRAGMENTATION_SUBHEADER_H
458
459#include "ns3/header.h"
460
461#include <stdint.h>
462
463namespace ns3
464{
465/**
466 * \ingroup wimax
467 * This class implements the fragmentation sub-header as described by IEEE Standard for
468 * Local and metropolitan area networks Part 16: Air Interface for Fixed Broadband Wireless Access
469 * Systems 6.3.2.2.1 Fragmentation subheader, page 39
470 */
472{
473 public:
475 ~FragmentationSubheader() override;
476
477 /**
478 * Set FC field
479 * \param fc the FC
480 */
481 void SetFc(uint8_t fc);
482 /**
483 * Set FSN field
484 * \param fsn the FSN
485 */
486 void SetFsn(uint8_t fsn);
487
488 /**
489 * Get FC field
490 * \returns the FC
491 */
492 uint8_t GetFc() const;
493 /**
494 * Get FSN field
495 * \returns the FSN
496 */
497 uint8_t GetFsn() const;
498
499 /**
500 * Get name field
501 * \returns the name
502 */
503 std::string GetName() const;
504 /**
505 * \brief Get the type ID.
506 * \return the object TypeId
507 */
508 static TypeId GetTypeId();
509 TypeId GetInstanceTypeId() const override;
510 void Print(std::ostream& os) const override;
511 uint32_t GetSerializedSize() const override;
512 void Serialize(Buffer::Iterator start) const override;
513 uint32_t Deserialize(Buffer::Iterator start) override;
514
515 private:
516 uint8_t m_fc; ///< Fragment Control
517 uint8_t m_fsn; ///< Fragment Sequence Number
518};
519} // namespace ns3
520
521#endif /* FRAGMENTATION_SUBHEADER_H */
This class implements the bandwidth-request mac Header as described by IEEE Standard for Local and me...
uint8_t m_ec
Encryption Control.
uint8_t GetHt() const
Get HT field.
uint32_t GetSerializedSize() const override
void SetBr(uint32_t br)
Set BR field.
uint32_t GetBr() const
Get BR field.
void SetEc(uint8_t ec)
Set EC field.
void SetType(uint8_t type)
Set type field.
uint8_t GetHcs() const
Get HCS field.
bool check_hcs() const
Check HCS.
uint8_t c_hcs
calculated header check sequence; this is used to check if the received header is correct or not
uint8_t m_hcs
Header Check Sequence.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
uint8_t GetEc() const
Get EC field.
void SetHcs(uint8_t hcs)
Set HCS field.
Cid GetCid() const
Get CID field.
void SetHt(uint8_t ht)
Set HT field.
void SetCid(Cid cid)
Set CID field.
uint32_t m_br
Bandwidth Request.
HeaderType
Header type enumeration.
void Serialize(Buffer::Iterator start) const override
void Print(std::ostream &os) const override
std::string GetName() const
Get name field.
uint8_t GetType() const
Get type field.
Cid m_cid
Connection identifier.
uint32_t Deserialize(Buffer::Iterator start) override
static TypeId GetTypeId()
Get the type ID.
iterator in a Buffer instance
Definition: buffer.h:100
Cid class.
Definition: cid.h:37
This class implements the fragmentation sub-header as described by IEEE Standard for Local and metrop...
uint8_t m_fsn
Fragment Sequence Number.
void Print(std::ostream &os) const override
std::string GetName() const
Get name field.
uint32_t GetSerializedSize() const override
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
uint8_t GetFsn() const
Get FSN field.
void SetFsn(uint8_t fsn)
Set FSN field.
uint8_t GetFc() const
Get FC field.
void SetFc(uint8_t fc)
Set FC field.
static TypeId GetTypeId()
Get the type ID.
void Serialize(Buffer::Iterator start) const override
uint8_t m_fc
Fragment Control.
uint32_t Deserialize(Buffer::Iterator start) override
This class implements the Generic mac Header as described by IEEE Standard for Local and metropolitan...
uint8_t GetEks() const
Get EKS field.
uint8_t GetType() const
Get type field.
void SetHcs(uint8_t hcs)
Set HCS field.
uint8_t m_hcs
Header Check Sequence.
void SetEc(uint8_t ec)
Set EC field.
bool check_hcs() const
Check HCS.
uint8_t GetCi() const
Get CI field.
uint8_t m_ht
Header type.
uint8_t GetHt() const
Get HT field.
uint32_t Deserialize(Buffer::Iterator start) override
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void SetType(uint8_t type)
Set type field.
uint32_t GetSerializedSize() const override
void SetHt(uint8_t ht)
Set HT field.
void Serialize(Buffer::Iterator start) const override
uint8_t m_ec
Encryption Control.
uint8_t GetHcs() const
Get HCS field.
uint8_t GetEc() const
Get EC field.
void SetEks(uint8_t eks)
Set EKS field.
uint8_t m_ci
CRC Indicator.
std::string GetName() const
Get name field.
void SetLen(uint16_t len)
Set length field.
static TypeId GetTypeId()
Get the type ID.
uint16_t GetLen() const
Get length field.
void SetCid(Cid cid)
Set CID field.
void SetCi(uint8_t ci)
Set CI field.
uint8_t c_hcs
calculated header check sequence; this is used to check if the received header is correct or not
uint8_t m_eks
Encryption Key Sequence.
void Print(std::ostream &os) const override
Cid GetCid() const
Get CID field.
This class implements the grant management sub-header as described by IEEE Standard for Local and met...
std::string GetName() const
Get name field.
uint8_t GetPm() const
Get PM field.
uint8_t GetSi() const
Get SI field.
uint16_t m_pbr
PiggyBack Request.
void Serialize(Buffer::Iterator start) const override
void SetSi(uint8_t si)
Set SI field.
void SetPm(uint8_t pm)
Set PM field.
uint16_t GetPbr() const
Get PBR field.
uint32_t GetSerializedSize() const override
uint32_t Deserialize(Buffer::Iterator start) override
uint8_t m_si
Slip Indicator.
void Print(std::ostream &os) const override
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void SetPbr(uint16_t pbr)
Set PRR field.
static TypeId GetTypeId()
Get the type ID.
uint8_t m_pm
Poll-Me bit (byte in this case)
Protocol header serialization and deserialization.
Definition: header.h:44
This class Represents the HT (Header Type) field of generic MAC and bandwidth request headers.
void Serialize(Buffer::Iterator start) const override
void SetType(uint8_t type)
Set type field.
uint8_t m_type
MAC header type.
HeaderType
Header type enumeration.
uint32_t GetSerializedSize() const override
uint8_t GetType() const
Get type field.
void Print(std::ostream &os) const override
std::string GetName() const
Get name field.
static TypeId GetTypeId()
Get the type ID.
uint32_t Deserialize(Buffer::Iterator start) override
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
MacHeaderType()
Constructor.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.