A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ul-mac-messages.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007,2008,2009 INRIA, UDcast
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
7 * Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
8 * <amine.ismail@UDcast.com>
9 */
10
11#include "ul-mac-messages.h"
12
13#include <stdint.h>
14
15namespace ns3
16{
17
19
21 : m_bwReqOppSize(0),
22 m_rangReqOppSize(0),
23 m_frequency(0)
24{
25}
26
30
31void
33{
34 m_bwReqOppSize = bwReqOppSize;
35}
36
37void
39{
40 m_rangReqOppSize = rangReqOppSize;
41}
42
43void
45{
46 m_frequency = frequency;
47}
48
49uint16_t
54
55uint16_t
60
66
67uint16_t
69{
70 return 2 + 2 + 4;
71}
72
82
92
93// ----------------------------------------------------------------------------------------------------------
94
96 : m_sbchnlReqRegionFullParams(0),
97 m_sbchnlFocContCodes(0)
98{
99}
100
104
105void
107{
108 m_sbchnlReqRegionFullParams = sbchnlReqRegionFullParams;
109}
110
111void
113{
114 m_sbchnlFocContCodes = sbchnlFocContCodes;
115}
116
117uint8_t
122
123uint8_t
128
129uint16_t
134
143
152
153// ----------------------------------------------------------------------------------------------------------
154
156 : m_type(0),
157 m_length(0),
158 m_uiuc(0),
159 m_fecCodeType(0)
160{
161}
162
166
167void
169{
170 m_type = type;
171}
172
173void
175{
176 m_length = length;
177}
178
179void
181{
182 m_uiuc = uiuc;
183}
184
185void
187{
188 m_fecCodeType = fecCodeType;
189}
190
191uint8_t
193{
194 return m_type;
195}
196
197uint8_t
199{
200 return m_length;
201}
202
203uint8_t
205{
206 return m_uiuc;
207}
208
209uint8_t
214
215uint16_t
217{
218 return 1 + 1 + 1 + 1;
219}
220
223{
224 Buffer::Iterator i = start;
225 i.WriteU8(m_type);
226 i.WriteU8(m_length);
227 i.WriteU8(m_uiuc);
229 return i;
230}
231
234{
235 Buffer::Iterator i = start;
236 m_type = i.ReadU8();
237 m_length = i.ReadU8();
238 m_uiuc = i.ReadU8();
239 m_fecCodeType = i.ReadU8();
240 return i;
241}
242
243// ----------------------------------------------------------------------------------------------------------
244
246 : m_configurationChangeCount(0),
247 m_rangingBackoffStart(0),
248 m_rangingBackoffEnd(0),
249 m_requestBackoffStart(0),
250 m_requestBackoffEnd(0),
251 m_nrUlBurstProfiles(0)
252{
253}
254
256{
257}
258
259void
260Ucd::SetConfigurationChangeCount(uint8_t configurationChangeCount)
261{
262 m_configurationChangeCount = configurationChangeCount;
263}
264
265void
266Ucd::SetRangingBackoffStart(uint8_t rangingBackoffStart)
267{
268 m_rangingBackoffStart = rangingBackoffStart;
269}
270
271void
272Ucd::SetRangingBackoffEnd(uint8_t rangingBackoffEnd)
273{
274 m_rangingBackoffEnd = rangingBackoffEnd;
275}
276
277void
278Ucd::SetRequestBackoffStart(uint8_t requestBackoffStart)
279{
280 m_requestBackoffStart = requestBackoffStart;
281}
282
283void
284Ucd::SetRequestBackoffEnd(uint8_t requestBackoffEnd)
285{
286 m_requestBackoffEnd = requestBackoffEnd;
287}
288
289void
291{
292 m_channelEncodings = channelEncodings;
293}
294
295void
297{
298 m_ulBurstProfiles.push_back(ulBurstProfile);
299}
300
301void
302Ucd::SetNrUlBurstProfiles(uint8_t nrUlBurstProfiles)
303{
304 // number of burst profiles is set to number of UL-MAP IEs after processing UL-MAP
305 m_nrUlBurstProfiles = nrUlBurstProfiles;
306}
307
308uint8_t
313
314uint8_t
319
320uint8_t
322{
323 return m_rangingBackoffEnd;
324}
325
326uint8_t
331
332uint8_t
334{
335 return m_requestBackoffEnd;
336}
337
340{
341 return m_channelEncodings;
342}
343
344std::vector<OfdmUlBurstProfile>
346{
347 return m_ulBurstProfiles;
348}
349
350uint8_t
352{
353 return m_nrUlBurstProfiles;
354}
355
356std::string
358{
359 return "UCD";
360}
361
362TypeId
364{
365 static TypeId tid =
366 TypeId("ns3::Ucd").SetParent<Header>().SetGroupName("Wimax").AddConstructor<Ucd>();
367 return tid;
368}
369
370TypeId
372{
373 return GetTypeId();
374}
375
376void
377Ucd::Print(std::ostream& os) const
378{
379 os << " configuration change count = " << (uint32_t)m_configurationChangeCount
380 << ", ranging backoff start = " << (uint32_t)m_rangingBackoffStart
381 << ", ranging backoff end = " << (uint32_t)m_rangingBackoffEnd
382 << ", request backoff start = " << (uint32_t)m_requestBackoffStart
383 << ", request backoff end = " << (uint32_t)m_requestBackoffEnd
384 << ", number of ul burst profiles = " << m_ulBurstProfiles.size();
385}
386
389{
390 uint32_t ulBurstProfilesSize = 0;
391
392 for (const auto& burstProfile : m_ulBurstProfiles)
393 {
394 ulBurstProfilesSize += burstProfile.GetSize();
395 }
396
397 return 5 + m_channelEncodings.GetSize() + ulBurstProfilesSize;
398}
399
400void
402{
403 Buffer::Iterator i = start;
410
411 for (const auto& burstProfile : m_ulBurstProfiles)
412 {
413 i = burstProfile.Write(i);
414 }
415}
416
419{
420 Buffer::Iterator i = start;
427
428 for (uint8_t j = 0; j < m_nrUlBurstProfiles; j++)
429 {
430 OfdmUlBurstProfile burstProfile;
431 i = burstProfile.Read(i);
432 AddUlBurstProfile(burstProfile);
433 }
434
435 return i.GetDistanceFrom(start);
436}
437
438// ----------------------------------------------------------------------------------------------------------
439
441 : m_cid(),
442 m_startTime(0),
443 m_subchannelIndex(0),
444 m_uiuc(0),
445 m_duration(0),
446 m_midambleRepetitionInterval(0)
447{
448}
449
453
454void
456{
457 m_cid = cid;
458}
459
460void
461OfdmUlMapIe::SetStartTime(uint16_t startTime)
462{
463 m_startTime = startTime;
464}
465
466void
467OfdmUlMapIe::SetSubchannelIndex(uint8_t subchannelIndex)
468{
469 m_subchannelIndex = subchannelIndex;
470}
471
472void
474{
475 m_uiuc = uiuc;
476}
477
478void
479OfdmUlMapIe::SetDuration(uint16_t duration)
480{
481 m_duration = duration;
482}
483
484void
485OfdmUlMapIe::SetMidambleRepetitionInterval(uint8_t midambleRepetitionInterval)
486{
487 m_midambleRepetitionInterval = midambleRepetitionInterval;
488}
489
490Cid
492{
493 return m_cid;
494}
495
496uint16_t
498{
499 return m_startTime;
500}
501
502uint8_t
507
508uint8_t
510{
511 return m_uiuc;
512}
513
514uint16_t
516{
517 return m_duration;
518}
519
520uint8_t
525
526uint16_t
528{
529 return 2 + 2 + 1 + 1 + 2 + 1;
530}
531
544
547{
548 Buffer::Iterator i = start;
549 m_cid = i.ReadU16();
550 m_startTime = i.ReadU16();
552 m_uiuc = i.ReadU8();
553 m_duration = i.ReadU16();
555 return i;
556}
557
558// ----------------------------------------------------------------------------------------------------------
559
561
563 : m_reserved(0),
564 m_ucdCount(0),
565 m_allocationStartTime(0)
566{
567}
568
570{
571}
572
573void
574UlMap::SetUcdCount(uint8_t ucdCount)
575{
576 m_ucdCount = ucdCount;
577}
578
579void
581{
582 m_allocationStartTime = allocationStartTime;
583}
584
585void
587{
588 m_ulMapElements.push_back(ulMapElement);
589}
590
591uint8_t
593{
594 return m_ucdCount;
595}
596
602
603std::list<OfdmUlMapIe>
605{
606 return m_ulMapElements;
607}
608
609std::string
611{
612 return "UL-MAP";
613}
614
615TypeId
617{
618 static TypeId tid =
619 TypeId("ns3::UlMap").SetParent<Header>().SetGroupName("Wimax").AddConstructor<UlMap>();
620 return tid;
621}
622
623TypeId
625{
626 return GetTypeId();
627}
628
629void
630UlMap::Print(std::ostream& os) const
631{
632 os << " ucd count = " << (uint32_t)m_ucdCount
633 << ", allocation start time = " << m_allocationStartTime
634 << ", number of ul-map elements = " << m_ulMapElements.size();
635}
636
639{
640 uint32_t ulMapElementsSize = 0;
641
642 for (const auto& ulMapIe : m_ulMapElements)
643 {
644 ulMapElementsSize += ulMapIe.GetSize();
645 }
646
647 return 1 + 1 + 4 + ulMapElementsSize;
648}
649
650void
652{
653 Buffer::Iterator i = start;
657
658 for (const auto& ulMapIe : m_ulMapElements)
659 {
660 i = ulMapIe.Write(i);
661 }
662}
663
666{
667 Buffer::Iterator i = start;
668 m_reserved = i.ReadU8();
669 m_ucdCount = i.ReadU8();
671
672 m_ulMapElements.clear(); // only for printing, otherwise it shows wrong number of elements
673
674 while (true)
675 {
676 OfdmUlMapIe ulMapIe;
677 i = ulMapIe.Read(i);
678
679 AddUlMapElement(ulMapIe);
680
681 if (ulMapIe.GetUiuc() == 14) // End of Map IE
682 {
683 break;
684 }
685 }
686 return i.GetDistanceFrom(start);
687}
688
689} // 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
uint32_t GetDistanceFrom(const Iterator &o) const
Definition buffer.cc:769
uint16_t ReadU16()
Definition buffer.h:1024
Cid class.
Definition cid.h:26
uint16_t GetIdentifier() const
Definition cid.cc:34
Protocol header serialization and deserialization.
Definition header.h:33
This class implements the OFDM UCD channel encodings as described by "IEEE Standard forLocal and metr...
uint16_t GetSize() const
Get size.
Buffer::Iterator DoWrite(Buffer::Iterator start) const override
Write item.
uint8_t m_sbchnlFocContCodes
SB channel for control codes.
Buffer::Iterator DoRead(Buffer::Iterator start) override
Read item.
void SetSbchnlReqRegionFullParams(uint8_t sbchnlReqRegionFullParams)
Set SB channel reguest region full parameters.
uint8_t GetSbchnlReqRegionFullParams() const
Get SB channel request region full parameters.
void SetSbchnlFocContCodes(uint8_t sbchnlFocContCodes)
Set SB channel for control codes.
uint8_t GetSbchnlFocContCodes() const
Get SB channel for control codes.
uint8_t m_sbchnlReqRegionFullParams
SB channel request region full parameters.
This class implements the UL burst profile as described by "IEEE Standard forLocal and metropolitan a...
uint16_t GetSize() const
Get size.
void SetLength(uint8_t length)
Set length.
void SetUiuc(uint8_t uiuc)
Set UIUC.
void SetFecCodeType(uint8_t fecCodeType)
Set FEC code type.
void SetType(uint8_t type)
Set type.
uint8_t GetFecCodeType() const
Get FEC code type.
uint8_t GetType() const
Get type.
uint8_t GetLength() const
Get length.
uint8_t GetUiuc() const
Get UIUC.
Buffer::Iterator Write(Buffer::Iterator start) const
Write item.
uint8_t m_fecCodeType
FEC code type.
Buffer::Iterator Read(Buffer::Iterator start)
Read item.
This class implements the UL-MAP_IE message as described by "IEEE Standard forLocal and metropolitan ...
uint16_t GetSize() const
Get size.
uint16_t GetDuration() const
Get duration.
void SetStartTime(uint16_t startTime)
Set start time.
Buffer::Iterator Write(Buffer::Iterator start) const
Write item.
Cid GetCid() const
Get CID.
uint8_t GetUiuc() const
Get UIUC.
void SetDuration(uint16_t duration)
Set duration.
void SetMidambleRepetitionInterval(uint8_t midambleRepetitionInterval)
Set midambe repetition interval.
void SetSubchannelIndex(uint8_t subchannelIndex)
Set subchannel index.
uint16_t GetStartTime() const
Get start time.
uint8_t m_subchannelIndex
subchannel index
uint8_t m_midambleRepetitionInterval
midamble repetition interval
uint8_t GetSubchannelIndex() const
Get subchannel index.
uint16_t m_startTime
start time
uint8_t m_uiuc
UIUC.
void SetCid(const Cid &cid)
Set CID.
Buffer::Iterator Read(Buffer::Iterator start)
Read item.
uint16_t m_duration
duration
void SetUiuc(uint8_t uiuc)
Set UIUC.
uint8_t GetMidambleRepetitionInterval() const
Get Midamble repetition interval.
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
void SetRangReqOppSize(uint16_t rangReqOppSize)
Set range request opp size.
void SetFrequency(uint32_t frequency)
Set frequency.
virtual Buffer::Iterator DoRead(Buffer::Iterator start)=0
Read item.
uint16_t m_bwReqOppSize
BW request opp size.
Buffer::Iterator Write(Buffer::Iterator start) const
Write item.
virtual Buffer::Iterator DoWrite(Buffer::Iterator start) const =0
Write item.
uint32_t m_frequency
frequency
uint16_t m_rangReqOppSize
range request opp size
uint16_t GetSize() const
Get size.
uint16_t GetRangReqOppSize() const
Get range request opp size.
Buffer::Iterator Read(Buffer::Iterator start)
Read item.
void SetBwReqOppSize(uint16_t bwReqOppSize)
Set BW request opp size.
uint16_t GetBwReqOppSize() const
Get BW request opp size.
uint32_t GetFrequency() const
Get frequency.
This class implements the UCD message as described by "IEEE Standard forLocal and metropolitan area n...
static TypeId GetTypeId()
Get the type ID.
uint8_t GetRangingBackoffEnd() const
Get ranging backoff end.
void SetNrUlBurstProfiles(uint8_t nrUlBurstProfiles)
Set NR UL burst profiles.
uint8_t m_nrUlBurstProfiles
number UL burst profiles
uint8_t GetNrUlBurstProfiles() const
Get number UL burst profiles.
uint8_t m_rangingBackoffStart
ranging backoff start
uint8_t m_requestBackoffEnd
request backoff end
uint8_t m_requestBackoffStart
request backoff start
uint8_t m_rangingBackoffEnd
ranging backoff end
uint8_t GetRequestBackoffStart() const
Get request backoff start.
void AddUlBurstProfile(OfdmUlBurstProfile ulBurstProfile)
Add UL burst profile.
void Print(std::ostream &os) const override
void SetChannelEncodings(OfdmUcdChannelEncodings channelEncodings)
Set channel encodings.
std::vector< OfdmUlBurstProfile > GetUlBurstProfiles() const
Get UL burst profiles.
uint8_t GetConfigurationChangeCount() const
Get configuration change count.
void SetConfigurationChangeCount(uint8_t ucdCount)
Set configuration change count.
uint32_t Deserialize(Buffer::Iterator start) override
void SetRangingBackoffStart(uint8_t rangingBackoffStart)
Set ranging backoff start.
void Serialize(Buffer::Iterator start) const override
void SetRangingBackoffEnd(uint8_t rangingBackoffEnd)
Set ranging backoff end.
uint32_t GetSerializedSize() const override
OfdmUcdChannelEncodings GetChannelEncodings() const
Get channel encodings.
void SetRequestBackoffEnd(uint8_t requestBackoffEnd)
Set request backoff end.
std::vector< OfdmUlBurstProfile > m_ulBurstProfiles
UL burst profiles.
uint8_t GetRangingBackoffStart() const
Get ranging backoff start.
uint8_t m_configurationChangeCount
configuration change count
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
~Ucd() override
uint8_t GetRequestBackoffEnd() const
Get request backoff end.
std::string GetName() const
Get name.
void SetRequestBackoffStart(uint8_t requestBackoffStart)
Set request backoff start.
OfdmUcdChannelEncodings m_channelEncodings
TLV Encoded information for the overall channel.
This class implements the UL-MAP_IE message as described by "IEEE Standard forLocal and metropolitan ...
void SetAllocationStartTime(uint32_t allocationStartTime)
Set allocation start time.
uint8_t m_ucdCount
UCD count.
std::list< OfdmUlMapIe > GetUlMapElements() const
Get UL map elements.
uint32_t GetAllocationStartTime() const
Get allocation start time.
std::string GetName() const
Get name.
uint8_t m_reserved
changed as per the amendment 802.16e-2005
void AddUlMapElement(OfdmUlMapIe ulMapElement)
Add UL map element.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
~UlMap() override
void SetUcdCount(uint8_t ucdCount)
Set UCD count.
uint32_t GetSerializedSize() const override
void Serialize(Buffer::Iterator start) const override
void Print(std::ostream &os) const override
uint32_t m_allocationStartTime
allocation start time
std::list< OfdmUlMapIe > m_ulMapElements
UL map elements.
static TypeId GetTypeId()
Get the type ID.
uint32_t Deserialize(Buffer::Iterator start) override
uint8_t GetUcdCount() const
Get UCD count.
#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.