A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wimax-tlv.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 INRIA, UDcast
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
18 *
19 */
20
21#include "wimax-tlv.h"
22
23namespace ns3
24{
25
27
28// NS_OBJECT_ENSURE_REGISTERED ("Tlv");
29
30/* static */
31TypeId
33{
34 static TypeId tid =
35 TypeId("ns3::Tlv").SetParent<Header>().SetGroupName("Wimax").AddConstructor<Tlv>();
36 return tid;
37}
38
41{
42 return GetTypeId();
43}
44
45void
46Tlv::Print(std::ostream& os) const
47{
48 os << "TLV type = " << (uint32_t)m_type << " TLV Length = " << (uint64_t)m_length;
49}
50
51Tlv::Tlv(uint8_t type, uint64_t length, const TlvValue& value)
52{
53 m_type = type;
54 m_length = length;
55 m_value = value.Copy();
56}
57
59{
60 m_type = 0;
61 m_length = 0;
62 m_value = nullptr;
63}
64
66{
67 if (m_value != nullptr)
68 {
69 delete m_value;
70 m_value = nullptr;
71 }
72}
73
76{
77 return m_value->Copy();
78}
79
80Tlv::Tlv(const Tlv& tlv)
81{
82 m_type = tlv.GetType();
83 m_length = tlv.GetLength();
84 m_value = tlv.CopyValue();
85}
86
87Tlv&
89{
90 if (m_value != nullptr)
91 {
92 delete m_value;
93 }
94 m_type = o.GetType();
95 m_length = o.GetLength();
96 m_value = o.CopyValue();
97
98 return *this;
99}
100
103{
104 return 1 + GetSizeOfLen() + m_value->GetSerializedSize();
105}
106
107uint8_t
109{
110 uint8_t sizeOfLen = 1;
111
112 if (m_length > 127)
113 {
114 sizeOfLen = 2;
115 uint64_t testValue = 0xFF;
116 while (m_length > testValue)
117 {
118 sizeOfLen++;
119 testValue *= 0xFF;
120 }
121 }
122 return sizeOfLen;
123}
124
125void
127{
128 i.WriteU8(m_type);
129 uint8_t lenSize = GetSizeOfLen();
130 if (lenSize == 1)
131 {
132 i.WriteU8(m_length);
133 }
134 else
135 {
136 i.WriteU8((lenSize - 1) | WIMAX_TLV_EXTENDED_LENGTH_MASK);
137 for (int j = 0; j < lenSize - 1; j++)
138 {
139 i.WriteU8((uint8_t)(m_length >> ((lenSize - 1 - 1 - j) * 8)));
140 }
141 }
142 m_value->Serialize(i);
143}
144
147{
148 // read the type of tlv
149 m_type = i.ReadU8();
150
151 // read the length
152 uint8_t lenSize = i.ReadU8();
153 uint32_t serializedSize = 2;
154 if (lenSize < 127)
155 {
156 m_length = lenSize;
157 }
158 else
159 {
160 lenSize &= ~WIMAX_TLV_EXTENDED_LENGTH_MASK;
161 for (int j = 0; j < lenSize; j++)
162 {
163 m_length <<= 8;
164 m_length |= i.ReadU8();
165 serializedSize++;
166 }
167 }
168 switch (m_type)
169 {
170 case HMAC_TUPLE:
171 /// \todo implement Deserialize HMAC_TUPLE
172 NS_FATAL_ERROR("Not implemented-- please implement and contribute a patch");
173 break;
175 /// \todo implement Deserialize MAC_VERSION_ENCODING
176 NS_FATAL_ERROR("Not implemented-- please implement and contribute a patch");
177 break;
179 /// \todo implement Deserialize CURRENT_TRANSMIT_POWER
180 NS_FATAL_ERROR("Not implemented-- please implement and contribute a patch");
181 break;
184 serializedSize += val.Deserialize(i, m_length);
185 m_value = val.Copy();
186 break;
187 }
188 case UPLINK_SERVICE_FLOW: {
190 serializedSize += val.Deserialize(i, m_length);
191 m_value = val.Copy();
192 break;
193 }
195 /// \todo implement Deserialize VENDOR_ID_EMCODING
196 NS_FATAL_ERROR("Not implemented-- please implement and contribute a patch");
197 break;
199 /// \todo implement Deserialize VENDOR_SPECIFIC_INFORMATION
200 NS_FATAL_ERROR("Not implemented-- please implement and contribute a patch");
201 break;
202 default:
203 NS_ASSERT_MSG(false, "Unknown tlv type.");
204 break;
205 }
206
207 return serializedSize;
208}
209
210uint8_t
212{
213 return m_type;
214}
215
216uint64_t
218{
219 return m_length;
220}
221
224{
225 return m_value;
226}
227
228Tlv*
230{
231 return new Tlv(m_type, m_length, *m_value);
232}
233
234// ==============================================================================
236{
237 m_tlvList = new std::vector<Tlv*>;
238}
239
241{
242 for (auto iter = m_tlvList->begin(); iter != m_tlvList->end(); ++iter)
243 {
244 delete (*iter);
245 }
246 m_tlvList->clear();
247 delete m_tlvList;
248}
249
252{
253 uint32_t size = 0;
254 for (auto iter = m_tlvList->begin(); iter != m_tlvList->end(); ++iter)
255 {
256 size += (*iter)->GetSerializedSize();
257 }
258 return size;
259}
260
261void
263{
264 for (auto iter = m_tlvList->begin(); iter != m_tlvList->end(); ++iter)
265 {
266 (*iter)->Serialize(i);
267 i.Next((*iter)->GetSerializedSize());
268 }
269}
270
273{
274 return m_tlvList->begin();
275}
276
279{
280 return m_tlvList->end();
281}
282
283void
285{
286 m_tlvList->push_back(val.Copy());
287}
288
289// ==============================================================================
291{
292}
293
296{
297 auto tmp = new SfVectorTlvValue();
298 for (auto iter = Begin(); iter != End(); ++iter)
299 {
300 tmp->Add(Tlv((*iter)->GetType(), (*iter)->GetLength(), *(*iter)->PeekValue()));
301 }
302 return tmp;
303}
304
307{
308 uint64_t serializedSize = 0;
309 while (serializedSize < valueLen)
310 {
311 uint8_t type = i.ReadU8();
312 // read the length
313 uint8_t lenSize = i.ReadU8();
314 serializedSize += 2;
315 uint64_t length = 0;
316 if (lenSize < 127)
317 {
318 length = lenSize;
319 }
320 else
321 {
322 lenSize &= ~WIMAX_TLV_EXTENDED_LENGTH_MASK;
323 for (int j = 0; j < lenSize; j++)
324 {
325 length <<= 8;
326 length |= i.ReadU8();
327 serializedSize++;
328 }
329 }
330 switch (type)
331 {
332 case SFID: {
333 U32TlvValue val;
334 serializedSize += val.Deserialize(i);
335 Add(Tlv(SFID, 4, val));
336 break;
337 }
338 case CID: {
339 U16TlvValue val;
340 serializedSize += val.Deserialize(i);
341 Add(Tlv(CID, 2, val));
342 break;
343 }
345 NS_FATAL_ERROR("Not implemented-- please implement and contribute a patch");
346 break;
347 case reserved1:
348 // NOTHING
349 break;
351 U8TlvValue val;
352 serializedSize += val.Deserialize(i);
354 break;
355 }
356 case Traffic_Priority: {
357 U8TlvValue val;
358 serializedSize += val.Deserialize(i);
359 Add(Tlv(Traffic_Priority, 1, val));
360 break;
361 }
363 U32TlvValue val;
364 serializedSize += val.Deserialize(i);
366 break;
367 }
369 U32TlvValue val;
370 serializedSize += val.Deserialize(i);
371 Add(Tlv(Maximum_Traffic_Burst, 4, val));
372 break;
373 }
375 U32TlvValue val;
376 serializedSize += val.Deserialize(i);
378 break;
379 }
381 U32TlvValue val;
382 serializedSize += val.Deserialize(i);
384 break;
385 }
387 U8TlvValue val;
388 serializedSize += val.Deserialize(i);
390 break;
391 }
393 U32TlvValue val;
394 serializedSize += val.Deserialize(i);
396 break;
397 }
398 case Tolerated_Jitter: {
399 U32TlvValue val;
400 serializedSize += val.Deserialize(i);
401 Add(Tlv(Tolerated_Jitter, 4, val));
402 break;
403 }
404 case Maximum_Latency: {
405 U32TlvValue val;
406 serializedSize += val.Deserialize(i);
407 Add(Tlv(Maximum_Latency, 4, val));
408 break;
409 }
411 U8TlvValue val;
412 serializedSize += val.Deserialize(i);
414 break;
415 }
416 case SDU_Size: {
417 U8TlvValue val;
418 serializedSize += val.Deserialize(i);
419 Add(Tlv(SDU_Size, 1, val));
420 break;
421 }
422 case Target_SAID: {
423 U16TlvValue val;
424 serializedSize += val.Deserialize(i);
425 Add(Tlv(Target_SAID, 2, val));
426 break;
427 }
428 case ARQ_Enable: {
429 U8TlvValue val;
430 serializedSize += val.Deserialize(i);
431 Add(Tlv(ARQ_Enable, 1, val));
432 break;
433 }
434 case ARQ_WINDOW_SIZE: {
435 U16TlvValue val;
436 serializedSize += val.Deserialize(i);
437 Add(Tlv(ARQ_WINDOW_SIZE, 2, val));
438 break;
439 }
441 break;
443 break;
445 break;
446 case ARQ_SYNC_LOSS:
447 break;
449 break;
451 break;
452 case ARQ_BLOCK_SIZE:
453 break;
454 case reserved2:
455 break;
456 case CS_Specification: {
457 U8TlvValue val;
458 serializedSize += val.Deserialize(i);
459 Add(Tlv(CS_Specification, 1, val));
460 break;
461 }
462 case IPV4_CS_Parameters: {
464 uint32_t size = val.Deserialize(i, length);
465 serializedSize += size;
466 Add(Tlv(IPV4_CS_Parameters, size, val));
467 break;
468 }
469 default:
470 NS_ASSERT_MSG(false, "Unknown tlv type.");
471 break;
472 }
473 i.Next(length);
474 }
475 return serializedSize;
476}
477
478// ==============================================================================
479
481{
482 m_value = value;
483}
484
486{
487 m_value = 0;
488}
489
491{
492}
493
496{
497 return 1;
498}
499
500void
502{
503 i.WriteU8(m_value);
504}
505
508{
509 return Deserialize(i);
510}
511
514{
515 m_value = i.ReadU8();
516 return 1;
517}
518
519uint8_t
521{
522 return m_value;
523}
524
527{
528 auto tmp = new U8TlvValue(m_value);
529 return tmp;
530}
531
532// ==============================================================================
534{
535 m_value = value;
536}
537
539{
540 m_value = 0;
541}
542
544{
545}
546
549{
550 return 2;
551}
552
553void
555{
557}
558
561{
562 return Deserialize(i);
563}
564
567{
568 m_value = i.ReadNtohU16();
569 return 2;
570}
571
572uint16_t
574{
575 return m_value;
576}
577
580{
581 auto tmp = new U16TlvValue(m_value);
582 return tmp;
583}
584
585// ==============================================================================
587{
588 m_value = value;
589}
590
592{
593 m_value = 0;
594}
595
597{
598}
599
602{
603 return 4;
604}
605
606void
608{
610}
611
614{
615 return Deserialize(i);
616}
617
620{
621 m_value = i.ReadNtohU32();
622 return 4;
623}
624
627{
628 return m_value;
629}
630
633{
634 auto tmp = new U32TlvValue(m_value);
635 return tmp;
636}
637
638// ==============================================================================
641{
642 uint64_t serializedSize = 0;
643 uint8_t lenSize = 0;
644 uint8_t type = 0;
645 while (serializedSize < valueLength)
646 {
647 type = i.ReadU8();
648 // read the length
649 lenSize = i.ReadU8();
650 serializedSize += 2;
651 uint64_t length = 0;
652 if (lenSize < 127)
653 {
654 length = lenSize;
655 }
656 else
657 {
658 lenSize &= ~WIMAX_TLV_EXTENDED_LENGTH_MASK;
659 for (int j = 0; j < lenSize; j++)
660 {
661 length <<= 8;
662 length |= i.ReadU8();
663 serializedSize++;
664 }
665 }
666 switch (type)
667 {
669 U8TlvValue val;
670 serializedSize += val.Deserialize(i);
671 Add(Tlv(Classifier_DSC_Action, 1, val));
672 break;
673 }
676 serializedSize += val.Deserialize(i, length);
678 break;
679 }
680 }
681 i.Next(length);
682 }
683 return serializedSize;
684}
685
687{
688}
689
692{
693 auto tmp = new CsParamVectorTlvValue();
694 for (auto iter = Begin(); iter != End(); ++iter)
695 {
696 tmp->Add(Tlv((*iter)->GetType(), (*iter)->GetLength(), *(*iter)->PeekValue()));
697 }
698 return tmp;
699}
700
701// ==============================================================================
702
704{
705}
706
709{
710 auto tmp = new ClassificationRuleVectorTlvValue();
711 for (auto iter = Begin(); iter != End(); ++iter)
712 {
713 tmp->Add(Tlv((*iter)->GetType(), (*iter)->GetLength(), *(*iter)->PeekValue()));
714 }
715 return tmp;
716}
717
720{
721 uint64_t serializedSize = 0;
722 uint8_t lenSize = 0;
723 uint8_t type = 0;
724 while (serializedSize < valueLength)
725 {
726 type = i.ReadU8();
727 // read the length
728 lenSize = i.ReadU8();
729 serializedSize += 2;
730 uint64_t length = 0;
731 if (lenSize < 127)
732 {
733 length = lenSize;
734 }
735 else
736 {
737 lenSize &= ~WIMAX_TLV_EXTENDED_LENGTH_MASK;
738 for (int j = 0; j < lenSize; j++)
739 {
740 length <<= 8;
741 length |= i.ReadU8();
742 serializedSize++;
743 }
744 }
745 switch (type)
746 {
747 case Priority: {
748 U8TlvValue val;
749 serializedSize += val.Deserialize(i);
750 Add(Tlv(Priority, 1, val));
751 break;
752 }
753 case ToS: {
754 TosTlvValue val;
755 serializedSize += val.Deserialize(i, length);
756 Add(Tlv(ToS, val.GetSerializedSize(), val));
757 break;
758 }
759 case Protocol: {
761 serializedSize += val.Deserialize(i, length);
762 Add(Tlv(Protocol, val.GetSerializedSize(), val));
763 break;
764 }
765 case IP_src: {
767 serializedSize += val.Deserialize(i, length);
768 Add(Tlv(IP_src, val.GetSerializedSize(), val));
769 break;
770 }
771 case IP_dst: {
773 serializedSize += val.Deserialize(i, length);
774 Add(Tlv(IP_dst, val.GetSerializedSize(), val));
775 break;
776 }
777 case Port_src: {
779 serializedSize += val.Deserialize(i, length);
780 Add(Tlv(Port_src, val.GetSerializedSize(), val));
781 break;
782 }
783 case Port_dst: {
785 serializedSize += val.Deserialize(i, length);
786 Add(Tlv(Port_dst, val.GetSerializedSize(), val));
787 break;
788 }
789 case Index: {
790 U16TlvValue val;
791 serializedSize += val.Deserialize(i);
792 Add(Tlv(Index, 2, val));
793 break;
794 }
795 }
796 i.Next(length);
797 }
798 return serializedSize;
799}
800
801// ==============================================================================
803{
804 m_low = 0;
805 m_high = 0;
806 m_mask = 0;
807}
808
809TosTlvValue::TosTlvValue(uint8_t low, uint8_t high, uint8_t mask)
810{
811 m_low = low;
812 m_high = high;
813 m_mask = mask;
814}
815
817{
818}
819
822{
823 return 3;
824}
825
826void
828{
829 i.WriteU8(m_low);
830 i.WriteU8(m_high);
831 i.WriteU8(m_mask);
832}
833
836{
837 m_low = i.ReadU8();
838 m_high = i.ReadU8();
839 m_mask = i.ReadU8();
840 return 3;
841}
842
843uint8_t
845{
846 return m_low;
847}
848
849uint8_t
851{
852 return m_high;
853}
854
855uint8_t
857{
858 return m_mask;
859}
860
863{
864 return new TosTlvValue(m_low, m_high, m_mask);
865}
866
867// ==============================================================================
869{
870 m_portRange = new std::vector<PortRange>;
871}
872
874{
875 m_portRange->clear();
876 delete m_portRange;
877}
878
881{
882 return m_portRange->size() * 4; // a port range is defined by 2 ports, each using 2 bytes
883}
884
885void
887{
888 for (auto iter = m_portRange->begin(); iter != m_portRange->end(); ++iter)
889 {
890 i.WriteHtonU16((*iter).PortLow);
891 i.WriteHtonU16((*iter).PortHigh);
892 }
893}
894
897{
898 uint64_t len = 0;
899 while (len < valueLength)
900 {
901 uint16_t low = i.ReadNtohU16();
902 uint16_t high = i.ReadNtohU16();
903 Add(low, high);
904 len += 4;
905 }
906 return len;
907}
908
909void
910PortRangeTlvValue::Add(uint16_t portLow, uint16_t portHigh)
911{
912 PortRange tmp;
913 tmp.PortLow = portLow;
914 tmp.PortHigh = portHigh;
915 m_portRange->push_back(tmp);
916}
917
920{
921 return m_portRange->begin();
922}
923
926{
927 return m_portRange->end();
928}
929
932{
933 auto tmp = new PortRangeTlvValue();
934 for (auto iter = m_portRange->begin(); iter != m_portRange->end(); ++iter)
935 {
936 tmp->Add((*iter).PortLow, (*iter).PortHigh);
937 }
938 return tmp;
939}
940
941// ==============================================================================
942
944{
945 m_protocol = new std::vector<uint8_t>;
946}
947
949{
950 if (m_protocol != nullptr)
951 {
952 m_protocol->clear();
953 delete m_protocol;
954 m_protocol = nullptr;
955 }
956}
957
960{
961 return m_protocol->size();
962}
963
964void
966{
967 for (auto iter = m_protocol->begin(); iter != m_protocol->end(); ++iter)
968 {
969 i.WriteU8(*iter);
970 }
971}
972
975{
976 uint64_t len = 0;
977 while (len < valueLength)
978 {
979 Add(i.ReadU8());
980 len++;
981 }
982 return len;
983}
984
985void
986ProtocolTlvValue::Add(uint8_t protocol)
987{
988 m_protocol->push_back(protocol);
989}
990
993{
994 return m_protocol->begin();
995}
996
999{
1000 return m_protocol->end();
1001}
1002
1005{
1006 auto tmp = new ProtocolTlvValue();
1007 for (auto iter = m_protocol->begin(); iter != m_protocol->end(); ++iter)
1008 {
1009 tmp->Add(*iter);
1010 }
1011 return tmp;
1012}
1013
1014// ==============================================================================
1015
1017{
1018 m_ipv4Addr = new std::vector<Ipv4Addr>;
1019}
1020
1022{
1023 if (m_ipv4Addr != nullptr)
1024 {
1025 m_ipv4Addr->clear();
1026 delete m_ipv4Addr;
1027 m_ipv4Addr = nullptr;
1028 }
1029}
1030
1033{
1034 return m_ipv4Addr->size() * 8; // IPv4 address and mask are 4 bytes each
1035}
1036
1037void
1039{
1040 for (auto iter = m_ipv4Addr->begin(); iter != m_ipv4Addr->end(); ++iter)
1041 {
1042 i.WriteHtonU32((*iter).Address.Get());
1043 i.WriteHtonU32((*iter).Mask.Get());
1044 }
1045}
1046
1049{
1050 uint64_t len = 0;
1051 while (len < valueLength)
1052 {
1053 uint32_t addr = i.ReadNtohU32();
1054 uint32_t mask = i.ReadNtohU32();
1055 Add(Ipv4Address(addr), Ipv4Mask(mask));
1056 len += 8;
1057 }
1058 return len;
1059}
1060
1061void
1063{
1064 m_ipv4Addr->push_back({address, mask});
1065}
1066
1069{
1070 return m_ipv4Addr->begin();
1071}
1072
1075{
1076 return m_ipv4Addr->end();
1077}
1078
1081{
1082 auto tmp = new Ipv4AddressTlvValue();
1083 for (auto iter = m_ipv4Addr->begin(); iter != m_ipv4Addr->end(); ++iter)
1084 {
1085 tmp->Add((*iter).Address, (*iter).Mask);
1086 }
1087 return tmp;
1088}
1089
1090} // namespace ns3
iterator in a Buffer instance
Definition: buffer.h:100
uint8_t ReadU8()
Definition: buffer.h:1027
void WriteU8(uint8_t data)
Definition: buffer.h:881
void WriteHtonU16(uint16_t data)
Definition: buffer.h:915
uint32_t ReadNtohU32()
Definition: buffer.h:978
void WriteHtonU32(uint32_t data)
Definition: buffer.h:933
uint16_t ReadNtohU16()
Definition: buffer.h:954
void Next()
go forward by one byte
Definition: buffer.h:853
this class implements the classifier descriptor as a tlv vector
Definition: wimax-tlv.h:408
ClassificationRuleVectorTlvValue * Copy() const override
Copy.
Definition: wimax-tlv.cc:708
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:719
this class implements the convergence sub-layer descriptor as a tlv vector
Definition: wimax-tlv.h:385
CsParamVectorTlvValue * Copy() const override
Copy.
Definition: wimax-tlv.cc:691
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:640
Protocol header serialization and deserialization.
Definition: header.h:44
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:42
Ipv4AddressTlvValue class.
Definition: wimax-tlv.h:573
Iterator End() const
End iterator.
Definition: wimax-tlv.cc:1074
std::vector< Ipv4Addr >::const_iterator Iterator
IPv4 address vector iterator typedef.
Definition: wimax-tlv.h:583
void Serialize(Buffer::Iterator start) const override
Serialize to a buffer.
Definition: wimax-tlv.cc:1038
void Add(Ipv4Address address, Ipv4Mask mask)
Add IPv4 address and mask.
Definition: wimax-tlv.cc:1062
std::vector< Ipv4Addr > * m_ipv4Addr
ipv4 addr
Definition: wimax-tlv.h:608
Ipv4AddressTlvValue * Copy() const override
Copy function.
Definition: wimax-tlv.cc:1080
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
Definition: wimax-tlv.cc:1032
Iterator Begin() const
Begin iterator.
Definition: wimax-tlv.cc:1068
~Ipv4AddressTlvValue() override
Definition: wimax-tlv.cc:1021
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:1048
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:257
PortRangeTlvValue class.
Definition: wimax-tlv.h:484
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
Definition: wimax-tlv.cc:880
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:896
std::vector< PortRange > * m_portRange
port range
Definition: wimax-tlv.h:523
std::vector< PortRange >::const_iterator Iterator
PortRange vector iterator typedef.
Definition: wimax-tlv.h:494
Iterator End() const
End iterator.
Definition: wimax-tlv.cc:925
void Serialize(Buffer::Iterator start) const override
Serialize to a buffer.
Definition: wimax-tlv.cc:886
~PortRangeTlvValue() override
Definition: wimax-tlv.cc:873
Iterator Begin() const
Begin iterator.
Definition: wimax-tlv.cc:919
void Add(uint16_t portLow, uint16_t portHigh)
Add a range.
Definition: wimax-tlv.cc:910
PortRangeTlvValue * Copy() const override
Copy.
Definition: wimax-tlv.cc:931
ProtocolTlvValue class.
Definition: wimax-tlv.h:532
~ProtocolTlvValue() override
Definition: wimax-tlv.cc:948
std::vector< uint8_t > * m_protocol
protocol
Definition: wimax-tlv.h:563
void Add(uint8_t protocol)
Add protocol number.
Definition: wimax-tlv.cc:986
Iterator Begin() const
Begin iterator.
Definition: wimax-tlv.cc:992
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
Definition: wimax-tlv.cc:959
ProtocolTlvValue * Copy() const override
Copy.
Definition: wimax-tlv.cc:1004
std::vector< uint8_t >::const_iterator Iterator
Iterator typedef.
Definition: wimax-tlv.h:537
Iterator End() const
End iterator.
Definition: wimax-tlv.cc:998
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:974
void Serialize(Buffer::Iterator start) const override
Serialize to a buffer.
Definition: wimax-tlv.cc:965
SfVectorTlvValue class.
Definition: wimax-tlv.h:337
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:306
@ Fixed_length_versus_Variable_length_SDU_Indicator
Definition: wimax-tlv.h:356
@ ARQ_RETRY_TIMEOUT_Transmitter_Delay
Definition: wimax-tlv.h:361
SfVectorTlvValue * Copy() const override
Copy.
Definition: wimax-tlv.cc:295
This class implements the Type-Len-Value structure channel encodings as described by "IEEE Standard f...
Definition: wimax-tlv.h:87
uint8_t m_type
type
Definition: wimax-tlv.h:164
TlvValue * CopyValue() const
Copy TlvValue.
Definition: wimax-tlv.cc:75
~Tlv() override
Definition: wimax-tlv.cc:65
uint64_t m_length
length
Definition: wimax-tlv.h:165
Tlv * Copy() const
Copy TLV.
Definition: wimax-tlv.cc:229
uint8_t GetType() const
Get type value.
Definition: wimax-tlv.cc:211
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition: wimax-tlv.cc:40
Tlv & operator=(const Tlv &o)
assignment operator
Definition: wimax-tlv.cc:88
TlvValue * PeekValue()
Peek value.
Definition: wimax-tlv.cc:223
static TypeId GetTypeId()
Register this type.
Definition: wimax-tlv.cc:32
uint64_t GetLength() const
Get length value.
Definition: wimax-tlv.cc:217
@ UPLINK_SERVICE_FLOW
Definition: wimax-tlv.h:96
@ VENDOR_ID_EMCODING
Definition: wimax-tlv.h:97
@ DOWNLINK_SERVICE_FLOW
Definition: wimax-tlv.h:95
@ CURRENT_TRANSMIT_POWER
Definition: wimax-tlv.h:94
@ HMAC_TUPLE
Definition: wimax-tlv.h:92
@ MAC_VERSION_ENCODING
Definition: wimax-tlv.h:93
@ VENDOR_SPECIFIC_INFORMATION
Definition: wimax-tlv.h:98
uint8_t GetSizeOfLen() const
Get size of length field.
Definition: wimax-tlv.cc:108
void Print(std::ostream &os) const override
Definition: wimax-tlv.cc:46
TlvValue * m_value
value
Definition: wimax-tlv.h:166
uint32_t GetSerializedSize() const override
Definition: wimax-tlv.cc:102
void Serialize(Buffer::Iterator start) const override
Definition: wimax-tlv.cc:126
uint32_t Deserialize(Buffer::Iterator start) override
Definition: wimax-tlv.cc:146
The value field of a tlv can take different values (uint8_t, uint16, vector, ...).
Definition: wimax-tlv.h:45
virtual uint32_t GetSerializedSize() const =0
Get serialized size in bytes.
virtual TlvValue * Copy() const =0
Copy function.
virtual void Serialize(Buffer::Iterator start) const =0
Serialize to a buffer.
TosTlvValue class.
Definition: wimax-tlv.h:436
void Serialize(Buffer::Iterator start) const override
Serialize to a buffer.
Definition: wimax-tlv.cc:827
uint8_t m_high
high
Definition: wimax-tlv.h:474
uint8_t GetHigh() const
Get high part.
Definition: wimax-tlv.cc:850
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
Definition: wimax-tlv.cc:821
~TosTlvValue() override
Definition: wimax-tlv.cc:816
uint8_t GetLow() const
Get low part.
Definition: wimax-tlv.cc:844
uint8_t GetMask() const
Get the mask.
Definition: wimax-tlv.cc:856
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:835
TosTlvValue * Copy() const override
Copy.
Definition: wimax-tlv.cc:862
uint8_t m_mask
mask
Definition: wimax-tlv.h:475
uint8_t m_low
low
Definition: wimax-tlv.h:473
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:932
U16TlvValue class.
Definition: wimax-tlv.h:215
void Serialize(Buffer::Iterator start) const override
Serialize to a buffer.
Definition: wimax-tlv.cc:554
U16TlvValue * Copy() const override
Copy.
Definition: wimax-tlv.cc:579
uint16_t m_value
value
Definition: wimax-tlv.h:246
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
Definition: wimax-tlv.cc:548
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLen) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:560
uint16_t GetValue() const
Get value.
Definition: wimax-tlv.cc:573
~U16TlvValue() override
Definition: wimax-tlv.cc:543
U32TlvValue class.
Definition: wimax-tlv.h:255
uint32_t GetValue() const
Get value.
Definition: wimax-tlv.cc:626
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
Definition: wimax-tlv.cc:601
~U32TlvValue() override
Definition: wimax-tlv.cc:596
void Serialize(Buffer::Iterator start) const override
Serialize to a buffer.
Definition: wimax-tlv.cc:607
U32TlvValue * Copy() const override
Copy.
Definition: wimax-tlv.cc:632
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLen) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:613
uint32_t m_value
value
Definition: wimax-tlv.h:287
U8TlvValue class.
Definition: wimax-tlv.h:175
~U8TlvValue() override
Definition: wimax-tlv.cc:490
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLen) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:507
uint8_t GetValue() const
Get value.
Definition: wimax-tlv.cc:520
uint8_t m_value
value
Definition: wimax-tlv.h:206
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
Definition: wimax-tlv.cc:495
void Serialize(Buffer::Iterator start) const override
Serialize to a buffer.
Definition: wimax-tlv.cc:501
U8TlvValue * Copy() const override
Copy.
Definition: wimax-tlv.cc:526
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
Definition: wimax-tlv.cc:251
~VectorTlvValue() override
Definition: wimax-tlv.cc:240
std::vector< Tlv * >::const_iterator Iterator
TLV vector iterator typedef.
Definition: wimax-tlv.h:300
void Serialize(Buffer::Iterator start) const override
Serialize to a buffer.
Definition: wimax-tlv.cc:262
Iterator End() const
End iterator.
Definition: wimax-tlv.cc:278
Iterator Begin() const
Begin iterator.
Definition: wimax-tlv.cc:272
void Add(const Tlv &val)
Add a TLV.
Definition: wimax-tlv.cc:284
std::vector< Tlv * > * m_tlvList
tlv list
Definition: wimax-tlv.h:328
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:86
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
Every class exported by the ns3 library is enclosed in the ns3 namespace.
PortRange structure.
Definition: wimax-tlv.h:488
#define WIMAX_TLV_EXTENDED_LENGTH_MASK
Definition: wimax-tlv.h:24