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:
172 NS_FATAL_ERROR("Not implemented-- please implement and contribute a patch");
173 break;
176 NS_FATAL_ERROR("Not implemented-- please implement and contribute a patch");
177 break;
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 }
196 NS_FATAL_ERROR("Not implemented-- please implement and contribute a patch");
197 break;
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 (std::vector<Tlv*>::const_iterator iter = m_tlvList->begin(); iter != m_tlvList->end();
243 ++iter)
244 {
245 delete (*iter);
246 }
247 m_tlvList->clear();
248 delete m_tlvList;
249}
250
253{
254 uint32_t size = 0;
255 for (std::vector<Tlv*>::const_iterator iter = m_tlvList->begin(); iter != m_tlvList->end();
256 ++iter)
257 {
258 size += (*iter)->GetSerializedSize();
259 }
260 return size;
261}
262
263void
265{
266 for (std::vector<Tlv*>::const_iterator iter = m_tlvList->begin(); iter != m_tlvList->end();
267 ++iter)
268 {
269 (*iter)->Serialize(i);
270 i.Next((*iter)->GetSerializedSize());
271 }
272}
273
276{
277 return m_tlvList->begin();
278}
279
282{
283 return m_tlvList->end();
284}
285
286void
288{
289 m_tlvList->push_back(val.Copy());
290}
291
292// ==============================================================================
294{
295}
296
299{
301 for (std::vector<Tlv*>::const_iterator iter = Begin(); iter != End(); ++iter)
302 {
303 tmp->Add(Tlv((*iter)->GetType(), (*iter)->GetLength(), *(*iter)->PeekValue()));
304 }
305 return tmp;
306}
307
310{
311 uint64_t serializedSize = 0;
312 while (serializedSize < valueLen)
313 {
314 uint8_t type = i.ReadU8();
315 // read the length
316 uint8_t lenSize = i.ReadU8();
317 serializedSize += 2;
318 uint64_t length = 0;
319 if (lenSize < 127)
320 {
321 length = lenSize;
322 }
323 else
324 {
325 lenSize &= ~WIMAX_TLV_EXTENDED_LENGTH_MASK;
326 for (int j = 0; j < lenSize; j++)
327 {
328 length <<= 8;
329 length |= i.ReadU8();
330 serializedSize++;
331 }
332 }
333 switch (type)
334 {
335 case SFID: {
336 U32TlvValue val;
337 serializedSize += val.Deserialize(i);
338 Add(Tlv(SFID, 4, val));
339 break;
340 }
341 case CID: {
342 U16TlvValue val;
343 serializedSize += val.Deserialize(i);
344 Add(Tlv(CID, 2, val));
345 break;
346 }
348 NS_FATAL_ERROR("Not implemented-- please implement and contribute a patch");
349 break;
350 case reserved1:
351 // NOTHING
352 break;
354 U8TlvValue val;
355 serializedSize += val.Deserialize(i);
357 break;
358 }
359 case Traffic_Priority: {
360 U8TlvValue val;
361 serializedSize += val.Deserialize(i);
362 Add(Tlv(Traffic_Priority, 1, val));
363 break;
364 }
366 U32TlvValue val;
367 serializedSize += val.Deserialize(i);
369 break;
370 }
372 U32TlvValue val;
373 serializedSize += val.Deserialize(i);
374 Add(Tlv(Maximum_Traffic_Burst, 4, val));
375 break;
376 }
378 U32TlvValue val;
379 serializedSize += val.Deserialize(i);
381 break;
382 }
384 U32TlvValue val;
385 serializedSize += val.Deserialize(i);
387 break;
388 }
390 U8TlvValue val;
391 serializedSize += val.Deserialize(i);
393 break;
394 }
396 U32TlvValue val;
397 serializedSize += val.Deserialize(i);
399 break;
400 }
401 case Tolerated_Jitter: {
402 U32TlvValue val;
403 serializedSize += val.Deserialize(i);
404 Add(Tlv(Tolerated_Jitter, 4, val));
405 break;
406 }
407 case Maximum_Latency: {
408 U32TlvValue val;
409 serializedSize += val.Deserialize(i);
410 Add(Tlv(Maximum_Latency, 4, val));
411 break;
412 }
414 U8TlvValue val;
415 serializedSize += val.Deserialize(i);
417 break;
418 }
419 case SDU_Size: {
420 U8TlvValue val;
421 serializedSize += val.Deserialize(i);
422 Add(Tlv(SDU_Size, 1, val));
423 break;
424 }
425 case Target_SAID: {
426 U16TlvValue val;
427 serializedSize += val.Deserialize(i);
428 Add(Tlv(Target_SAID, 2, val));
429 break;
430 }
431 case ARQ_Enable: {
432 U8TlvValue val;
433 serializedSize += val.Deserialize(i);
434 Add(Tlv(ARQ_Enable, 1, val));
435 break;
436 }
437 case ARQ_WINDOW_SIZE: {
438 U16TlvValue val;
439 serializedSize += val.Deserialize(i);
440 Add(Tlv(ARQ_WINDOW_SIZE, 2, val));
441 break;
442 }
444 break;
446 break;
448 break;
449 case ARQ_SYNC_LOSS:
450 break;
452 break;
454 break;
455 case ARQ_BLOCK_SIZE:
456 break;
457 case reserved2:
458 break;
459 case CS_Specification: {
460 U8TlvValue val;
461 serializedSize += val.Deserialize(i);
462 Add(Tlv(CS_Specification, 1, val));
463 break;
464 }
465 case IPV4_CS_Parameters: {
467 uint32_t size = val.Deserialize(i, length);
468 serializedSize += size;
469 Add(Tlv(IPV4_CS_Parameters, size, val));
470 break;
471 }
472 default:
473 NS_ASSERT_MSG(false, "Unknown tlv type.");
474 break;
475 }
476 i.Next(length);
477 }
478 return serializedSize;
479}
480
481// ==============================================================================
482
484{
485 m_value = value;
486}
487
489{
490 m_value = 0;
491}
492
494{
495}
496
499{
500 return 1;
501}
502
503void
505{
506 i.WriteU8(m_value);
507}
508
511{
512 return Deserialize(i);
513}
514
517{
518 m_value = i.ReadU8();
519 return 1;
520}
521
522uint8_t
524{
525 return m_value;
526}
527
530{
531 U8TlvValue* tmp = new U8TlvValue(m_value);
532 return tmp;
533}
534
535// ==============================================================================
537{
538 m_value = value;
539}
540
542{
543 m_value = 0;
544}
545
547{
548}
549
552{
553 return 2;
554}
555
556void
558{
560}
561
564{
565 return Deserialize(i);
566}
567
570{
571 m_value = i.ReadNtohU16();
572 return 2;
573}
574
575uint16_t
577{
578 return m_value;
579}
580
583{
584 U16TlvValue* tmp = new U16TlvValue(m_value);
585 return tmp;
586}
587
588// ==============================================================================
590{
591 m_value = value;
592}
593
595{
596 m_value = 0;
597}
598
600{
601}
602
605{
606 return 4;
607}
608
609void
611{
613}
614
617{
618 return Deserialize(i);
619}
620
623{
624 m_value = i.ReadNtohU32();
625 return 4;
626}
627
630{
631 return m_value;
632}
633
636{
637 U32TlvValue* tmp = new U32TlvValue(m_value);
638 return tmp;
639}
640
641// ==============================================================================
644{
645 uint64_t serializedSize = 0;
646 uint8_t lenSize = 0;
647 uint8_t type = 0;
648 while (serializedSize < valueLength)
649 {
650 type = i.ReadU8();
651 // read the length
652 lenSize = i.ReadU8();
653 serializedSize += 2;
654 uint64_t length = 0;
655 if (lenSize < 127)
656 {
657 length = lenSize;
658 }
659 else
660 {
661 lenSize &= ~WIMAX_TLV_EXTENDED_LENGTH_MASK;
662 for (int j = 0; j < lenSize; j++)
663 {
664 length <<= 8;
665 length |= i.ReadU8();
666 serializedSize++;
667 }
668 }
669 switch (type)
670 {
672 U8TlvValue val;
673 serializedSize += val.Deserialize(i);
674 Add(Tlv(Classifier_DSC_Action, 1, val));
675 break;
676 }
679 serializedSize += val.Deserialize(i, length);
681 break;
682 }
683 }
684 i.Next(length);
685 }
686 return serializedSize;
687}
688
690{
691}
692
695{
697 for (std::vector<Tlv*>::const_iterator iter = Begin(); iter != End(); ++iter)
698 {
699 tmp->Add(Tlv((*iter)->GetType(), (*iter)->GetLength(), *(*iter)->PeekValue()));
700 }
701 return tmp;
702}
703
704// ==============================================================================
705
707{
708}
709
712{
714 for (std::vector<Tlv*>::const_iterator iter = Begin(); iter != End(); ++iter)
715 {
716 tmp->Add(Tlv((*iter)->GetType(), (*iter)->GetLength(), *(*iter)->PeekValue()));
717 }
718 return tmp;
719}
720
723{
724 uint64_t serializedSize = 0;
725 uint8_t lenSize = 0;
726 uint8_t type = 0;
727 while (serializedSize < valueLength)
728 {
729 type = i.ReadU8();
730 // read the length
731 lenSize = i.ReadU8();
732 serializedSize += 2;
733 uint64_t length = 0;
734 if (lenSize < 127)
735 {
736 length = lenSize;
737 }
738 else
739 {
740 lenSize &= ~WIMAX_TLV_EXTENDED_LENGTH_MASK;
741 for (int j = 0; j < lenSize; j++)
742 {
743 length <<= 8;
744 length |= i.ReadU8();
745 serializedSize++;
746 }
747 }
748 switch (type)
749 {
750 case Priority: {
751 U8TlvValue val;
752 serializedSize += val.Deserialize(i);
753 Add(Tlv(Priority, 1, val));
754 break;
755 }
756 case ToS: {
757 TosTlvValue val;
758 serializedSize += val.Deserialize(i, length);
759 Add(Tlv(ToS, val.GetSerializedSize(), val));
760 break;
761 }
762 case Protocol: {
764 serializedSize += val.Deserialize(i, length);
765 Add(Tlv(Protocol, val.GetSerializedSize(), val));
766 break;
767 }
768 case IP_src: {
770 serializedSize += val.Deserialize(i, length);
771 Add(Tlv(IP_src, val.GetSerializedSize(), val));
772 break;
773 }
774 case IP_dst: {
776 serializedSize += val.Deserialize(i, length);
777 Add(Tlv(IP_dst, val.GetSerializedSize(), val));
778 break;
779 }
780 case Port_src: {
782 serializedSize += val.Deserialize(i, length);
783 Add(Tlv(Port_src, val.GetSerializedSize(), val));
784 break;
785 }
786 case Port_dst: {
788 serializedSize += val.Deserialize(i, length);
789 Add(Tlv(Port_dst, val.GetSerializedSize(), val));
790 break;
791 }
792 case Index: {
793 U16TlvValue val;
794 serializedSize += val.Deserialize(i);
795 Add(Tlv(Index, 2, val));
796 break;
797 }
798 }
799 i.Next(length);
800 }
801 return serializedSize;
802}
803
804// ==============================================================================
806{
807 m_low = 0;
808 m_high = 0;
809 m_mask = 0;
810}
811
812TosTlvValue::TosTlvValue(uint8_t low, uint8_t high, uint8_t mask)
813{
814 m_low = low;
815 m_high = high;
816 m_mask = mask;
817}
818
820{
821}
822
825{
826 return 3;
827}
828
829void
831{
832 i.WriteU8(m_low);
833 i.WriteU8(m_high);
834 i.WriteU8(m_mask);
835}
836
839{
840 m_low = i.ReadU8();
841 m_high = i.ReadU8();
842 m_mask = i.ReadU8();
843 return 3;
844}
845
846uint8_t
848{
849 return m_low;
850}
851
852uint8_t
854{
855 return m_high;
856}
857
858uint8_t
860{
861 return m_mask;
862}
863
866{
867 return new TosTlvValue(m_low, m_high, m_mask);
868}
869
870// ==============================================================================
872{
873 m_portRange = new std::vector<PortRange>;
874}
875
877{
878 m_portRange->clear();
879 delete m_portRange;
880}
881
884{
885 return m_portRange->size() * 4; // a port range is defined by 2 ports, each using 2 bytes
886}
887
888void
890{
891 for (std::vector<PortRange>::const_iterator iter = m_portRange->begin();
892 iter != m_portRange->end();
893 ++iter)
894 {
895 i.WriteHtonU16((*iter).PortLow);
896 i.WriteHtonU16((*iter).PortHigh);
897 }
898}
899
902{
903 uint64_t len = 0;
904 while (len < valueLength)
905 {
906 uint16_t low = i.ReadNtohU16();
907 uint16_t high = i.ReadNtohU16();
908 Add(low, high);
909 len += 4;
910 }
911 return len;
912}
913
914void
915PortRangeTlvValue::Add(uint16_t portLow, uint16_t portHigh)
916{
917 PortRange tmp;
918 tmp.PortLow = portLow;
919 tmp.PortHigh = portHigh;
920 m_portRange->push_back(tmp);
921}
922
925{
926 return m_portRange->begin();
927}
928
931{
932 return m_portRange->end();
933}
934
937{
939 for (std::vector<PortRange>::const_iterator iter = m_portRange->begin();
940 iter != m_portRange->end();
941 ++iter)
942 {
943 tmp->Add((*iter).PortLow, (*iter).PortHigh);
944 }
945 return tmp;
946}
947
948// ==============================================================================
949
951{
952 m_protocol = new std::vector<uint8_t>;
953}
954
956{
957 if (m_protocol != nullptr)
958 {
959 m_protocol->clear();
960 delete m_protocol;
961 m_protocol = nullptr;
962 }
963}
964
967{
968 return m_protocol->size();
969}
970
971void
973{
974 for (std::vector<uint8_t>::const_iterator iter = m_protocol->begin(); iter != m_protocol->end();
975 ++iter)
976 {
977 i.WriteU8((*iter));
978 }
979}
980
983{
984 uint64_t len = 0;
985 while (len < valueLength)
986 {
987 Add(i.ReadU8());
988 len++;
989 }
990 return len;
991}
992
993void
994ProtocolTlvValue::Add(uint8_t protocol)
995{
996 m_protocol->push_back(protocol);
997}
998
1001{
1002 return m_protocol->begin();
1003}
1004
1007{
1008 return m_protocol->end();
1009}
1010
1013{
1015 for (std::vector<uint8_t>::const_iterator iter = m_protocol->begin(); iter != m_protocol->end();
1016 ++iter)
1017 {
1018 tmp->Add((*iter));
1019 }
1020 return tmp;
1021}
1022
1023// ==============================================================================
1024
1026{
1027 m_ipv4Addr = new std::vector<Ipv4Addr>;
1028}
1029
1031{
1032 if (m_ipv4Addr != nullptr)
1033 {
1034 m_ipv4Addr->clear();
1035 delete m_ipv4Addr;
1036 m_ipv4Addr = nullptr;
1037 }
1038}
1039
1042{
1043 return m_ipv4Addr->size() * 8; // IPv4 address and mask are 4 bytes each
1044}
1045
1046void
1048{
1049 for (std::vector<Ipv4Addr>::const_iterator iter = m_ipv4Addr->begin();
1050 iter != m_ipv4Addr->end();
1051 ++iter)
1052 {
1053 i.WriteHtonU32((*iter).Address.Get());
1054 i.WriteHtonU32((*iter).Mask.Get());
1055 }
1056}
1057
1060{
1061 uint64_t len = 0;
1062 while (len < valueLength)
1063 {
1064 uint32_t addr = i.ReadNtohU32();
1065 uint32_t mask = i.ReadNtohU32();
1066 Add(Ipv4Address(addr), Ipv4Mask(mask));
1067 len += 8;
1068 }
1069 return len;
1070}
1071
1072void
1074{
1075 m_ipv4Addr->push_back({address, mask});
1076}
1077
1080{
1081 return m_ipv4Addr->begin();
1082}
1083
1086{
1087 return m_ipv4Addr->end();
1088}
1089
1092{
1094 for (std::vector<Ipv4Addr>::const_iterator iter = m_ipv4Addr->begin();
1095 iter != m_ipv4Addr->end();
1096 ++iter)
1097 {
1098 tmp->Add((*iter).Address, (*iter).Mask);
1099 }
1100 return tmp;
1101}
1102
1103} // 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:711
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:722
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:694
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:643
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:1085
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:1047
void Add(Ipv4Address address, Ipv4Mask mask)
Add IPv4 address and mask.
Definition: wimax-tlv.cc:1073
std::vector< Ipv4Addr > * m_ipv4Addr
ipv4 addr
Definition: wimax-tlv.h:608
Ipv4AddressTlvValue * Copy() const override
Copy function.
Definition: wimax-tlv.cc:1091
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
Definition: wimax-tlv.cc:1041
Iterator Begin() const
Begin iterator.
Definition: wimax-tlv.cc:1079
~Ipv4AddressTlvValue() override
Definition: wimax-tlv.cc:1030
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:1059
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:883
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:901
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:930
void Serialize(Buffer::Iterator start) const override
Serialize to a buffer.
Definition: wimax-tlv.cc:889
~PortRangeTlvValue() override
Definition: wimax-tlv.cc:876
Iterator Begin() const
Begin iterator.
Definition: wimax-tlv.cc:924
void Add(uint16_t portLow, uint16_t portHigh)
Add a range.
Definition: wimax-tlv.cc:915
PortRangeTlvValue * Copy() const override
Copy.
Definition: wimax-tlv.cc:936
ProtocolTlvValue class.
Definition: wimax-tlv.h:532
~ProtocolTlvValue() override
Definition: wimax-tlv.cc:955
std::vector< uint8_t > * m_protocol
protocol
Definition: wimax-tlv.h:563
void Add(uint8_t protocol)
Add protocol number.
Definition: wimax-tlv.cc:994
Iterator Begin() const
Begin iterator.
Definition: wimax-tlv.cc:1000
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
Definition: wimax-tlv.cc:966
ProtocolTlvValue * Copy() const override
Copy.
Definition: wimax-tlv.cc:1012
std::vector< uint8_t >::const_iterator Iterator
Iterator typedef.
Definition: wimax-tlv.h:537
Iterator End() const
End iterator.
Definition: wimax-tlv.cc:1006
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:982
void Serialize(Buffer::Iterator start) const override
Serialize to a buffer.
Definition: wimax-tlv.cc:972
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:309
@ 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:298
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:830
uint8_t m_high
high
Definition: wimax-tlv.h:474
uint8_t GetHigh() const
Get high part.
Definition: wimax-tlv.cc:853
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
Definition: wimax-tlv.cc:824
~TosTlvValue() override
Definition: wimax-tlv.cc:819
uint8_t GetLow() const
Get low part.
Definition: wimax-tlv.cc:847
uint8_t GetMask() const
Get the mask.
Definition: wimax-tlv.cc:859
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:838
TosTlvValue * Copy() const override
Copy.
Definition: wimax-tlv.cc:865
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:936
U16TlvValue class.
Definition: wimax-tlv.h:215
void Serialize(Buffer::Iterator start) const override
Serialize to a buffer.
Definition: wimax-tlv.cc:557
U16TlvValue * Copy() const override
Copy.
Definition: wimax-tlv.cc:582
uint16_t m_value
value
Definition: wimax-tlv.h:246
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
Definition: wimax-tlv.cc:551
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLen) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:563
uint16_t GetValue() const
Get value.
Definition: wimax-tlv.cc:576
~U16TlvValue() override
Definition: wimax-tlv.cc:546
U32TlvValue class.
Definition: wimax-tlv.h:255
uint32_t GetValue() const
Get value.
Definition: wimax-tlv.cc:629
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
Definition: wimax-tlv.cc:604
~U32TlvValue() override
Definition: wimax-tlv.cc:599
void Serialize(Buffer::Iterator start) const override
Serialize to a buffer.
Definition: wimax-tlv.cc:610
U32TlvValue * Copy() const override
Copy.
Definition: wimax-tlv.cc:635
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLen) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:616
uint32_t m_value
value
Definition: wimax-tlv.h:287
U8TlvValue class.
Definition: wimax-tlv.h:175
~U8TlvValue() override
Definition: wimax-tlv.cc:493
uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLen) override
Deserialize from a buffer.
Definition: wimax-tlv.cc:510
uint8_t GetValue() const
Get value.
Definition: wimax-tlv.cc:523
uint8_t m_value
value
Definition: wimax-tlv.h:206
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
Definition: wimax-tlv.cc:498
void Serialize(Buffer::Iterator start) const override
Serialize to a buffer.
Definition: wimax-tlv.cc:504
U8TlvValue * Copy() const override
Copy.
Definition: wimax-tlv.cc:529
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
Definition: wimax-tlv.cc:252
~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:264
Iterator End() const
End iterator.
Definition: wimax-tlv.cc:281
Iterator Begin() const
Begin iterator.
Definition: wimax-tlv.cc:275
void Add(const Tlv &val)
Add a TLV.
Definition: wimax-tlv.cc:287
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