A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
icmpv6-header.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007-2009 Strasbourg University
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
7 * Mehdi Benamor <benamor.mehdi@ensi.rnu.tn>
8 * David Gross <gdavid.devel@gmail.com>
9 */
10
11#ifndef ICMPV6_HEADER_H
12#define ICMPV6_HEADER_H
13
14#include "ns3/header.h"
15#include "ns3/ipv6-address.h"
16#include "ns3/packet.h"
17
18namespace ns3
19{
20
21/**
22 * @ingroup icmpv6
23 *
24 * @brief ICMPv6 header.
25 */
26class Icmpv6Header : public Header
27{
28 public:
29 /**
30 * @brief ICMPv6 type code.
31 */
63
64 /**
65 * @brief ICMPv6 Option type code.
66 */
79
80 /**
81 * @brief ICMPv6 error code : Destination Unreachable
82 */
91
92 /**
93 * @brief ICMPv6 error code : Time Exceeded
94 */
100
101 /**
102 * @brief ICMPv6 error code : Parameter Error
103 */
110
111 /**
112 * @brief Get the UID of this class.
113 * @return UID
114 */
115 static TypeId GetTypeId();
116
117 /**
118 * @brief Get the instance type ID.
119 * @return instance type ID
120 */
121 TypeId GetInstanceTypeId() const override;
122
123 /**
124 * @brief Constructor.
125 */
126 Icmpv6Header();
127
128 /**
129 * @brief Destructor.
130 */
131 ~Icmpv6Header() override;
132
133 /**
134 * @brief Get the type field.
135 * @return type of ICMPv6 message
136 */
137 uint8_t GetType() const;
138
139 /**
140 * @brief Set the type.
141 * @param type type to set
142 */
143 void SetType(uint8_t type);
144
145 /**
146 * @brief Get the code field.
147 * @return code of ICMPv6 message
148 */
149 uint8_t GetCode() const;
150
151 /**
152 * @brief Set the code field.
153 * @param code code to set
154 */
155 void SetCode(uint8_t code);
156
157 /**
158 * @brief Get the checksum.
159 * @return checksum
160 */
161 uint16_t GetChecksum() const;
162
163 /**
164 * @brief Set the checksum.
165 * @param checksum to set
166 */
167 void SetChecksum(uint16_t checksum);
168
169 /**
170 * @brief Print information.
171 * @param os output stream
172 */
173 void Print(std::ostream& os) const override;
174
175 /**
176 * @brief Get the serialized size.
177 * @return serialized size
178 */
179 uint32_t GetSerializedSize() const override;
180
181 /**
182 * @brief Serialize the packet.
183 * @param start start offset
184 */
185 void Serialize(Buffer::Iterator start) const override;
186
187 /**
188 * @brief Deserialize the packet.
189 * @param start start offset
190 * @return length of packet
191 */
192 uint32_t Deserialize(Buffer::Iterator start) override;
193
194 /**
195 * @brief Calculate pseudo header checksum for IPv6.
196 *
197 * The upper-layer protocol in the pseudo header is always ICMPv6.
198 *
199 * @param src source address
200 * @param dst destination address
201 * @param length length
202 */
203 void CalculatePseudoHeaderChecksum(Ipv6Address src, Ipv6Address dst, uint16_t length);
204
205 /**
206 * @brief Initialize the IPv6 pseudo header used for checksum verification.
207 *
208 * Stores the pseudo header addresses so that the checksum of a received
209 * message is verified during Deserialize. The verification result is
210 * reported by IsChecksumOk. The upper-layer protocol is always ICMPv6.
211 *
212 * @param source the IPv6 source address
213 * @param destination the IPv6 destination address
214 * @see UdpHeader::InitializeChecksum
215 */
216 void InitializeChecksum(Ipv6Address source, Ipv6Address destination);
217
218 /**
219 * @brief Checks if the message checksum is correct.
220 * @return true if the checksum is correct, false otherwise. Returns true
221 * by default if InitializeChecksum has not been called before
222 * deserializing this header.
223 */
224 bool IsChecksumOk() const;
225
226 protected:
227 /**
228 * @brief Checksum enable or not.
229 */
231
232 /**
233 * @brief The checksum.
234 */
235 uint16_t m_checksum;
236
237 private:
238 /**
239 * @brief Calculate the partial checksum of the IPv6 pseudo header.
240 * @param size the size of the ICMPv6 message (header and payload)
241 * @return the non-complemented pseudo header checksum
242 */
243 uint16_t CalculateHeaderChecksum(uint16_t size) const;
244
245 /**
246 * @brief The type.
247 */
248 uint8_t m_type;
249
250 /**
251 * @brief The code.
252 */
253 uint8_t m_code;
254
255 Ipv6Address m_source; //!< Source address of the IPv6 pseudo header
256 Ipv6Address m_destination; //!< Destination address of the IPv6 pseudo header
257 bool m_verifyChecksum; //!< true if the checksum must be verified during Deserialize
258 bool m_goodChecksum; //!< true if the checksum is correct
259};
260
261/**
262 * @ingroup icmpv6
263 *
264 * @brief ICMPv6 option header.
265 */
267{
268 public:
269 /**
270 * @brief Get the UID of this class.
271 * @return UID
272 */
273 static TypeId GetTypeId();
274
275 /**
276 * @brief Get the instance type ID.
277 * @return instance type ID
278 */
279 TypeId GetInstanceTypeId() const override;
280
281 /**
282 * @brief Constructor.
283 */
285
286 /**
287 * @brief Destructor.
288 */
289 ~Icmpv6OptionHeader() override;
290
291 /**
292 * @brief Get the type of the option.
293 * @return type
294 */
295 uint8_t GetType() const;
296
297 /**
298 * @brief Set the type of the option.
299 * @param type the type to set
300 */
301 void SetType(uint8_t type);
302
303 /**
304 * @brief Get the length of the option in 8 bytes unit.
305 * @return length of the option
306 */
307 uint8_t GetLength() const;
308
309 /**
310 * @brief Set the length of the option.
311 * @param len length value to set
312 */
313 void SetLength(uint8_t len);
314
315 /**
316 * @brief Print information.
317 * @param os output stream
318 */
319 void Print(std::ostream& os) const override;
320
321 /**
322 * @brief Get the serialized size.
323 * @return serialized size
324 */
325 uint32_t GetSerializedSize() const override;
326
327 /**
328 * @brief Serialize the packet.
329 * @param start start offset
330 */
331 void Serialize(Buffer::Iterator start) const override;
332
333 /**
334 * @brief Deserialize the packet.
335 * @param start start offset
336 * @return length of packet
337 */
338 uint32_t Deserialize(Buffer::Iterator start) override;
339
340 private:
341 /**
342 * @brief The type.
343 */
344 uint8_t m_type;
345
346 /**
347 * @brief The length.
348 */
349 uint8_t m_len;
350};
351
352/**
353 * @ingroup icmpv6
354 *
355 * @brief ICMPv6 Neighbor Solicitation header.
356 */
357class Icmpv6NS : public Icmpv6Header
358{
359 public:
360 /**
361 * @brief Constructor.
362 * @param target target IPv6 address
363 */
364 Icmpv6NS(Ipv6Address target);
365
366 /**
367 * @brief Constructor.
368 */
369 Icmpv6NS();
370
371 /**
372 * @brief Destructor.
373 */
374 ~Icmpv6NS() override;
375
376 /**
377 * @brief Get the UID of this class.
378 * @return UID
379 */
380 static TypeId GetTypeId();
381
382 /**
383 * @brief Get the instance type ID.
384 * @return instance type ID
385 */
386 TypeId GetInstanceTypeId() const override;
387
388 /**
389 * @brief Get the reserved field.
390 * @return reserved value
391 */
392 uint32_t GetReserved() const;
393
394 /**
395 * @brief Set the reserved field.
396 * @param reserved the reserved value
397 */
398 void SetReserved(uint32_t reserved);
399
400 /**
401 * @brief Get the IPv6 target field.
402 * @return IPv6 address
403 */
405
406 /**
407 * @brief Set the IPv6 target field.
408 * @param target IPv6 address
409 */
410 void SetIpv6Target(Ipv6Address target);
411
412 /**
413 * @brief Print information.
414 * @param os output stream
415 */
416 void Print(std::ostream& os) const override;
417
418 /**
419 * @brief Get the serialized size.
420 * @return serialized size
421 */
422 uint32_t GetSerializedSize() const override;
423
424 /**
425 * @brief Serialize the packet.
426 * @param start start offset
427 */
428 void Serialize(Buffer::Iterator start) const override;
429
430 /**
431 * @brief Deserialize the packet.
432 * @param start start offset
433 * @return length of packet
434 */
435 uint32_t Deserialize(Buffer::Iterator start) override;
436
437 private:
438 /**
439 * @brief The reserved value.
440 */
442
443 /**
444 * @brief The IPv6 target address.
445 */
447};
448
449/**
450 * @ingroup icmpv6
451 *
452 * @brief ICMPv6 Neighbor Advertisement header.
453 */
454class Icmpv6NA : public Icmpv6Header
455{
456 public:
457 /**
458 * @brief Constructor.
459 */
460 Icmpv6NA();
461
462 /**
463 * @brief Destructor.
464 */
465 ~Icmpv6NA() override;
466
467 /**
468 * @brief Get the UID of this class.
469 * @return UID
470 */
471 static TypeId GetTypeId();
472
473 /**
474 * @brief Get the instance type ID.
475 * @return instance type ID
476 */
477 TypeId GetInstanceTypeId() const override;
478
479 /**
480 * @brief Get the reserved field.
481 * @return reserved value
482 */
483 uint32_t GetReserved() const;
484
485 /**
486 * @brief Set the reserved field.
487 * @param reserved the reserved value
488 */
489 void SetReserved(uint32_t reserved);
490
491 /**
492 * @brief Get the IPv6 target field.
493 * @return IPv6 address
494 */
496
497 /**
498 * @brief Set the IPv6 target field.
499 * @param target IPv6 address
500 */
501 void SetIpv6Target(Ipv6Address target);
502
503 /**
504 * @brief Get the R flag.
505 * @return R flag
506 */
507 bool GetFlagR() const;
508
509 /**
510 * @brief Set the R flag.
511 * @param r value
512 */
513 void SetFlagR(bool r);
514
515 /**
516 * @brief Get the S flag.
517 * @return S flag
518 */
519 bool GetFlagS() const;
520
521 /**
522 * @brief Set the S flag.
523 * @param s value
524 */
525 void SetFlagS(bool s);
526
527 /**
528 * @brief Get the O flag.
529 * @return O flag
530 */
531 bool GetFlagO() const;
532
533 /**
534 * @brief Set the O flag.
535 * @param o value
536 */
537 void SetFlagO(bool o);
538
539 /**
540 * @brief Print information.
541 * @param os output stream
542 */
543 void Print(std::ostream& os) const override;
544
545 /**
546 * @brief Get the serialized size.
547 * @return serialized size
548 */
549 uint32_t GetSerializedSize() const override;
550
551 /**
552 * @brief Serialize the packet.
553 * @param start start offset
554 */
555 void Serialize(Buffer::Iterator start) const override;
556
557 /**
558 * @brief Deserialize the packet.
559 * @param start start offset
560 * @return length of packet
561 */
562 uint32_t Deserialize(Buffer::Iterator start) override;
563
564 private:
565 /**
566 * @brief The R flag.
567 */
569
570 /**
571 * @brief The O flag.
572 */
574
575 /**
576 * @brief The M flag.
577 */
579
580 /**
581 * @brief The reserved value.
582 */
584
585 /**
586 * @brief The IPv6 target address.
587 */
589};
590
591/**
592 * @ingroup icmpv6
593 *
594 * @brief ICMPv6 Router Advertisement header.
595 */
596class Icmpv6RA : public Icmpv6Header
597{
598 public:
599 /**
600 * @brief Constructor.
601 */
602 Icmpv6RA();
603
604 /**
605 * @brief Destructor.
606 */
607 ~Icmpv6RA() override;
608
609 /**
610 * @brief Get the UID of this class.
611 * @return UID
612 */
613 static TypeId GetTypeId();
614
615 /**
616 * @brief Get the instance type ID.
617 * @return instance type ID
618 */
619 TypeId GetInstanceTypeId() const override;
620
621 /**
622 * @brief Set the IPv6 maximum number of jumps.
623 * @param m maximum jumps
624 */
625 void SetCurHopLimit(uint8_t m);
626
627 /**
628 * @brief Get the IPv6 maximum number of jumps.
629 * @return maximum jumps
630 */
631 uint8_t GetCurHopLimit() const;
632
633 /**
634 * @brief Set the node Life time (Neighbor Discovery).
635 * @param l life time
636 */
637 void SetLifeTime(uint16_t l);
638
639 /**
640 * @brief Get the node Life time (Neighbor Discovery).
641 * @return life time
642 */
643 uint16_t GetLifeTime() const;
644
645 /**
646 * @brief Set the node Reachable time (Neighbor Discovery).
647 * @param r Reachable time
648 */
650
651 /**
652 * @brief Get the node Reachable time (Neighbor Discovery).
653 * @return reachable time
654 */
656
657 /**
658 * @brief Set the node Retransmission time (Neighbor Discovery).
659 * @param r Retransmission time
660 */
662
663 /**
664 * @brief Get the node Retransmission time (Neighbor Discovery).
665 * @return retransmission time
666 */
668
669 /**
670 * @brief Get the M flag.
671 * @return M flag
672 */
673 bool GetFlagM() const;
674
675 /**
676 * @brief Set the M flag.
677 * @param m value
678 */
679 void SetFlagM(bool m);
680
681 /**
682 * @brief Get the O flag.
683 * @return O flag
684 */
685 bool GetFlagO() const;
686
687 /**
688 * @brief Set the O flag.
689 * @param o value
690 */
691 void SetFlagO(bool o);
692
693 /**
694 * @brief Get the H flag.
695 * @return H flag
696 */
697 bool GetFlagH() const;
698
699 /**
700 * @brief Set the H flag.
701 * @param h value
702 */
703 void SetFlagH(bool h);
704
705 /**
706 * @brief Print information.
707 * @param os output stream
708 */
709 void Print(std::ostream& os) const override;
710
711 /**
712 * @brief Get the serialized size.
713 * @return serialized size
714 */
715 uint32_t GetSerializedSize() const override;
716
717 /**
718 * @brief Serialize the packet.
719 * @param start start offset
720 */
721 void Serialize(Buffer::Iterator start) const override;
722
723 /**
724 * @brief Deserialize the packet.
725 * @param start start offset
726 * @return length of packet
727 */
728 uint32_t Deserialize(Buffer::Iterator start) override;
729
730 private:
731 /**
732 * @brief The M flag.
733 */
735
736 /**
737 * @brief The O flag.
738 */
740
741 /**
742 * @brief The H flag.
743 */
745
746 /**
747 * @brief The lifetime value.
748 */
749 uint16_t m_LifeTime;
750
751 /**
752 * @brief The reachable time value.
753 */
755
756 /**
757 * @brief The retransmission timer.
758 */
760
761 /**
762 * @brief The max jumps.
763 */
765};
766
767/**
768 * @ingroup icmpv6
769 *
770 * @brief ICMPv6 Router Solicitation header.
771 */
772class Icmpv6RS : public Icmpv6Header
773{
774 public:
775 /**
776 * @brief Constructor.
777 */
778 Icmpv6RS();
779
780 /**
781 * @brief Destructor.
782 */
783 ~Icmpv6RS() override;
784
785 /**
786 * @brief Get the UID of this class.
787 * @return UID
788 */
789 static TypeId GetTypeId();
790
791 /**
792 * @brief Get the instance type ID.
793 * @return instance type ID
794 */
795 TypeId GetInstanceTypeId() const override;
796
797 /**
798 * @brief Get the reserved field.
799 * @return reserved value
800 */
801 uint32_t GetReserved() const;
802
803 /**
804 * @brief Set the reserved field.
805 * @param reserved the reserved value
806 */
807 void SetReserved(uint32_t reserved);
808
809 /**
810 * @brief Print information.
811 * @param os output stream
812 */
813 void Print(std::ostream& os) const override;
814
815 /**
816 * @brief Get the serialized size.
817 * @return serialized size
818 */
819 uint32_t GetSerializedSize() const override;
820
821 /**
822 * @brief Serialize the packet.
823 * @param start start offset
824 */
825 void Serialize(Buffer::Iterator start) const override;
826
827 /**
828 * @brief Deserialize the packet.
829 * @param start start offset
830 * @return length of packet
831 */
832 uint32_t Deserialize(Buffer::Iterator start) override;
833
834 private:
835 /**
836 * @brief The reserved value.
837 */
839};
840
841/**
842 * @ingroup icmpv6
843 *
844 * @brief ICMPv6 Redirection header.
845 */
847{
848 public:
849 /**
850 * @brief Constructor.
851 */
853
854 /**
855 * @brief Destructor.
856 */
857 ~Icmpv6Redirection() override;
858
859 /**
860 * @brief Get the UID of this class.
861 * @return UID
862 */
863 static TypeId GetTypeId();
864
865 /**
866 * @brief Get the instance type ID.
867 * @return instance type ID
868 */
869 TypeId GetInstanceTypeId() const override;
870
871 /**
872 * @brief Get the IPv6 target address.
873 * @return the IPv6 target address
874 */
875 Ipv6Address GetTarget() const;
876
877 /**
878 * @brief Set the IPv6 target address.
879 * @param target IPv6 target address
880 */
881 void SetTarget(Ipv6Address target);
882
883 /**
884 * @brief Get the IPv6 destination address.
885 * @return the IPv6 destination address
886 */
888
889 /**
890 * @brief Set the IPv6 destination address.
891 * @param destination IPv6 destination address
892 */
893 void SetDestination(Ipv6Address destination);
894
895 /**
896 * @brief Print information.
897 * @param os output stream
898 */
899 void Print(std::ostream& os) const override;
900
901 /**
902 * @brief Get the serialized size.
903 * @return serialized size
904 */
905 uint32_t GetSerializedSize() const override;
906
907 /**
908 * @brief Serialize the packet.
909 * @param start start offset
910 */
911 void Serialize(Buffer::Iterator start) const override;
912
913 /**
914 * @brief Deserialize the packet.
915 * @param start start offset
916 * @return length of packet
917 */
918 uint32_t Deserialize(Buffer::Iterator start) override;
919
920 /**
921 * @brief Get the reserved field.
922 * @return reserved value
923 */
924 uint32_t GetReserved() const;
925
926 /**
927 * @brief Set the reserved field.
928 * @param reserved the reserved value
929 */
930 void SetReserved(uint32_t reserved);
931
932 private:
933 /**
934 * @brief IPv6 target address.
935 */
937
938 /**
939 * @brief IPv6 destination address.
940 */
942
943 /**
944 * @brief Reserved value.
945 */
947};
948
949/**
950 * @ingroup icmpv6
951 *
952 * @brief ICMPv6 Echo message.
953 */
955{
956 public:
957 /**
958 * @brief Get the UID of this class.
959 * @return UID
960 */
961 static TypeId GetTypeId();
962
963 /**
964 * @brief Get the instance type ID.
965 * @return instance type ID
966 */
967 TypeId GetInstanceTypeId() const override;
968
969 /**
970 * @brief Default constructor.
971 */
972 Icmpv6Echo();
973
974 /**
975 * @brief Constructor.
976 * @param request request or reply message
977 */
978 Icmpv6Echo(bool request);
979
980 /**
981 * @brief Destructor.
982 */
983 ~Icmpv6Echo() override;
984
985 /**
986 * @brief Get the ID of the packet.
987 * @return id
988 */
989 uint16_t GetId() const;
990
991 /**
992 * @brief Set the ID of the packet.
993 * @param id id to set
994 */
995 void SetId(uint16_t id);
996
997 /**
998 * @brief Get the sequence number.
999 * @return sequence number
1000 */
1001 uint16_t GetSeq() const;
1002
1003 /**
1004 * @brief Set the sequence number.
1005 * @param seq sequence to set
1006 */
1007 void SetSeq(uint16_t seq);
1008
1009 /**
1010 * @brief Print information.
1011 * @param os output stream
1012 */
1013 void Print(std::ostream& os) const override;
1014
1015 /**
1016 * @brief Get the serialized size.
1017 * @return serialized size
1018 */
1019 uint32_t GetSerializedSize() const override;
1020
1021 /**
1022 * @brief Serialize the packet.
1023 * @param start start offset
1024 */
1025 void Serialize(Buffer::Iterator start) const override;
1026
1027 /**
1028 * @brief Deserialize the packet.
1029 * @param start start offset
1030 * @return length of packet
1031 */
1032 uint32_t Deserialize(Buffer::Iterator start) override;
1033
1034 private:
1035 /**
1036 * @brief ID of the packet (to distinguish response between many ping program).
1037 */
1038 uint16_t m_id;
1039
1040 /**
1041 * @brief Sequence number (to distinguish response).
1042 */
1043 uint16_t m_seq;
1044};
1045
1046/**
1047 * @ingroup icmpv6
1048 *
1049 * @brief ICMPv6 Error Destination Unreachable header.
1050 */
1052{
1053 public:
1054 /**
1055 * @brief Constructor.
1056 */
1058
1059 /**
1060 * @brief Destructor.
1061 */
1063
1064 /**
1065 * @brief Get the UID of this class.
1066 * @return UID
1067 */
1068 static TypeId GetTypeId();
1069
1070 /**
1071 * @brief Get the instance type ID.
1072 * @return instance type ID
1073 */
1074 TypeId GetInstanceTypeId() const override;
1075
1076 /**
1077 * @brief Set the incorrect packet.
1078 * @param p the incorrect packet
1079 */
1080 void SetPacket(Ptr<Packet> p);
1081
1082 /**
1083 * @brief Print information.
1084 * @param os output stream
1085 */
1086 void Print(std::ostream& os) const override;
1087
1088 /**
1089 * @brief Get the serialized size.
1090 * @return serialized size
1091 */
1092 uint32_t GetSerializedSize() const override;
1093
1094 /**
1095 * @brief Serialize the packet.
1096 * @param start start offset
1097 */
1098 void Serialize(Buffer::Iterator start) const override;
1099
1100 /**
1101 * @brief Deserialize the packet.
1102 * @param start start offset
1103 * @return length of packet
1104 */
1105 uint32_t Deserialize(Buffer::Iterator start) override;
1106
1107 private:
1108 /**
1109 * @brief The incorrect Packet.
1110 */
1112};
1113
1114/**
1115 * @ingroup icmpv6
1116 *
1117 * @brief ICMPv6 Error Too Big header.
1118 */
1120{
1121 public:
1122 /**
1123 * @brief Constructor.
1124 */
1125 Icmpv6TooBig();
1126
1127 /**
1128 * @brief Destructor.
1129 */
1130 ~Icmpv6TooBig() override;
1131
1132 /**
1133 * @brief Get the UID of this class.
1134 * @return UID
1135 */
1136 static TypeId GetTypeId();
1137
1138 /**
1139 * @brief Get the instance type ID.
1140 * @return instance type ID
1141 */
1142 TypeId GetInstanceTypeId() const override;
1143
1144 /**
1145 * @brief Set the incorrect packet.
1146 * @param p the incorrect packet
1147 */
1148 void SetPacket(Ptr<Packet> p);
1149
1150 /**
1151 * @brief Get the MTU field.
1152 * @return MTU value
1153 */
1154 uint32_t GetMtu() const;
1155
1156 /**
1157 * @brief Set the MTU.
1158 * @param mtu the MTU
1159 */
1160 void SetMtu(uint32_t mtu);
1161
1162 /**
1163 * @brief Print information.
1164 * @param os output stream
1165 */
1166 void Print(std::ostream& os) const override;
1167
1168 /**
1169 * @brief Get the serialized size.
1170 * @return serialized size
1171 */
1172 uint32_t GetSerializedSize() const override;
1173
1174 /**
1175 * @brief Serialize the packet.
1176 * @param start start offset
1177 */
1178 void Serialize(Buffer::Iterator start) const override;
1179
1180 /**
1181 * @brief Deserialize the packet.
1182 * @param start start offset
1183 * @return length of packet
1184 */
1185 uint32_t Deserialize(Buffer::Iterator start) override;
1186
1187 private:
1188 /**
1189 * @brief the incorrect packet.
1190 */
1192
1193 /**
1194 * @brief The MTU value.
1195 */
1197};
1198
1199/**
1200 * @ingroup icmpv6
1201 *
1202 * @brief ICMPv6 Error Time Exceeded header.
1203 */
1205{
1206 public:
1207 /**
1208 * @brief Constructor.
1209 */
1211
1212 /**
1213 * @brief Destructor.
1214 */
1215 ~Icmpv6TimeExceeded() override;
1216
1217 /**
1218 * @brief Get the UID of this class.
1219 * @return UID
1220 */
1221 static TypeId GetTypeId();
1222
1223 /**
1224 * @brief Get the instance type ID.
1225 * @return instance type ID
1226 */
1227 TypeId GetInstanceTypeId() const override;
1228
1229 /**
1230 * @brief Set the incorrect packet.
1231 * @param p the incorrect packet
1232 */
1233 void SetPacket(Ptr<Packet> p);
1234
1235 /**
1236 * @brief Print information.
1237 * @param os output stream
1238 */
1239 void Print(std::ostream& os) const override;
1240
1241 /**
1242 * @brief Get the serialized size.
1243 * @return serialized size
1244 */
1245 uint32_t GetSerializedSize() const override;
1246
1247 /**
1248 * @brief Serialize the packet.
1249 * @param start start offset
1250 */
1251 void Serialize(Buffer::Iterator start) const override;
1252
1253 /**
1254 * @brief Deserialize the packet.
1255 * @param start start offset
1256 * @return length of packet
1257 */
1258 uint32_t Deserialize(Buffer::Iterator start) override;
1259
1260 private:
1261 /**
1262 * @brief The incorrect packet.
1263 */
1265};
1266
1267/**
1268 * @ingroup icmpv6
1269 *
1270 * @brief ICMPv6 Error Parameter Error header.
1271 */
1273{
1274 public:
1275 /**
1276 * @brief Constructor.
1277 */
1279
1280 /**
1281 * @brief Destructor.
1282 */
1283 ~Icmpv6ParameterError() override;
1284
1285 /**
1286 * @brief Get the UID of this class.
1287 * @return UID
1288 */
1289 static TypeId GetTypeId();
1290
1291 /**
1292 * @brief Get the instance type ID.
1293 * @return instance type ID
1294 */
1295 TypeId GetInstanceTypeId() const override;
1296
1297 /**
1298 * @brief Set the incorrect packet.
1299 * @param p the incorrect packet
1300 */
1301 void SetPacket(Ptr<Packet> p);
1302
1303 /**
1304 * @brief Get the pointer field.
1305 * @return pointer value
1306 */
1307 uint32_t GetPtr() const;
1308
1309 /**
1310 * @brief Set the pointer field.
1311 * @param ptr byte where the error is located in the incorrect packet
1312 */
1313 void SetPtr(uint32_t ptr);
1314
1315 /**
1316 * @brief Print information.
1317 * @param os output stream
1318 */
1319 void Print(std::ostream& os) const override;
1320
1321 /**
1322 * @brief Get the serialized size.
1323 * @return serialized size
1324 */
1325 uint32_t GetSerializedSize() const override;
1326
1327 /**
1328 * @brief Serialize the packet.
1329 * @param start start offset
1330 */
1331 void Serialize(Buffer::Iterator start) const override;
1332
1333 /**
1334 * @brief Deserialize the packet.
1335 * @param start start offset
1336 * @return length of packet
1337 */
1338 uint32_t Deserialize(Buffer::Iterator start) override;
1339
1340 private:
1341 /**
1342 * @brief The incorrect packet.
1343 */
1345
1346 /**
1347 * @brief The pointer field.
1348 */
1350};
1351
1352/**
1353 * @ingroup icmpv6
1354 *
1355 * @brief ICMPv6 MTU option.
1356 */
1358{
1359 public:
1360 /**
1361 * @brief Constructor.
1362 */
1364
1365 /**
1366 * @brief Constructor.
1367 * @param mtu MTU used.
1368 */
1370
1371 /**
1372 * @brief Destructor.
1373 */
1374 ~Icmpv6OptionMtu() override;
1375
1376 /**
1377 * @brief Get the UID of this class.
1378 * @return UID
1379 */
1380 static TypeId GetTypeId();
1381
1382 /**
1383 * @brief Get the instance type ID.
1384 * @return instance type ID
1385 */
1386 TypeId GetInstanceTypeId() const override;
1387
1388 /**
1389 * @brief Get the reserved field.
1390 * @return the reserved value
1391 */
1392 uint16_t GetReserved() const;
1393
1394 /**
1395 * @brief Set the reserved field.
1396 * @param reserved the reserved value
1397 */
1398 void SetReserved(uint16_t reserved);
1399
1400 /**
1401 * @brief Get the MTU.
1402 * @return the MTU value
1403 */
1404 uint32_t GetMtu() const;
1405
1406 /**
1407 * @brief Set the MTU.
1408 * @param mtu the MTU to set
1409 */
1410 void SetMtu(uint32_t mtu);
1411
1412 /**
1413 * @brief Print information.
1414 * @param os output stream
1415 */
1416 void Print(std::ostream& os) const override;
1417
1418 /**
1419 * @brief Get the serialized size.
1420 * @return serialized size
1421 */
1422 uint32_t GetSerializedSize() const override;
1423
1424 /**
1425 * @brief Serialize the packet.
1426 * @param start start offset
1427 */
1428 void Serialize(Buffer::Iterator start) const override;
1429
1430 /**
1431 * @brief Deserialize the packet.
1432 * @param start start offset
1433 * @return length of packet
1434 */
1435 uint32_t Deserialize(Buffer::Iterator start) override;
1436
1437 private:
1438 /**
1439 * @brief The reserved value
1440 */
1441 uint16_t m_reserved;
1442
1443 /**
1444 * @brief The MTU value.
1445 */
1447};
1448
1449/**
1450 * @ingroup icmpv6
1451 *
1452 * @brief ICMPv6 Option Prefix Information.
1453 */
1455{
1456 public:
1457 /**
1458 * @brief Constructor.
1459 */
1461
1462 /**
1463 * @brief Constructor.
1464 * @param network prefix
1465 * @param prefixlen prefix length
1466 */
1467 Icmpv6OptionPrefixInformation(Ipv6Address network, uint8_t prefixlen);
1468
1469 /**
1470 * @brief Destructor.
1471 */
1473
1474 /**
1475 * @brief Get the UID of this class.
1476 * @return UID
1477 */
1478 static TypeId GetTypeId();
1479
1480 /**
1481 * @brief Get the instance type ID.
1482 * @return instance type ID
1483 */
1484 TypeId GetInstanceTypeId() const override;
1485
1486 /**
1487 * @brief Icmpv6 Option Prefix Information flag field values
1488 */
1490 {
1491 NONE = 0, //!< No flags
1492 ROUTERADDR = 32, //!< Router Address
1493 AUTADDRCONF = 64, //!< Autonomous Address Configuration
1494 ONLINK = 128 //!< On-link
1495 };
1496
1497 /**
1498 * @brief Get the prefix length.
1499 * @return prefix length
1500 */
1501 uint8_t GetPrefixLength() const;
1502
1503 /**
1504 * @brief Set the prefix length.
1505 * @param prefixLength the prefix length
1506 */
1507 void SetPrefixLength(uint8_t prefixLength);
1508
1509 /**
1510 * @brief Get the flags.
1511 * @return the flags.
1512 */
1513 uint8_t GetFlags() const;
1514
1515 /**
1516 * @brief Set the flags.
1517 * @param flags the flags to set
1518 */
1519 void SetFlags(uint8_t flags);
1520
1521 /**
1522 * @brief Get the valid time of the information.
1523 * @return valid time
1524 */
1525 uint32_t GetValidTime() const;
1526
1527 /**
1528 * @brief Set the valid time of the information.
1529 * @param validTime valid time
1530 */
1531 void SetValidTime(uint32_t validTime);
1532
1533 /**
1534 * @brief Get the preferred time of the information.
1535 * @return preferred time
1536 */
1537 uint32_t GetPreferredTime() const;
1538
1539 /**
1540 * @brief Set the preferred time of the information.
1541 * @param preferredTime preferred time
1542 */
1543 void SetPreferredTime(uint32_t preferredTime);
1544
1545 /**
1546 * @brief Get the reserved field.
1547 * @return the reserved field (should be 0x00000000)
1548 */
1549 uint32_t GetReserved() const;
1550
1551 /**
1552 * @brief Set the reserved field (normally it will be 0x00000000).
1553 * @param reserved reserved value
1554 */
1555 void SetReserved(uint32_t reserved);
1556
1557 /**
1558 * @brief Get the IPv6 prefix.
1559 * @return IPv6 prefix
1560 */
1561 Ipv6Address GetPrefix() const;
1562
1563 /**
1564 * @brief Set the IPv6 prefix.
1565 * @param prefix the IPv6 prefix
1566 */
1567 void SetPrefix(Ipv6Address prefix);
1568
1569 /**
1570 * @brief Print information.
1571 * @param os output stream
1572 */
1573 void Print(std::ostream& os) const override;
1574
1575 /**
1576 * @brief Get the serialized size.
1577 * @return serialized size
1578 */
1579 uint32_t GetSerializedSize() const override;
1580
1581 /**
1582 * @brief Serialize the packet.
1583 * @param start start offset
1584 */
1585 void Serialize(Buffer::Iterator start) const override;
1586
1587 /**
1588 * @brief Deserialize the packet.
1589 * @param start start offset
1590 * @return length of packet
1591 */
1592 uint32_t Deserialize(Buffer::Iterator start) override;
1593
1594 private:
1595 /**
1596 * @brief The prefix value.
1597 */
1599
1600 /**
1601 * @brief The length of the prefix.
1602 */
1604
1605 /**
1606 * @brief The flags.
1607 */
1608 uint8_t m_flags;
1609
1610 /**
1611 * @brief The valid time.
1612 */
1614
1615 /**
1616 * @brief The preferred time.
1617 */
1619
1620 /**
1621 * @brief The reserved field.
1622 */
1624};
1625
1626/**
1627 * @ingroup icmpv6
1628 *
1629 * @brief ICMPv6 link-layer address option.
1630 */
1632{
1633 public:
1634 /**
1635 * @brief Constructor.
1636 * @param source source hardware address or target hardware address for the option
1637 */
1638 Icmpv6OptionLinkLayerAddress(bool source);
1639
1640 /**
1641 * @brief Get the UID of this class.
1642 * @return UID
1643 */
1644 static TypeId GetTypeId();
1645
1646 /**
1647 * @brief Get the instance type ID.
1648 * @return instance type ID
1649 */
1650 TypeId GetInstanceTypeId() const override;
1651
1652 /**
1653 * @brief Constructor.
1654 * @param source source hardware address or target hardware address for the option
1655 * @param addr hardware address
1656 */
1657 Icmpv6OptionLinkLayerAddress(bool source, Address addr);
1658
1659 /**
1660 * @brief Constructor.
1661 */
1663
1664 /**
1665 * @brief Destructor.
1666 */
1668
1669 /**
1670 * @brief Get the hardware address.
1671 * @return the hardware address
1672 */
1673 Address GetAddress() const;
1674
1675 /**
1676 * @brief Set the hardware address.
1677 * @param addr the address to set
1678 */
1679 void SetAddress(Address addr);
1680
1681 /**
1682 * @brief Print information.
1683 * @param os output stream
1684 */
1685 void Print(std::ostream& os) const override;
1686
1687 /**
1688 * @brief Get the serialized size.
1689 * @return serialized size
1690 */
1691 uint32_t GetSerializedSize() const override;
1692
1693 /**
1694 * @brief Serialize the packet.
1695 * @param start start offset
1696 */
1697 void Serialize(Buffer::Iterator start) const override;
1698
1699 /**
1700 * @brief Deserialize the packet.
1701 * @param start start offset
1702 * @return length of packet
1703 */
1704 uint32_t Deserialize(Buffer::Iterator start) override;
1705
1706 private:
1707 /**
1708 * @brief The hardware address.
1709 */
1711};
1712
1713/**
1714 * @ingroup icmpv6
1715 *
1716 * @brief ICMPv6 redirected option.
1717 */
1719{
1720 public:
1721 /**
1722 * @brief Get the UID of this class.
1723 * @return UID
1724 */
1725 static TypeId GetTypeId();
1726
1727 /**
1728 * @brief Get the instance type ID.
1729 * @return instance type ID
1730 */
1731 TypeId GetInstanceTypeId() const override;
1732
1733 /**
1734 * @brief Constructor.
1735 */
1737
1738 /**
1739 * @brief Destructor.
1740 */
1741 ~Icmpv6OptionRedirected() override;
1742
1743 /**
1744 * @brief Set the redirected packet.
1745 * @param packet the redirected packet
1746 */
1747 void SetPacket(Ptr<Packet> packet);
1748
1749 /**
1750 * @brief Print information.
1751 * @param os output stream
1752 */
1753 void Print(std::ostream& os) const override;
1754
1755 /**
1756 * @brief Get the serialized size.
1757 * @return serialized size
1758 */
1759 uint32_t GetSerializedSize() const override;
1760
1761 /**
1762 * @brief Serialize the packet.
1763 * @param start start offset
1764 */
1765 void Serialize(Buffer::Iterator start) const override;
1766
1767 /**
1768 * @brief Deserialize the packet.
1769 * @param start start offset
1770 * @return length of packet
1771 */
1772 uint32_t Deserialize(Buffer::Iterator start) override;
1773
1774 private:
1775 /**
1776 * @brief The redirected packet.
1777 */
1779};
1780
1781} /* namespace ns3 */
1782
1783#endif /* ICMPV6_HEADER_H */
uint32_t r
a polymophic address class
Definition address.h:114
iterator in a Buffer instance
Definition buffer.h:109
Protocol header serialization and deserialization.
Definition header.h:36
uint32_t GetSerializedSize() const override
Get the serialized size.
void SetPacket(Ptr< Packet > p)
Set the incorrect packet.
~Icmpv6DestinationUnreachable() override
Destructor.
void Print(std::ostream &os) const override
Print information.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
Ptr< Packet > m_packet
The incorrect Packet.
static TypeId GetTypeId()
Get the UID of this class.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
static TypeId GetTypeId()
Get the UID of this class.
void SetId(uint16_t id)
Set the ID of the packet.
uint16_t m_seq
Sequence number (to distinguish response).
Icmpv6Echo()
Default constructor.
~Icmpv6Echo() override
Destructor.
uint16_t m_id
ID of the packet (to distinguish response between many ping program).
uint16_t GetId() const
Get the ID of the packet.
void Print(std::ostream &os) const override
Print information.
void SetSeq(uint16_t seq)
Set the sequence number.
uint32_t GetSerializedSize() const override
Get the serialized size.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
uint16_t GetSeq() const
Get the sequence number.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
uint8_t GetCode() const
Get the code field.
OptionType_e
ICMPv6 Option type code.
@ ICMPV6_OPT_AUTHORITATIVE_BORDER_ROUTER
@ ICMPV6_OPT_EXTENDED_ADDRESS_REGISTRATION
ErrorDestinationUnreachable_e
ICMPv6 error code : Destination Unreachable.
uint8_t GetType() const
Get the type field.
Icmpv6Header()
Constructor.
uint8_t m_code
The code.
uint16_t GetChecksum() const
Get the checksum.
bool m_verifyChecksum
true if the checksum must be verified during Deserialize
TypeId GetInstanceTypeId() const override
Get the instance type ID.
uint16_t CalculateHeaderChecksum(uint16_t size) const
Calculate the partial checksum of the IPv6 pseudo header.
ErrorTimeExceeded_e
ICMPv6 error code : Time Exceeded.
static TypeId GetTypeId()
Get the UID of this class.
uint16_t m_checksum
The checksum.
Ipv6Address m_destination
Destination address of the IPv6 pseudo header.
void InitializeChecksum(Ipv6Address source, Ipv6Address destination)
Initialize the IPv6 pseudo header used for checksum verification.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
void SetCode(uint8_t code)
Set the code field.
Ipv6Address m_source
Source address of the IPv6 pseudo header.
uint8_t m_type
The type.
uint32_t GetSerializedSize() const override
Get the serialized size.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
void SetType(uint8_t type)
Set the type.
bool m_goodChecksum
true if the checksum is correct
Type_e
ICMPv6 type code.
@ ICMPV6_SECURE_ND_CERTIFICATE_PATH_ADVERTISEMENT
@ ICMPV6_MOBILITY_HA_DISCOVER_RESPONSE
@ ICMPV6_ERROR_DESTINATION_UNREACHABLE
@ ICMPV6_ND_DUPLICATE_ADDRESS_CONFIRM
@ ICMPV6_SECURE_ND_CERTIFICATE_PATH_SOLICITATION
@ ICMPV6_MOBILITY_HA_DISCOVER_REQUEST
@ ICMPV6_MOBILITY_MOBILE_PREFIX_SOLICITATION
@ ICMPV6_ND_DUPLICATE_ADDRESS_REQUEST
~Icmpv6Header() override
Destructor.
void SetChecksum(uint16_t checksum)
Set the checksum.
void CalculatePseudoHeaderChecksum(Ipv6Address src, Ipv6Address dst, uint16_t length)
Calculate pseudo header checksum for IPv6.
void Print(std::ostream &os) const override
Print information.
ErrorParameterError_e
ICMPv6 error code : Parameter Error.
bool IsChecksumOk() const
Checks if the message checksum is correct.
bool m_calcChecksum
Checksum enable or not.
bool GetFlagS() const
Get the S flag.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
bool m_flagS
The O flag.
uint32_t m_reserved
The reserved value.
~Icmpv6NA() override
Destructor.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
void SetFlagS(bool s)
Set the S flag.
void SetIpv6Target(Ipv6Address target)
Set the IPv6 target field.
void SetFlagR(bool r)
Set the R flag.
Ipv6Address GetIpv6Target() const
Get the IPv6 target field.
bool GetFlagR() const
Get the R flag.
uint32_t GetSerializedSize() const override
Get the serialized size.
bool GetFlagO() const
Get the O flag.
void SetFlagO(bool o)
Set the O flag.
Icmpv6NA()
Constructor.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
bool m_flagR
The R flag.
void SetReserved(uint32_t reserved)
Set the reserved field.
void Print(std::ostream &os) const override
Print information.
static TypeId GetTypeId()
Get the UID of this class.
Ipv6Address m_target
The IPv6 target address.
bool m_flagO
The M flag.
uint32_t GetReserved() const
Get the reserved field.
uint32_t m_reserved
The reserved value.
uint32_t GetSerializedSize() const override
Get the serialized size.
void SetIpv6Target(Ipv6Address target)
Set the IPv6 target field.
uint32_t GetReserved() const
Get the reserved field.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
static TypeId GetTypeId()
Get the UID of this class.
void Print(std::ostream &os) const override
Print information.
Ipv6Address m_target
The IPv6 target address.
void SetReserved(uint32_t reserved)
Set the reserved field.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
Ipv6Address GetIpv6Target() const
Get the IPv6 target field.
Icmpv6NS(Ipv6Address target)
Constructor.
~Icmpv6NS() override
Destructor.
Icmpv6NS()
Constructor.
void SetType(uint8_t type)
Set the type of the option.
Icmpv6OptionHeader()
Constructor.
void Print(std::ostream &os) const override
Print information.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
uint8_t m_len
The length.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
uint8_t m_type
The type.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
static TypeId GetTypeId()
Get the UID of this class.
uint8_t GetType() const
Get the type of the option.
~Icmpv6OptionHeader() override
Destructor.
void SetLength(uint8_t len)
Set the length of the option.
uint32_t GetSerializedSize() const override
Get the serialized size.
uint8_t GetLength() const
Get the length of the option in 8 bytes unit.
~Icmpv6OptionMtu() override
Destructor.
uint32_t GetSerializedSize() const override
Get the serialized size.
uint16_t m_reserved
The reserved value.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
void SetReserved(uint16_t reserved)
Set the reserved field.
uint32_t GetMtu() const
Get the MTU.
static TypeId GetTypeId()
Get the UID of this class.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
void Print(std::ostream &os) const override
Print information.
void SetMtu(uint32_t mtu)
Set the MTU.
uint32_t m_mtu
The MTU value.
Icmpv6OptionMtu()
Constructor.
uint16_t GetReserved() const
Get the reserved field.
uint32_t GetValidTime() const
Get the valid time of the information.
uint8_t m_prefixLength
The length of the prefix.
void SetReserved(uint32_t reserved)
Set the reserved field (normally it will be 0x00000000).
void SetValidTime(uint32_t validTime)
Set the valid time of the information.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
void SetPrefix(Ipv6Address prefix)
Set the IPv6 prefix.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
Ipv6Address GetPrefix() const
Get the IPv6 prefix.
void SetFlags(uint8_t flags)
Set the flags.
void Print(std::ostream &os) const override
Print information.
uint32_t GetSerializedSize() const override
Get the serialized size.
~Icmpv6OptionPrefixInformation() override
Destructor.
void SetPrefixLength(uint8_t prefixLength)
Set the prefix length.
Flags_t
Icmpv6 Option Prefix Information flag field values.
@ AUTADDRCONF
Autonomous Address Configuration.
Ipv6Address m_prefix
The prefix value.
uint32_t m_reserved
The reserved field.
uint8_t GetPrefixLength() const
Get the prefix length.
void SetPreferredTime(uint32_t preferredTime)
Set the preferred time of the information.
uint32_t m_preferredTime
The preferred time.
uint8_t GetFlags() const
Get the flags.
uint32_t GetReserved() const
Get the reserved field.
uint32_t m_validTime
The valid time.
static TypeId GetTypeId()
Get the UID of this class.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
uint32_t GetPreferredTime() const
Get the preferred time of the information.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
~Icmpv6OptionRedirected() override
Destructor.
Ptr< Packet > m_packet
The redirected packet.
void Print(std::ostream &os) const override
Print information.
uint32_t GetSerializedSize() const override
Get the serialized size.
static TypeId GetTypeId()
Get the UID of this class.
void SetPacket(Ptr< Packet > packet)
Set the redirected packet.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
uint32_t GetSerializedSize() const override
Get the serialized size.
uint32_t m_ptr
The pointer field.
void SetPacket(Ptr< Packet > p)
Set the incorrect packet.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
static TypeId GetTypeId()
Get the UID of this class.
void SetPtr(uint32_t ptr)
Set the pointer field.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
~Icmpv6ParameterError() override
Destructor.
void Print(std::ostream &os) const override
Print information.
Ptr< Packet > m_packet
The incorrect packet.
uint32_t GetPtr() const
Get the pointer field.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
void Print(std::ostream &os) const override
Print information.
Icmpv6RA()
Constructor.
void SetLifeTime(uint16_t l)
Set the node Life time (Neighbor Discovery).
bool m_flagM
The M flag.
uint32_t GetRetransmissionTime() const
Get the node Retransmission time (Neighbor Discovery).
bool m_flagO
The O flag.
void SetFlagH(bool h)
Set the H flag.
void SetRetransmissionTime(uint32_t r)
Set the node Retransmission time (Neighbor Discovery).
void SetCurHopLimit(uint8_t m)
Set the IPv6 maximum number of jumps.
void SetFlagO(bool o)
Set the O flag.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
void SetFlagM(bool m)
Set the M flag.
void SetReachableTime(uint32_t r)
Set the node Reachable time (Neighbor Discovery).
static TypeId GetTypeId()
Get the UID of this class.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
uint32_t m_RetransmissionTimer
The retransmission timer.
uint32_t GetSerializedSize() const override
Get the serialized size.
uint16_t GetLifeTime() const
Get the node Life time (Neighbor Discovery).
uint32_t GetReachableTime() const
Get the node Reachable time (Neighbor Discovery).
uint8_t GetCurHopLimit() const
Get the IPv6 maximum number of jumps.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
bool GetFlagO() const
Get the O flag.
uint16_t m_LifeTime
The lifetime value.
bool GetFlagM() const
Get the M flag.
uint8_t m_curHopLimit
The max jumps.
uint32_t m_ReachableTime
The reachable time value.
bool m_flagH
The H flag.
~Icmpv6RA() override
Destructor.
bool GetFlagH() const
Get the H flag.
void SetReserved(uint32_t reserved)
Set the reserved field.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
~Icmpv6RS() override
Destructor.
uint32_t GetReserved() const
Get the reserved field.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
uint32_t GetSerializedSize() const override
Get the serialized size.
uint32_t m_reserved
The reserved value.
static TypeId GetTypeId()
Get the UID of this class.
void Print(std::ostream &os) const override
Print information.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
Icmpv6RS()
Constructor.
Ipv6Address m_target
IPv6 target address.
Ipv6Address GetTarget() const
Get the IPv6 target address.
Ipv6Address m_destination
IPv6 destination address.
uint32_t GetReserved() const
Get the reserved field.
uint32_t GetSerializedSize() const override
Get the serialized size.
~Icmpv6Redirection() override
Destructor.
void Print(std::ostream &os) const override
Print information.
Icmpv6Redirection()
Constructor.
void SetDestination(Ipv6Address destination)
Set the IPv6 destination address.
void SetReserved(uint32_t reserved)
Set the reserved field.
Ipv6Address GetDestination() const
Get the IPv6 destination address.
void SetTarget(Ipv6Address target)
Set the IPv6 target address.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
static TypeId GetTypeId()
Get the UID of this class.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
uint32_t m_reserved
Reserved value.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
uint32_t GetSerializedSize() const override
Get the serialized size.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
void SetPacket(Ptr< Packet > p)
Set the incorrect packet.
~Icmpv6TimeExceeded() override
Destructor.
Icmpv6TimeExceeded()
Constructor.
static TypeId GetTypeId()
Get the UID of this class.
void Print(std::ostream &os) const override
Print information.
Ptr< Packet > m_packet
The incorrect packet.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
static TypeId GetTypeId()
Get the UID of this class.
void SetMtu(uint32_t mtu)
Set the MTU.
void Print(std::ostream &os) const override
Print information.
Ptr< Packet > m_packet
the incorrect packet.
Icmpv6TooBig()
Constructor.
TypeId GetInstanceTypeId() const override
Get the instance type ID.
uint32_t GetSerializedSize() const override
Get the serialized size.
~Icmpv6TooBig() override
Destructor.
void SetPacket(Ptr< Packet > p)
Set the incorrect packet.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
uint32_t m_mtu
The MTU value.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
uint32_t GetMtu() const
Get the MTU field.
Describes an IPv6 address.
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
a unique identifier for an interface.
Definition type-id.h:50
Every class exported by the ns3 library is enclosed in the ns3 namespace.