A Discrete-Event Network Simulator
API
icmpv6-header.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007-2009 Strasbourg University
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  * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
19  * Mehdi Benamor <benamor.mehdi@ensi.rnu.tn>
20  * David Gross <gdavid.devel@gmail.com>
21  */
22 
23 #include "ns3/assert.h"
24 #include "ns3/address-utils.h"
25 #include "ns3/log.h"
26 
27 #include "icmpv6-header.h"
28 
29 namespace ns3
30 {
31 
32 NS_LOG_COMPONENT_DEFINE ("Icmpv6Header");
33 
34 NS_OBJECT_ENSURE_REGISTERED (Icmpv6Header);
35 
37 {
38  static TypeId tid = TypeId ("ns3::Icmpv6Header")
39  .SetParent<Header> ()
40  .SetGroupName ("Internet")
41  .AddConstructor<Icmpv6Header> ()
42  ;
43  return tid;
44 }
45 
47 {
48  NS_LOG_FUNCTION (this);
49  return GetTypeId ();
50 }
51 
53  : m_calcChecksum (true),
54  m_checksum (0),
55  m_type (0),
56  m_code (0)
57 {
58  NS_LOG_FUNCTION (this);
59 }
60 
62 {
63  NS_LOG_FUNCTION (this);
64 }
65 
66 uint8_t Icmpv6Header::GetType () const
67 {
68  NS_LOG_FUNCTION (this);
69  return m_type;
70 }
71 
72 void Icmpv6Header::SetType (uint8_t type)
73 {
74  NS_LOG_FUNCTION (this << static_cast<uint32_t> (type));
75  m_type = type;
76 }
77 
78 uint8_t Icmpv6Header::GetCode () const
79 {
80  NS_LOG_FUNCTION (this);
81  return m_code;
82 }
83 
84 void Icmpv6Header::SetCode (uint8_t code)
85 {
86  NS_LOG_FUNCTION (this << static_cast<uint32_t> (code));
87  m_code = code;
88 }
89 
90 uint16_t Icmpv6Header::GetChecksum () const
91 {
92  NS_LOG_FUNCTION (this);
93  return m_checksum;
94 }
95 
96 void Icmpv6Header::SetChecksum (uint16_t checksum)
97 {
98  NS_LOG_FUNCTION (this << checksum);
99  m_checksum = checksum;
100 }
101 
102 void Icmpv6Header::Print (std::ostream& os) const
103 {
104  NS_LOG_FUNCTION (this << &os);
105  os << "( type = " << (uint32_t)m_type << " code = " << (uint32_t)m_code << " checksum = " << (uint32_t)m_checksum << ")";
106 }
107 
109 {
110  NS_LOG_FUNCTION (this);
111  return 4;
112 }
113 
115 {
116  NS_LOG_FUNCTION (this << &start);
118 
119  m_type = i.ReadU8 ();
120  m_code = i.ReadU8 ();
121  m_checksum = i.ReadNtohU16 ();
122 #if 0
123  i.ReadU32 (); /* padding */
124 #endif
125  return GetSerializedSize ();
126 }
127 
129 {
130  NS_LOG_FUNCTION (this << &start);
132 
133  i.WriteU8 (m_type);
134  i.WriteU8 (m_code);
135  i.WriteU16 (0);
136 #if 0
137  i.WriteU32 (0); /* padding */
138 #endif
139 
140  if (m_calcChecksum)
141  {
142  i = start;
143  uint16_t checksum = i.CalculateIpChecksum (i.GetSize (), m_checksum);
144  i = start;
145  i.Next (2);
146  i.WriteU16 (checksum);
147  }
148 }
149 
150 void Icmpv6Header::CalculatePseudoHeaderChecksum (Ipv6Address src, Ipv6Address dst, uint16_t length, uint8_t protocol)
151 {
152  NS_LOG_FUNCTION (this << src << dst << length << static_cast<uint32_t> (protocol));
153 
154  Buffer buf = Buffer (40);
155  uint8_t tmp[16];
156  Buffer::Iterator it;
157 
158  buf.AddAtStart (40);
159  it = buf.Begin ();
160 
161  src.Serialize (tmp);
162  it.Write (tmp, 16); /* source IPv6 address */
163  dst.Serialize (tmp);
164  it.Write (tmp, 16); /* destination IPv6 address */
165  it.WriteU16 (0); /* length */
166  it.WriteU8 (length >> 8); /* length */
167  it.WriteU8 (length & 0xff); /* length */
168  it.WriteU16 (0); /* zero */
169  it.WriteU8 (0); /* zero */
170  it.WriteU8 (protocol); /* next header */
171 
172  it = buf.Begin ();
173  m_checksum = ~(it.CalculateIpChecksum (40));
174 }
175 
177 
179 {
180  NS_LOG_FUNCTION (this);
182  SetCode (0);
183  SetReserved (0);
184  m_checksum = 0;
185 }
186 
188 {
189  static TypeId tid = TypeId ("ns3::Icmpv6NS")
191  .SetGroupName ("Internet")
192  .AddConstructor<Icmpv6NS> ()
193  ;
194  return tid;
195 }
196 
198 {
199  NS_LOG_FUNCTION (this);
200  return GetTypeId ();
201 }
202 
204 {
205  NS_LOG_FUNCTION (this << target);
207  SetCode (0);
208  SetReserved (0);
209  SetIpv6Target (target);
210  m_checksum = 0;
211 
212  /* test */
213  /*
214  m_reserved = 0xdeadbeef;
215  */
216 }
217 
219 {
220  NS_LOG_FUNCTION (this);
221 }
222 
223 uint32_t Icmpv6NS::GetReserved () const
224 {
225  NS_LOG_FUNCTION (this);
226  return m_reserved;
227 }
228 
229 void Icmpv6NS::SetReserved (uint32_t reserved)
230 {
231  NS_LOG_FUNCTION (this << reserved);
232  m_reserved = reserved;
233 }
234 
236 {
237  NS_LOG_FUNCTION (this);
238  return m_target;
239 }
240 
242 {
243  NS_LOG_FUNCTION (this << target);
244  m_target = target;
245 }
246 
247 void Icmpv6NS::Print (std::ostream& os) const
248 {
249  NS_LOG_FUNCTION (this << &os);
250  os << "( type = " << (uint32_t)GetType () << " (NS) code = " << (uint32_t)GetCode () << " target = " << m_target << " checksum = " << (uint32_t)GetChecksum () << ")";
251 }
252 
254 {
255  NS_LOG_FUNCTION (this);
256  return 24;
257 }
258 
260 {
261  NS_LOG_FUNCTION (this << &start);
262  uint8_t buff_target[16];
263  uint16_t checksum = 0;
265 
266  i.WriteU8 (GetType ());
267  i.WriteU8 (GetCode ());
268  i.WriteU16 (0);
270  m_target.Serialize (buff_target);
271  i.Write (buff_target, 16);
272 
273  if (m_calcChecksum)
274  {
275  i = start;
276  checksum = i.CalculateIpChecksum (i.GetSize (), m_checksum);
277  i = start;
278  i.Next (2);
279  i.WriteU16 (checksum);
280  }
281 }
282 
284 {
285  NS_LOG_FUNCTION (this << &start);
286  uint8_t buf[16];
288 
289  SetType (i.ReadU8 ());
290  SetCode (i.ReadU8 ());
291  m_checksum = i.ReadU16 ();
292  m_reserved = i.ReadNtohU32 ();
293  i.Read (buf, 16);
294  m_target.Set (buf);
295 
296  return GetSerializedSize ();
297 }
298 
300 
302 {
303  static TypeId tid = TypeId ("ns3::Icmpv6NA")
305  .SetGroupName ("Internet")
306  .AddConstructor<Icmpv6NA> ()
307  ;
308  return tid;
309 }
310 
312 {
313  NS_LOG_FUNCTION (this);
314  return GetTypeId ();
315 }
316 
318 {
319  NS_LOG_FUNCTION (this);
321  SetCode (0);
322  SetReserved (0);
323  SetFlagR (0);
324  SetFlagS (0);
325  SetFlagO (0);
326  m_checksum = 0;
327 }
328 
330 {
331  NS_LOG_FUNCTION (this);
332 }
333 
334 uint32_t Icmpv6NA::GetReserved () const
335 {
336  NS_LOG_FUNCTION (this);
337  return m_reserved;
338 }
339 
340 void Icmpv6NA::SetReserved (uint32_t reserved)
341 {
342  NS_LOG_FUNCTION (this << reserved);
343  m_reserved = reserved;
344 }
345 
347 {
348  NS_LOG_FUNCTION (this);
349  return m_target;
350 }
351 
352 bool Icmpv6NA::GetFlagR () const
353 {
354  NS_LOG_FUNCTION (this);
355  return m_flagR;
356 }
357 
358 void Icmpv6NA::SetFlagR (bool r)
359 {
360  NS_LOG_FUNCTION (this << r);
361  m_flagR = r;
362 }
363 
364 bool Icmpv6NA::GetFlagS () const
365 {
366  NS_LOG_FUNCTION (this);
367  return m_flagS;
368 }
369 
370 void Icmpv6NA::SetFlagS (bool s)
371 {
372  NS_LOG_FUNCTION (this << s);
373  m_flagS = s;
374 }
375 
376 bool Icmpv6NA::GetFlagO () const
377 {
378  NS_LOG_FUNCTION (this);
379  return m_flagO;
380 }
381 
382 void Icmpv6NA::SetFlagO (bool o)
383 {
384  NS_LOG_FUNCTION (this << o);
385  m_flagO = o;
386 }
387 
389 {
390  NS_LOG_FUNCTION (this << target);
391  m_target = target;
392 }
393 
394 void Icmpv6NA::Print (std::ostream& os) const
395 {
396  NS_LOG_FUNCTION (this << &os);
397  os << "( type = " << (uint32_t)GetType () << " (NA) code = " << (uint32_t)GetCode () << " checksum = " << (uint32_t)GetChecksum () << ")";
398 }
399 
401 {
402  NS_LOG_FUNCTION (this);
403  return 24;
404 }
405 
407 {
408  NS_LOG_FUNCTION (this << &start);
409  uint8_t buff_target[16];
410  uint16_t checksum = 0;
412  uint32_t reserved = m_reserved;
413 
414  i.WriteU8 (GetType ());
415  i.WriteU8 (GetCode ());
416  i.WriteU16 (0);
417 
418  if (m_flagR)
419  {
420  reserved |= (uint32_t)(1 << 31);
421  }
422 
423  if (m_flagS)
424  {
425  reserved |= (uint32_t)(1<< 30);
426  }
427 
428  if (m_flagO)
429  {
430  reserved |= (uint32_t)(1<< 29);
431  }
432 
433  i.WriteHtonU32 (reserved);
434  m_target.Serialize (buff_target);
435  i.Write (buff_target, 16);
436 
437  if (m_calcChecksum)
438  {
439  i = start;
440  checksum = i.CalculateIpChecksum (i.GetSize (), GetChecksum ());
441  i = start;
442  i.Next (2);
443  i.WriteU16 (checksum);
444  }
445 }
446 
448 {
449  NS_LOG_FUNCTION (this << &start);
450  uint8_t buf[16];
452 
453  SetType (i.ReadU8 ());
454  SetCode (i.ReadU8 ());
455  m_checksum = i.ReadU16 ();
456  m_reserved = i.ReadNtohU32 ();
457 
458  m_flagR = false;
459  m_flagS = false;
460  m_flagO = false;
461 
462  if (m_reserved & (1 << 31))
463  {
464  m_flagR = true;
465  }
466 
467  if (m_reserved & (1 << 30))
468  {
469  m_flagS = true;
470  }
471 
472  if (m_reserved & (1 << 29))
473  {
474  m_flagO = true;
475  }
476 
477  i.Read (buf, 16);
478  m_target.Set (buf);
479 
480  return GetSerializedSize ();
481 }
482 
484 
486 {
487  static TypeId tid = TypeId ("ns3::Icmpv6RA")
489  .SetGroupName ("Internet")
490  .AddConstructor<Icmpv6RA> ()
491  ;
492  return tid;
493 }
494 
496 {
497  NS_LOG_FUNCTION (this);
498  return GetTypeId ();
499 }
500 
502 {
503  NS_LOG_FUNCTION (this);
505  SetCode (0);
506  SetFlagM (0);
507  SetFlagO (0);
508  SetFlagH (0);
509  SetCurHopLimit (0);
510  SetLifeTime (0);
512  SetReachableTime (0);
513 }
514 
516 {
517  NS_LOG_FUNCTION (this);
518 }
519 
520 void Icmpv6RA::SetCurHopLimit (uint8_t m)
521 {
522  NS_LOG_FUNCTION (this << static_cast<uint32_t> (m));
523  m_curHopLimit = m;
524 }
525 
526 uint8_t Icmpv6RA::GetCurHopLimit () const
527 {
528  NS_LOG_FUNCTION (this);
529  return m_curHopLimit;
530 }
531 
532 uint16_t Icmpv6RA::GetLifeTime () const
533 {
534  NS_LOG_FUNCTION (this);
535  return m_LifeTime;
536 }
537 
538 uint32_t Icmpv6RA::GetReachableTime () const
539 {
540  NS_LOG_FUNCTION (this);
541  return m_ReachableTime;
542 }
543 
545 {
546  NS_LOG_FUNCTION (this);
547  return m_RetransmissionTimer;
548 }
549 
550 void Icmpv6RA::SetLifeTime (uint16_t l)
551 {
552  NS_LOG_FUNCTION (this << l);
553  m_LifeTime = l;
554 }
555 
556 void Icmpv6RA::SetReachableTime (uint32_t r)
557 {
558  NS_LOG_FUNCTION (this << r);
559  m_ReachableTime = r;
560 }
561 
563 {
564  NS_LOG_FUNCTION (this << r);
566 }
567 
568 bool Icmpv6RA::GetFlagM () const
569 {
570  NS_LOG_FUNCTION (this);
571  return m_flagM;
572 }
573 
574 void Icmpv6RA::SetFlagM (bool m)
575 {
576  NS_LOG_FUNCTION (this << m);
577  m_flagM = m;
578 }
579 
580 bool Icmpv6RA::GetFlagO () const
581 {
582  NS_LOG_FUNCTION (this);
583  return m_flagO;
584 }
585 
586 void Icmpv6RA::SetFlagO (bool o)
587 {
588  NS_LOG_FUNCTION (this << o);
589  m_flagO = o;
590 }
591 
592 bool Icmpv6RA::GetFlagH () const
593 {
594  NS_LOG_FUNCTION (this);
595  return m_flagH;
596 }
597 
598 void Icmpv6RA::SetFlagH (bool h)
599 {
600  NS_LOG_FUNCTION (this << h);
601  m_flagH = h;
602 }
603 
604 uint8_t Icmpv6RA::GetFlags () const
605 {
606  NS_LOG_FUNCTION (this);
607  return 0;
608 }
609 
610 void Icmpv6RA::SetFlags (uint8_t f)
611 {
612  NS_LOG_FUNCTION (this << static_cast<uint32_t> (f));
613 }
614 
615 void Icmpv6RA::Print (std::ostream& os) const
616 {
617  NS_LOG_FUNCTION (this << &os);
618  os << "( type = " << (uint32_t)GetType () << " (RA) code = " << (uint32_t)GetCode () << " checksum = " << (uint32_t)GetChecksum () << ")";
619 }
620 
622 {
623  NS_LOG_FUNCTION (this);
624  return 16;
625 }
626 
628 {
629  NS_LOG_FUNCTION (this << &start);
630  uint16_t checksum = 0;
632  uint8_t flags = 0;
633 
634  i.WriteU8 (GetType ());
635  i.WriteU8 (GetCode ());
636  i.WriteHtonU16 (0);
638 
639  if (m_flagM)
640  {
641  flags |= (uint8_t)(1<< 7);
642  }
643 
644  if (m_flagO)
645  {
646  flags |= (uint8_t)(1<< 6);
647  }
648 
649  if (m_flagH)
650  {
651  flags |= (uint8_t)(1<< 5);
652  }
653  i.WriteU8 (flags);
654  i.WriteHtonU16 (GetLifeTime ());
657 
658  i = start;
659  checksum = i.CalculateIpChecksum (i.GetSize (), GetChecksum ());
660 
661  i = start;
662  i.Next (2);
663  i.WriteU16 (checksum);
664 }
665 
667 {
668  NS_LOG_FUNCTION (this << &start);
670 
671  SetType (i.ReadU8 ());
672  SetCode (i.ReadU8 ());
673  m_checksum = i.ReadU16 ();
674  SetCurHopLimit (i.ReadU8 ());
675  uint8_t flags = i.ReadU8 ();
676  m_flagM = false;
677  m_flagO = false;
678  m_flagH = false;
679 
680  if (flags & (1 << 7))
681  {
682  m_flagM = true;
683  }
684 
685  if (flags & (1 << 6))
686  {
687  m_flagO = true;
688  }
689 
690  if (flags & (1 << 5))
691  {
692  m_flagH = true;
693  }
694  SetLifeTime (i.ReadNtohU16 ());
697 
698  return GetSerializedSize ();
699 }
700 
702 
704 {
705  static TypeId tid = TypeId ("ns3::Icmpv6RS")
707  .SetGroupName ("Internet")
708  .AddConstructor<Icmpv6RS> ()
709  ;
710  return tid;
711 }
712 
714 {
715  NS_LOG_FUNCTION (this);
716  return GetTypeId ();
717 }
718 
720 {
721  NS_LOG_FUNCTION (this);
723  SetCode (0);
724  SetReserved (0);
725 }
726 
728 {
729  NS_LOG_FUNCTION (this);
730 }
731 
732 uint32_t Icmpv6RS::GetReserved () const
733 {
734  NS_LOG_FUNCTION (this);
735  return m_reserved;
736 }
737 
738 void Icmpv6RS::SetReserved (uint32_t reserved)
739 {
740  NS_LOG_FUNCTION (this << reserved);
741  m_reserved = reserved;
742 }
743 
744 void Icmpv6RS::Print (std::ostream& os) const
745 {
746  NS_LOG_FUNCTION (this << &os);
747  os << "( type = " << (uint32_t)GetType () << " (RS) code = " << (uint32_t)GetCode () << " checksum = " << (uint32_t)GetChecksum () << ")";
748 }
749 
751 {
752  NS_LOG_FUNCTION (this);
753  return 8;
754 }
755 
757 {
758  NS_LOG_FUNCTION (this << &start);
759 
760  uint16_t checksum = 0;
762 
763  i.WriteU8 (GetType ());
764  i.WriteU8 (GetCode ());
765  i.WriteU16 (0);
767 
768  if (m_calcChecksum)
769  {
770  i = start;
771  checksum = i.CalculateIpChecksum (i.GetSize (), GetChecksum ());
772 
773  i = start;
774  i.Next (2);
775  i.WriteU16 (checksum);
776  }
777 }
778 
780 {
781  NS_LOG_FUNCTION (this << &start);
783 
784  SetType (i.ReadU8 ());
785  SetCode (i.ReadU8 ());
786  m_checksum = i.ReadU16 ();
787  m_reserved = i.ReadNtohU32 ();
788 
789  return GetSerializedSize ();
790 }
791 
793 
795 {
796  static TypeId tid = TypeId ("ns3::Icmpv6Redirection")
798  .SetGroupName ("Internet")
799  .AddConstructor<Icmpv6Redirection> ()
800  ;
801  return tid;
802 }
803 
805 {
806  NS_LOG_FUNCTION (this);
807  return GetTypeId ();
808 }
809 
811  : m_target (Ipv6Address ("")),
812  m_destination (Ipv6Address ("")),
813  m_reserved (0)
814 {
815  NS_LOG_FUNCTION (this);
817  SetCode (0);
818  m_checksum = 0;
819 }
820 
822 {
823  NS_LOG_FUNCTION (this);
824 }
825 
826 void Icmpv6Redirection::SetReserved (uint32_t reserved)
827 {
828  NS_LOG_FUNCTION (this << reserved);
829  m_reserved = reserved;
830 }
831 
833 {
834  NS_LOG_FUNCTION (this);
835  return m_reserved;
836 }
837 
839 {
840  NS_LOG_FUNCTION (this);
841  return m_target;
842 }
843 
845 {
846  NS_LOG_FUNCTION (this << target);
847  m_target = target;
848 }
849 
851 {
852  NS_LOG_FUNCTION (this);
853  return m_destination;
854 }
855 
857 {
858  NS_LOG_FUNCTION (this << destination);
859  m_destination = destination;
860 }
861 
862 void Icmpv6Redirection::Print (std::ostream& os) const
863 {
864  NS_LOG_FUNCTION (this << &os);
865  os << "( type = " << (uint32_t)GetType () << " (Redirection) code = " << (uint32_t)GetCode () << " checksum = " << (uint32_t)GetChecksum () << " target = " << m_target << " destination = " << m_destination << ")";
866 }
867 
869 {
870  NS_LOG_FUNCTION (this);
871  return 40;
872 }
873 
875 {
876  NS_LOG_FUNCTION (this << &start);
877  uint8_t buff[16];
878  uint16_t checksum = 0;
880 
881  i.WriteU8 (GetType ());
882  i.WriteU8 (GetCode ());
883  i.WriteU16 (checksum);
884  i.WriteU32 (m_reserved);
885 
886  m_target.Serialize (buff);
887  i.Write (buff, 16);
888 
889  m_destination.Serialize (buff);
890  i.Write (buff, 16);
891 
892  if (m_calcChecksum)
893  {
894  i = start;
895  checksum = i.CalculateIpChecksum (i.GetSize (), GetChecksum ());
896 
897  i = start;
898  i.Next (2);
899  i.WriteU16 (checksum);
900  }
901 }
902 
904 {
905  NS_LOG_FUNCTION (this << &start);
906  uint8_t buff[16];
908 
909  SetType (i.ReadU8 ());
910  SetCode (i.ReadU8 ());
911  m_checksum = i.ReadU16 ();
912  SetReserved (i.ReadU32 ());
913 
914  i.Read (buff, 16);
915  m_target.Set (buff);
916 
917  i.Read (buff, 16);
918  m_destination.Set (buff);
919 
920  return GetSerializedSize ();
921 }
922 
924 
926 {
927  static TypeId tid = TypeId ("ns3::Icmpv6Echo")
929  .SetGroupName ("Internet")
930  .AddConstructor<Icmpv6Echo> ()
931  ;
932  return tid;
933 }
934 
936 {
937  NS_LOG_FUNCTION (this);
938  return GetTypeId ();
939 }
940 
942 {
943  NS_LOG_FUNCTION (this);
945  SetCode (0);
946  m_checksum = 0;
947  SetId (0);
948  SetSeq (0);
949 }
950 
952 {
953  NS_LOG_FUNCTION (this << request);
955  SetCode (0);
956  m_checksum = 0;
957  SetId (0);
958  SetSeq (0);
959 }
960 
962 {
963  NS_LOG_FUNCTION (this);
964 }
965 
966 uint16_t Icmpv6Echo::GetId () const
967 {
968  NS_LOG_FUNCTION (this);
969  return m_id;
970 }
971 
972 void Icmpv6Echo::SetId (uint16_t id)
973 {
974  NS_LOG_FUNCTION (this << id);
975  m_id = id;
976 }
977 
978 uint16_t Icmpv6Echo::GetSeq () const
979 {
980  NS_LOG_FUNCTION (this);
981  return m_seq;
982 }
983 
984 void Icmpv6Echo::SetSeq (uint16_t seq)
985 {
986  NS_LOG_FUNCTION (this << seq);
987  m_seq = seq;
988 }
989 
990 void Icmpv6Echo::Print (std::ostream& os) const
991 {
992  NS_LOG_FUNCTION (this << &os);
993  os << "( type = " << (GetType () == 128 ? "128 (Request)" : "129 (Reply)") <<
994  " Id = " << (uint32_t)GetId () <<
995  " SeqNo = " << (uint32_t)GetSeq () <<
996  " checksum = " << (uint32_t)GetChecksum () << ")";
997 }
998 
1000 {
1001  NS_LOG_FUNCTION (this);
1002  return 8;
1003 }
1004 
1006 {
1007  NS_LOG_FUNCTION (this << &start);
1008  uint16_t checksum = 0;
1009  Buffer::Iterator i = start;
1010 
1011  i.WriteU8 (GetType ());
1012  i.WriteU8 (GetCode ());
1013  i.WriteHtonU16 (0);
1014 
1015  i.WriteHtonU16 (m_id);
1016  i.WriteHtonU16 (m_seq);
1017 
1018  if (m_calcChecksum)
1019  {
1020  i = start;
1021  checksum = i.CalculateIpChecksum (i.GetSize (), GetChecksum ());
1022  i = start;
1023  i.Next (2);
1024  i.WriteU16 (checksum);
1025  }
1026 }
1027 
1029 {
1030  NS_LOG_FUNCTION (this << &start);
1031  Buffer::Iterator i = start;
1032 
1033  SetType (i.ReadU8 ());
1034  SetCode (i.ReadU8 ());
1035  m_checksum = i.ReadU16 ();
1036 
1037  m_id = i.ReadNtohU16 ();
1038  m_seq = i.ReadNtohU16 ();
1039  return GetSerializedSize ();
1040 }
1041 
1043 
1045 {
1046  static TypeId tid = TypeId ("ns3::Icmpv6DestinationUnreachable")
1047  .SetParent<Icmpv6Header> ()
1048  .SetGroupName ("Internet")
1049  .AddConstructor<Icmpv6DestinationUnreachable> ()
1050  ;
1051  return tid;
1052 }
1053 
1055 {
1056  NS_LOG_FUNCTION (this);
1057  return GetTypeId ();
1058 }
1059 
1061  : m_packet (0)
1062 {
1063  NS_LOG_FUNCTION (this);
1065 }
1066 
1068 {
1069  NS_LOG_FUNCTION (this);
1070 }
1071 
1073 {
1074  NS_LOG_FUNCTION (this << *p);
1075  NS_ASSERT (p->GetSize () <= 1280);
1076  m_packet = p->Copy ();
1077 }
1078 
1079 void Icmpv6DestinationUnreachable::Print (std::ostream& os) const
1080 {
1081  NS_LOG_FUNCTION (this << &os);
1082  os << "( type = " << (uint32_t)GetType () << " (Destination Unreachable) code = " << (uint32_t)GetCode () << " checksum = " << (uint32_t)GetChecksum () << ")";
1083 }
1084 
1086 {
1087  NS_LOG_FUNCTION (this);
1088  // The real size of the header is 8 + m_packet->GetSize ()
1089  // HOWEVER we just serialize the first 8 bytes, as the rest is serialized separately.
1090  return 8;
1091 }
1092 
1094 {
1095  NS_LOG_FUNCTION (this << &start);
1096  uint16_t checksum = 0;
1097  Buffer::Iterator i = start;
1098 
1099  Buffer secondaryBuffer;
1100  secondaryBuffer.AddAtStart (8 + m_packet->GetSize ());
1101  Buffer::Iterator iter = secondaryBuffer.Begin ();
1102 
1103  iter.WriteU8 (GetType ());
1104  iter.WriteU8 (GetCode ());
1105  iter.WriteU16 (0);
1106  iter.WriteU32 (0);
1107 
1108  uint32_t size = m_packet->GetSize ();
1109  uint8_t *buf = new uint8_t[size];
1110  m_packet->CopyData (buf, size);
1111  iter.Write (buf, size);
1112  delete[] buf;
1113 
1114  iter = secondaryBuffer.Begin ();
1115  checksum = iter.CalculateIpChecksum (iter.GetSize (), GetChecksum ());
1116 
1117  i.WriteU8 (GetType ());
1118  i.WriteU8 (GetCode ());
1119  i.WriteU16 (checksum);
1120  i.WriteU32 (0);
1121 }
1122 
1124 {
1125  NS_LOG_FUNCTION (this << &start);
1126  Buffer::Iterator i = start;
1127 
1128  SetType (i.ReadU8 ());
1129  SetCode (i.ReadU8 ());
1130  m_checksum = i.ReadU16 ();
1131  i.ReadU32 ();
1132 
1133  return GetSerializedSize ();
1134 }
1135 
1137 
1139 {
1140  static TypeId tid = TypeId ("ns3::Icmpv6TooBig")
1141  .SetParent<Icmpv6Header> ()
1142  .SetGroupName ("Internet")
1143  .AddConstructor<Icmpv6TooBig> ()
1144  ;
1145  return tid;
1146 }
1147 
1149 {
1150  NS_LOG_FUNCTION (this);
1151  return GetTypeId ();
1152 }
1153 
1155  : m_packet (0),
1156  m_mtu (0)
1157 {
1158  NS_LOG_FUNCTION (this);
1160 }
1161 
1163 {
1164  NS_LOG_FUNCTION (this);
1165 }
1166 
1168 {
1169  NS_LOG_FUNCTION (this << *p);
1170  NS_ASSERT (p->GetSize () <= 1280);
1171  m_packet = p->Copy ();
1172 }
1173 
1174 uint32_t Icmpv6TooBig::GetMtu () const
1175 {
1176  NS_LOG_FUNCTION (this);
1177  return m_mtu;
1178 }
1179 
1180 void Icmpv6TooBig::SetMtu (uint32_t mtu)
1181 {
1182  NS_LOG_FUNCTION (this << mtu);
1183  m_mtu = mtu;
1184 }
1185 
1186 void Icmpv6TooBig::Print (std::ostream& os) const
1187 {
1188  NS_LOG_FUNCTION (this << &os);
1189  os << "( type = " << (uint32_t)GetType () << " (Too Big) code = " << (uint32_t)GetCode () << " checksum = " << (uint32_t)GetChecksum () << " mtu = " << (uint32_t)GetMtu () << ")";
1190 }
1191 
1193 {
1194  NS_LOG_FUNCTION (this);
1195  // The real size of the header is 8 + m_packet->GetSize ()
1196  // HOWEVER we just serialize the first 8 bytes, as the rest is serialized separately.
1197  return 8;
1198 }
1199 
1201 {
1202  NS_LOG_FUNCTION (this << &start);
1203  uint16_t checksum = 0;
1204  Buffer::Iterator i = start;
1205 
1206  Buffer secondaryBuffer;
1207  secondaryBuffer.AddAtStart (8 + m_packet->GetSize ());
1208  Buffer::Iterator iter = secondaryBuffer.Begin ();
1209 
1210  iter.WriteU8 (GetType ());
1211  iter.WriteU8 (GetCode ());
1212  iter.WriteU16 (0);
1213  iter.WriteHtonU32 (GetMtu ());
1214 
1215  uint32_t size = m_packet->GetSize ();
1216  uint8_t *buf = new uint8_t[size];
1217  m_packet->CopyData (buf, size);
1218  iter.Write (buf, size);
1219  delete[] buf;
1220 
1221  iter = secondaryBuffer.Begin ();
1222  checksum = iter.CalculateIpChecksum (iter.GetSize (), GetChecksum ());
1223 
1224  i.WriteU8 (GetType ());
1225  i.WriteU8 (GetCode ());
1226  i.WriteU16 (checksum);
1227  i.WriteHtonU32 (GetMtu ());
1228 }
1229 
1231 {
1232  NS_LOG_FUNCTION (this << &start);
1233  Buffer::Iterator i = start;
1234 
1235  SetType (i.ReadU8 ());
1236  SetCode (i.ReadU8 ());
1237  m_checksum = i.ReadU16 ();
1238  SetMtu (i.ReadNtohU32 ());
1239 
1240  return GetSerializedSize ();
1241 }
1242 
1244 
1246 {
1247  static TypeId tid = TypeId ("ns3::Icmpv6TimeExceeded")
1248  .SetParent<Icmpv6Header> ()
1249  .SetGroupName ("Internet")
1250  .AddConstructor<Icmpv6TimeExceeded> ()
1251  ;
1252  return tid;
1253 }
1254 
1256 {
1257  NS_LOG_FUNCTION (this);
1258  return GetTypeId ();
1259 }
1260 
1262  : m_packet (0)
1263 {
1264  NS_LOG_FUNCTION (this);
1266 }
1267 
1269 {
1270  NS_LOG_FUNCTION (this);
1271 }
1272 
1273 
1275 {
1276  NS_LOG_FUNCTION (this << *p);
1277  NS_ASSERT (p->GetSize () <= 1280);
1278  m_packet = p->Copy ();
1279 }
1280 
1281 void Icmpv6TimeExceeded::Print (std::ostream& os) const
1282 {
1283  NS_LOG_FUNCTION (this << &os);
1284  os << "( type = " << (uint32_t)GetType () << " (Destination Unreachable) code = " << (uint32_t)GetCode () << " checksum = " << (uint32_t)GetChecksum () << ")";
1285 }
1286 
1288 {
1289  NS_LOG_FUNCTION (this);
1290  // The real size of the header is 8 + m_packet->GetSize ()
1291  // HOWEVER we just serialize the first 8 bytes, as the rest is serialized separately.
1292  return 8;
1293 }
1294 
1296 {
1297  NS_LOG_FUNCTION (this << &start);
1298  uint16_t checksum = 0;
1299  Buffer::Iterator i = start;
1300 
1301  Buffer secondaryBuffer;
1302  secondaryBuffer.AddAtStart (8 + m_packet->GetSize ());
1303  Buffer::Iterator iter = secondaryBuffer.Begin ();
1304 
1305  iter.WriteU8 (GetType ());
1306  iter.WriteU8 (GetCode ());
1307  iter.WriteU16 (0);
1308  iter.WriteU32 (0);
1309 
1310  uint32_t size = m_packet->GetSize ();
1311  uint8_t *buf = new uint8_t[size];
1312  m_packet->CopyData (buf, size);
1313  iter.Write (buf, size);
1314  delete[] buf;
1315 
1316  iter = secondaryBuffer.Begin ();
1317  checksum = iter.CalculateIpChecksum (iter.GetSize (), GetChecksum ());
1318 
1319  i.WriteU8 (GetType ());
1320  i.WriteU8 (GetCode ());
1321  i.WriteU16 (checksum);
1322  i.WriteU32 (0);
1323 }
1324 
1326 {
1327  NS_LOG_FUNCTION (this << &start);
1328  Buffer::Iterator i = start;
1329 
1330  SetType (i.ReadU8 ());
1331  SetCode (i.ReadU8 ());
1332  m_checksum = i.ReadU16 ();
1333  i.ReadU32 ();
1334 
1335  return GetSerializedSize ();
1336 }
1337 
1339 
1341 {
1342  static TypeId tid = TypeId ("ns3::Icmpv6ParameterError")
1343  .SetParent<Icmpv6Header> ()
1344  .SetGroupName ("Internet")
1345  .AddConstructor<Icmpv6ParameterError> ()
1346  ;
1347  return tid;
1348 }
1349 
1351 {
1352  NS_LOG_FUNCTION (this);
1353  return GetTypeId ();
1354 }
1355 
1357  : m_packet (0),
1358  m_ptr (0)
1359 {
1360  NS_LOG_FUNCTION (this);
1362 }
1363 
1365 {
1366  NS_LOG_FUNCTION (this);
1367 }
1368 
1370 {
1371  NS_LOG_FUNCTION (this << *p);
1372  NS_ASSERT (p->GetSize () <= 1280);
1373  m_packet = p->Copy ();
1374 }
1375 
1377 {
1378  NS_LOG_FUNCTION (this);
1379  return m_ptr;
1380 }
1381 
1382 void Icmpv6ParameterError::SetPtr (uint32_t ptr)
1383 {
1384  NS_LOG_FUNCTION (this << ptr);
1385  m_ptr = ptr;
1386 }
1387 
1388 void Icmpv6ParameterError::Print (std::ostream& os) const
1389 {
1390  NS_LOG_FUNCTION (this << &os);
1391  os << "( type = " << (uint32_t)GetType () << " (Destination Unreachable) code = " << (uint32_t)GetCode () << " checksum = " << (uint32_t)GetChecksum () << " ptr = " << (uint32_t)GetPtr () << ")";
1392 }
1393 
1395 {
1396  NS_LOG_FUNCTION (this);
1397  // The real size of the header is 8 + m_packet->GetSize ()
1398  // HOWEVER we just serialize the first 8 bytes, as the rest is serialized separately.
1399  return 8;
1400 }
1401 
1403 {
1404  NS_LOG_FUNCTION (this << &start);
1405  uint16_t checksum = 0;
1406  Buffer::Iterator i = start;
1407 
1408  Buffer secondaryBuffer;
1409  secondaryBuffer.AddAtStart (8 + m_packet->GetSize ());
1410  Buffer::Iterator iter = secondaryBuffer.Begin ();
1411 
1412  iter.WriteU8 (GetType ());
1413  iter.WriteU8 (GetCode ());
1414  iter.WriteU16 (0);
1415  iter.WriteHtonU32 (GetPtr ());
1416 
1417  uint32_t size = m_packet->GetSize ();
1418  uint8_t *buf = new uint8_t[size];
1419  m_packet->CopyData (buf, size);
1420  iter.Write (buf, size);
1421  delete[] buf;
1422 
1423  iter = secondaryBuffer.Begin ();
1424  checksum = iter.CalculateIpChecksum (iter.GetSize (), GetChecksum ());
1425 
1426  i.WriteU8 (GetType ());
1427  i.WriteU8 (GetCode ());
1428  i.WriteU16 (checksum);
1429  i.WriteHtonU32 (GetPtr ());
1430 }
1431 
1433 {
1434  NS_LOG_FUNCTION (this << &start);
1435  Buffer::Iterator i = start;
1436 
1437  SetType (i.ReadU8 ());
1438  SetCode (i.ReadU8 ());
1439  m_checksum = i.ReadU16 ();
1440  SetPtr (i.ReadNtohU32 ());
1441 
1442  return GetSerializedSize ();
1443 }
1444 
1446 
1448 {
1449  static TypeId tid = TypeId ("ns3::Icmpv6OptionHeader")
1450  .SetParent<Header> ()
1451  .SetGroupName ("Internet")
1452  .AddConstructor<Icmpv6OptionHeader> ()
1453  ;
1454  return tid;
1455 }
1456 
1458 {
1459  NS_LOG_FUNCTION (this);
1460  return GetTypeId ();
1461 }
1462 
1463 
1465 {
1466  NS_LOG_FUNCTION (this);
1468  m_type = 0;
1469  m_len = 0;
1470 }
1471 
1473 {
1474  NS_LOG_FUNCTION (this);
1475 }
1476 
1478 {
1479  NS_LOG_FUNCTION (this);
1480  return m_type;
1481 }
1482 
1483 void Icmpv6OptionHeader::SetType (uint8_t type)
1484 {
1485  NS_LOG_FUNCTION (this << static_cast<uint32_t> (type));
1486  m_type = type;
1487 }
1488 
1490 {
1491  NS_LOG_FUNCTION (this);
1492  return m_len;
1493 }
1494 
1496 {
1497  NS_LOG_FUNCTION (this << static_cast<uint32_t> (len));
1498  m_len = len;
1499 }
1500 
1501 void Icmpv6OptionHeader::Print (std::ostream& os) const
1502 {
1503  NS_LOG_FUNCTION (this << &os);
1504  os << "( type = " << (uint32_t)GetType () << " length = " << (uint32_t)GetLength () << ")";
1505 }
1506 
1508 {
1509  NS_LOG_FUNCTION (this);
1510  return m_len*8;
1511 }
1512 
1514 {
1515  NS_LOG_FUNCTION (this << &start);
1516  return GetSerializedSize ();
1517 }
1518 
1520 {
1521  NS_LOG_FUNCTION (this << &start);
1522 }
1523 
1525 
1527 {
1528  static TypeId tid = TypeId ("ns3::Icmpv6OptionMtu")
1530  .SetGroupName ("Internet")
1531  .AddConstructor<Icmpv6OptionMtu> ()
1532  ;
1533  return tid;
1534 }
1535 
1537 {
1538  NS_LOG_FUNCTION (this);
1539  return GetTypeId ();
1540 }
1541 
1543 {
1544  NS_LOG_FUNCTION (this);
1546  SetLength (1);
1547  SetReserved (0);
1548 }
1549 
1551  : m_mtu (mtu)
1552 {
1553  NS_LOG_FUNCTION (this << mtu);
1555  SetLength (1);
1556  SetReserved (0);
1557 }
1558 
1560 {
1561  NS_LOG_FUNCTION (this);
1562 }
1563 
1565 {
1566  NS_LOG_FUNCTION (this);
1567  return m_reserved;
1568 }
1569 
1570 void Icmpv6OptionMtu::SetReserved (uint16_t reserved)
1571 {
1572  NS_LOG_FUNCTION (this << reserved);
1573  m_reserved = reserved;
1574 }
1575 
1576 uint32_t Icmpv6OptionMtu::GetMtu () const
1577 {
1578  NS_LOG_FUNCTION (this);
1579  return m_mtu;
1580 }
1581 
1582 void Icmpv6OptionMtu::SetMtu (uint32_t mtu)
1583 {
1584  NS_LOG_FUNCTION (this << mtu);
1585  m_mtu = mtu;
1586 }
1587 
1588 void Icmpv6OptionMtu::Print (std::ostream& os) const
1589 {
1590  NS_LOG_FUNCTION (this << &os);
1591  os << "( type = " << (uint32_t)GetType () << " length = " << (uint32_t)GetLength () << " MTU = " << m_mtu << ")";
1592 }
1593 
1595 {
1596  NS_LOG_FUNCTION (this);
1597  return 8; /* m_len = 1 so the real size is multiple by 8 */
1598 }
1599 
1601 {
1602  NS_LOG_FUNCTION (this << &start);
1603  Buffer::Iterator i = start;
1604  i.WriteU8 (GetType ());
1605  i.WriteU8 (GetLength ());
1606  i.WriteHtonU16 (GetReserved ());
1607  i.WriteHtonU32 (GetMtu ());
1608 }
1609 
1611 {
1612  NS_LOG_FUNCTION (this << &start);
1613  Buffer::Iterator i = start;
1614  SetType (i.ReadU8 ());
1615  SetLength (i.ReadU8 ());
1616  SetReserved (i.ReadNtohU16 ());
1617  SetMtu (i.ReadNtohU32 ());
1618  return GetSerializedSize ();
1619 }
1620 
1622 
1624 {
1625  static TypeId tid = TypeId ("ns3::Icmpv6OptionPrefixInformation")
1627  .SetGroupName ("Internet")
1628  .AddConstructor<Icmpv6OptionPrefixInformation> ()
1629  ;
1630  return tid;
1631 }
1632 
1634 {
1635  NS_LOG_FUNCTION (this);
1636  return GetTypeId ();
1637 }
1638 
1640 {
1641  NS_LOG_FUNCTION (this);
1643  SetLength (4);
1644  SetPrefix (Ipv6Address ("::"));
1645  SetPrefixLength (0);
1646  SetValidTime (0);
1647  SetPreferredTime (0);
1648  SetFlags (0);
1649  SetReserved (0);
1650 }
1651 
1653 {
1654  NS_LOG_FUNCTION (this << prefix << static_cast<uint32_t> (prefixlen));
1656  SetLength (4);
1657  SetPrefix (prefix);
1658  SetPrefixLength (prefixlen);
1659  SetValidTime (0);
1660  SetPreferredTime (0);
1661  SetFlags (0);
1662  SetReserved (0);
1663 }
1664 
1666 {
1667  NS_LOG_FUNCTION (this);
1668 }
1669 
1671 {
1672  NS_LOG_FUNCTION (this);
1673  return m_prefixLength;
1674 }
1675 
1677 {
1678  NS_LOG_FUNCTION (this << static_cast<uint32_t> (prefixLength));
1679  NS_ASSERT (prefixLength <= 128);
1680  m_prefixLength = prefixLength;
1681 }
1682 
1684 {
1685  NS_LOG_FUNCTION (this);
1686  return m_flags;
1687 }
1688 
1690 {
1691  NS_LOG_FUNCTION (this);
1692  m_flags = flags;
1693 }
1694 
1696 {
1697  NS_LOG_FUNCTION (this);
1698  return m_validTime;
1699 }
1700 
1702 {
1703  NS_LOG_FUNCTION (this << validTime);
1704  m_validTime = validTime;
1705 }
1706 
1708 {
1709  NS_LOG_FUNCTION (this);
1710  return m_preferredTime;
1711 }
1712 
1714 {
1715  NS_LOG_FUNCTION (this << preferredTime);
1716  m_preferredTime = preferredTime;
1717 }
1718 
1720 {
1721  NS_LOG_FUNCTION (this);
1722  return m_preferredTime;
1723 }
1724 
1726 {
1727  NS_LOG_FUNCTION (this << reserved);
1728  m_reserved = reserved;
1729 }
1730 
1732 {
1733  NS_LOG_FUNCTION (this);
1734  return m_prefix;
1735 }
1736 
1738 {
1739  NS_LOG_FUNCTION (this << prefix);
1740  m_prefix = prefix;
1741 }
1742 
1743 void Icmpv6OptionPrefixInformation::Print (std::ostream& os) const
1744 {
1745  NS_LOG_FUNCTION (this << &os);
1746  os << "( type = " << (uint32_t)GetType () << " length = " << (uint32_t)GetLength () << " prefix " << m_prefix << ")";
1747 }
1748 
1750 {
1751  NS_LOG_FUNCTION (this);
1752  return 32;
1753 }
1754 
1756 {
1757  NS_LOG_FUNCTION (this << &start);
1758  Buffer::Iterator i = start;
1759  uint8_t buf[16];
1760 
1761  memset (buf, 0x00, sizeof (buf));
1762 
1763  i.WriteU8 (GetType ());
1764  i.WriteU8 (GetLength ());
1765  i.WriteU8 (m_prefixLength);
1766  i.WriteU8 (m_flags);
1770  m_prefix.GetBytes (buf);
1771  i.Write (buf, 16);
1772 }
1773 
1775 {
1776  NS_LOG_FUNCTION (this << &start);
1777  Buffer::Iterator i = start;
1778  uint8_t buf[16];
1779 
1780  SetType (i.ReadU8 ());
1781  SetLength (i.ReadU8 ());
1782  SetPrefixLength (i.ReadU8 ());
1783  SetFlags (i.ReadU8 ());
1784  SetValidTime (i.ReadNtohU32 ());
1786  SetReserved (i.ReadNtohU32 ());
1787  i.Read (buf, 16);
1788 
1789  Ipv6Address prefix (buf);
1790  SetPrefix (prefix);
1791 
1792  return GetSerializedSize ();
1793 }
1794 
1796 
1798 {
1799  static TypeId tid = TypeId ("ns3::Icmpv6OptionLinkLayerAddress")
1801  .SetGroupName ("Internet")
1802  .AddConstructor<Icmpv6OptionLinkLayerAddress> ()
1803  ;
1804  return tid;
1805 }
1806 
1808 {
1809  NS_LOG_FUNCTION (this);
1810  return GetTypeId ();
1811 }
1812 
1814 {
1815  NS_LOG_FUNCTION (this << source);
1817 }
1818 
1820 {
1821  NS_LOG_FUNCTION (this);
1823 }
1824 
1826 {
1827  NS_LOG_FUNCTION (this << source << addr);
1829  SetAddress (addr);
1830 
1831  uint8_t len = (2 + m_addr.GetLength ()) / 8;
1832  if ( (2 + m_addr.GetLength ()) % 8 )
1833  {
1834  len ++;
1835  }
1836  SetLength (len);
1837 }
1838 
1840 {
1841  NS_LOG_FUNCTION (this);
1842 }
1843 
1845 {
1846  NS_LOG_FUNCTION (this);
1847  return m_addr;
1848 }
1849 
1851 {
1852  NS_LOG_FUNCTION (this << addr);
1853  m_addr = addr;
1854 }
1855 
1856 void Icmpv6OptionLinkLayerAddress::Print (std::ostream& os) const
1857 {
1858  NS_LOG_FUNCTION (this << &os);
1859  os << "( type = " << (uint32_t)GetType () << " length = " << (uint32_t)GetLength () << " L2 Address = " << m_addr << ")";
1860 }
1861 
1863 {
1864  NS_LOG_FUNCTION (this);
1865  uint8_t nb = GetLength() * 8;
1866  return nb;
1867 }
1868 
1870 {
1871  NS_LOG_FUNCTION (this << &start);
1872  Buffer::Iterator i = start;
1873  uint8_t mac[32];
1874 
1875  i.WriteU8 (GetType ());
1876  i.WriteU8 (GetLength ());
1877  m_addr.CopyTo (mac);
1878  i.Write (mac, m_addr.GetLength ());
1879 
1880  uint8_t len = GetLength ()*8 - (2 + m_addr.GetLength ());
1881  for (uint8_t nb = 0; nb<len; nb++)
1882  {
1883  i.WriteU8 (0);
1884  }
1885 }
1886 
1888 {
1889  NS_LOG_FUNCTION (this << &start);
1890  Buffer::Iterator i = start;
1891  uint8_t mac[32];
1892 
1893  SetType (i.ReadU8 ());
1894  SetLength (i.ReadU8 ());
1895  // -fstrict-overflow sensitive, see bug 1868
1896  NS_ASSERT (GetLength () * 8 <= 32 + 2);
1897  i.Read (mac, (GetLength () * 8) - 2);
1898 
1899  m_addr.CopyFrom (mac, (GetLength () * 8) - 2);
1900 
1901  return GetSerializedSize ();
1902 }
1903 
1905 
1907 {
1908  static TypeId tid = TypeId ("ns3::Icmpv6OptionRedirected")
1910  .SetGroupName ("Internet")
1911  .AddConstructor<Icmpv6OptionRedirected> ()
1912  ;
1913  return tid;
1914 }
1915 
1917 {
1918  NS_LOG_FUNCTION (this);
1919  return GetTypeId ();
1920 }
1921 
1923  : m_packet (0)
1924 {
1925  NS_LOG_FUNCTION (this);
1927 }
1928 
1930 {
1931  NS_LOG_FUNCTION (this);
1932  m_packet = 0;
1933 }
1934 
1936 {
1937  NS_LOG_FUNCTION (this << *packet);
1938  NS_ASSERT (packet->GetSize () <= 1280);
1939  m_packet = packet->Copy ();
1940  SetLength (1 + (m_packet->GetSize () / 8));
1941 }
1942 
1943 void Icmpv6OptionRedirected::Print (std::ostream& os) const
1944 {
1945  NS_LOG_FUNCTION (this << &os);
1946  os << "( type = " << (uint32_t)GetType () << " length = " << (uint32_t)GetLength () << ")";
1947 }
1948 
1950 {
1951  NS_LOG_FUNCTION (this);
1952  return 8 + m_packet->GetSize ();
1953 }
1954 
1956 {
1957  NS_LOG_FUNCTION (this << &start);
1958  Buffer::Iterator i = start;
1959 
1960  i.WriteU8 (GetType ());
1961  i.WriteU8 (GetLength ());
1962  // Reserved
1963  i.WriteU16 (0);
1964  i.WriteU32 (0);
1965 
1966  uint32_t size = m_packet->GetSize ();
1967  uint8_t *buf = new uint8_t[size];
1968  m_packet->CopyData (buf, size);
1969  i.Write (buf, size);
1970  delete[] buf;
1971 }
1972 
1974 {
1975  NS_LOG_FUNCTION (this << &start);
1976  Buffer::Iterator i = start;
1977 
1978  SetType (i.ReadU8 ());
1979  uint8_t length = i.ReadU8 ();
1980  SetLength (length);
1981  i.ReadU16 ();
1982  i.ReadU32 ();
1983 
1984  uint32_t len2 = (GetLength () - 1) * 8;
1985  uint8_t* buff = new uint8_t[len2];
1986  i.Read (buff, len2);
1987  m_packet = Create<Packet> (buff, len2);
1988  delete[] buff;
1989 
1990  return GetSerializedSize ();
1991 }
1992 
1993 } /* namespace ns3 */
1994 
ns3::Icmpv6NS::SetReserved
void SetReserved(uint32_t reserved)
Set the reserved field.
Definition: icmpv6-header.cc:229
ns3::Icmpv6OptionPrefixInformation::m_prefixLength
uint8_t m_prefixLength
The length of the prefix.
Definition: icmpv6-header.h:1593
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::Buffer::Iterator::Write
void Write(uint8_t const *buffer, uint32_t size)
Definition: buffer.cc:954
ns3::Icmpv6OptionMtu::Serialize
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
Definition: icmpv6-header.cc:1600
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
ns3::Icmpv6OptionPrefixInformation::m_reserved
uint32_t m_reserved
The reserved field.
Definition: icmpv6-header.h:1613
ns3::Icmpv6OptionMtu::GetTypeId
static TypeId GetTypeId()
Get the UID of this class.
Definition: icmpv6-header.cc:1526
ns3::Icmpv6OptionPrefixInformation::SetFlags
void SetFlags(uint8_t flags)
Set the flags.
Definition: icmpv6-header.cc:1689
ns3::Icmpv6NS::m_reserved
uint32_t m_reserved
The reserved value.
Definition: icmpv6-header.h:414
ns3::Icmpv6DestinationUnreachable::Icmpv6DestinationUnreachable
Icmpv6DestinationUnreachable()
Constructor.
Definition: icmpv6-header.cc:1060
ns3::Icmpv6RA::Print
virtual void Print(std::ostream &os) const
Print information.
Definition: icmpv6-header.cc:615
ns3::Icmpv6OptionPrefixInformation::GetPrefixLength
uint8_t GetPrefixLength() const
Get the prefix length.
Definition: icmpv6-header.cc:1670
ns3::Icmpv6Redirection::~Icmpv6Redirection
virtual ~Icmpv6Redirection()
Destructor.
Definition: icmpv6-header.cc:821
ns3::Icmpv6Redirection::GetReserved
uint32_t GetReserved() const
Get the reserved field.
Definition: icmpv6-header.cc:832
ns3::Icmpv6OptionMtu::~Icmpv6OptionMtu
virtual ~Icmpv6OptionMtu()
Destructor.
Definition: icmpv6-header.cc:1559
ns3::Ipv6Address::Set
void Set(char const *address)
Sets an Ipv6Address by parsing the input C-string.
Definition: ipv6-address.cc:323
ns3::Icmpv6NA::GetTypeId
static TypeId GetTypeId()
Get the UID of this class.
Definition: icmpv6-header.cc:301
ns3::Icmpv6Header::~Icmpv6Header
virtual ~Icmpv6Header()
Destructor.
Definition: icmpv6-header.cc:61
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
NS_ASSERT
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:67
ns3::Icmpv6OptionPrefixInformation::GetSerializedSize
virtual uint32_t GetSerializedSize() const
Get the serialized size.
Definition: icmpv6-header.cc:1749
ns3::Icmpv6Echo::Print
virtual void Print(std::ostream &os) const
Print information.
Definition: icmpv6-header.cc:990
ns3::Icmpv6NA::GetIpv6Target
Ipv6Address GetIpv6Target() const
Get the IPv6 target field.
Definition: icmpv6-header.cc:346
ns3::Icmpv6Header::ICMPV6_OPT_PREFIX
@ ICMPV6_OPT_PREFIX
Definition: icmpv6-header.h:81
ns3::Icmpv6TooBig::Serialize
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
Definition: icmpv6-header.cc:1200
ns3::Packet::GetSize
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:852
ns3::Icmpv6TimeExceeded
ICMPv6 Error Time Exceeded header.
Definition: icmpv6-header.h:1193
ns3::Icmpv6RA::Serialize
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
Definition: icmpv6-header.cc:627
ns3::Icmpv6Redirection::GetInstanceTypeId
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
Definition: icmpv6-header.cc:804
ns3::Buffer::Iterator::Read
void Read(uint8_t *buffer, uint32_t size)
Definition: buffer.cc:1124
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Icmpv6NS::m_target
Ipv6Address m_target
The IPv6 target address.
Definition: icmpv6-header.h:419
ns3::Icmpv6Header::Serialize
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
Definition: icmpv6-header.cc:128
ns3::Icmpv6OptionRedirected::Icmpv6OptionRedirected
Icmpv6OptionRedirected()
Constructor.
Definition: icmpv6-header.cc:1922
ns3::Icmpv6Header::ICMPV6_ND_ROUTER_ADVERTISEMENT
@ ICMPV6_ND_ROUTER_ADVERTISEMENT
Definition: icmpv6-header.h:56
ns3::Icmpv6TooBig::m_packet
Ptr< Packet > m_packet
the incorrect packet.
Definition: icmpv6-header.h:1179
ns3::Icmpv6Redirection::SetDestination
void SetDestination(Ipv6Address destination)
Set the IPv6 destination address.
Definition: icmpv6-header.cc:856
ns3::Buffer::Iterator::ReadU8
uint8_t ReadU8(void)
Definition: buffer.h:1021
ns3::Icmpv6Header::ICMPV6_ND_NEIGHBOR_ADVERTISEMENT
@ ICMPV6_ND_NEIGHBOR_ADVERTISEMENT
Definition: icmpv6-header.h:58
ns3::Icmpv6NA::SetReserved
void SetReserved(uint32_t reserved)
Set the reserved field.
Definition: icmpv6-header.cc:340
ns3::Icmpv6RS::~Icmpv6RS
virtual ~Icmpv6RS()
Destructor.
Definition: icmpv6-header.cc:727
ns3::Icmpv6Echo::GetId
uint16_t GetId() const
Get the ID of the packet.
Definition: icmpv6-header.cc:966
ns3::Icmpv6OptionRedirected::~Icmpv6OptionRedirected
virtual ~Icmpv6OptionRedirected()
Destructor.
Definition: icmpv6-header.cc:1929
ns3::Icmpv6OptionHeader::Icmpv6OptionHeader
Icmpv6OptionHeader()
Constructor.
Definition: icmpv6-header.cc:1464
ns3::Buffer::Iterator::ReadNtohU16
uint16_t ReadNtohU16(void)
Definition: buffer.h:946
ns3::Icmpv6ParameterError::SetPacket
void SetPacket(Ptr< Packet > p)
Set the incorrect packet.
Definition: icmpv6-header.cc:1369
ns3::Icmpv6NA::Serialize
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
Definition: icmpv6-header.cc:406
ns3::Icmpv6NS::Icmpv6NS
Icmpv6NS()
Constructor.
Definition: icmpv6-header.cc:178
ns3::Icmpv6OptionHeader::Print
virtual void Print(std::ostream &os) const
Print information.
Definition: icmpv6-header.cc:1501
ns3::Icmpv6TooBig::GetInstanceTypeId
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
Definition: icmpv6-header.cc:1148
ns3::Icmpv6RA::Icmpv6RA
Icmpv6RA()
Constructor.
Definition: icmpv6-header.cc:501
ns3::Packet::CopyData
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte buffer.
Definition: packet.cc:378
ns3::Icmpv6NA::GetFlagR
bool GetFlagR() const
Get the R flag.
Definition: icmpv6-header.cc:352
ns3::Buffer::Iterator::WriteU8
void WriteU8(uint8_t data)
Definition: buffer.h:869
ns3::Icmpv6Header::GetCode
uint8_t GetCode() const
Get the code field.
Definition: icmpv6-header.cc:78
ns3::Icmpv6NA::m_reserved
uint32_t m_reserved
The reserved value.
Definition: icmpv6-header.h:556
ns3::Icmpv6NA::SetFlagS
void SetFlagS(bool s)
Set the S flag.
Definition: icmpv6-header.cc:370
ns3::Buffer::Iterator::WriteU16
void WriteU16(uint16_t data)
Definition: buffer.cc:871
ns3::Icmpv6OptionPrefixInformation::GetReserved
uint32_t GetReserved() const
Get the reserved field.
Definition: icmpv6-header.cc:1719
ns3::Icmpv6DestinationUnreachable::GetSerializedSize
virtual uint32_t GetSerializedSize() const
Get the serialized size.
Definition: icmpv6-header.cc:1085
ns3::Ipv6Address
Describes an IPv6 address.
Definition: ipv6-address.h:50
ns3::Icmpv6RA::SetFlagM
void SetFlagM(bool m)
Set the M flag.
Definition: icmpv6-header.cc:574
ns3::Icmpv6OptionHeader::GetLength
uint8_t GetLength() const
Get the length of the option in 8 bytes unit.
Definition: icmpv6-header.cc:1489
ns3::Icmpv6Header::m_type
uint8_t m_type
The type.
Definition: icmpv6-header.h:225
ns3::Icmpv6ParameterError::SetPtr
void SetPtr(uint32_t ptr)
Set the pointer field.
Definition: icmpv6-header.cc:1382
ns3::Ipv6Address::GetBytes
void GetBytes(uint8_t buf[16]) const
Get the bytes corresponding to the address.
Definition: ipv6-address.cc:911
ns3::Icmpv6Redirection::GetDestination
Ipv6Address GetDestination() const
Get the IPv6 destination address.
Definition: icmpv6-header.cc:850
ns3::Icmpv6Header::ICMPV6_OPT_LINK_LAYER_SOURCE
@ ICMPV6_OPT_LINK_LAYER_SOURCE
Definition: icmpv6-header.h:79
third.mac
mac
Definition: third.py:99
ns3::Icmpv6NS::GetReserved
uint32_t GetReserved() const
Get the reserved field.
Definition: icmpv6-header.cc:223
ns3::Icmpv6TooBig::~Icmpv6TooBig
virtual ~Icmpv6TooBig()
Destructor.
Definition: icmpv6-header.cc:1162
ns3::Icmpv6ParameterError::GetTypeId
static TypeId GetTypeId()
Get the UID of this class.
Definition: icmpv6-header.cc:1340
ns3::Icmpv6RA::SetRetransmissionTime
void SetRetransmissionTime(uint32_t r)
Set the node Retransmission time (Neighbor Discovery).
Definition: icmpv6-header.cc:562
ns3::Icmpv6RS::m_reserved
uint32_t m_reserved
The reserved value.
Definition: icmpv6-header.h:825
ns3::Icmpv6Redirection::m_destination
Ipv6Address m_destination
IPv6 destination address.
Definition: icmpv6-header.h:928
ns3::Icmpv6Header::SetType
void SetType(uint8_t type)
Set the type.
Definition: icmpv6-header.cc:72
ns3::Icmpv6Redirection::Serialize
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
Definition: icmpv6-header.cc:874
ns3::Icmpv6Header::ICMPV6_ECHO_REQUEST
@ ICMPV6_ECHO_REQUEST
Definition: icmpv6-header.h:50
ns3::Icmpv6Echo::SetSeq
void SetSeq(uint16_t seq)
Set the sequence number.
Definition: icmpv6-header.cc:984
ns3::Icmpv6Header::CalculatePseudoHeaderChecksum
void CalculatePseudoHeaderChecksum(Ipv6Address src, Ipv6Address dst, uint16_t length, uint8_t protocol)
Calculate pseudo header checksum for IPv6.
Definition: icmpv6-header.cc:150
ns3::Icmpv6Header::ICMPV6_OPT_LINK_LAYER_TARGET
@ ICMPV6_OPT_LINK_LAYER_TARGET
Definition: icmpv6-header.h:80
ns3::Buffer::Iterator::Next
void Next(void)
go forward by one byte
Definition: buffer.h:845
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
ns3::Icmpv6RS::GetTypeId
static TypeId GetTypeId()
Get the UID of this class.
Definition: icmpv6-header.cc:703
ns3::Icmpv6TimeExceeded::m_packet
Ptr< Packet > m_packet
The incorrect packet.
Definition: icmpv6-header.h:1253
ns3::Icmpv6RA::SetReachableTime
void SetReachableTime(uint32_t r)
Set the node Reachable time (Neighbor Discovery).
Definition: icmpv6-header.cc:556
ns3::Buffer::Iterator::CalculateIpChecksum
uint16_t CalculateIpChecksum(uint16_t size)
Calculate the checksum.
Definition: buffer.cc:1134
ns3::Icmpv6OptionHeader::Serialize
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
Definition: icmpv6-header.cc:1519
ns3::Buffer::AddAtStart
void AddAtStart(uint32_t start)
Definition: buffer.cc:309
ns3::Ipv6Address::Serialize
void Serialize(uint8_t buf[16]) const
Serialize this address to a 16-byte buffer.
Definition: ipv6-address.cc:338
ns3::Icmpv6Redirection::Print
virtual void Print(std::ostream &os) const
Print information.
Definition: icmpv6-header.cc:862
ns3::Icmpv6ParameterError::m_ptr
uint32_t m_ptr
The pointer field.
Definition: icmpv6-header.h:1339
ns3::Buffer::Iterator::WriteHtonU16
void WriteHtonU16(uint16_t data)
Definition: buffer.h:905
ns3::Icmpv6Header::ICMPV6_OPT_REDIRECTED
@ ICMPV6_OPT_REDIRECTED
Definition: icmpv6-header.h:82
ns3::Icmpv6Header::GetInstanceTypeId
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
Definition: icmpv6-header.cc:46
ns3::Icmpv6NS::Serialize
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
Definition: icmpv6-header.cc:259
ns3::Icmpv6Echo::m_id
uint16_t m_id
ID of the packet (to distinguish response between many ping program).
Definition: icmpv6-header.h:1025
ns3::Icmpv6RS::GetInstanceTypeId
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
Definition: icmpv6-header.cc:713
ns3::Icmpv6OptionMtu::Print
virtual void Print(std::ostream &os) const
Print information.
Definition: icmpv6-header.cc:1588
ns3::Icmpv6Header::ICMPV6_ERROR_PACKET_TOO_BIG
@ ICMPV6_ERROR_PACKET_TOO_BIG
Definition: icmpv6-header.h:47
ns3::Icmpv6OptionPrefixInformation::GetPrefix
Ipv6Address GetPrefix() const
Get the IPv6 prefix.
Definition: icmpv6-header.cc:1731
ns3::Icmpv6OptionRedirected
ICMPv6 redirected option.
Definition: icmpv6-header.h:1709
ns3::Icmpv6RS::Serialize
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
Definition: icmpv6-header.cc:756
ns3::Icmpv6ParameterError::GetPtr
uint32_t GetPtr() const
Get the pointer field.
Definition: icmpv6-header.cc:1376
ns3::Icmpv6TimeExceeded::GetTypeId
static TypeId GetTypeId()
Get the UID of this class.
Definition: icmpv6-header.cc:1245
ns3::Ptr< Packet >
ns3::Icmpv6TooBig::GetMtu
uint32_t GetMtu() const
Get the MTU field.
Definition: icmpv6-header.cc:1174
ns3::Icmpv6NA::GetFlagS
bool GetFlagS() const
Get the S flag.
Definition: icmpv6-header.cc:364
ns3::Icmpv6Header::GetTypeId
static TypeId GetTypeId()
Get the UID of this class.
Definition: icmpv6-header.cc:36
ns3::Icmpv6TimeExceeded::GetSerializedSize
virtual uint32_t GetSerializedSize() const
Get the serialized size.
Definition: icmpv6-header.cc:1287
ns3::Icmpv6OptionMtu::SetReserved
void SetReserved(uint16_t reserved)
Set the reserved field.
Definition: icmpv6-header.cc:1570
ns3::Icmpv6ParameterError::GetInstanceTypeId
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
Definition: icmpv6-header.cc:1350
visualizer.core.start
def start()
Definition: core.py:1855
ns3::Icmpv6NA::GetInstanceTypeId
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
Definition: icmpv6-header.cc:311
ns3::Icmpv6RA::SetLifeTime
void SetLifeTime(uint16_t l)
Set the node Life time (Neighbor Discovery).
Definition: icmpv6-header.cc:550
ns3::Icmpv6Echo::m_seq
uint16_t m_seq
Sequence number (to distinguish response).
Definition: icmpv6-header.h:1030
ns3::Icmpv6OptionHeader::GetSerializedSize
virtual uint32_t GetSerializedSize() const
Get the serialized size.
Definition: icmpv6-header.cc:1507
ns3::Icmpv6Header::ICMPV6_ND_NEIGHBOR_SOLICITATION
@ ICMPV6_ND_NEIGHBOR_SOLICITATION
Definition: icmpv6-header.h:57
ns3::Icmpv6RA::GetSerializedSize
virtual uint32_t GetSerializedSize() const
Get the serialized size.
Definition: icmpv6-header.cc:621
ns3::Icmpv6OptionPrefixInformation::GetFlags
uint8_t GetFlags() const
Get the flags.
Definition: icmpv6-header.cc:1683
ns3::Icmpv6DestinationUnreachable::Serialize
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
Definition: icmpv6-header.cc:1093
ns3::Icmpv6RA::m_ReachableTime
uint32_t m_ReachableTime
The reachable time value.
Definition: icmpv6-header.h:741
ns3::Icmpv6OptionMtu::Icmpv6OptionMtu
Icmpv6OptionMtu()
Constructor.
Definition: icmpv6-header.cc:1542
ns3::Icmpv6OptionMtu::GetSerializedSize
virtual uint32_t GetSerializedSize() const
Get the serialized size.
Definition: icmpv6-header.cc:1594
ns3::Icmpv6NA::SetFlagR
void SetFlagR(bool r)
Set the R flag.
Definition: icmpv6-header.cc:358
ns3::Icmpv6Header::GetSerializedSize
virtual uint32_t GetSerializedSize() const
Get the serialized size.
Definition: icmpv6-header.cc:108
ns3::Icmpv6TimeExceeded::Serialize
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
Definition: icmpv6-header.cc:1295
ns3::Icmpv6OptionMtu::GetInstanceTypeId
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
Definition: icmpv6-header.cc:1536
ns3::Icmpv6OptionHeader::m_type
uint8_t m_type
The type.
Definition: icmpv6-header.h:316
ns3::Icmpv6OptionMtu::GetReserved
uint16_t GetReserved() const
Get the reserved field.
Definition: icmpv6-header.cc:1564
ns3::Icmpv6Redirection::m_reserved
uint32_t m_reserved
Reserved value.
Definition: icmpv6-header.h:933
ns3::Address
a polymophic address class
Definition: address.h:91
ns3::Icmpv6RA
ICMPv6 Router Advertisement header.
Definition: icmpv6-header.h:570
ns3::Icmpv6ParameterError::Icmpv6ParameterError
Icmpv6ParameterError()
Constructor.
Definition: icmpv6-header.cc:1356
ns3::Icmpv6NA
ICMPv6 Neighbor Advertisement header.
Definition: icmpv6-header.h:428
ns3::Icmpv6NA::SetFlagO
void SetFlagO(bool o)
Set the O flag.
Definition: icmpv6-header.cc:382
ns3::Icmpv6OptionMtu
ICMPv6 MTU option.
Definition: icmpv6-header.h:1348
ns3::Icmpv6NA::GetReserved
uint32_t GetReserved() const
Get the reserved field.
Definition: icmpv6-header.cc:334
ns3::Icmpv6TooBig::SetPacket
void SetPacket(Ptr< Packet > p)
Set the incorrect packet.
Definition: icmpv6-header.cc:1167
ns3::Icmpv6NA::~Icmpv6NA
virtual ~Icmpv6NA()
Destructor.
Definition: icmpv6-header.cc:329
ns3::Icmpv6TooBig::Print
virtual void Print(std::ostream &os) const
Print information.
Definition: icmpv6-header.cc:1186
ns3::Icmpv6OptionRedirected::m_packet
Ptr< Packet > m_packet
The redirected packet.
Definition: icmpv6-header.h:1768
ns3::Icmpv6RA::GetFlagH
bool GetFlagH() const
Get the H flag.
Definition: icmpv6-header.cc:592
ns3::Icmpv6NA::Print
virtual void Print(std::ostream &os) const
Print information.
Definition: icmpv6-header.cc:394
ns3::Icmpv6OptionPrefixInformation::SetReserved
void SetReserved(uint32_t reserved)
Set the reserved field (normally it will be 0x00000000).
Definition: icmpv6-header.cc:1725
ns3::Icmpv6RA::SetFlagH
void SetFlagH(bool h)
Set the H flag.
Definition: icmpv6-header.cc:598
ns3::Icmpv6Echo::Serialize
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
Definition: icmpv6-header.cc:1005
ns3::Icmpv6RA::GetTypeId
static TypeId GetTypeId()
Get the UID of this class.
Definition: icmpv6-header.cc:485
ns3::Icmpv6OptionHeader::m_len
uint8_t m_len
The length.
Definition: icmpv6-header.h:321
ns3::Icmpv6Redirection::GetTarget
Ipv6Address GetTarget() const
Get the IPv6 target address.
Definition: icmpv6-header.cc:838
ns3::Icmpv6OptionRedirected::Serialize
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
Definition: icmpv6-header.cc:1955
ns3::Icmpv6DestinationUnreachable::m_packet
Ptr< Packet > m_packet
The incorrect Packet.
Definition: icmpv6-header.h:1098
ns3::Icmpv6DestinationUnreachable::Print
virtual void Print(std::ostream &os) const
Print information.
Definition: icmpv6-header.cc:1079
ns3::Address::CopyFrom
uint32_t CopyFrom(const uint8_t *buffer, uint8_t len)
Definition: address.cc:101
ns3::Icmpv6RA::SetFlags
NS_DEPRECATED_3_34 void SetFlags(uint8_t f)
Setflags.
Definition: icmpv6-header.cc:610
ns3::Icmpv6Redirection::GetSerializedSize
virtual uint32_t GetSerializedSize() const
Get the serialized size.
Definition: icmpv6-header.cc:868
ns3::Icmpv6RA::GetFlags
NS_DEPRECATED_3_34 uint8_t GetFlags() const
Getflags.
Definition: icmpv6-header.cc:604
ns3::Icmpv6RA::SetFlagO
void SetFlagO(bool o)
Set the O flag.
Definition: icmpv6-header.cc:586
ns3::Icmpv6Header::SetCode
void SetCode(uint8_t code)
Set the code field.
Definition: icmpv6-header.cc:84
ns3::Buffer
automatically resized byte buffer
Definition: buffer.h:93
ns3::Icmpv6Header::GetChecksum
uint16_t GetChecksum() const
Get the checksum.
Definition: icmpv6-header.cc:90
ns3::Icmpv6Redirection::m_target
Ipv6Address m_target
IPv6 target address.
Definition: icmpv6-header.h:923
ns3::Icmpv6OptionHeader
ICMPv6 option header.
Definition: icmpv6-header.h:239
ns3::Icmpv6TimeExceeded::Icmpv6TimeExceeded
Icmpv6TimeExceeded()
Constructor.
Definition: icmpv6-header.cc:1261
ns3::Header
Protocol header serialization and deserialization.
Definition: header.h:43
ns3::Icmpv6RA::GetLifeTime
uint16_t GetLifeTime() const
Get the node Life time (Neighbor Discovery).
Definition: icmpv6-header.cc:532
icmpv6-header.h
ns3::Buffer::Begin
Buffer::Iterator Begin(void) const
Definition: buffer.h:1069
ns3::Icmpv6RS::GetReserved
uint32_t GetReserved() const
Get the reserved field.
Definition: icmpv6-header.cc:732
ns3::Icmpv6NA::GetSerializedSize
virtual uint32_t GetSerializedSize() const
Get the serialized size.
Definition: icmpv6-header.cc:400
ns3::Icmpv6Header::ICMPV6_ND_REDIRECTION
@ ICMPV6_ND_REDIRECTION
Definition: icmpv6-header.h:59
ns3::Icmpv6NA::m_flagO
bool m_flagO
The M flag.
Definition: icmpv6-header.h:551
ns3::Icmpv6NS::~Icmpv6NS
virtual ~Icmpv6NS()
Destructor.
Definition: icmpv6-header.cc:218
ns3::Icmpv6TooBig::m_mtu
uint32_t m_mtu
The MTU value.
Definition: icmpv6-header.h:1184
ns3::Icmpv6RS::SetReserved
void SetReserved(uint32_t reserved)
Set the reserved field.
Definition: icmpv6-header.cc:738
ns3::Icmpv6Header::GetType
uint8_t GetType() const
Get the type field.
Definition: icmpv6-header.cc:66
ns3::Icmpv6OptionPrefixInformation::m_validTime
uint32_t m_validTime
The valid time.
Definition: icmpv6-header.h:1603
ns3::Icmpv6OptionPrefixInformation::SetPrefix
void SetPrefix(Ipv6Address prefix)
Set the IPv6 prefix.
Definition: icmpv6-header.cc:1737
ns3::Icmpv6RA::m_RetransmissionTimer
uint32_t m_RetransmissionTimer
The retransmission timer.
Definition: icmpv6-header.h:746
ns3::Icmpv6RA::SetCurHopLimit
void SetCurHopLimit(uint8_t m)
Set the IPv6 maximum number of jumps.
Definition: icmpv6-header.cc:520
ns3::Icmpv6Header::ICMPV6_ERROR_PARAMETER_ERROR
@ ICMPV6_ERROR_PARAMETER_ERROR
Definition: icmpv6-header.h:49
ns3::Icmpv6OptionPrefixInformation::m_flags
uint8_t m_flags
The flags.
Definition: icmpv6-header.h:1598
ns3::Icmpv6Header::ICMPV6_ECHO_REPLY
@ ICMPV6_ECHO_REPLY
Definition: icmpv6-header.h:51
ns3::Icmpv6OptionPrefixInformation::m_prefix
Ipv6Address m_prefix
The prefix value.
Definition: icmpv6-header.h:1588
ns3::Icmpv6NS::GetSerializedSize
virtual uint32_t GetSerializedSize() const
Get the serialized size.
Definition: icmpv6-header.cc:253
ns3::Icmpv6OptionRedirected::Print
virtual void Print(std::ostream &os) const
Print information.
Definition: icmpv6-header.cc:1943
ns3::Icmpv6OptionRedirected::GetTypeId
static TypeId GetTypeId()
Get the UID of this class.
Definition: icmpv6-header.cc:1906
ns3::Buffer::Iterator::ReadU16
uint16_t ReadU16(void)
Definition: buffer.h:1029
ns3::Header::Deserialize
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
ns3::Icmpv6Header::ICMPV6_OPT_MTU
@ ICMPV6_OPT_MTU
Definition: icmpv6-header.h:83
ns3::Buffer::Iterator::ReadU32
uint32_t ReadU32(void)
Definition: buffer.cc:973
ns3::Icmpv6NS::SetIpv6Target
void SetIpv6Target(Ipv6Address target)
Set the IPv6 target field.
Definition: icmpv6-header.cc:241
ns3::Icmpv6NA::m_flagR
bool m_flagR
The R flag.
Definition: icmpv6-header.h:541
ns3::Icmpv6OptionRedirected::SetPacket
void SetPacket(Ptr< Packet > packet)
Set the redirected packet.
Definition: icmpv6-header.cc:1935
ns3::Icmpv6TimeExceeded::~Icmpv6TimeExceeded
virtual ~Icmpv6TimeExceeded()
Destructor.
Definition: icmpv6-header.cc:1268
ns3::Icmpv6RS::Icmpv6RS
Icmpv6RS()
Constructor.
Definition: icmpv6-header.cc:719
ns3::Icmpv6TimeExceeded::GetInstanceTypeId
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
Definition: icmpv6-header.cc:1255
ns3::Buffer::Iterator::GetSize
uint32_t GetSize(void) const
Definition: buffer.cc:1159
ns3::Icmpv6NS::GetIpv6Target
Ipv6Address GetIpv6Target() const
Get the IPv6 target field.
Definition: icmpv6-header.cc:235
ns3::Icmpv6RS
ICMPv6 Router Solicitation header.
Definition: icmpv6-header.h:760
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition: buffer.h:99
ns3::Icmpv6Redirection::Icmpv6Redirection
Icmpv6Redirection()
Constructor.
Definition: icmpv6-header.cc:810
ns3::Icmpv6ParameterError::m_packet
Ptr< Packet > m_packet
The incorrect packet.
Definition: icmpv6-header.h:1334
ns3::Icmpv6NS
ICMPv6 Neighbor Solicitation header.
Definition: icmpv6-header.h:330
ns3::Icmpv6Header::ICMPV6_ERROR_DESTINATION_UNREACHABLE
@ ICMPV6_ERROR_DESTINATION_UNREACHABLE
Definition: icmpv6-header.h:46
ns3::Icmpv6TooBig::GetTypeId
static TypeId GetTypeId()
Get the UID of this class.
Definition: icmpv6-header.cc:1138
ns3::Icmpv6OptionMtu::SetMtu
void SetMtu(uint32_t mtu)
Set the MTU.
Definition: icmpv6-header.cc:1582
ns3::Icmpv6DestinationUnreachable::GetTypeId
static TypeId GetTypeId()
Get the UID of this class.
Definition: icmpv6-header.cc:1044
ns3::Icmpv6NA::GetFlagO
bool GetFlagO() const
Get the O flag.
Definition: icmpv6-header.cc:376
ns3::Icmpv6OptionHeader::GetInstanceTypeId
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
Definition: icmpv6-header.cc:1457
ns3::Icmpv6RA::GetInstanceTypeId
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
Definition: icmpv6-header.cc:495
ns3::Icmpv6OptionPrefixInformation::m_preferredTime
uint32_t m_preferredTime
The preferred time.
Definition: icmpv6-header.h:1608
ns3::Icmpv6RS::Print
virtual void Print(std::ostream &os) const
Print information.
Definition: icmpv6-header.cc:744
ns3::Icmpv6RA::m_flagH
bool m_flagH
The H flag.
Definition: icmpv6-header.h:731
ns3::Icmpv6Redirection::SetTarget
void SetTarget(Ipv6Address target)
Set the IPv6 target address.
Definition: icmpv6-header.cc:844
ns3::Icmpv6RA::GetRetransmissionTime
uint32_t GetRetransmissionTime() const
Get the node Retransmission time (Neighbor Discovery).
Definition: icmpv6-header.cc:544
ns3::Address::CopyTo
uint32_t CopyTo(uint8_t buffer[MAX_SIZE]) const
Copy the address bytes into a buffer.
Definition: address.cc:82
ns3::Icmpv6RA::m_curHopLimit
uint8_t m_curHopLimit
The max jumps.
Definition: icmpv6-header.h:751
ns3::Packet::Copy
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition: packet.cc:121
ns3::Icmpv6OptionHeader::SetLength
void SetLength(uint8_t len)
Set the length of the option.
Definition: icmpv6-header.cc:1495
ns3::Icmpv6OptionPrefixInformation::Icmpv6OptionPrefixInformation
Icmpv6OptionPrefixInformation()
Constructor.
Definition: icmpv6-header.cc:1639
ns3::Icmpv6Redirection::SetReserved
void SetReserved(uint32_t reserved)
Set the reserved field.
Definition: icmpv6-header.cc:826
f
double f(double x, void *params)
Definition: 80211b.c:70
ns3::Icmpv6Header::m_code
uint8_t m_code
The code.
Definition: icmpv6-header.h:230
ns3::Icmpv6ParameterError
ICMPv6 Error Parameter Error header.
Definition: icmpv6-header.h:1262
ns3::Icmpv6TooBig::SetMtu
void SetMtu(uint32_t mtu)
Set the MTU.
Definition: icmpv6-header.cc:1180
ns3::Icmpv6RS::GetSerializedSize
virtual uint32_t GetSerializedSize() const
Get the serialized size.
Definition: icmpv6-header.cc:750
ns3::Icmpv6ParameterError::GetSerializedSize
virtual uint32_t GetSerializedSize() const
Get the serialized size.
Definition: icmpv6-header.cc:1394
ns3::Icmpv6OptionPrefixInformation::SetValidTime
void SetValidTime(uint32_t validTime)
Set the valid time of the information.
Definition: icmpv6-header.cc:1701
ns3::Icmpv6OptionMtu::m_mtu
uint32_t m_mtu
The MTU value.
Definition: icmpv6-header.h:1436
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition: log-macros-enabled.h:244
ns3::Icmpv6RA::GetReachableTime
uint32_t GetReachableTime() const
Get the node Reachable time (Neighbor Discovery).
Definition: icmpv6-header.cc:538
ns3::Icmpv6TooBig::GetSerializedSize
virtual uint32_t GetSerializedSize() const
Get the serialized size.
Definition: icmpv6-header.cc:1192
ns3::Icmpv6OptionPrefixInformation::GetPreferredTime
uint32_t GetPreferredTime() const
Get the preferred time of the information.
Definition: icmpv6-header.cc:1707
ns3::Icmpv6Echo::GetInstanceTypeId
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
Definition: icmpv6-header.cc:935
ns3::Address::GetLength
uint8_t GetLength(void) const
Get the length of the underlying address.
Definition: address.cc:75
ns3::Icmpv6Header::Print
virtual void Print(std::ostream &os) const
Print information.
Definition: icmpv6-header.cc:102
ns3::Icmpv6OptionRedirected::GetInstanceTypeId
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
Definition: icmpv6-header.cc:1916
ns3::Icmpv6OptionPrefixInformation::Print
virtual void Print(std::ostream &os) const
Print information.
Definition: icmpv6-header.cc:1743
ns3::Icmpv6Echo::GetSeq
uint16_t GetSeq() const
Get the sequence number.
Definition: icmpv6-header.cc:978
ns3::Icmpv6Echo::SetId
void SetId(uint16_t id)
Set the ID of the packet.
Definition: icmpv6-header.cc:972
ns3::Icmpv6OptionPrefixInformation::GetInstanceTypeId
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
Definition: icmpv6-header.cc:1633
ns3::Icmpv6Echo::Icmpv6Echo
Icmpv6Echo()
Default constructor.
Definition: icmpv6-header.cc:941
ns3::Icmpv6Echo
ICMPv6 Echo message.
Definition: icmpv6-header.h:942
ns3::Icmpv6RA::m_flagO
bool m_flagO
The O flag.
Definition: icmpv6-header.h:726
ns3::Icmpv6NA::m_target
Ipv6Address m_target
The IPv6 target address.
Definition: icmpv6-header.h:561
ns3::Icmpv6OptionPrefixInformation::GetTypeId
static TypeId GetTypeId()
Get the UID of this class.
Definition: icmpv6-header.cc:1623
ns3::Icmpv6NA::SetIpv6Target
void SetIpv6Target(Ipv6Address target)
Set the IPv6 target field.
Definition: icmpv6-header.cc:388
ns3::Icmpv6ParameterError::~Icmpv6ParameterError
virtual ~Icmpv6ParameterError()
Destructor.
Definition: icmpv6-header.cc:1364
ns3::Icmpv6DestinationUnreachable::SetPacket
void SetPacket(Ptr< Packet > p)
Set the incorrect packet.
Definition: icmpv6-header.cc:1072
ns3::Icmpv6ParameterError::Print
virtual void Print(std::ostream &os) const
Print information.
Definition: icmpv6-header.cc:1388
ns3::Icmpv6Header::SetChecksum
void SetChecksum(uint16_t checksum)
Set the checksum.
Definition: icmpv6-header.cc:96
ns3::Icmpv6Echo::GetTypeId
static TypeId GetTypeId()
Get the UID of this class.
Definition: icmpv6-header.cc:925
ns3::Icmpv6OptionMtu::m_reserved
uint16_t m_reserved
The reserved value.
Definition: icmpv6-header.h:1431
ns3::Icmpv6NS::GetInstanceTypeId
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
Definition: icmpv6-header.cc:197
ns3::Icmpv6ParameterError::Serialize
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
Definition: icmpv6-header.cc:1402
ns3::Icmpv6OptionPrefixInformation::Serialize
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
Definition: icmpv6-header.cc:1755
ns3::Icmpv6OptionHeader::GetTypeId
static TypeId GetTypeId()
Get the UID of this class.
Definition: icmpv6-header.cc:1447
ns3::Icmpv6OptionPrefixInformation::~Icmpv6OptionPrefixInformation
virtual ~Icmpv6OptionPrefixInformation()
Destructor.
Definition: icmpv6-header.cc:1665
ns3::Icmpv6Header::m_checksum
uint16_t m_checksum
The checksum.
Definition: icmpv6-header.h:219
ns3::Icmpv6DestinationUnreachable::~Icmpv6DestinationUnreachable
virtual ~Icmpv6DestinationUnreachable()
Destructor.
Definition: icmpv6-header.cc:1067
ns3::Icmpv6Echo::~Icmpv6Echo
virtual ~Icmpv6Echo()
Destructor.
Definition: icmpv6-header.cc:961
ns3::Icmpv6NS::GetTypeId
static TypeId GetTypeId()
Get the UID of this class.
Definition: icmpv6-header.cc:187
ns3::Icmpv6OptionPrefixInformation
ICMPv6 Option Prefix Information.
Definition: icmpv6-header.h:1445
ns3::Icmpv6RA::GetFlagM
bool GetFlagM() const
Get the M flag.
Definition: icmpv6-header.cc:568
ns3::Icmpv6RA::m_LifeTime
uint16_t m_LifeTime
The lifetime value.
Definition: icmpv6-header.h:736
ns3::Icmpv6RA::GetFlagO
bool GetFlagO() const
Get the O flag.
Definition: icmpv6-header.cc:580
ns3::Icmpv6NA::m_flagS
bool m_flagS
The O flag.
Definition: icmpv6-header.h:546
ns3::Icmpv6RA::~Icmpv6RA
virtual ~Icmpv6RA()
Destructor.
Definition: icmpv6-header.cc:515
ns3::Icmpv6OptionPrefixInformation::SetPreferredTime
void SetPreferredTime(uint32_t preferredTime)
Set the preferred time of the information.
Definition: icmpv6-header.cc:1713
ns3::Buffer::Iterator::WriteU32
void WriteU32(uint32_t data)
Definition: buffer.cc:879
ns3::Icmpv6Header::Icmpv6Header
Icmpv6Header()
Constructor.
Definition: icmpv6-header.cc:52
ns3::Icmpv6NA::Icmpv6NA
Icmpv6NA()
Constructor.
Definition: icmpv6-header.cc:317
ns3::Icmpv6TimeExceeded::SetPacket
void SetPacket(Ptr< Packet > p)
Set the incorrect packet.
Definition: icmpv6-header.cc:1274
ns3::Icmpv6Header
ICMPv6 header.
Definition: icmpv6-header.h:39
ns3::Icmpv6Redirection
ICMPv6 Redirection header.
Definition: icmpv6-header.h:834
ns3::Icmpv6NS::Print
virtual void Print(std::ostream &os) const
Print information.
Definition: icmpv6-header.cc:247
ns3::Icmpv6RA::GetCurHopLimit
uint8_t GetCurHopLimit() const
Get the IPv6 maximum number of jumps.
Definition: icmpv6-header.cc:526
ns3::Icmpv6OptionMtu::GetMtu
uint32_t GetMtu() const
Get the MTU.
Definition: icmpv6-header.cc:1576
ns3::Icmpv6TimeExceeded::Print
virtual void Print(std::ostream &os) const
Print information.
Definition: icmpv6-header.cc:1281
ns3::Icmpv6OptionPrefixInformation::GetValidTime
uint32_t GetValidTime() const
Get the valid time of the information.
Definition: icmpv6-header.cc:1695
ns3::Buffer::Iterator::ReadNtohU32
uint32_t ReadNtohU32(void)
Definition: buffer.h:970
ns3::Icmpv6OptionRedirected::GetSerializedSize
virtual uint32_t GetSerializedSize() const
Get the serialized size.
Definition: icmpv6-header.cc:1949
ns3::Icmpv6OptionPrefixInformation::SetPrefixLength
void SetPrefixLength(uint8_t prefixLength)
Set the prefix length.
Definition: icmpv6-header.cc:1676
ns3::Icmpv6Header::ICMPV6_ND_ROUTER_SOLICITATION
@ ICMPV6_ND_ROUTER_SOLICITATION
Definition: icmpv6-header.h:55
ns3::Icmpv6TooBig::Icmpv6TooBig
Icmpv6TooBig()
Constructor.
Definition: icmpv6-header.cc:1154
ns3::Icmpv6Redirection::GetTypeId
static TypeId GetTypeId()
Get the UID of this class.
Definition: icmpv6-header.cc:794
ns3::Icmpv6TooBig
ICMPv6 Error Too Big header.
Definition: icmpv6-header.h:1107
ns3::Icmpv6RA::m_flagM
bool m_flagM
The M flag.
Definition: icmpv6-header.h:721
ns3::Icmpv6OptionHeader::SetType
void SetType(uint8_t type)
Set the type of the option.
Definition: icmpv6-header.cc:1483
ns3::Icmpv6OptionHeader::GetType
uint8_t GetType() const
Get the type of the option.
Definition: icmpv6-header.cc:1477
ns3::Icmpv6Header::ICMPV6_ERROR_TIME_EXCEEDED
@ ICMPV6_ERROR_TIME_EXCEEDED
Definition: icmpv6-header.h:48
ns3::Buffer::Iterator::WriteHtonU32
void WriteHtonU32(uint32_t data)
Definition: buffer.h:924
ns3::Icmpv6DestinationUnreachable
ICMPv6 Error Destination Unreachable header.
Definition: icmpv6-header.h:1039
ns3::Icmpv6Header::m_calcChecksum
bool m_calcChecksum
Checksum enable or not.
Definition: icmpv6-header.h:214
ns3::Icmpv6Echo::GetSerializedSize
virtual uint32_t GetSerializedSize() const
Get the serialized size.
Definition: icmpv6-header.cc:999
ns3::Icmpv6OptionHeader::~Icmpv6OptionHeader
virtual ~Icmpv6OptionHeader()
Destructor.
Definition: icmpv6-header.cc:1472
ns3::Icmpv6DestinationUnreachable::GetInstanceTypeId
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
Definition: icmpv6-header.cc:1054