A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
25 
26 namespace ns3 {
27 // NS_OBJECT_ENSURE_REGISTERED ("Tlv")
28 // ;
29 
31 {
32  return GetTypeId ();
33 }
34 
35 void Tlv::Print (std::ostream &os) const
36 {
37  os << "TLV type = " << (uint32_t) m_type << " TLV Length = " << (uint64_t) m_length;
38 }
39 
40 Tlv::Tlv (uint8_t type, uint64_t length, const TlvValue & value)
41 {
42  m_type = type;
43  m_length = length;
44  m_value = value.Copy ();
45 }
46 
48 {
49  m_type = 0;
50  m_length = 0;
51  m_value = 0;
52 }
53 
55 {
56  if (m_value != 0)
57  {
58  delete m_value;
59  m_value = 0;
60  }
61 }
62 
63 TlvValue *
64 Tlv::CopyValue (void) const
65 {
66  return m_value->Copy ();
67 }
68 
69 Tlv::Tlv (const Tlv & tlv)
70 {
71  m_type = tlv.GetType ();
72  m_length = tlv.GetLength ();
73  m_value = tlv.CopyValue ();
74 }
75 
76 Tlv &
78 {
79  if (m_value != 0)
80  {
81  delete m_value;
82  }
83  m_type = o.GetType ();
84  m_length = o.GetLength ();
85  m_value = o.CopyValue ();
86 
87  return *this;
88 }
89 
90 uint32_t
92 {
93  return 1 + GetSizeOfLen () + m_value->GetSerializedSize ();
94 }
95 
96 uint8_t
97 Tlv::GetSizeOfLen (void) const
98 {
99  uint8_t sizeOfLen = 1;
100 
101  if (m_length > 127)
102  {
103  sizeOfLen = 2;
104  uint64_t testValue = 0xFF;
105  while (m_length > testValue)
106  {
107  sizeOfLen++;
108  testValue *= 0xFF;
109  }
110  }
111  return sizeOfLen;
112 }
113 
114 void
116 {
117  i.WriteU8 (m_type);
118  uint8_t lenSize = GetSizeOfLen ();
119  if (lenSize == 1)
120  {
121  i.WriteU8 (m_length);
122  }
123  else
124  {
125  i.WriteU8 ((lenSize-1) | WIMAX_TLV_EXTENDED_LENGTH_MASK);
126  for (int j = 0; j < lenSize - 1; j++)
127  {
128  i.WriteU8 ((uint8_t)(m_length >> ((lenSize - 1 - 1 - j) * 8)));
129  }
130  }
131  m_value->Serialize (i);
132 }
133 
134 uint32_t
136 {
137  // read the type of tlv
138  m_type = i.ReadU8 ();
139 
140  // read the length
141  uint8_t lenSize = i.ReadU8 ();
142  uint32_t serializedSize = 2;
143  if (lenSize < 127)
144  {
145  m_length = lenSize;
146  }
147  else
148  {
149  lenSize &= ~WIMAX_TLV_EXTENDED_LENGTH_MASK;
150  for (int j = 0; j < lenSize; j++)
151  {
152  m_length <<= 8;
153  m_length |= i.ReadU8 ();
154  serializedSize++;
155  }
156  }
157  switch (m_type)
158  {
159  case HMAC_TUPLE:
161  NS_FATAL_ERROR ("Not implemented-- please implement and contribute a patch");
162  break;
165  NS_FATAL_ERROR ("Not implemented-- please implement and contribute a patch");
166  break;
169  NS_FATAL_ERROR ("Not implemented-- please implement and contribute a patch");
170  break;
172  {
173  SfVectorTlvValue val;
174  serializedSize += val.Deserialize (i, m_length);
175  m_value = val.Copy ();
176  break;
177  }
178  case UPLINK_SERVICE_FLOW:
179  {
180  SfVectorTlvValue val;
181  serializedSize += val.Deserialize (i, m_length);
182  m_value = val.Copy ();
183  break;
184  }
185  case VENDOR_ID_EMCODING:
187  NS_FATAL_ERROR ("Not implemented-- please implement and contribute a patch");
188  break;
191  NS_FATAL_ERROR ("Not implemented-- please implement and contribute a patch");
192  break;
193  default:
194  NS_ASSERT_MSG (false, "Unknown tlv type.");
195  break;
196  }
197 
198  return serializedSize;
199 }
200 
201 uint8_t
202 Tlv::GetType (void) const
203 {
204  return m_type;
205 }
206 uint64_t
207 Tlv::GetLength (void) const
208 {
209  return m_length;
210 }
211 TlvValue*
213 {
214  return m_value;
215 }
216 
217 Tlv *
218 Tlv::Copy (void) const
219 {
220  return new Tlv (m_type, m_length, *m_value);
221 }
222 // ==============================================================================
224 {
225  m_tlvList = new std::vector<Tlv*>;
226 }
227 
229 {
230  for (std::vector<Tlv*>::const_iterator iter = m_tlvList->begin (); iter != m_tlvList->end (); ++iter)
231  {
232  delete (*iter);
233  }
234  m_tlvList->clear ();
235  delete m_tlvList;
236 }
237 
238 uint32_t
240 {
241  uint32_t size = 0;
242  for (std::vector<Tlv*>::const_iterator iter = m_tlvList->begin (); iter != m_tlvList->end (); ++iter)
243  {
244  size += (*iter)->GetSerializedSize ();
245  }
246  return size;
247 }
248 
249 void
251 {
252  for (std::vector<Tlv*>::const_iterator iter = m_tlvList->begin (); iter != m_tlvList->end (); ++iter)
253  {
254  (*iter)->Serialize (i);
255  i.Next ((*iter)->GetSerializedSize ());
256  }
257 }
258 
261 {
262  return m_tlvList->begin ();
263 }
264 
267 {
268  return m_tlvList->end ();
269 }
270 
271 void
273 {
274  m_tlvList->push_back (val.Copy ());
275 }
276 
277 // ==============================================================================
279 {
280 
281 }
282 
285 {
286  SfVectorTlvValue * tmp = new SfVectorTlvValue ();
287  for (std::vector<Tlv*>::const_iterator iter = Begin (); iter != End (); ++iter)
288  {
289  tmp->Add (Tlv ((*iter)->GetType (), (*iter)->GetLength (), *(*iter)->PeekValue ()));
290  }
291  return tmp;
292 }
293 
294 uint32_t
296 {
297  uint64_t serializedSize = 0;
298  while (serializedSize < valueLen)
299  {
300  uint8_t type = i.ReadU8 ();
301  // read the length
302  uint8_t lenSize = i.ReadU8 ();
303  serializedSize += 2;
304  uint64_t length = 0;
305  if (lenSize < 127)
306  {
307  length = lenSize;
308  }
309  else
310  {
311  lenSize &= ~WIMAX_TLV_EXTENDED_LENGTH_MASK;
312  for (int j = 0; j < lenSize; j++)
313  {
314  length <<= 8;
315  length |= i.ReadU8 ();
316  serializedSize++;
317  }
318  }
319  switch (type)
320  {
321  case SFID:
322  {
323  U32TlvValue val;
324  serializedSize += val.Deserialize (i);
325  Add (Tlv (SFID, 4, val));
326  break;
327  }
328  case CID:
329  {
330  U16TlvValue val;
331  serializedSize += val.Deserialize (i);
332  Add (Tlv (CID, 2, val));
333  break;
334  }
335  case Service_Class_Name:
336  NS_FATAL_ERROR ("Not implemented-- please implement and contribute a patch");
337  break;
338  case reserved1:
339  // NOTHING
340  break;
342  {
343  U8TlvValue val;
344  serializedSize += val.Deserialize (i);
345  Add (Tlv (QoS_Parameter_Set_Type, 1, val));
346  break;
347  }
348  case Traffic_Priority:
349  {
350  U8TlvValue val;
351  serializedSize += val.Deserialize (i);
352  Add (Tlv (Traffic_Priority, 1, val));
353  break;
354  }
356  {
357  U32TlvValue val;
358  serializedSize += val.Deserialize (i);
360  break;
361  }
363  {
364  U32TlvValue val;
365  serializedSize += val.Deserialize (i);
366  Add (Tlv (Maximum_Traffic_Burst, 4, val));
367  break;
368  }
370  {
371  U32TlvValue val;
372  serializedSize += val.Deserialize (i);
374  break;
375  }
377  {
378  U32TlvValue val;
379  serializedSize += val.Deserialize (i);
381  break;
382  }
384  {
385  U8TlvValue val;
386  serializedSize += val.Deserialize (i);
388  break;
389  }
391  {
392  U32TlvValue val;
393  serializedSize += val.Deserialize (i);
394  Add (Tlv (Request_Transmission_Policy, 4, val));
395  break;
396  }
397  case Tolerated_Jitter:
398  {
399  U32TlvValue val;
400  serializedSize += val.Deserialize (i);
401  Add (Tlv (Tolerated_Jitter, 4, val));
402  break;
403  }
404  case Maximum_Latency:
405  {
406  U32TlvValue val;
407  serializedSize += val.Deserialize (i);
408  Add (Tlv (Maximum_Latency, 4, val));
409  break;
410  }
412  {
413  U8TlvValue val;
414  serializedSize += val.Deserialize (i);
416  break;
417  }
418  case SDU_Size:
419  {
420  U8TlvValue val;
421  serializedSize += val.Deserialize (i);
422  Add (Tlv (SDU_Size, 1, val));
423  break;
424  }
425  case Target_SAID:
426  {
427  U16TlvValue val;
428  serializedSize += val.Deserialize (i);
429  Add (Tlv (Target_SAID, 2, val));
430  break;
431  }
432  case ARQ_Enable:
433  {
434  U8TlvValue val;
435  serializedSize += val.Deserialize (i);
436  Add (Tlv (ARQ_Enable, 1, val));
437  break;
438  }
439  case ARQ_WINDOW_SIZE:
440  {
441  U16TlvValue val;
442  serializedSize += val.Deserialize (i);
443  Add (Tlv (ARQ_WINDOW_SIZE, 2, val));
444  break;
445  }
447  break;
449  break;
450  case ARQ_BLOCK_LIFETIME:
451  break;
452  case ARQ_SYNC_LOSS:
453  break;
455  break;
456  case ARQ_PURGE_TIMEOUT:
457  break;
458  case ARQ_BLOCK_SIZE:
459  break;
460  case reserved2:
461  break;
462  case CS_Specification:
463  {
464  U8TlvValue val;
465  serializedSize += val.Deserialize (i);
466  Add (Tlv (CS_Specification, 1, val));
467  break;
468  }
469  case IPV4_CS_Parameters:
470  {
472  uint32_t size = val.Deserialize (i, length);
473  serializedSize += size;
474  Add (Tlv (IPV4_CS_Parameters, size, val));
475  break;
476  }
477  default:
478  NS_ASSERT_MSG (false, "Unknown tlv type.");
479  break;
480  }
481  i.Next (length);
482  }
483  return serializedSize;
484 }
485 
486 // ==============================================================================
487 
488 U8TlvValue::U8TlvValue (uint8_t value)
489 {
490  m_value = value;
491 }
492 
494 {
495  m_value = 0;
496 }
497 
499 {
500 }
501 uint32_t
503 {
504  return 1;
505 }
506 void
508 {
509  i.WriteU8 (m_value);
510 }
511 uint32_t
513 {
514  return Deserialize (i);
515 }
516 
517 uint32_t
519 {
520  m_value = i.ReadU8 ();
521  return 1;
522 }
523 
524 uint8_t
526 {
527  return m_value;
528 }
529 
530 U8TlvValue *
531 U8TlvValue::Copy (void) const
532 {
533  U8TlvValue * tmp = new U8TlvValue (m_value);
534  return tmp;
535 }
536 // ==============================================================================
537 U16TlvValue::U16TlvValue (uint16_t value)
538 {
539  m_value = value;
540 }
541 
543 {
544  m_value = 0;
545 }
546 
548 {
549 }
550 
551 uint32_t
553 {
554  return 2;
555 }
556 void
558 {
559  i.WriteHtonU16 (m_value);
560 }
561 uint32_t
563 {
564  return Deserialize (i);
565 }
566 
567 uint32_t
569 {
570  m_value = i.ReadNtohU16 ();
571  return 2;
572 }
573 
574 uint16_t
576 {
577  return m_value;
578 }
579 
580 U16TlvValue *
581 U16TlvValue::Copy (void) const
582 {
583  U16TlvValue * tmp = new U16TlvValue (m_value);
584  return tmp;
585 }
586 // ==============================================================================
587 U32TlvValue::U32TlvValue (uint32_t value)
588 {
589  m_value = value;
590 }
591 
593 {
594  m_value = 0;
595 }
596 
598 {
599 }
600 
601 uint32_t U32TlvValue::GetSerializedSize (void) const
602 {
603  return 4;
604 }
605 void
607 {
608  i.WriteHtonU32 (m_value);
609 }
610 uint32_t
612 {
613  return Deserialize (i);
614 }
615 
616 uint32_t
618 {
619  m_value = i.ReadNtohU32 ();
620  return 4;
621 }
622 uint32_t
624 {
625  return m_value;
626 }
627 
628 U32TlvValue *
629 U32TlvValue::Copy (void) const
630 {
631  U32TlvValue * tmp = new U32TlvValue (m_value);
632  return tmp;
633 }
634 // ==============================================================================
635 uint32_t
637 {
638  uint64_t serializedSize = 0;
639  uint8_t lenSize = 0;
640  uint8_t type = 0;
641  while (serializedSize < valueLength)
642  {
643  type = i.ReadU8 ();
644  // read the length
645  lenSize = i.ReadU8 ();
646  serializedSize += 2;
647  uint64_t length = 0;
648  if (lenSize < 127)
649  {
650  length = lenSize;
651  }
652  else
653  {
654  lenSize &= ~WIMAX_TLV_EXTENDED_LENGTH_MASK;
655  for (int j = 0; j < lenSize; j++)
656  {
657  length <<= 8;
658  length |= i.ReadU8 ();
659  serializedSize++;
660  }
661  }
662  switch (type)
663  {
665  {
666  U8TlvValue val;
667  serializedSize += val.Deserialize (i);
668  Add (Tlv (Classifier_DSC_Action, 1, val));
669  break;
670  }
672  {
674  serializedSize += val.Deserialize (i, length);
676  break;
677  }
678  }
679  i.Next (length);
680  }
681  return serializedSize;
682 }
683 
685 {
686 
687 }
688 
691 {
693  for (std::vector<Tlv*>::const_iterator iter = Begin (); iter != End (); ++iter)
694  {
695  tmp->Add (Tlv ((*iter)->GetType (), (*iter)->GetLength (), *(*iter)->PeekValue ()));
696  }
697  return tmp;
698 }
699 // ==============================================================================
700 
702 {
703 
704 }
705 
708 {
710  for (std::vector<Tlv*>::const_iterator iter = Begin (); iter != End (); ++iter)
711  {
712  tmp->Add (Tlv ((*iter)->GetType (), (*iter)->GetLength (), *(*iter)->PeekValue ()));
713  }
714  return tmp;
715 }
716 
717 uint32_t
719 {
720  uint64_t serializedSize = 0;
721  uint8_t lenSize = 0;
722  uint8_t type = 0;
723  while (serializedSize < valueLength)
724  {
725  type = i.ReadU8 ();
726  // read the length
727  lenSize = i.ReadU8 ();
728  serializedSize += 2;
729  uint64_t length = 0;
730  if (lenSize < 127)
731  {
732  length = lenSize;
733  }
734  else
735  {
736  lenSize &= ~WIMAX_TLV_EXTENDED_LENGTH_MASK;
737  for (int j = 0; j < lenSize; j++)
738  {
739  length <<= 8;
740  length |= i.ReadU8 ();
741  serializedSize++;
742  }
743  }
744  switch (type)
745  {
746  case Priority:
747  {
748  U8TlvValue val;
749  serializedSize += val.Deserialize (i);
750  Add (Tlv (Priority, 1, val));
751  break;
752  }
753  case ToS:
754  {
755  TosTlvValue val;
756  serializedSize += val.Deserialize (i, length);
757  Add (Tlv (ToS, val.GetSerializedSize (), val));
758  break;
759  }
760  case Protocol:
761  {
762  ProtocolTlvValue val;
763  serializedSize += val.Deserialize (i, length);
764  Add (Tlv (Protocol, val.GetSerializedSize (), val));
765  break;
766  }
767  case IP_src:
768  {
770  serializedSize += val.Deserialize (i, length);
771  Add (Tlv (IP_src, val.GetSerializedSize (), val));
772  break;
773  }
774  case IP_dst:
775  {
777  serializedSize += val.Deserialize (i, length);
778  Add (Tlv (IP_dst, val.GetSerializedSize (), val));
779  break;
780  }
781  case Port_src:
782  {
783  PortRangeTlvValue val;
784  serializedSize += val.Deserialize (i, length);
785  Add (Tlv (Port_src, val.GetSerializedSize (), val));
786  break;
787  }
788  case Port_dst:
789  {
790  PortRangeTlvValue val;
791  serializedSize += val.Deserialize (i, length);
792  Add (Tlv (Port_dst, val.GetSerializedSize (), val));
793  break;
794  }
795  case Index:
796  {
797  U16TlvValue val;
798  serializedSize += val.Deserialize (i);
799  Add (Tlv (Index, 2, val));
800  break;
801  }
802  }
803  i.Next (length);
804  }
805  return serializedSize;
806 }
807 
808 // ==============================================================================
810 {
811  m_low = 0;
812  m_high = 0;
813  m_mask = 0;
814 }
815 TosTlvValue::TosTlvValue (uint8_t low, uint8_t high, uint8_t mask)
816 {
817  m_low = low;
818  m_high = high;
819  m_mask = mask;
820 }
822 {
823 }
824 
825 uint32_t
827 {
828  return 3;
829 }
830 void
832 {
833  i.WriteU8 (m_low);
834  i.WriteU8 (m_high);
835  i.WriteU8 (m_mask);
836 }
837 uint32_t
839 {
840  m_low = i.ReadU8 ();
841  m_high = i.ReadU8 ();
842  m_mask = i.ReadU8 ();
843  return 3;
844 }
845 uint8_t
847 {
848  return m_low;
849 }
850 uint8_t
852 {
853  return m_high;
854 }
855 uint8_t
857 {
858  return m_mask;
859 }
860 
861 TosTlvValue *
862 TosTlvValue::Copy (void) const
863 {
864  return new TosTlvValue (m_low, m_high, m_mask);
865 }
866 
867 // ==============================================================================
869 {
870  m_portRange = new std::vector<struct PortRange>;
871 }
873 {
874  m_portRange->clear ();
875  delete m_portRange;
876 }
877 
878 uint32_t
880 {
881  return m_portRange->size () * sizeof(struct PortRange);
882 }
883 void
885 {
886  for (std::vector<struct PortRange>::const_iterator iter = m_portRange->begin (); iter != m_portRange->end (); ++iter)
887  {
888  i.WriteHtonU16 ((*iter).PortLow);
889  i.WriteHtonU16 ((*iter).PortHigh);
890  }
891 }
892 uint32_t
894 {
895  uint64_t len = 0;
896  while (len < valueLength)
897  {
898  uint16_t low = i.ReadNtohU16 ();
899  uint16_t high = i.ReadNtohU16 ();
900  Add (low, high);
901  len += 4;
902  }
903  return len;
904 }
905 void
906 PortRangeTlvValue::Add (uint16_t portLow, uint16_t portHigh)
907 {
908  struct PortRange tmp;
909  tmp.PortLow = portLow;
910  tmp.PortHigh = portHigh;
911  m_portRange->push_back (tmp);
912 }
915 {
916  return m_portRange->begin ();
917 }
918 
921 {
922  return m_portRange->end ();
923 }
924 
927 {
928  PortRangeTlvValue * tmp = new PortRangeTlvValue ();
929  for (std::vector<struct PortRange>::const_iterator iter = m_portRange->begin (); iter != m_portRange->end (); ++iter)
930  {
931  tmp->Add ((*iter).PortLow, (*iter).PortHigh);
932  }
933  return tmp;
934 }
935 
936 // ==============================================================================
937 
939 {
940  m_protocol = new std::vector<uint8_t>;
941 }
943 {
944  if (m_protocol != 0)
945  {
946  m_protocol->clear ();
947  delete m_protocol;
948  m_protocol = 0;
949  }
950 }
951 
952 uint32_t
954 {
955  return m_protocol->size ();
956 }
957 
958 void
960 {
961  for (std::vector<uint8_t>::const_iterator iter = m_protocol->begin (); iter != m_protocol->end (); ++iter)
962  {
963  i.WriteU8 ((*iter));
964  }
965 }
966 
967 uint32_t
969 {
970  uint64_t len = 0;
971  while (len < valueLength)
972  {
973  Add (i.ReadU8 ());
974  len++;
975  }
976  return len;
977 }
978 
979 void
980 ProtocolTlvValue::Add (uint8_t protocol)
981 {
982  m_protocol->push_back (protocol);
983 }
984 
987 {
988  return m_protocol->begin ();
989 }
990 
993 {
994  return m_protocol->end ();
995 }
996 
999 {
1000  ProtocolTlvValue* tmp = new ProtocolTlvValue ();
1001  for (std::vector<uint8_t>::const_iterator iter = m_protocol->begin (); iter != m_protocol->end (); ++iter)
1002  {
1003  tmp->Add ((*iter));
1004  }
1005  return tmp;
1006 }
1007 
1008 // ==============================================================================
1009 
1011 {
1012  m_ipv4Addr = new std::vector<struct ipv4Addr>;
1013 }
1014 
1016 {
1017  if (m_ipv4Addr != 0)
1018  {
1019  m_ipv4Addr->clear ();
1020  delete m_ipv4Addr;
1021  m_ipv4Addr = 0;
1022  }
1023 }
1024 
1025 uint32_t
1027 {
1028  return m_ipv4Addr->size () * sizeof(struct ipv4Addr);
1029 }
1030 
1031 void
1033 {
1034  for (std::vector<struct ipv4Addr>::const_iterator iter = m_ipv4Addr->begin (); iter != m_ipv4Addr->end (); ++iter)
1035  {
1036  i.WriteHtonU32 ((*iter).Address.Get ());
1037  i.WriteHtonU32 ((*iter).Mask.Get ());
1038  }
1039 }
1040 
1041 uint32_t
1043 {
1044  uint64_t len = 0;
1045  while (len < valueLength)
1046  {
1047  uint32_t addr = i.ReadNtohU32 ();
1048  uint32_t mask = i.ReadNtohU32 ();
1049  Add (Ipv4Address (addr), Ipv4Mask (mask));
1050  len += 8;
1051  }
1052  return len;
1053 }
1054 
1055 void
1057 {
1058  struct ipv4Addr tmp;
1059  tmp.Address = address;
1060  tmp.Mask = Mask;
1061  m_ipv4Addr->push_back (tmp);
1062 }
1063 
1066 {
1067  return m_ipv4Addr->begin ();
1068 }
1069 
1072 {
1073  return m_ipv4Addr->end ();
1074 }
1075 
1078 {
1080  for (std::vector<struct ipv4Addr>::const_iterator iter = m_ipv4Addr->begin (); iter != m_ipv4Addr->end (); ++iter)
1081  {
1082  tmp->Add ((*iter).Address, (*iter).Mask);
1083  }
1084  return tmp;
1085 }
1086 
1087 }
virtual PortRangeTlvValue * Copy(void) const
Definition: wimax-tlv.cc:926
virtual uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength)
Definition: wimax-tlv.cc:295
virtual uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength)
Definition: wimax-tlv.cc:1042
virtual ProtocolTlvValue * Copy(void) const
Definition: wimax-tlv.cc:998
uint8_t GetSizeOfLen(void) const
Definition: wimax-tlv.cc:97
virtual void Serialize(Buffer::Iterator start) const
Definition: wimax-tlv.cc:1032
std::vector< struct ipv4Addr >::const_iterator Iterator
Definition: wimax-tlv.h:358
std::vector< uint8_t >::const_iterator Iterator
Definition: wimax-tlv.h:333
Iterator Begin() const
Definition: wimax-tlv.cc:986
uint16_t GetValue(void) const
Definition: wimax-tlv.cc:575
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:222
virtual uint32_t GetSerializedSize(void) const =0
uint8_t GetValue(void) const
Definition: wimax-tlv.cc:525
uint64_t m_length
Definition: wimax-tlv.h:96
virtual uint32_t GetSerializedSize(void) const
Definition: wimax-tlv.cc:552
virtual uint32_t Deserialize(Buffer::Iterator start)
Definition: wimax-tlv.cc:135
Iterator End() const
Definition: wimax-tlv.cc:1071
virtual uint32_t GetSerializedSize(void) const
Definition: wimax-tlv.cc:879
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:170
virtual void Serialize(Buffer::Iterator start) const
Definition: wimax-tlv.cc:831
void Add(uint16_t portLow, uint16_t portHigh)
Definition: wimax-tlv.cc:906
virtual uint32_t GetSerializedSize(void) const
Definition: wimax-tlv.cc:239
Tlv * Copy(void) const
Definition: wimax-tlv.cc:218
#define NS_FATAL_ERROR(msg)
fatal error handling
Definition: fatal-error.h:95
this class implements the convergence sub-layer descriptor as a tlv vector
Definition: wimax-tlv.h:235
virtual uint32_t GetSerializedSize(void) const
Definition: wimax-tlv.cc:953
uint16_t m_value
Definition: wimax-tlv.h:137
virtual uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength)
Definition: wimax-tlv.cc:838
virtual U16TlvValue * Copy(void) const
Definition: wimax-tlv.cc:581
void Add(uint8_t protiocol)
Definition: wimax-tlv.cc:980
uint32_t ReadNtohU32(void)
Definition: buffer.h:977
This class implements the Type-Len-Value structure channel encodings as described by "IEEE Standard f...
Definition: wimax-tlv.h:64
virtual uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength)
Definition: wimax-tlv.cc:893
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:42
std::vector< struct ipv4Addr > * m_ipv4Addr
Definition: wimax-tlv.h:369
TlvValue * m_value
Definition: wimax-tlv.h:97
uint8_t GetLow(void) const
Definition: wimax-tlv.cc:846
virtual void Serialize(Buffer::Iterator start) const
Definition: wimax-tlv.cc:507
void Add(const Tlv &val)
Definition: wimax-tlv.cc:272
virtual void Serialize(Buffer::Iterator start) const
Definition: wimax-tlv.cc:115
std::vector< struct PortRange >::const_iterator Iterator
Definition: wimax-tlv.h:310
virtual uint32_t GetSerializedSize(void) const
Definition: wimax-tlv.cc:1026
virtual uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength)
Definition: wimax-tlv.cc:636
static TypeId GetTypeId(void)
Get the type ID.
Definition: header.cc:16
#define WIMAX_TLV_EXTENDED_LENGTH_MASK
Definition: wimax-tlv.h:25
virtual void Serialize(Buffer::Iterator start) const
Definition: wimax-tlv.cc:557
uint64_t GetLength(void) const
Definition: wimax-tlv.cc:207
uint8_t m_value
Definition: wimax-tlv.h:117
std::vector< Tlv * > * m_tlvList
Definition: wimax-tlv.h:181
uint8_t GetHigh(void) const
Definition: wimax-tlv.cc:851
Tlv(void)
Definition: wimax-tlv.cc:47
void WriteHtonU16(uint16_t data)
Definition: buffer.h:912
virtual TlvValue * Copy(void) const =0
void Next(void)
go forward by one byte
Definition: buffer.h:852
std::vector< uint8_t > * m_protocol
Definition: wimax-tlv.h:342
virtual void Serialize(Buffer::Iterator start) const
Definition: wimax-tlv.cc:250
U8TlvValue * Copy(void) const
Definition: wimax-tlv.cc:531
Iterator End() const
Definition: wimax-tlv.cc:992
virtual U32TlvValue * Copy(void) const
Definition: wimax-tlv.cc:629
TlvValue * CopyValue(void) const
Definition: wimax-tlv.cc:64
uint8_t GetType(void) const
Definition: wimax-tlv.cc:202
virtual TypeId GetInstanceTypeId(void) const
Definition: wimax-tlv.cc:30
virtual SfVectorTlvValue * Copy(void) const
Definition: wimax-tlv.cc:284
std::vector< struct PortRange > * m_portRange
Definition: wimax-tlv.h:321
virtual CsParamVectorTlvValue * Copy(void) const
Definition: wimax-tlv.cc:690
virtual uint32_t GetSerializedSize(void) const
Definition: wimax-tlv.cc:502
virtual uint32_t GetSerializedSize(void) const
Definition: wimax-tlv.cc:91
virtual ClassificationRuleVectorTlvValue * Copy(void) const
Definition: wimax-tlv.cc:707
TlvValue * PeekValue(void)
Definition: wimax-tlv.cc:212
Iterator Begin() const
Definition: wimax-tlv.cc:1065
~Tlv(void)
Definition: wimax-tlv.cc:54
this class implements the classifier descriptor as a tlv vector
Definition: wimax-tlv.h:255
void WriteHtonU32(uint32_t data)
Definition: buffer.h:931
virtual uint32_t GetSerializedSize(void) const
Definition: wimax-tlv.cc:601
uint8_t m_type
Definition: wimax-tlv.h:95
#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:84
Iterator End() const
Definition: wimax-tlv.cc:920
Tlv & operator=(Tlv const &o)
Definition: wimax-tlv.cc:77
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:38
virtual uint32_t GetSerializedSize(void) const
Definition: wimax-tlv.cc:826
virtual uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLen)
Definition: wimax-tlv.cc:512
void WriteU8(uint8_t data)
Definition: buffer.h:876
virtual void Print(std::ostream &os) const
Definition: wimax-tlv.cc:35
virtual uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLen)
Definition: wimax-tlv.cc:611
Iterator Begin() const
Definition: wimax-tlv.cc:260
virtual void Serialize(Buffer::Iterator start) const
Definition: wimax-tlv.cc:959
virtual void Serialize(Buffer::Iterator start) const =0
virtual void Serialize(Buffer::Iterator start) const
Definition: wimax-tlv.cc:606
virtual Ipv4AddressTlvValue * Copy() const
Definition: wimax-tlv.cc:1077
uint8_t m_high
Definition: wimax-tlv.h:294
uint8_t ReadU8(void)
Definition: buffer.h:1028
uint32_t GetValue(void) const
Definition: wimax-tlv.cc:623
void Add(Ipv4Address address, Ipv4Mask Mask)
Definition: wimax-tlv.cc:1056
uint8_t m_mask
Definition: wimax-tlv.h:295
tuple address
Definition: first.py:37
uint32_t m_value
Definition: wimax-tlv.h:158
uint8_t GetMask(void) const
Definition: wimax-tlv.cc:856
uint16_t ReadNtohU16(void)
Definition: buffer.h:953
std::vector< Tlv * >::const_iterator Iterator
Definition: wimax-tlv.h:170
virtual void Serialize(Buffer::Iterator start) const
Definition: wimax-tlv.cc:884
a unique identifier for an interface.
Definition: type-id.h:49
Iterator Begin() const
Definition: wimax-tlv.cc:914
virtual TosTlvValue * Copy() const
Definition: wimax-tlv.cc:862
virtual uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength)
Definition: wimax-tlv.cc:968
virtual uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLength)
Definition: wimax-tlv.cc:718
virtual uint32_t Deserialize(Buffer::Iterator start, uint64_t valueLen)
Definition: wimax-tlv.cc:562
Iterator End() const
Definition: wimax-tlv.cc:266