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
amsdu-subframe-header.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2009 MIRKO BANCHI
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Mirko Banchi <mk.banchi@gmail.com>
7
*/
8
9
#include "
amsdu-subframe-header.h
"
10
11
#include "ns3/address-utils.h"
12
13
namespace
ns3
14
{
15
16
NS_OBJECT_ENSURE_REGISTERED
(AmsduSubframeHeader);
17
18
TypeId
19
AmsduSubframeHeader::GetTypeId
()
20
{
21
static
TypeId
tid =
TypeId
(
"ns3::AmsduSubframeHeader"
)
22
.
SetParent
<
Header
>()
23
.SetGroupName(
"Wifi"
)
24
.AddConstructor<
AmsduSubframeHeader
>();
25
return
tid;
26
}
27
28
TypeId
29
AmsduSubframeHeader::GetInstanceTypeId
()
const
30
{
31
return
GetTypeId
();
32
}
33
34
AmsduSubframeHeader::AmsduSubframeHeader
()
35
: m_length(0)
36
{
37
}
38
39
AmsduSubframeHeader::~AmsduSubframeHeader
()
40
{
41
}
42
43
uint32_t
44
AmsduSubframeHeader::GetSerializedSize
()
const
45
{
46
return
(6 + 6 + 2);
47
}
48
49
void
50
AmsduSubframeHeader::Serialize
(
Buffer::Iterator
i)
const
51
{
52
WriteTo
(i,
m_da
);
53
WriteTo
(i,
m_sa
);
54
i.
WriteHtonU16
(
m_length
);
55
}
56
57
uint32_t
58
AmsduSubframeHeader::Deserialize
(
Buffer::Iterator
start)
59
{
60
Buffer::Iterator
i = start;
61
ReadFrom
(i,
m_da
);
62
ReadFrom
(i,
m_sa
);
63
m_length
= i.
ReadNtohU16
();
64
return
i.
GetDistanceFrom
(start);
65
}
66
67
void
68
AmsduSubframeHeader::Print
(std::ostream& os)
const
69
{
70
os <<
"DA = "
<<
m_da
<<
", SA = "
<<
m_sa
<<
", length = "
<<
m_length
;
71
}
72
73
void
74
AmsduSubframeHeader::SetDestinationAddr
(
Mac48Address
to)
75
{
76
m_da
= to;
77
}
78
79
void
80
AmsduSubframeHeader::SetSourceAddr
(
Mac48Address
from)
81
{
82
m_sa
= from;
83
}
84
85
void
86
AmsduSubframeHeader::SetLength
(uint16_t length)
87
{
88
m_length
= length;
89
}
90
91
Mac48Address
92
AmsduSubframeHeader::GetDestinationAddr
()
const
93
{
94
return
m_da
;
95
}
96
97
Mac48Address
98
AmsduSubframeHeader::GetSourceAddr
()
const
99
{
100
return
m_sa
;
101
}
102
103
uint16_t
104
AmsduSubframeHeader::GetLength
()
const
105
{
106
return
m_length
;
107
}
108
109
}
// namespace ns3
amsdu-subframe-header.h
ns3::AmsduSubframeHeader
Headers for A-MSDU subframes.
Definition
amsdu-subframe-header.h:23
ns3::AmsduSubframeHeader::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
amsdu-subframe-header.cc:19
ns3::AmsduSubframeHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition
amsdu-subframe-header.cc:44
ns3::AmsduSubframeHeader::SetSourceAddr
void SetSourceAddr(Mac48Address to)
Set source address function.
Definition
amsdu-subframe-header.cc:80
ns3::AmsduSubframeHeader::AmsduSubframeHeader
AmsduSubframeHeader()
Definition
amsdu-subframe-header.cc:34
ns3::AmsduSubframeHeader::GetSourceAddr
Mac48Address GetSourceAddr() const
Get source address function.
Definition
amsdu-subframe-header.cc:98
ns3::AmsduSubframeHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition
amsdu-subframe-header.cc:29
ns3::AmsduSubframeHeader::SetDestinationAddr
void SetDestinationAddr(Mac48Address to)
Set destination address function.
Definition
amsdu-subframe-header.cc:74
ns3::AmsduSubframeHeader::m_sa
Mac48Address m_sa
source address
Definition
amsdu-subframe-header.h:73
ns3::AmsduSubframeHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Definition
amsdu-subframe-header.cc:50
ns3::AmsduSubframeHeader::m_length
uint16_t m_length
length in bytes
Definition
amsdu-subframe-header.h:74
ns3::AmsduSubframeHeader::m_da
Mac48Address m_da
destination address
Definition
amsdu-subframe-header.h:72
ns3::AmsduSubframeHeader::SetLength
void SetLength(uint16_t length)
Set length function.
Definition
amsdu-subframe-header.cc:86
ns3::AmsduSubframeHeader::GetDestinationAddr
Mac48Address GetDestinationAddr() const
Get destination address function.
Definition
amsdu-subframe-header.cc:92
ns3::AmsduSubframeHeader::GetLength
uint16_t GetLength() const
Get length function.
Definition
amsdu-subframe-header.cc:104
ns3::AmsduSubframeHeader::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Definition
amsdu-subframe-header.cc:58
ns3::AmsduSubframeHeader::Print
void Print(std::ostream &os) const override
Definition
amsdu-subframe-header.cc:68
ns3::AmsduSubframeHeader::~AmsduSubframeHeader
~AmsduSubframeHeader() override
Definition
amsdu-subframe-header.cc:39
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition
buffer.h:89
ns3::Buffer::Iterator::WriteHtonU16
void WriteHtonU16(uint16_t data)
Definition
buffer.h:904
ns3::Buffer::Iterator::ReadNtohU16
uint16_t ReadNtohU16()
Definition
buffer.h:943
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::Mac48Address
an EUI-48 address
Definition
mac48-address.h:35
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.
ns3::WriteTo
void WriteTo(Buffer::Iterator &i, Ipv4Address ad)
Write an Ipv4Address to a Buffer.
Definition
address-utils.cc:21
ns3::ReadFrom
void ReadFrom(Buffer::Iterator &i, Ipv4Address &ad)
Read an Ipv4Address from a Buffer.
Definition
address-utils.cc:74
src
wifi
model
amsdu-subframe-header.cc
Generated on Fri Nov 8 2024 13:59:07 for ns-3 by
1.11.0