A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
ampdu-subframe-header.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2013
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Ghada Badawy <gbadawy@gmail.com>
7
*/
8
9
#include "
ampdu-subframe-header.h
"
10
11
#include <iomanip>
12
13
namespace
ns3
14
{
15
16
NS_OBJECT_ENSURE_REGISTERED
(AmpduSubframeHeader);
17
18
TypeId
19
AmpduSubframeHeader::GetTypeId
()
20
{
21
static
TypeId
tid =
TypeId
(
"ns3::AmpduSubframeHeader"
)
22
.
SetParent
<
Header
>()
23
.SetGroupName(
"Wifi"
)
24
.AddConstructor<
AmpduSubframeHeader
>();
25
return
tid;
26
}
27
28
TypeId
29
AmpduSubframeHeader::GetInstanceTypeId
()
const
30
{
31
return
GetTypeId
();
32
}
33
34
AmpduSubframeHeader::AmpduSubframeHeader
()
35
: m_length(0),
36
m_eof(false),
37
m_signature(0x4E)
// Per 802.11 standard, the unique pattern is set to the value 0x4E.
38
{
39
}
40
41
AmpduSubframeHeader::~AmpduSubframeHeader
()
42
{
43
}
44
45
uint32_t
46
AmpduSubframeHeader::GetSerializedSize
()
const
47
{
48
return
(2 + 1 + 1);
49
}
50
51
void
52
AmpduSubframeHeader::Serialize
(
Buffer::Iterator
i)
const
53
{
54
i.
WriteHtolsbU16
((
m_eof
<< 15) |
m_length
);
55
i.
WriteU8
(1);
// not used, CRC always set to 1
56
i.
WriteU8
(
m_signature
);
57
}
58
59
uint32_t
60
AmpduSubframeHeader::Deserialize
(
Buffer::Iterator
start)
61
{
62
Buffer::Iterator
i = start;
63
uint16_t field = i.
ReadLsbtohU16
();
64
m_eof
= (field & 0x8000) >> 15;
65
m_length
= (field & 0x3fff);
66
i.
ReadU8
();
// CRC
67
m_signature
= i.
ReadU8
();
// SIG
68
return
i.
GetDistanceFrom
(start);
69
}
70
71
void
72
AmpduSubframeHeader::Print
(std::ostream& os)
const
73
{
74
os <<
"EOF = "
<<
m_eof
<<
", length = "
<<
m_length
<<
", signature = 0x"
<< std::hex
75
<<
m_signature
;
76
}
77
78
void
79
AmpduSubframeHeader::SetLength
(uint16_t length)
80
{
81
m_length
= length;
82
}
83
84
void
85
AmpduSubframeHeader::SetEof
(
bool
eof)
86
{
87
m_eof
= eof;
88
}
89
90
uint16_t
91
AmpduSubframeHeader::GetLength
()
const
92
{
93
return
m_length
;
94
}
95
96
bool
97
AmpduSubframeHeader::GetEof
()
const
98
{
99
return
m_eof
;
100
}
101
102
bool
103
AmpduSubframeHeader::IsSignatureValid
()
const
104
{
105
return
m_signature
== 0x4E;
106
}
107
108
}
// namespace ns3
ampdu-subframe-header.h
ns3::AmpduSubframeHeader
Headers for A-MPDU subframes.
Definition
ampdu-subframe-header.h:22
ns3::AmpduSubframeHeader::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Definition
ampdu-subframe-header.cc:60
ns3::AmpduSubframeHeader::m_length
uint16_t m_length
length field in bytes
Definition
ampdu-subframe-header.h:73
ns3::AmpduSubframeHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition
ampdu-subframe-header.cc:29
ns3::AmpduSubframeHeader::SetEof
void SetEof(bool eof)
Set the EOF field.
Definition
ampdu-subframe-header.cc:85
ns3::AmpduSubframeHeader::IsSignatureValid
bool IsSignatureValid() const
Return whether the pattern stored in the delimiter signature field is correct, i.e.
Definition
ampdu-subframe-header.cc:103
ns3::AmpduSubframeHeader::SetLength
void SetLength(uint16_t length)
Set the length field.
Definition
ampdu-subframe-header.cc:79
ns3::AmpduSubframeHeader::GetLength
uint16_t GetLength() const
Return the length field.
Definition
ampdu-subframe-header.cc:91
ns3::AmpduSubframeHeader::GetEof
bool GetEof() const
Return the EOF field.
Definition
ampdu-subframe-header.cc:97
ns3::AmpduSubframeHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition
ampdu-subframe-header.cc:46
ns3::AmpduSubframeHeader::m_eof
bool m_eof
EOF field.
Definition
ampdu-subframe-header.h:74
ns3::AmpduSubframeHeader::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
ampdu-subframe-header.cc:19
ns3::AmpduSubframeHeader::m_signature
uint8_t m_signature
delimiter signature (should correspond to pattern 0x4E in order to be assumed valid)
Definition
ampdu-subframe-header.h:75
ns3::AmpduSubframeHeader::AmpduSubframeHeader
AmpduSubframeHeader()
Definition
ampdu-subframe-header.cc:34
ns3::AmpduSubframeHeader::~AmpduSubframeHeader
~AmpduSubframeHeader() override
Definition
ampdu-subframe-header.cc:41
ns3::AmpduSubframeHeader::Print
void Print(std::ostream &os) const override
Definition
ampdu-subframe-header.cc:72
ns3::AmpduSubframeHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Definition
ampdu-subframe-header.cc:52
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition
buffer.h:89
ns3::Buffer::Iterator::WriteHtolsbU16
void WriteHtolsbU16(uint16_t data)
Definition
buffer.cc:891
ns3::Buffer::Iterator::ReadU8
uint8_t ReadU8()
Definition
buffer.h:1016
ns3::Buffer::Iterator::WriteU8
void WriteU8(uint8_t data)
Definition
buffer.h:870
ns3::Buffer::Iterator::ReadLsbtohU16
uint16_t ReadLsbtohU16()
Definition
buffer.cc:1053
ns3::Buffer::Iterator::GetDistanceFrom
uint32_t GetDistanceFrom(const Iterator &o) const
Definition
buffer.cc:769
ns3::Header
Protocol header serialization and deserialization.
Definition
header.h:33
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1001
uint32_t
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition
object-base.h:35
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
wifi
model
ampdu-subframe-header.cc
Generated on Fri Nov 8 2024 13:59:07 for ns-3 by
1.11.0