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 }
443 case ARQ_SYNC_LOSS:
446 case ARQ_BLOCK_SIZE:
447 case reserved2:
448 break;
449 case CS_Specification: {
450 U8TlvValue val;
451 serializedSize += val.Deserialize(i);
452 Add(Tlv(CS_Specification, 1, val));
453 break;
454 }
455 case IPV4_CS_Parameters: {
457 uint32_t size = val.Deserialize(i, length);
458 serializedSize += size;
459 Add(Tlv(IPV4_CS_Parameters, size, val));
460 break;
461 }
462 default:
463 NS_ASSERT_MSG(false, "Unknown tlv type.");
464 break;
465 }
466 i.Next(length);
467 }
468 return serializedSize;
469}
470
471// ==============================================================================
472
474{
475 m_value = value;
476}
477
479{
480 m_value = 0;
481}
482
484{
485}
486
489{
490 return 1;
491}
492
493void
495{
496 i.WriteU8(m_value);
497}
498
501{
502 return Deserialize(i);
503}
504
507{
508 m_value = i.ReadU8();
509 return 1;
510}
511
512uint8_t
514{
515 return m_value;
516}
517
520{
521 auto tmp = new U8TlvValue(m_value);
522 return tmp;
523}
524
525// ==============================================================================
527{
528 m_value = value;
529}
530
532{
533 m_value = 0;
534}
535
537{
538}
539
542{
543 return 2;
544}
545
546void
548{
550}
551
554{
555 return Deserialize(i);
556}
557
560{
561 m_value = i.ReadNtohU16();
562 return 2;
563}
564
565uint16_t
567{
568 return m_value;
569}
570
573{
574 auto tmp = new U16TlvValue(m_value);
575 return tmp;
576}
577
578// ==============================================================================
580{
581 m_value = value;
582}
583
585{
586 m_value = 0;
587}
588
590{
591}
592
595{
596 return 4;
597}
598
599void
601{
603}
604
607{
608 return Deserialize(i);
609}
610
613{
614 m_value = i.ReadNtohU32();
615 return 4;
616}
617
620{
621 return m_value;
622}
623
626{
627 auto tmp = new U32TlvValue(m_value);
628 return tmp;
629}
630
631// ==============================================================================
634{
635 uint64_t serializedSize = 0;
636 uint8_t lenSize = 0;
637 uint8_t type = 0;
638 while (serializedSize < valueLength)
639 {
640 type = i.ReadU8();
641 // read the length
642 lenSize = i.ReadU8();
643 serializedSize += 2;
644 uint64_t length = 0;
645 if (lenSize < 127)
646 {
647 length = lenSize;
648 }
649 else
650 {
651 lenSize &= ~WIMAX_TLV_EXTENDED_LENGTH_MASK;
652 for (int j = 0; j < lenSize; j++)
653 {
654 length <<= 8;
655 length |= i.ReadU8();
656 serializedSize++;
657 }
658 }
659 switch (type)
660 {
662 U8TlvValue val;
663 serializedSize += val.Deserialize(i);
664 Add(Tlv(Classifier_DSC_Action, 1, val));
665 break;
666 }
669 serializedSize += val.Deserialize(i, length);
671 break;
672 }
673 }
674 i.Next(length);
675 }
676 return serializedSize;
677}
678
680{
681}
682
685{
686 auto tmp = new CsParamVectorTlvValue();
687 for (auto iter = Begin(); iter != End(); ++iter)
688 {
689 tmp->Add(Tlv((*iter)->GetType(), (*iter)->GetLength(), *(*iter)->PeekValue()));
690 }
691 return tmp;
692}
693
694// ==============================================================================
695
697{
698}
699
702{
703 auto tmp = new ClassificationRuleVectorTlvValue();
704 for (auto iter = Begin(); iter != End(); ++iter)
705 {
706 tmp->Add(Tlv((*iter)->GetType(), (*iter)->GetLength(), *(*iter)->PeekValue()));
707 }
708 return tmp;
709}
710
713{
714 uint64_t serializedSize = 0;
715 uint8_t lenSize = 0;
716 uint8_t type = 0;
717 while (serializedSize < valueLength)
718 {
719 type = i.ReadU8();
720 // read the length
721 lenSize = i.ReadU8();
722 serializedSize += 2;
723 uint64_t length = 0;
724 if (lenSize < 127)
725 {
726 length = lenSize;
727 }
728 else
729 {
730 lenSize &= ~WIMAX_TLV_EXTENDED_LENGTH_MASK;
731 for (int j = 0; j < lenSize; j++)
732 {
733 length <<= 8;
734 length |= i.ReadU8();
735 serializedSize++;
736 }
737 }
738 switch (type)
739 {
740 case Priority: {
741 U8TlvValue val;
742 serializedSize += val.Deserialize(i);
743 Add(Tlv(Priority, 1, val));
744 break;
745 }
746 case ToS: {
747 TosTlvValue val;
748 serializedSize += val.Deserialize(i, length);
749 Add(Tlv(ToS, val.GetSerializedSize(), val));
750 break;
751 }
752 case Protocol: {
754 serializedSize += val.Deserialize(i, length);
755 Add(Tlv(Protocol, val.GetSerializedSize(), val));
756 break;
757 }
758 case IP_src: {
760 serializedSize += val.Deserialize(i, length);
761 Add(Tlv(IP_src, val.GetSerializedSize(), val));
762 break;
763 }
764 case IP_dst: {
766 serializedSize += val.Deserialize(i, length);
767 Add(Tlv(IP_dst, val.GetSerializedSize(), val));
768 break;
769 }
770 case Port_src: {
772 serializedSize += val.Deserialize(i, length);
773 Add(Tlv(Port_src, val.GetSerializedSize(), val));
774 break;
775 }
776 case Port_dst: {
778 serializedSize += val.Deserialize(i, length);
779 Add(Tlv(Port_dst, val.GetSerializedSize(), val));
780 break;
781 }
782 case Index: {
783 U16TlvValue val;
784 serializedSize += val.Deserialize(i);
785 Add(Tlv(Index, 2, val));
786 break;
787 }
788 }
789 i.Next(length);
790 }
791 return serializedSize;
792}
793
794// ==============================================================================
796{
797 m_low = 0;
798 m_high = 0;
799 m_mask = 0;
800}
801
802TosTlvValue::TosTlvValue(uint8_t low, uint8_t high, uint8_t mask)
803{
804 m_low = low;
805 m_high = high;
806 m_mask = mask;
807}
808
810{
811}
812
815{
816 return 3;
817}
818
819void
821{
822 i.WriteU8(m_low);
823 i.WriteU8(m_high);
824 i.WriteU8(m_mask);
825}
826
829{
830 m_low = i.ReadU8();
831 m_high = i.ReadU8();
832 m_mask = i.ReadU8();
833 return 3;
834}
835
836uint8_t
838{
839 return m_low;
840}
841
842uint8_t
844{
845 return m_high;
846}
847
848uint8_t
850{
851 return m_mask;
852}
853
856{
857 return new TosTlvValue(m_low, m_high, m_mask);
858}
859
860// ==============================================================================
862{
863 m_portRange = new std::vector<PortRange>;
864}
865
867{
868 m_portRange->clear();
869 delete m_portRange;
870}
871
874{
875 return m_portRange->size() * 4; // a port range is defined by 2 ports, each using 2 bytes
876}
877
878void
880{
881 for (auto iter = m_portRange->begin(); iter != m_portRange->end(); ++iter)
882 {
883 i.WriteHtonU16((*iter).PortLow);
884 i.WriteHtonU16((*iter).PortHigh);
885 }
886}
887
890{
891 uint64_t len = 0;
892 while (len < valueLength)
893 {
894 uint16_t low = i.ReadNtohU16();
895 uint16_t high = i.ReadNtohU16();
896 Add(low, high);
897 len += 4;
898 }
899 return len;
900}
901
902void
903PortRangeTlvValue::Add(uint16_t portLow, uint16_t portHigh)
904{
905 PortRange tmp;
906 tmp.PortLow = portLow;
907 tmp.PortHigh = portHigh;
908 m_portRange->push_back(tmp);
909}
910
913{
914 return m_portRange->begin();
915}
916
919{
920 return m_portRange->end();
921}
922
925{
926 auto tmp = new PortRangeTlvValue();
927 for (auto iter = m_portRange->begin(); iter != m_portRange->end(); ++iter)
928 {
929 tmp->Add((*iter).PortLow, (*iter).PortHigh);
930 }
931 return tmp;
932}
933
934// ==============================================================================
935
937{
938 m_protocol = new std::vector<uint8_t>;
939}
940
942{
943 if (m_protocol != nullptr)
944 {
945 m_protocol->clear();
946 delete m_protocol;
947 m_protocol = nullptr;
948 }
949}
950
953{
954 return m_protocol->size();
955}
956
957void
959{
960 for (auto iter = m_protocol->begin(); iter != m_protocol->end(); ++iter)
961 {
962 i.WriteU8(*iter);
963 }
964}
965
968{
969 uint64_t len = 0;
970 while (len < valueLength)
971 {
972 Add(i.ReadU8());
973 len++;
974 }
975 return len;
976}
977
978void
979ProtocolTlvValue::Add(uint8_t protocol)
980{
981 m_protocol->push_back(protocol);
982}
983
986{
987 return m_protocol->begin();
988}
989
992{
993 return m_protocol->end();
994}
995
998{
999 auto tmp = new ProtocolTlvValue();
1000 for (auto iter = m_protocol->begin(); iter != m_protocol->end(); ++iter)
1001 {
1002 tmp->Add(*iter);
1003 }
1004 return tmp;
1005}
1006
1007// ==============================================================================
1008
1010{
1011 m_ipv4Addr = new std::vector<Ipv4Addr>;
1012}
1013
1015{
1016 if (m_ipv4Addr != nullptr)
1017 {
1018 m_ipv4Addr->clear();
1019 delete m_ipv4Addr;
1020 m_ipv4Addr = nullptr;
1021 }
1022}
1023
1026{
1027 return m_ipv4Addr->size() * 8; // IPv4 address and mask are 4 bytes each
1028}
1029
1030void
1032{
1033 for (auto iter = m_ipv4Addr->begin(); iter != m_ipv4Addr->end(); ++iter)
1034 {
1035 i.WriteHtonU32((*iter).Address.Get());
1036 i.WriteHtonU32((*iter).Mask.Get());
1037 }
1038}
1039
1042{
1043 uint64_t len = 0;
1044 while (len < valueLength)
1045 {
1046 uint32_t addr = i.ReadNtohU32();
1047 uint32_t mask = i.ReadNtohU32();
1048 Add(Ipv4Address(addr), Ipv4Mask(mask));
1049 len += 8;
1050 }
1051 return len;
1052}
1053
1054void
1056{
1057 m_ipv4Addr->push_back({address, mask});
1058}
1059
1062{
1063 return m_ipv4Addr->begin();
1064}
1065
1068{
1069 return m_ipv4Addr->end();
1070}
1071
1074{
1075 auto tmp = new Ipv4AddressTlvValue();
1076 for (auto iter = m_ipv4Addr->begin(); iter != m_ipv4Addr->end(); ++iter)
1077 {
1078 tmp->Add((*iter).Address, (*iter).Mask);
1079 }
1080 return tmp;
1081}
1082
1083} // 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:701
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:712
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:684
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:633
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:1067
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:1031
void Add(Ipv4Address address, Ipv4Mask mask)
Add IPv4 address and mask.
Definition: wimax-tlv.cc:1055
std::vector< Ipv4Addr > * m_ipv4Addr
ipv4 addr
Definition: wimax-tlv.h:608
Ipv4AddressTlvValue * Copy() const override
Copy function.
Definition: wimax-tlv.cc:1073
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
Definition: wimax-tlv.cc:1025
Iterator Begin() const
Begin iterator.
Definition: wimax-tlv.cc:1061
~Ipv4AddressTlvValue() override
Definition: wimax-tlv.cc:1014
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:1041
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:873
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:889
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:918
void Serialize(Buffer::Iterator start) const override
Serialize to a buffer.
Definition: wimax-tlv.cc:879
~PortRangeTlvValue() override
Definition: wimax-tlv.cc:866
Iterator Begin() const
Begin iterator.
Definition: wimax-tlv.cc:912
void Add(uint16_t portLow, uint16_t portHigh)
Add a range.
Definition: wimax-tlv.cc:903
PortRangeTlvValue * Copy() const override
Copy.
Definition: wimax-tlv.cc:924
ProtocolTlvValue class.
Definition: wimax-tlv.h:532
~ProtocolTlvValue() override
Definition: wimax-tlv.cc:941
std::vector< uint8_t > * m_protocol
protocol
Definition: wimax-tlv.h:563
void Add(uint8_t protocol)
Add protocol number.
Definition: wimax-tlv.cc:979
Iterator Begin() const
Begin iterator.
Definition: wimax-tlv.cc:985
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
Definition: wimax-tlv.cc:952
ProtocolTlvValue * Copy() const override
Copy.
Definition: wimax-tlv.cc:997
std::vector< uint8_t >::const_iterator Iterator
Iterator typedef.
Definition: wimax-tlv.h:537
Iterator End() const
End iterator.
Definition: wimax-tlv.cc:991
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:967
void Serialize(Buffer::Iterator start) const override
Serialize to a buffer.
Definition: wimax-tlv.cc:958
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:820
uint8_t m_high
high
Definition: wimax-tlv.h:474
uint8_t GetHigh() const
Get high part.
Definition: wimax-tlv.cc:843
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
Definition: wimax-tlv.cc:814
~TosTlvValue() override
Definition: wimax-tlv.cc:809
uint8_t GetLow() const
Get low part.
Definition: wimax-tlv.cc:837
uint8_t GetMask() const
Get the mask.
Definition: wimax-tlv.cc:849
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:828
TosTlvValue * Copy() const override
Copy.
Definition: wimax-tlv.cc:855
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:547
U16TlvValue * Copy() const override
Copy.
Definition: wimax-tlv.cc:572
uint16_t m_value
value
Definition: wimax-tlv.h:246
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
Definition: wimax-tlv.cc:541
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLen) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:553
uint16_t GetValue() const
Get value.
Definition: wimax-tlv.cc:566
~U16TlvValue() override
Definition: wimax-tlv.cc:536
U32TlvValue class.
Definition: wimax-tlv.h:255
uint32_t GetValue() const
Get value.
Definition: wimax-tlv.cc:619
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
Definition: wimax-tlv.cc:594
~U32TlvValue() override
Definition: wimax-tlv.cc:589
void Serialize(Buffer::Iterator start) const override
Serialize to a buffer.
Definition: wimax-tlv.cc:600
U32TlvValue * Copy() const override
Copy.
Definition: wimax-tlv.cc:625
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLen) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:606
uint32_t m_value
value
Definition: wimax-tlv.h:287
U8TlvValue class.
Definition: wimax-tlv.h:175
~U8TlvValue() override
Definition: wimax-tlv.cc:483
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLen) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:500
uint8_t GetValue() const
Get value.
Definition: wimax-tlv.cc:513
uint8_t m_value
value
Definition: wimax-tlv.h:206
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
Definition: wimax-tlv.cc:488
void Serialize(Buffer::Iterator start) const override
Serialize to a buffer.
Definition: wimax-tlv.cc:494
U8TlvValue * Copy() const override
Copy.
Definition: wimax-tlv.cc:519
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