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