59 return "MAC Header Type";
67 .SetGroupName(
"Wimax")
80 os <<
" header type = " << (uint32_t)
m_type;
202 return "Generic Mac Header";
209 .SetGroupName(
"Wimax")
222 os <<
" ec (encryption control) = " << (uint32_t)
m_ec <<
", type = " << (uint32_t)
m_type
223 <<
", ci (crc indicator) = " << (uint32_t)
m_ci <<
", eks (encryption key sequence) = " << (uint32_t)
m_eks
224 <<
", len (length) = " <<
m_len <<
", cid = " <<
m_cid <<
", hcs (header check sequence) = " << (uint32_t)
m_hcs;
245 uint8_t headerBuffer[6];
246 memset (headerBuffer, 0, 6);
248 headerBuffer[0] = ((
m_ht << 7) & 0x80) | ((
m_ec << 6) & 0x40) | (
m_type & 0x3F);
249 headerBuffer[1] = ((
m_esf << 7) & 0x80) | ((
m_ci << 6) & 0x40) | ((
m_eks << 4) & 0x30) | ((
m_rsv1 << 3) & 0x08)
250 | (((uint8_t)(
m_len >> 8)) & 0x07);
251 headerBuffer[2] = (uint8_t)(
m_len);
255 headerBuffer[5] = crc;
256 for (
int j = 0; j < 6; j++)
276 uint8_t headerBuffer[6];
277 for (
int j = 0; j < 6; j++)
279 headerBuffer[j] = i.
ReadU8 ();
281 m_ht = (headerBuffer[0] >> 7) & 0x01;
282 m_ec = (headerBuffer[0] >> 6) & 0x01;
283 m_type = (headerBuffer[0]) & 0x3F;
284 m_esf = (headerBuffer[1] >> 7) & 0x01;
285 m_ci = (headerBuffer[1] >> 6) & 0x01;
286 m_eks = (headerBuffer[1] >> 4) & 0x03;
287 m_rsv1 = (headerBuffer[1] >> 3) & 0x01;
288 uint16_t lenmsb = (headerBuffer[1] & 0x07);
289 uint16_t lenlsb = headerBuffer[2];
290 m_len = ((lenmsb << 8) & 0x0700) | (lenlsb & 0x00FF);
291 uint16_t cidmsb = headerBuffer[3];
292 uint16_t cidlsb = headerBuffer[4];
293 uint16_t cid = ((cidmsb << 8) & 0xFF00) | (cidlsb & 0x00FF);
295 m_hcs = headerBuffer[5];
385 return "Bandwidth Request Header";
390 static TypeId tid =
TypeId (
"ns3::BandwidthRequestHeader")
392 .SetGroupName(
"Wimax")
405 os <<
" ec (encryption control) = " << (uint32_t)
m_ec <<
", type = " << (uint32_t)
m_type
406 <<
", br (bandwidth request) = " <<
m_br <<
", cid = ";
408 os <<
", hcs (header check sequence) = " << (uint32_t)
m_hcs;
431 uint8_t headerBuffer[6];
432 uint8_t br_msb1 = (((uint32_t)
m_br) >> 16) & 0x00000007;
433 uint8_t br_msb2 = (((uint32_t)
m_br) >> 8) & 0x000000FF;
434 uint8_t br_lsb =
m_br & 0x000000FF;
435 headerBuffer[0] = ((
m_ht << 7) & 0x80) | ((
m_ec << 6) & 0x40) | ((
m_type << 3) & 0x38) | br_msb1;
436 headerBuffer[1] = br_msb2;
437 headerBuffer[2] = br_lsb;
442 for (
int j = 0; j < 6; j++)
461 uint8_t headerBuffer[6];
462 for (
int j = 0; j < 6; j++)
464 headerBuffer[j] = i.
ReadU8 ();
467 m_ht = (headerBuffer[0] >> 7) & 0x01;
468 m_ec = (headerBuffer[0] >> 6) & 0x01;
469 m_type = (headerBuffer[0] >> 3) & 0x07;
470 uint32_t br_msb1 = headerBuffer[0] & 0x00000007;
471 uint32_t br_msb2 = headerBuffer[1] & 0x000000FF;
472 uint32_t br_lsb = headerBuffer[2] & 0x000000FF;
473 m_br = ((uint32_t) br_msb1 << 14) | ((uint32_t) br_msb2 << 8) | br_lsb;
474 uint16_t cidmsb = headerBuffer[3];
475 uint16_t cidlsb = headerBuffer[4];
476 uint16_t cid = ((cidmsb << 8) & 0xFF00) | (cidlsb & 0x00FF);
478 m_hcs = headerBuffer[5];
537 return "Grant Management Subheader";
542 static TypeId tid =
TypeId (
"ns3::GrantManagementSubheader")
544 .SetGroupName(
"Wimax")
557 os <<
" si (slip indicator) = " << (uint32_t)
m_si <<
", pm (poll me) = " << (uint32_t)
m_pm
558 <<
", pbr (piggyback request) = " <<
m_pbr;
626 return "Fragmentation Subheader";
632 static TypeId tid =
TypeId (
"ns3::FragmentationSubheader")
634 .SetGroupName(
"Wimax")
649 os <<
" fc (fragment control) = " << (uint32_t)
m_fc <<
", fsn (fragmentation sequence number) = "
650 << (uint32_t)
m_fsn <<
"\n";
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.
BandwidthRequestHeader(void)
uint32_t m_br
Bandwidth Request.
~BandwidthRequestHeader(void)
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
void WriteU8(uint8_t data)
void WriteU16(uint16_t data)
uint32_t GetDistanceFrom(Iterator const &o) const
uint16_t GetIdentifier(void) const
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t CRC8Calculate(const uint8_t *data, int length)