A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ofdm-downlink-frame-prefix.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007,2008 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
7 */
8
10
11#include "ns3/address-utils.h"
12
13#include <stdint.h>
14
15namespace ns3
16{
17
19 : m_rateId(0),
20 m_diuc(0),
21 m_preamblePresent(0),
22 m_length(0),
23 m_startTime(0)
24{
25}
26
30
31void
36
37void
42
43void
48
49void
51{
52 m_length = length;
53}
54
55void
57{
58 m_startTime = startTime;
59}
60
61uint8_t
63{
64 return m_rateId;
65}
66
67uint8_t
69{
70 return m_diuc;
71}
72
73uint8_t
78
79uint16_t
81{
82 return m_length;
83}
84
85uint16_t
87{
88 return m_startTime;
89}
90
91uint16_t
93{
94 return 1 + 1 + 1 + 2 + 2;
95}
96
99{
100 Buffer::Iterator i = start;
101 i.WriteU8(m_rateId);
102 i.WriteU8(m_diuc);
103 i.WriteU8(m_preamblePresent);
104 i.WriteU16(m_length);
105 i.WriteU16(m_startTime);
106 return i;
107}
108
111{
112 Buffer::Iterator i = start;
113 m_rateId = i.ReadU8();
114 m_diuc = i.ReadU8();
115 m_preamblePresent = i.ReadU8();
116 m_length = i.ReadU16();
117 m_startTime = i.ReadU16();
118 return i;
119}
120
122 : m_baseStationId(Mac48Address("00:00:00:00:00:00")),
123 m_frameNumber(0),
124 m_configurationChangeCount(0),
125 m_hcs(0)
126{
127}
128
132
133/* static */
134TypeId
136{
137 static TypeId tid =
138 TypeId("ns3::OfdmDownlinkFramePrefix").SetParent<Header>().SetGroupName("Wimax")
139 // No AddConstructor because this is an abstract class.
140 ;
141 return tid;
142}
143
144void
149
150void
155
156void
161
162void
167
168void
173
179
185
186uint8_t
191
192std::vector<DlFramePrefixIe>
197
198uint8_t
200{
201 return m_hcs;
202}
203
204std::string
206{
207 return "OFDM Downlink Frame Prefix";
208}
209
210void
211OfdmDownlinkFramePrefix::Print(std::ostream& os) const
212{
213 os << " base station id = " << m_baseStationId << ", frame number = " << m_frameNumber
214 << ", configuration change count = " << (uint32_t)m_configurationChangeCount
215 << ", number of dl frame prefix elements = " << m_dlFramePrefixElements.size()
216 << ", hcs = " << (uint32_t)m_hcs;
217}
218
221{
223
225 {
227 }
228
229 return 6 + 4 + 1 + dlFramePrefixElementsSize + 1;
230}
231
232void
234{
235 Buffer::Iterator i = start;
237 i.WriteU32(m_frameNumber);
239
241 {
242 i = dlFramePrefixElement.Write(i);
243 }
244
245 i.WriteU8(m_hcs);
246}
247
250{
251 Buffer::Iterator i = start;
253 m_frameNumber = i.ReadU32();
254 m_configurationChangeCount = i.ReadU8();
255
256 bool end = false;
257
258 while (!end)
259 {
262
264
265 if (dlFramePrefixElement.GetDiuc() == 14)
266 {
267 end = true;
268 }
269 }
270
271 m_hcs = i.ReadU8();
272
273 return GetSerializedSize();
274}
275
276} // namespace ns3
iterator in a Buffer instance
Definition buffer.h:89
This class implements the DL Frame Prefix IE as described by IEEE-802.16 standard.
uint8_t GetDiuc() const
Get DIUC field.
uint8_t m_preamblePresent
preamble present
uint16_t GetStartTime() const
Get start time field.
uint8_t GetPreamblePresent() const
Get preamble present field.
uint16_t GetLength() const
Get length field.
uint8_t GetRateId() const
Get rate ID field.
void SetStartTime(uint16_t startTime)
Set start time field.
void SetDiuc(uint8_t diuc)
Set DIUC field.
void SetLength(uint16_t length)
Set length field.
Buffer::Iterator Read(Buffer::Iterator start)
Read item function.
void SetPreamblePresent(uint8_t preamblePresent)
Set preamble present field.
Buffer::Iterator Write(Buffer::Iterator start) const
Write item function.
uint16_t GetSize() const
Get size field.
void SetRateId(uint8_t rateId)
Set rate ID field.
Protocol header serialization and deserialization.
Definition header.h:33
an EUI-48 address
a unique identifier for an interface.
Definition type-id.h:49
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void WriteTo(Buffer::Iterator &i, Ipv4Address ad)
Write an Ipv4Address to a Buffer.
void ReadFrom(Buffer::Iterator &i, Ipv4Address &ad)
Read an Ipv4Address from a Buffer.