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
33{
34 m_rateId = rateId;
35}
36
37void
39{
40 m_diuc = diuc;
41}
42
43void
45{
46 m_preamblePresent = preamblePresent;
47}
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);
106 return i;
107}
108
111{
112 Buffer::Iterator i = start;
113 m_rateId = i.ReadU8();
114 m_diuc = 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
146{
147 m_baseStationId = baseStationId;
148}
149
150void
152{
153 m_frameNumber = frameNumber;
154}
155
156void
158{
159 m_configurationChangeCount = configurationChangeCount;
160}
161
162void
164{
165 m_dlFramePrefixElements.push_back(dlFramePrefixElement);
166}
167
168void
170{
171 m_hcs = hcs;
172}
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{
222 int dlFramePrefixElementsSize = 0;
223
224 for (const auto& dlFramePrefixElement : m_dlFramePrefixElements)
225 {
226 dlFramePrefixElementsSize += dlFramePrefixElement.GetSize();
227 }
228
229 return 6 + 4 + 1 + dlFramePrefixElementsSize + 1;
230}
231
232void
234{
235 Buffer::Iterator i = start;
239
240 for (const auto& dlFramePrefixElement : m_dlFramePrefixElements)
241 {
242 i = dlFramePrefixElement.Write(i);
243 }
244
245 i.WriteU8(m_hcs);
246}
247
250{
251 Buffer::Iterator i = start;
255
256 bool end = false;
257
258 while (!end)
259 {
260 DlFramePrefixIe dlFramePrefixElement;
261 i = dlFramePrefixElement.Read(i);
262
263 AddDlFramePrefixElement(dlFramePrefixElement);
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
void WriteU32(uint32_t data)
Definition buffer.cc:857
void WriteU8(uint8_t data)
Definition buffer.h:870
void Write(const uint8_t *buffer, uint32_t size)
Definition buffer.cc:937
void WriteU16(uint16_t data)
Definition buffer.cc:848
uint32_t ReadU32()
Definition buffer.cc:955
uint16_t ReadU16()
Definition buffer.h:1024
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:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
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.