A Discrete-Event Network Simulator
API
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 
28 namespace ns3
29 {
30 
37 class MacHeaderType : public Header
38 {
39  public:
42  {
45  };
46 
50  MacHeaderType();
56  MacHeaderType(uint8_t type);
57  ~MacHeaderType() override;
62  void SetType(uint8_t type);
67  uint8_t GetType() const;
68 
73  std::string GetName() const;
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;
83  uint32_t Deserialize(Buffer::Iterator start) override;
84 
85  private:
86  uint8_t m_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 
104 namespace ns3
105 {
106 
113 class GenericMacHeader : public Header
114 {
115  public:
117  ~GenericMacHeader() override;
118 
123  void SetEc(uint8_t ec);
128  void SetType(uint8_t type);
133  void SetCi(uint8_t ci);
138  void SetEks(uint8_t eks);
143  void SetLen(uint16_t len);
148  void SetCid(Cid cid);
153  void SetHcs(uint8_t hcs);
158  void SetHt(uint8_t ht);
159 
164  uint8_t GetEc() const;
169  uint8_t GetType() const;
174  uint8_t GetCi() const;
179  uint8_t GetEks() const;
184  uint16_t GetLen() const;
189  Cid GetCid() const;
194  uint8_t GetHcs() const;
199  uint8_t GetHt() const;
204  std::string GetName() const;
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;
219  bool check_hcs() const;
220 
221  private:
222  uint8_t m_ht;
223  uint8_t m_ec;
224  uint8_t m_type;
225  uint8_t m_esf;
226  uint8_t m_ci;
227  uint8_t m_eks;
228  uint8_t m_rsv1;
229  uint16_t m_len;
231  uint8_t m_hcs;
232  uint8_t c_hcs;
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 
251 namespace ns3
252 {
260 {
261  public:
264  {
267  };
268 
270  ~BandwidthRequestHeader() override;
271 
276  void SetHt(uint8_t ht);
281  void SetEc(uint8_t ec);
286  void SetType(uint8_t type);
291  void SetBr(uint32_t br);
296  void SetCid(Cid cid);
301  void SetHcs(uint8_t hcs);
302 
307  uint8_t GetHt() const;
312  uint8_t GetEc() const;
317  uint8_t GetType() const;
322  uint32_t GetBr() const;
327  Cid GetCid() const;
332  uint8_t GetHcs() const;
333 
338  std::string GetName() const;
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;
353  bool check_hcs() const;
354 
355  private:
356  uint8_t m_ht;
357  uint8_t m_ec;
358  uint8_t m_type;
359  uint32_t m_br;
361  uint8_t m_hcs;
362  uint8_t c_hcs;
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 
379 namespace ns3
380 {
381 
389 {
390  public:
392  ~GrantManagementSubheader() override;
393 
398  void SetSi(uint8_t si);
403  void SetPm(uint8_t pm);
408  void SetPbr(uint16_t pbr);
409 
414  uint8_t GetSi() const;
419  uint8_t GetPm() const;
424  uint16_t GetPbr() const;
425 
430  std::string GetName() const;
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;
446  uint8_t m_pm;
447  uint16_t m_pbr;
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 
463 namespace ns3
464 {
472 {
473  public:
475  ~FragmentationSubheader() override;
476 
481  void SetFc(uint8_t fc);
486  void SetFsn(uint8_t fsn);
487 
492  uint8_t GetFc() const;
497  uint8_t GetFsn() const;
498 
503  std::string GetName() const;
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;
517  uint8_t m_fsn;
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.
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.
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.
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
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
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
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.
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.