A Discrete-Event Network Simulator
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
10
11#include <iomanip>
12
13namespace ns3
14{
15
16NS_OBJECT_ENSURE_REGISTERED(AmpduSubframeHeader);
17
18TypeId
20{
21 static TypeId tid = TypeId("ns3::AmpduSubframeHeader")
23 .SetGroupName("Wifi")
24 .AddConstructor<AmpduSubframeHeader>();
25 return tid;
26}
27
33
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
44
47{
48 return (2 + 1 + 1);
49}
50
51void
53{
54 i.WriteHtolsbU16((m_eof << 15) | m_length);
55 i.WriteU8(1); // not used, CRC always set to 1
57}
58
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
71void
72AmpduSubframeHeader::Print(std::ostream& os) const
73{
74 os << "EOF = " << m_eof << ", length = " << m_length << ", signature = 0x" << std::hex
75 << m_signature;
76}
77
78void
80{
81 m_length = length;
82}
83
84void
86{
87 m_eof = eof;
88}
89
90uint16_t
92{
93 return m_length;
94}
95
96bool
98{
99 return m_eof;
100}
101
102bool
104{
105 return m_signature == 0x4E;
106}
107
108} // namespace ns3
Headers for A-MPDU subframes.
uint32_t Deserialize(Buffer::Iterator start) override
uint16_t m_length
length field in bytes
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void SetEof(bool eof)
Set the EOF field.
bool IsSignatureValid() const
Return whether the pattern stored in the delimiter signature field is correct, i.e.
void SetLength(uint16_t length)
Set the length field.
uint16_t GetLength() const
Return the length field.
bool GetEof() const
Return the EOF field.
uint32_t GetSerializedSize() const override
static TypeId GetTypeId()
Get the type ID.
uint8_t m_signature
delimiter signature (should correspond to pattern 0x4E in order to be assumed valid)
void Print(std::ostream &os) const override
void Serialize(Buffer::Iterator start) const override
iterator in a Buffer instance
Definition buffer.h:89
void WriteHtolsbU16(uint16_t data)
Definition buffer.cc:891
void WriteU8(uint8_t data)
Definition buffer.h:870
uint16_t ReadLsbtohU16()
Definition buffer.cc:1053
uint32_t GetDistanceFrom(const Iterator &o) const
Definition buffer.cc:769
Protocol header serialization and deserialization.
Definition header.h:33
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Every class exported by the ns3 library is enclosed in the ns3 namespace.