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