A Discrete-Event Network Simulator
API
wimax-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) 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 
36 class MacHeaderType : public Header
37 {
38 public:
41  {
44  };
45 
49  MacHeaderType (void);
55  MacHeaderType (uint8_t type);
56  virtual ~MacHeaderType (void);
61  void SetType (uint8_t type);
66  uint8_t GetType (void) const;
67 
72  std::string GetName (void) const;
77  static TypeId GetTypeId (void);
78  virtual TypeId GetInstanceTypeId (void) const;
79  void Print (std::ostream &os) const;
80  uint32_t GetSerializedSize (void) const;
81  void Serialize (Buffer::Iterator start) const;
83 private:
84  uint8_t m_type;
85 };
86 
87 } // namespace ns3
88 
89 #endif /* MAC_HEADER_TYPE_H */
90 
91 // ----------------------------------------------------------------------------------------------------------
92 
93 #ifndef GENERIC_MAC_HEADER_H
94 #define GENERIC_MAC_HEADER_H
95 
96 #include <stdint.h>
97 #include "ns3/header.h"
98 #include "cid.h"
99 
100 namespace ns3 {
101 
108 class GenericMacHeader : public Header
109 {
110 public:
111  GenericMacHeader (void);
112  ~GenericMacHeader (void);
113 
118  void SetEc (uint8_t ec);
123  void SetType (uint8_t type);
128  void SetCi (uint8_t ci);
133  void SetEks (uint8_t eks);
138  void SetLen (uint16_t len);
143  void SetCid (Cid cid);
148  void SetHcs (uint8_t hcs);
153  void SetHt (uint8_t ht);
154 
159  uint8_t GetEc (void) const;
164  uint8_t GetType (void) const;
169  uint8_t GetCi (void) const;
174  uint8_t GetEks (void) const;
179  uint16_t GetLen (void) const;
184  Cid GetCid (void) const;
189  uint8_t GetHcs (void) const;
194  uint8_t GetHt (void) const;
199  std::string GetName (void) const;
204  static TypeId GetTypeId (void);
205  virtual TypeId GetInstanceTypeId (void) const;
206  void Print (std::ostream &os) const;
207  uint32_t GetSerializedSize (void) const;
208  void Serialize (Buffer::Iterator start) const;
214  bool check_hcs (void) const;
215 private:
216  uint8_t m_ht;
217  uint8_t m_ec;
218  uint8_t m_type;
219  uint8_t m_esf;
220  uint8_t m_ci;
221  uint8_t m_eks;
222  uint8_t m_rsv1;
223  uint16_t m_len;
225  uint8_t m_hcs;
226  uint8_t c_hcs;
227 
228 
229 };
230 
231 } // namespace ns3
232 
233 #endif /* GENERIC_MAC_HEADER */
234 
235 // ----------------------------------------------------------------------------------------------------------
236 
237 #ifndef BANDWIDTH_REQUEST_HEADER_H
238 #define BANDWIDTH_REQUEST_HEADER_H
239 
240 #include <stdint.h>
241 #include "ns3/header.h"
242 #include "cid.h"
243 
244 namespace ns3 {
252 {
253 public:
256  {
258  };
259 
260  BandwidthRequestHeader (void);
262 
267  void SetHt (uint8_t ht);
272  void SetEc (uint8_t ec);
277  void SetType (uint8_t type);
282  void SetBr (uint32_t br);
287  void SetCid (Cid cid);
292  void SetHcs (uint8_t hcs);
293 
298  uint8_t GetHt (void) const;
303  uint8_t GetEc (void) const;
308  uint8_t GetType (void) const;
313  uint32_t GetBr (void) const;
318  Cid GetCid (void) const;
323  uint8_t GetHcs (void) const;
324 
329  std::string GetName (void) const;
334  static TypeId GetTypeId (void);
335  virtual TypeId GetInstanceTypeId (void) const;
336  void Print (std::ostream &os) const;
337  uint32_t GetSerializedSize (void) const;
338  void Serialize (Buffer::Iterator start) const;
344  bool check_hcs (void) const;
345 private:
346  uint8_t m_ht;
347  uint8_t m_ec;
348  uint8_t m_type;
349  uint32_t m_br;
351  uint8_t m_hcs;
352  uint8_t c_hcs;
353 
354 };
355 
356 } // namespace ns3
357 
358 #endif /* BANDWIDTH_REQUEST_HEADER_H */
359 
360 // ----------------------------------------------------------------------------------------------------------
361 
362 #ifndef GRANT_MANAGEMENT_SUBHEADER_H
363 #define GRANT_MANAGEMENT_SUBHEADER_H
364 
365 #include <stdint.h>
366 #include "ns3/header.h"
367 
368 namespace ns3 {
369 
377 {
378 public:
381 
386  void SetSi (uint8_t si);
391  void SetPm (uint8_t pm);
396  void SetPbr (uint16_t pbr);
397 
402  uint8_t GetSi (void) const;
407  uint8_t GetPm (void) const;
412  uint16_t GetPbr (void) const;
413 
418  std::string GetName (void) const;
423  static TypeId GetTypeId (void);
424  virtual TypeId GetInstanceTypeId (void) const;
425  void Print (std::ostream &os) const;
426  uint32_t GetSerializedSize (void) const;
427  void Serialize (Buffer::Iterator start) const;
429 
430 private:
431  // size of the Grant Management Subheader shall actually be 2 bytes
432 
433  uint8_t m_si;
434  uint8_t m_pm;
435  uint16_t m_pbr;
436 };
437 
438 } // namespace ns3
439 
440 #endif /* GRANT_MANAGEMENT_SUBHEADER_H */
441 
442 // ----------------------------------------------------------------------------------------------------------
443 
444 #ifndef FRAGMENTATION_SUBHEADER_H
445 #define FRAGMENTATION_SUBHEADER_H
446 
447 #include <stdint.h>
448 #include "ns3/header.h"
449 
450 namespace ns3 {
458 {
459 public:
460  FragmentationSubheader (void);
462 
467  void SetFc (uint8_t fc);
472  void SetFsn (uint8_t fsn);
473 
478  uint8_t GetFc (void) const;
483  uint8_t GetFsn (void) const;
484 
489  std::string GetName (void) const;
494  static TypeId GetTypeId (void);
495  virtual TypeId GetInstanceTypeId (void) const;
496  void Print (std::ostream &os) const;
497  uint32_t GetSerializedSize (void) const;
498  void Serialize (Buffer::Iterator start) const;
500 
501 private:
502  uint8_t m_fc;
503  uint8_t m_fsn;
504 };
505 } // namespace ns3
506 
507 #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.
uint32_t GetSerializedSize(void) const
void SetBr(uint32_t br)
Set BR field.
Cid GetCid(void) const
Get CID field.
void SetEc(uint8_t ec)
Set EC field.
void SetType(uint8_t type)
Set type 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_hcs
Header Check Sequence.
uint32_t GetBr(void) const
Get BR field.
void Serialize(Buffer::Iterator start) const
uint8_t GetHcs(void) const
Get HCS field.
void SetHcs(uint8_t hcs)
Set HCS field.
std::string GetName(void) const
Get name field.
void SetHt(uint8_t ht)
Set HT field.
void SetCid(Cid cid)
Set CID field.
uint8_t GetHt(void) const
Get HT field.
uint32_t m_br
Bandwidth Request.
HeaderType
Header type enumeration.
uint8_t GetEc(void) const
Get EC field.
bool check_hcs(void) const
Check HCS.
uint8_t GetType(void) const
Get type field.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
static TypeId GetTypeId(void)
Get the type ID.
void Print(std::ostream &os) const
Cid m_cid
Connection identifier.
iterator in a Buffer instance
Definition: buffer.h:99
Cid class.
Definition: cid.h:38
This class implements the fragmentation sub-header as described by IEEE Standard for Local and metrop...
static TypeId GetTypeId(void)
Get the type ID.
uint8_t m_fsn
Fragment Sequence Number.
std::string GetName(void) const
Get name field.
void Serialize(Buffer::Iterator start) const
uint8_t GetFc(void) const
Get FC field.
void Print(std::ostream &os) const
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
void SetFsn(uint8_t fsn)
Set FSN field.
void SetFc(uint8_t fc)
Set FC field.
uint32_t GetSerializedSize(void) const
uint8_t GetFsn(void) const
Get FSN field.
uint8_t m_fc
Fragment Control.
This class implements the Generic mac Header as described by IEEE Standard for Local and metropolitan...
bool check_hcs(void) const
Check HCS.
uint8_t GetHt(void) const
Get HT field.
void SetHcs(uint8_t hcs)
Set HCS field.
uint8_t m_hcs
Header Check Sequence.
void SetEc(uint8_t ec)
Set EC field.
uint8_t m_ht
Header type.
uint8_t GetEks(void) const
Get EKS field.
void Serialize(Buffer::Iterator start) const
uint8_t GetType(void) const
Get type field.
uint8_t GetHcs(void) const
Get HCS field.
void SetType(uint8_t type)
Set type field.
uint16_t GetLen(void) const
Get length field.
void SetHt(uint8_t ht)
Set HT field.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
uint8_t m_ec
Encryption Control.
static TypeId GetTypeId(void)
Get the type ID.
uint8_t GetCi(void) const
Get CI field.
void SetEks(uint8_t eks)
Set EKS field.
uint8_t m_ci
CRC Indicator.
void Print(std::ostream &os) const
void SetLen(uint16_t len)
Set length field.
std::string GetName(void) const
Get name field.
uint8_t GetEc(void) const
Get EC 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
uint32_t GetSerializedSize(void) const
uint8_t m_eks
Encryption Key Sequence.
Cid GetCid(void) const
Get CID field.
This class implements the grant management sub-header as described by IEEE Standard for Local and met...
uint16_t GetPbr(void) const
Get PBR field.
uint8_t GetPm(void) const
Get PM field.
uint16_t m_pbr
PiggyBack Request.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
void SetSi(uint8_t si)
Set SI field.
void SetPm(uint8_t pm)
Set PM field.
void Serialize(Buffer::Iterator start) const
uint32_t GetSerializedSize(void) const
static TypeId GetTypeId(void)
Get the type ID.
uint8_t GetSi(void) const
Get SI field.
uint8_t m_si
Slip Indicator.
void Print(std::ostream &os) const
std::string GetName(void) const
Get name field.
void SetPbr(uint16_t pbr)
Set PRR field.
uint8_t m_pm
Poll-Me bit (byte in this case)
Protocol header serialization and deserialization.
Definition: header.h:43
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 SetType(uint8_t type)
Set type field.
uint8_t m_type
MAC header type.
void Print(std::ostream &os) const
MacHeaderType(void)
Constructor.
void Serialize(Buffer::Iterator start) const
uint8_t GetType(void) const
Get type field.
virtual ~MacHeaderType(void)
HeaderType
Header type enumeration.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
std::string GetName(void) const
Get name field.
uint32_t GetSerializedSize(void) const
static TypeId GetTypeId(void)
Get the type ID.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
def start()
Definition: core.py:1853