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 
24 namespace ns3 {
25 
27 
28 // NS_OBJECT_ENSURE_REGISTERED ("Tlv");
29 
30 /* static */
31 TypeId
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 
47 void Tlv::Print (std::ostream &os) const
48 {
49  os << "TLV type = " << (uint32_t) m_type << " TLV Length = " << (uint64_t) m_length;
50 }
51 
52 Tlv::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 
75 TlvValue *
76 Tlv::CopyValue (void) const
77 {
78  return m_value->Copy ();
79 }
80 
81 Tlv::Tlv (const Tlv & tlv)
82 {
83  m_type = tlv.GetType ();
84  m_length = tlv.GetLength ();
85  m_value = tlv.CopyValue ();
86 }
87 
88 Tlv &
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 
102 uint32_t
104 {
105  return 1 + GetSizeOfLen () + m_value->GetSerializedSize ();
106 }
107 
108 uint8_t
109 Tlv::GetSizeOfLen (void) const
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 
126 void
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 
146 uint32_t
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  {
185  SfVectorTlvValue val;
186  serializedSize += val.Deserialize (i, m_length);
187  m_value = val.Copy ();
188  break;
189  }
190  case UPLINK_SERVICE_FLOW:
191  {
192  SfVectorTlvValue val;
193  serializedSize += val.Deserialize (i, m_length);
194  m_value = val.Copy ();
195  break;
196  }
197  case VENDOR_ID_EMCODING:
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 
213 uint8_t
214 Tlv::GetType (void) const
215 {
216  return m_type;
217 }
218 uint64_t
219 Tlv::GetLength (void) const
220 {
221  return m_length;
222 }
223 TlvValue*
225 {
226  return m_value;
227 }
228 
229 Tlv *
230 Tlv::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 
250 uint32_t
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 
261 void
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 
283 void
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 
306 uint32_t
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  }
347  case Service_Class_Name:
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);
406  Add (Tlv (Request_Transmission_Policy, 4, val));
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;
462  case ARQ_BLOCK_LIFETIME:
463  break;
464  case ARQ_SYNC_LOSS:
465  break;
467  break;
468  case ARQ_PURGE_TIMEOUT:
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  }
481  case IPV4_CS_Parameters:
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 
500 U8TlvValue::U8TlvValue (uint8_t value)
501 {
502  m_value = value;
503 }
504 
506 {
507  m_value = 0;
508 }
509 
511 {
512 }
513 uint32_t
515 {
516  return 1;
517 }
518 void
520 {
521  i.WriteU8 (m_value);
522 }
523 uint32_t
525 {
526  return Deserialize (i);
527 }
528 
529 uint32_t
531 {
532  m_value = i.ReadU8 ();
533  return 1;
534 }
535 
536 uint8_t
538 {
539  return m_value;
540 }
541 
542 U8TlvValue *
543 U8TlvValue::Copy (void) const
544 {
545  U8TlvValue * tmp = new U8TlvValue (m_value);
546  return tmp;
547 }
548 // ==============================================================================
549 U16TlvValue::U16TlvValue (uint16_t value)
550 {
551  m_value = value;
552 }
553 
555 {
556  m_value = 0;
557 }
558 
560 {
561 }
562 
563 uint32_t
565 {
566  return 2;
567 }
568 void
570 {
571  i.WriteHtonU16 (m_value);
572 }
573 uint32_t
575 {
576  return Deserialize (i);
577 }
578 
579 uint32_t
581 {
582  m_value = i.ReadNtohU16 ();
583  return 2;
584 }
585 
586 uint16_t
588 {
589  return m_value;
590 }
591 
592 U16TlvValue *
593 U16TlvValue::Copy (void) const
594 {
595  U16TlvValue * tmp = new U16TlvValue (m_value);
596  return tmp;
597 }
598 // ==============================================================================
599 U32TlvValue::U32TlvValue (uint32_t value)
600 {
601  m_value = value;
602 }
603 
605 {
606  m_value = 0;
607 }
608 
610 {
611 }
612 
613 uint32_t U32TlvValue::GetSerializedSize (void) const
614 {
615  return 4;
616 }
617 void
619 {
620  i.WriteHtonU32 (m_value);
621 }
622 uint32_t
624 {
625  return Deserialize (i);
626 }
627 
628 uint32_t
630 {
631  m_value = i.ReadNtohU32 ();
632  return 4;
633 }
634 uint32_t
636 {
637  return m_value;
638 }
639 
640 U32TlvValue *
641 U32TlvValue::Copy (void) const
642 {
643  U32TlvValue * tmp = new U32TlvValue (m_value);
644  return tmp;
645 }
646 // ==============================================================================
647 uint32_t
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 
729 uint32_t
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  {
774  ProtocolTlvValue val;
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  {
795  PortRangeTlvValue val;
796  serializedSize += val.Deserialize (i, length);
797  Add (Tlv (Port_src, val.GetSerializedSize (), val));
798  break;
799  }
800  case Port_dst:
801  {
802  PortRangeTlvValue val;
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 }
827 TosTlvValue::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 
837 uint32_t
839 {
840  return 3;
841 }
842 void
844 {
845  i.WriteU8 (m_low);
846  i.WriteU8 (m_high);
847  i.WriteU8 (m_mask);
848 }
849 uint32_t
851 {
852  m_low = i.ReadU8 ();
853  m_high = i.ReadU8 ();
854  m_mask = i.ReadU8 ();
855  return 3;
856 }
857 uint8_t
859 {
860  return m_low;
861 }
862 uint8_t
864 {
865  return m_high;
866 }
867 uint8_t
869 {
870  return m_mask;
871 }
872 
873 TosTlvValue *
874 TosTlvValue::Copy (void) const
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 
890 uint32_t
892 {
893  return m_portRange->size () * 4; // a port range is defined by 2 ports, each using 2 bytes
894 }
895 void
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 }
904 uint32_t
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 }
917 void
918 PortRangeTlvValue::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 {
940  PortRangeTlvValue * tmp = new PortRangeTlvValue ();
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 
964 uint32_t
966 {
967  return m_protocol->size ();
968 }
969 
970 void
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 
979 uint32_t
981 {
982  uint64_t len = 0;
983  while (len < valueLength)
984  {
985  Add (i.ReadU8 ());
986  len++;
987  }
988  return len;
989 }
990 
991 void
992 ProtocolTlvValue::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 
1037 uint32_t
1039 {
1040  return m_ipv4Addr->size () * 8; // IPv4 address and mask are 4 bytes each
1041 }
1042 
1043 void
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 
1053 uint32_t
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 
1067 void
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 }
Protocol header serialization and deserialization.
Definition: header.h:42
uint8_t GetLow(void) const
Get low part.
Definition: wimax-tlv.cc:858
virtual uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength)
Deserialize from a buffer.
Definition: wimax-tlv.cc:307
uint64_t GetLength(void) const
Get length value.
Definition: wimax-tlv.cc:219
virtual uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength)
Deserialize from a buffer.
Definition: wimax-tlv.cc:1054
U16TlvValue class.
Definition: wimax-tlv.h:209
virtual uint32_t GetSerializedSize(void) const
Get serialized size in bytes.
Definition: wimax-tlv.cc:1038
virtual uint32_t GetSerializedSize(void) const
Definition: wimax-tlv.cc:103
std::vector< struct ipv4Addr >::const_iterator Iterator
IPv4 address vector iterator typedef.
Definition: wimax-tlv.h:566
std::vector< uint8_t >::const_iterator Iterator
Iterator typedef.
Definition: wimax-tlv.h:522
virtual void Serialize(Buffer::Iterator start) const
Serialize to a buffer.
Definition: wimax-tlv.cc:896
PortRange structure.
Definition: wimax-tlv.h:474
Iterator Begin() const
Begin iterator.
Definition: wimax-tlv.cc:926
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: wimax-tlv.cc:42
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:269
ProtocolTlvValue class.
Definition: wimax-tlv.h:516
virtual uint32_t GetSerializedSize(void) const =0
Get serialized size in bytes.
SfVectorTlvValue class.
Definition: wimax-tlv.h:328
uint64_t m_length
length
Definition: wimax-tlv.h:161
virtual uint32_t Deserialize(Buffer::Iterator start)
Definition: wimax-tlv.cc:147
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
void Add(uint16_t portLow, uint16_t portHigh)
Add a range.
Definition: wimax-tlv.cc:918
Iterator End() const
End iterator.
Definition: wimax-tlv.cc:932
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
Iterator End() const
End iterator.
Definition: wimax-tlv.cc:278
TosTlvValue class.
Definition: wimax-tlv.h:423
this class implements the convergence sub-layer descriptor as a tlv vector
Definition: wimax-tlv.h:376
uint16_t m_value
value
Definition: wimax-tlv.h:240
virtual PortRangeTlvValue * Copy(void) const
Copy.
Definition: wimax-tlv.cc:938
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:251
Ipv4AddressTlvValue class.
Definition: wimax-tlv.h:556
virtual void Serialize(Buffer::Iterator start) const
Serialize to a buffer.
Definition: wimax-tlv.cc:618
uint32_t ReadNtohU32(void)
Definition: buffer.h:970
virtual void Print(std::ostream &os) const
Definition: wimax-tlv.cc:47
This class implements the Type-Len-Value structure channel encodings as described by "IEEE Standard f...
Definition: wimax-tlv.h:83
virtual uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength)
Deserialize from a buffer.
Definition: wimax-tlv.cc:905
iterator in a Buffer instance
Definition: buffer.h:98
The value field of a tlv can take different values (uint8_t, uint16, vector, ...).
Definition: wimax-tlv.h:43
Tlv * Copy(void) const
Copy TLV.
Definition: wimax-tlv.cc:230
std::vector< struct ipv4Addr > * m_ipv4Addr
ipv4 addr
Definition: wimax-tlv.h:590
TlvValue * m_value
value
Definition: wimax-tlv.h:162
uint8_t GetSizeOfLen(void) const
Get size of length field.
Definition: wimax-tlv.cc:109
void Add(const Tlv &val)
Add a TLV.
Definition: wimax-tlv.cc:284
virtual U32TlvValue * Copy(void) const
Copy.
Definition: wimax-tlv.cc:641
virtual uint32_t GetSerializedSize(void) const
Get serialized size in bytes.
Definition: wimax-tlv.cc:514
std::vector< struct PortRange >::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:971
virtual uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength)
Deserialize from a buffer.
Definition: wimax-tlv.cc:648
virtual uint32_t GetSerializedSize(void) const
Get serialized size in bytes.
Definition: wimax-tlv.cc:965
#define WIMAX_TLV_EXTENDED_LENGTH_MASK
Definition: wimax-tlv.h:25
Iterator Begin() const
Begin iterator.
Definition: wimax-tlv.cc:998
uint8_t m_value
value
Definition: wimax-tlv.h:201
virtual CsParamVectorTlvValue * Copy(void) const
Copy.
Definition: wimax-tlv.cc:702
std::vector< Tlv * > * m_tlvList
tlv list
Definition: wimax-tlv.h:320
uint8_t GetMask(void) const
Get the mask.
Definition: wimax-tlv.cc:868
virtual TosTlvValue * Copy() const
Copy.
Definition: wimax-tlv.cc:874
Iterator Begin() const
Begin iterator.
Definition: wimax-tlv.cc:272
uint32_t GetValue(void) const
Get value.
Definition: wimax-tlv.cc:635
static TypeId GetTypeId(void)
Register this type.
Definition: wimax-tlv.cc:32
Tlv(void)
Definition: wimax-tlv.cc:59
void WriteHtonU16(uint16_t data)
Definition: buffer.h:905
uint8_t GetHigh(void) const
Get high part.
Definition: wimax-tlv.cc:863
U8TlvValue class.
Definition: wimax-tlv.h:170
virtual TlvValue * Copy(void) const =0
Copy function.
void Next(void)
go forward by one byte
Definition: buffer.h:845
uint8_t GetType(void) const
Get type value.
Definition: wimax-tlv.cc:214
virtual uint32_t GetSerializedSize(void) const
Get serialized size in bytes.
Definition: wimax-tlv.cc:891
Iterator End() const
End iterator.
Definition: wimax-tlv.cc:1004
std::vector< uint8_t > * m_protocol
protocol
Definition: wimax-tlv.h:547
Iterator Begin() const
Begin iterator.
Definition: wimax-tlv.cc:1077
virtual uint32_t GetSerializedSize(void) const
Get serialized size in bytes.
Definition: wimax-tlv.cc:564
virtual uint32_t GetSerializedSize(void) const
Get serialized size in bytes.
Definition: wimax-tlv.cc:613
void Add(uint8_t protocol)
Add protocol number.
Definition: wimax-tlv.cc:992
uint8_t m_low
low
Definition: wimax-tlv.h:460
virtual void Serialize(Buffer::Iterator start) const
Serialize to a buffer.
Definition: wimax-tlv.cc:519
uint8_t GetValue(void) const
Get value.
Definition: wimax-tlv.cc:537
Ipv4Address Address
address
Definition: wimax-tlv.h:562
Every class exported by the ns3 library is enclosed in the ns3 namespace.
address
Definition: first.py:44
std::vector< struct PortRange > * m_portRange
port range
Definition: wimax-tlv.h:508
U8TlvValue * Copy(void) const
Copy.
Definition: wimax-tlv.cc:543
TlvValue * PeekValue(void)
Peek value.
Definition: wimax-tlv.cc:224
virtual void Serialize(Buffer::Iterator start) const
Serialize to a buffer.
Definition: wimax-tlv.cc:843
~Tlv(void)
Definition: wimax-tlv.cc:66
this class implements the classifier descriptor as a tlv vector
Definition: wimax-tlv.h:397
uint16_t GetValue(void) const
Get value.
Definition: wimax-tlv.cc:587
virtual Ipv4AddressTlvValue * Copy() const
Copy function.
Definition: wimax-tlv.cc:1089
void WriteHtonU32(uint32_t data)
Definition: buffer.h:924
uint8_t m_type
type
Definition: wimax-tlv.h:160
PortRangeTlvValue class.
Definition: wimax-tlv.h:470
Iterator End() const
End iterator.
Definition: wimax-tlv.cc:1083
#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
virtual uint32_t GetSerializedSize(void) const
Get serialized size in bytes.
Definition: wimax-tlv.cc:838
virtual SfVectorTlvValue * Copy(void) const
Copy.
Definition: wimax-tlv.cc:296
Tlv & operator=(Tlv const &o)
assignment operator
Definition: wimax-tlv.cc:89
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
virtual uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLen)
Deserialize from a buffer.
Definition: wimax-tlv.cc:524
void WriteU8(uint8_t data)
Definition: buffer.h:869
virtual uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLen)
Deserialize from a buffer.
Definition: wimax-tlv.cc:623
virtual ProtocolTlvValue * Copy(void) const
Copy.
Definition: wimax-tlv.cc:1010
virtual void Serialize(Buffer::Iterator start) const
Serialize to a buffer.
Definition: wimax-tlv.cc:569
virtual ClassificationRuleVectorTlvValue * Copy(void) const
Copy.
Definition: wimax-tlv.cc:719
virtual U16TlvValue * Copy(void) const
Copy.
Definition: wimax-tlv.cc:593
virtual void Serialize(Buffer::Iterator start) const =0
Serialize to a buffer.
U32TlvValue class.
Definition: wimax-tlv.h:248
virtual void Serialize(Buffer::Iterator start) const
Definition: wimax-tlv.cc:127
uint8_t m_high
high
Definition: wimax-tlv.h:461
uint8_t ReadU8(void)
Definition: buffer.h:1021
void Add(Ipv4Address address, Ipv4Mask Mask)
Add IPv4 address and mask.
Definition: wimax-tlv.cc:1068
uint8_t m_mask
mask
Definition: wimax-tlv.h:462
TlvValue * CopyValue(void) const
Copy TlvValue.
Definition: wimax-tlv.cc:76
uint32_t m_value
value
Definition: wimax-tlv.h:280
uint16_t ReadNtohU16(void)
Definition: buffer.h:946
std::vector< Tlv * >::const_iterator Iterator
TLV vector iterator typedef.
Definition: wimax-tlv.h:293
virtual void Serialize(Buffer::Iterator start) const
Serialize to a buffer.
Definition: wimax-tlv.cc:262
a unique identifier for an interface.
Definition: type-id.h:58
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
virtual void Serialize(Buffer::Iterator start) const
Serialize to a buffer.
Definition: wimax-tlv.cc:1044
virtual uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength)
Deserialize from a buffer.
Definition: wimax-tlv.cc:980
virtual uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength)
Deserialize from a buffer.
Definition: wimax-tlv.cc:730
virtual uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLen)
Deserialize from a buffer.
Definition: wimax-tlv.cc:574