1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // icmp6_hdr.h - ICMPv6 header structure
15 // This module defines the basic classes for accessing the header
16 // structures within ICMPv6 packets.
23 @ingroup ip_packet_formats
28 #ifndef __ICMP6_HDR_H__
29 #define __ICMP6_HDR_H__
33 #include <in_sock.h> // IPv6 enhanced in_sock.h
35 #ifdef SYMBIAN_TCPIPDHCP_UPDATE
36 //RFC 5006 definitions
37 #define RDNSSADDRSIZE 16
38 #define RDNSSOPTION_HDRLENGTH 8
39 #define RDNSS_MAX_ADDRESS 4 //4 DNS address shall be processed from RDNSS Option available in RA
40 #endif //SYMBIAN_TCPIPDHCP_UPDATE
43 * @addtogroup ip_packet_formats
48 class TInet6HeaderICMP
50 * ICMPv6 header common part layout.
52 * The basic ICMP header format only covers the common part (4 bytes)
53 * and 4 bytes of the Message Body (can be accesses as "Parameter")
55 Extract from RFC-2462: General format of ICMP message
58 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
59 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
60 | Type | Code | Checksum |
61 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
71 inline TInt HeaderLength() const
73 * Gets the header length.
76 * This length is not the true length of the
77 * ICMP header. This only covers the fixed part.
79 * @return Header length.
82 inline static TInt MinHeaderLength()
84 * Gets the minimum header length.
86 * @return Minimum header length
89 inline static TInt MaxHeaderLength()
91 * Gets the maximum header length.
94 * This length is not the true length of the
95 * ICMP header. This only covers the fixed part.
97 * @return Maximum header length
100 inline TUint8 *EndPtr() const
102 * Gets a pointer to the byte following the header.
105 * Pointer to the byte following the minimum
108 {return (TUint8 *)i + HeaderLength();}
110 // Access, get ICMP header field values from the packet
112 inline TUint8 Type() const
114 * Gets the ICMPv6 type from the header.
115 * @return ICMPv6 type [0..255]
120 inline TUint8 Code() const
122 * Gets the ICMPv6 code from the header.
123 * @return ICMPv6 code [0..255]
128 inline TInt Checksum() const
130 * Gets the Checksum from the header.
131 * @return Header Checksum (TUint16 in NETWORK byte order)
134 // Checksum is used in network byte order
135 return *((TUint16 *)&i[2]);
137 inline TUint32 Parameter() const
139 * Gets the ICMPv6 Parameter.
141 * Accesses the first 4 bytes of ICMP message body, and assumes
142 * they form a 32 bit integer in network byte order. Returns
143 * this integer in host order.
145 * @return ICMPv6 Parameter (as an integer)
148 return (i[4] << 24) | (i[5] << 16) | (i[6] << 8) | i[7];
151 // Build, set IP header field values into the packet
153 inline void SetType(TUint8 aType)
155 * Sets the ICMPv6 type.
156 * @param aType ICMPv6 type [0..255]
161 inline void SetCode(TUint8 aCode)
163 * Sets the ICMPv6 code.
164 * @param aCode ICMPv6 code [0..255]
169 inline void SetChecksum(TInt aSum)
174 * The Checksum [0..65535] (16 least significant bits
175 * stored as is (assumed to be in NETWORK byte order).
178 *((TUint16 *)&i[2]) = (TUint16)aSum;
180 inline void SetParameter(TUint32 aValue)
182 * Sets the ICMPv6 Parameter.
184 * The value is converted into network byte order and
185 * stored as the first 4 bytes of the ICMP message body.
191 i[7] = (TUint8)aValue;
192 i[6] = (TUint8)(aValue >> 8);
193 i[5] = (TUint8)(aValue >> 16);
194 i[4] = (TUint8)(aValue >> 24);
201 TUint32 iAlign; // A dummy member to force the 4 byte alignment
207 // TInet6HeaderICMP_Echo
209 class TInet6HeaderICMP_Echo : public TInet6HeaderICMP
211 * ICMPv6 Echo Request and Echo Reply layout.
213 * Describes the ICMP Echo Request and Replay layout. The space for
214 * Identifier and Sequence is already covered by the base class.
220 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
221 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
222 | Type | Code | Checksum |
223 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
224 | Identifier | Sequence Number |
225 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
237 inline TInt HeaderLength() const
239 * Gets the header length.
243 inline static TInt MinHeaderLength()
245 * Gets the minimum header length.
249 inline static TInt MaxHeaderLength()
251 * Gets the maximum header length.
257 // Access, get ICMP header field values from the packet
259 inline TInt Identifier() const
261 * Gets the Idenfifier
262 * @return The Identifier
265 return (i[4] << 8) + i[5];
267 inline TInt Sequence() const
269 * Gets the Sequence Number
273 return (i[6] << 8) + i[7];
276 // Build, set IP header field values into the packet
278 inline void SetIdentifier(TUint16 aIdentifier)
280 * Sets the Idenfifier
281 * @param aIdentifier The Identifier
284 i[4] = (TUint8)(aIdentifier >> 8);
285 i[5] = (TUint8)aIdentifier;
287 inline void SetSequence(TUint16 aSequence)
289 * Sets the Sequence Number
290 * @param aSequence The number
293 i[6] = (TUint8)(aSequence >> 8);
294 i[7] = (TUint8)aSequence;
300 class TInet6HeaderICMP_RouterSol: public TInet6HeaderICMP
302 * ICMPv6 Router Solicitation layout.
305 Router Solicitation Message Format (from RFC-2461)
308 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
309 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
310 | Type | Code | Checksum |
311 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
313 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
315 +-+-+-+-+-+-+-+-+-+-+-+-
317 * Aside from the fields provided by the base class, there is nothing
322 * - #KInet6OptionICMP_SourceLink
329 inline static TInt MinHeaderLength() {return 8; }
330 inline static TInt MaxHeaderLength() {return 8; }
331 inline TInt HeaderLength() const {return 8;}
334 // Router Advertisement Message Format from RFC-2461
335 class TInet6HeaderICMP_RouterAdv : public TInet6HeaderICMP
337 * ICMPv6 Router Advertisement layout.
339 * (Neighbour Discovery for IP version 6)
340 * (+ Home Agent flag from draft-ietf-mobileip-ipv6-08)
345 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
346 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
347 | Type | Code | Checksum |
348 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
349 | Cur Hop Limit |M|O|H|Prf|Rsrvd| Router Lifetime |
350 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
352 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
354 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
356 +-+-+-+-+-+-+-+-+-+-+-+-
360 * Above is longer thant what is declared in the base class
361 * i-member. The user must verify the sufficient length of
362 * the packet, when using this.
366 * - #KInet6OptionICMP_SourceLink
367 * - #KInet6OptionICMP_Mtu
368 * - #KInet6OptionICMP_Prefix
369 * - #KInet6OptionICMP_RouteInformation (draft)
379 inline static TInt MinHeaderLength() {return 16; }
380 inline static TInt MaxHeaderLength() {return 16; }
381 inline TInt HeaderLength() const {return 16;}
383 // Access, get ICMP header field values from the packet
385 inline TInt CurHopLimit() const
387 * Gets Cur Hop Limit.
393 inline TInt Flags() const
396 * @return Flags (M, O, H, Prf and Rsrvd)
399 return i[5]; // M + O + Reserved as one unit
401 inline TInt M() const
402 /** Gets Managed Address Configuration (M) flag */
406 inline TInt O() const
407 /** Gets Other Address Configuartion (O) flag */
411 inline TInt H() const
412 /** Gets Home Agent Configuration (H) flag */
417 inline TInt Prf() const
419 * Gets default route preference.
421 * Experimental: draft-draves-ipngwg-router-selection-01.txt
422 * Default Router Preferences and More-Specific Routes
425 return (i[5] >> 3) & 0x3; // should be treated as 2bit signed int
428 inline TInt RouterLifetime() const
430 * Gets the lifetime of the defaul route.
432 * If non-zero, specifies how long (in seconds) this
433 * router is willing to act as a default router.
435 * @return The life time of the default route.
438 * This is badly named. The parameter controls
439 * only the default route processing. The value
440 * ZERO does not mean that the sender is not a
444 return (i[6] << 8) + i[7];
446 inline TUint32 ReachableTime() const
448 * Gets the value of reachable timer.
451 // coverity[overrun-local]
452 return (i[8] << 24) | (i[9] << 16) | (i[10] << 8) | i[11];
454 inline TUint32 RetransTimer() const
456 * Gets the value of retransmit timer.
459 // coverity[overrun-local]
460 return (i[12] << 24) | (i[13] << 16) | (i[14] << 8) | i[15];
463 // Build, set IP header field values into the packet
465 inline void SetCurHopLimit(TInt aLimit)
467 * Sets the Cur Hoplimit.
468 * @param aLimit The Hoplimit [0..255]
471 i[4] = (TUint8)aLimit;
473 inline void SetFlags(TInt aFlags)
476 * @param aFlags The flags bits [0..255].
479 i[5] = (TUint8)aFlags;
481 inline void SetRouterLifetime(TInt aTime)
483 * Sets the lifetime of the default route.
484 * @param aTime The lifetime.
487 i[7] = (TUint8)aTime;
488 i[6] = (TUint8)(aTime >> 8);
490 inline void SetReachableTime(TUint32 aTime)
492 * Sets the value of reachable timer
493 * @param aTime The timer value
496 // coverity[overrun-local]
497 i[11] = (TUint8)aTime;
498 // coverity[overrun-local]
499 i[10] = (TUint8)(aTime >> 8);
500 // coverity[overrun-local]
501 i[9] = (TUint8)(aTime >> 16);
502 // coverity[overrun-local]
503 i[8] = (TUint8)(aTime >> 24);
505 inline void SetRetransTimer(TUint32 aTimer)
507 * Sets the value of the retransmit timer
508 * @param aTimer The timer value
511 // coverity[overrun-local]
512 i[15] = (TUint8)aTimer;
513 // coverity[overrun-local]
514 i[14] = (TUint8)(aTimer >> 8);
515 // coverity[overrun-local]
516 i[13] = (TUint8)(aTimer >> 16);
517 // coverity[overrun-local]
518 i[12] = (TUint8)(aTimer >> 24);
524 class TInet6HeaderICMP_NeighborSol : public TInet6HeaderICMP
526 * ICMPv6 Neighbour Solicitation layout.
528 Neigbour Solicitation Message Format from RFC-2461
531 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
532 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
533 | Type | Code | Checksum |
534 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
536 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
544 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
546 +-+-+-+-+-+-+-+-+-+-+-+-
550 * Above is longer thant what is declared in the base class
551 * i-member. The user must verify the sufficient length of
552 * the packet, when using this.
556 * - #KInet6OptionICMP_SourceLink
566 inline static TInt MinHeaderLength() {return 24; }
567 inline static TInt MaxHeaderLength() {return 24; }
568 inline TInt HeaderLength() const {return 24;}
569 inline TIp6Addr &Target() const
571 * Gets the Target Address.
573 * @return The target address (reference).
576 return (TIp6Addr &)i[8];
582 class TInet6HeaderICMP_NeighborAdv : public TInet6HeaderICMP
584 * ICMPv6 Neighbour Advertisement layout.
586 Neighbor Advertisement Message Format (from RFC-2461)
589 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
590 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
591 | Type | Code | Checksum |
592 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
594 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
602 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
604 +-+-+-+-+-+-+-+-+-+-+-+-
607 * Above is longer thant what is declared in the base class
608 * i-member. The user must verify the sufficient length of
609 * the packet, when using this.
613 * - #KInet6OptionICMP_TargetLink
623 inline static TInt MinHeaderLength() {return 24; }
624 inline static TInt MaxHeaderLength() {return 24; }
625 inline TInt HeaderLength() const {return 24;}
628 // Set and Access the Target Address
630 inline TIp6Addr &Target() const
632 * Gets the Target Address.
634 * @return The target address (reference).
637 return (TIp6Addr &)i[8];
652 inline void SetR(TInt aValue)
654 if (aValue) i[4] |= 0x80; else i[4] &= ~0x80;
656 inline void SetS(TInt aValue)
658 if (aValue) i[4] |= 0x40; else i[4] &= ~0x40;
660 inline void SetO(TInt aValue)
662 if (aValue) i[4] |= 0x20; else i[4] &= ~0x20;
668 class TInet6HeaderICMP_Redirect : public TInet6HeaderICMP
670 * ICMPv6 Redirect layout.
672 Redirect Message Format (RFC-2461)
675 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
676 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
677 | Type | Code | Checksum |
678 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
680 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
688 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
692 + Destination Address +
696 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
698 +-+-+-+-+-+-+-+-+-+-+-+-
702 * Above is longer thant what is declared in the base class
703 * i-member. The user must verify the sufficient length of
704 * the packet, when using this.
708 * - #KInet6OptionICMP_TargetLink
709 * - #KInet6OptionICMP_Redirect
719 inline static TInt MinHeaderLength() {return 40; }
720 inline static TInt MaxHeaderLength() {return 40; }
721 inline TInt HeaderLength() const {return 40;}
723 inline TIp6Addr &Target() const
725 * Gets the Target Address.
727 * @return The target address (reference).
730 return (TIp6Addr &)i[8];
732 inline TIp6Addr &Destination() const
734 * Gets the Destination Address.
736 * @return The destination address (reference).
739 return (TIp6Addr &)i[24];
744 class TInet6OptionICMP_LinkLayer
746 * ICMPv6 Link-layer Address layout.
748 Source/Target Link-layer Address Option (RFC-2461)
751 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
752 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
753 | Type | Length | Link-Layer Address ...
754 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
761 inline static TInt MinHeaderLength() {return 8; }
762 inline static TInt MaxHeaderLength() {return 8; } // Not very useful
763 inline TInt HeaderLength() const {return Length() * 8; }
767 inline TInt Type() const
771 inline TInt Length() const
778 inline TPtr8 Address() const
780 return TPtr8((TUint8 *)&i[2], i[1] * 8 - 2, i[1] * 8 - 2);
785 inline void SetType(TInt aType)
787 i[0] = (TUint8)aType;
789 inline void SetLength(TInt aLength)
791 i[1] = (TUint8)aLength;
797 TUint32 iAlign; // A dummy member to force the 4 byte alignment
802 class TInet6OptionICMP_Prefix
804 * ICMPv6 Prefix Infotmation Option.
806 Prefix Information Option (RFC-2461)
807 (+ Router Address flag from draft-ietf-mobileip-ipv6-08)
809 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
810 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
811 | Type | Length | Prefix Length |L|A|R| Rsrvd1 |
812 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
814 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
815 | Preferred Lifetime |
816 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
818 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
826 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
834 inline static TInt MinHeaderLength() {return 4*8; }
835 inline static TInt MaxHeaderLength() {return 4*8; } // Not very useful
836 inline TInt HeaderLength() const {return 4*8; }
838 inline TInt Type() const
842 inline TInt Length() const
846 inline TInt PrefixLength() const
848 return i[2]; // 0..128
850 inline TInt LFlag() const
854 inline TInt AFlag() const
858 inline TInt RFlag() const
862 inline TUint32 ValidLifetime() const
864 return (i[4] << 24) | (i[5] << 16) | (i[6] << 8) | i[7];
866 inline TUint32 PreferredLifetime() const
868 return (i[8] << 24) | (i[9] << 16) | (i[10] << 8) | i[11];
872 inline TIp6Addr &Prefix() const
874 return (TIp6Addr &)i[16];
879 inline void SetType(TInt aType)
881 i[0] = (TUint8)aType;
883 inline void SetLength(TInt aLength)
885 i[1] = (TUint8)aLength;
887 inline void SetPrefixLength(TInt aLength)
889 i[2] = (TUint8)aLength;
891 inline void SetFlags(TInt aFlags)
893 i[3] = (TUint8)aFlags;
895 inline void SetValidLifetime(TUint32 aTime)
897 i[7] = (TUint8)aTime;
898 i[6] = (TUint8)(aTime >> 8);
899 i[5] = (TUint8)(aTime >> 16);
900 i[4] = (TUint8)(aTime >> 24);
902 inline void SetPreferredLifetime(TUint32 aTime)
904 i[11] = (TUint8)aTime;
905 i[10] = (TUint8)(aTime >> 8);
906 i[9] = (TUint8)(aTime >> 16);
907 i[8] = (TUint8)(aTime >> 24);
909 inline void SetReserved2(TUint32 aFiller)
911 i[15] = (TUint8)aFiller;
912 i[14] = (TUint8)(aFiller >> 8);
913 i[13] = (TUint8)(aFiller >> 16);
914 i[12] = (TUint8)(aFiller >> 24);
922 TUint32 iAlign; // A dummy member to force the 4 byte alignment
927 class TInet6OptionICMP_Mtu
931 MTU Option (RFC-2461)
934 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
935 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
936 | Type | Length | Reserved |
937 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
939 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
946 inline static TInt MinHeaderLength() {return 8; }
947 inline static TInt MaxHeaderLength() {return 8; } // Not very useful
948 inline TInt HeaderLength() const {return 8; }
950 inline TInt Type() const
954 inline TInt Length() const
958 inline TInt Mtu() const
960 return (i[4] << 24) | (i[5] << 16) | (i[6] << 8) | i[7];
965 inline void SetType(TInt aType)
967 i[0] = (TUint8)aType;
969 inline void SetLength(TInt aLength)
971 i[1] = (TUint8)aLength;
972 // Silently ZERO the reserved bits... not too nice --- msa
976 inline void SetMtu(TUint32 aMtu)
979 i[6] = (TUint8)(aMtu >> 8);
980 i[5] = (TUint8)(aMtu >> 16);
981 i[4] = (TUint8)(aMtu >> 24);
989 class TInet6OptionICMP_RouteInformation
990 // Route Information Option
991 // Experimental: draft-draves-ipngwg-router-selection-01.txt
993 * ICMPv6 Route Information Option.
995 Default Router Preferences and More-Specific Routes
998 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
999 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1000 | Type | Length | Prefix Length |Resvd|Prf|Resvd|
1001 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1003 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1011 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1018 inline static TInt MinHeaderLength() {return 8; }
1019 inline static TInt MaxHeaderLength() {return 3*8; }
1020 inline TInt HeaderLength() const {return Length()*8; }
1022 inline TInt Type() const
1026 inline TInt Length() const
1030 inline TInt PrefixLength() const
1032 return i[2]; // 0..128
1034 inline TInt Prf() const
1036 return (i[3] >> 3) & 0x3; // should be treated as 2bit signed int
1038 inline TUint32 RouteLifetime() const
1040 return (i[4] << 24) | (i[5] << 16) | (i[6] << 8) | i[7];
1043 // *WARNING* The "Prefix" returns a raw reference to the beginning
1044 // of the prefix field in the option structure. HOWEVER, the option
1045 // field can be shorter than 128 bits! If used to allocate space,
1046 // the maximum is allocated and the method is safe, but that is not
1047 // true if header is mapped directly to the received packet! -- msa
1048 inline TIp6Addr &Prefix() const
1050 return (TIp6Addr &)i[8];
1053 // Construct methods
1055 inline void SetType(TInt aType)
1057 i[0] = (TUint8)aType;
1059 inline void SetLength(TInt aLength)
1061 i[1] = (TUint8)aLength;
1063 inline void SetPrefixLength(TInt aLength)
1065 i[2] = (TUint8)aLength;
1067 inline void SetPrefixLifetime(TUint32 aTime)
1069 i[7] = (TUint8)aTime;
1070 i[6] = (TUint8)(aTime >> 8);
1071 i[5] = (TUint8)(aTime >> 16);
1072 i[4] = (TUint8)(aTime >> 24);
1078 TUint8 i[3*8]; // The space allocated for MAX LENGTH
1079 TUint32 iAlign; // A dummy member to force the 4 byte alignment
1083 class TInet6OptionICMP_DnsInformation
1085 * ICMPv6 Recursive DNS Server Option.
1086 * IPv6 DNS Configuration based on Router Advertisement
1088 * Experimental: draft-jeong-dnsop-ipv6-discovery-03.txt
1090 Recursive DNS Server Option
1093 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
1094 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1095 | Type | Length | Pref | Reserved |
1096 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1098 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1100 : IPv6 Address of RDNSS :
1102 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1110 inline static TInt MinHeaderLength() {return 24; }
1111 inline static TInt MaxHeaderLength() {return 24; }
1112 inline TInt HeaderLength() const {return Length()*8; }
1114 inline TInt Type() const
1118 inline TInt Length() const
1122 inline TInt Pref() const
1124 return (i[3] >> 4) & 0xF;
1126 inline TUint32 Lifetime() const
1128 return (i[4] << 24) | (i[5] << 16) | (i[6] << 8) | i[7];
1130 inline TIp6Addr &Address() const
1132 return (TIp6Addr &)i[8];
1135 // Construct methods
1137 inline void SetType(TInt aType)
1139 i[0] = (TUint8)aType;
1141 inline void SetLength(TInt aLength)
1143 i[1] = (TUint8)aLength;
1145 inline void SetPref(TInt aPref)
1147 i[2] = (TUint8)(((aPref << 4) & 0xF0) | (i[2] & 0xF));
1149 inline void SetLifetime(TUint32 aTime)
1151 i[7] = (TUint8)aTime;
1152 i[6] = (TUint8)(aTime >> 8);
1153 i[5] = (TUint8)(aTime >> 16);
1154 i[4] = (TUint8)(aTime >> 24);
1160 TUint8 i[24]; // The space allocated for MAX LENGTH
1161 TUint32 iAlign; // A dummy member to force the 4 byte alignment
1165 #ifdef SYMBIAN_TCPIPDHCP_UPDATE
1166 class TInet6OptionICMP_DnsInformationV1
1168 * ICMPv6 Recursive DNS Server Option(RFC-5006)
1169 * IPv6 DNS Configuration based on Router Advertisement
1173 Recursive DNS Server Option
1176 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
1177 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1178 | Type | Length | Reserved |
1179 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1181 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1183 : IPv6 Address of RDNSS :
1185 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1193 inline static TInt MinRdnssOptionLength() {return RDNSSOPTION_HDRLENGTH + RDNSSADDRSIZE;}//24
1195 inline static TInt MaxRdnssOptionLength() {return RDNSSOPTION_HDRLENGTH + (RDNSSADDRSIZE*RDNSS_MAX_ADDRESS); }//72
1197 inline TInt HeaderLength() const {return RDNSSOPTION_HDRLENGTH;}//8
1199 inline TInt Type() const
1203 inline TInt Length() const
1207 inline TUint32 Lifetime() const
1209 return (i[4] << 24) | (i[5] << 16) | (i[6] << 8) | i[7];
1211 inline TIp6Addr &Address() const
1213 return (TIp6Addr &)i[8];
1215 inline TIp6Addr &GetNextAddress(TInt aOffset) const
1217 return (TIp6Addr &)i[aOffset];
1222 TUint8 i[RDNSSOPTION_HDRLENGTH + (RDNSSADDRSIZE * RDNSS_MAX_ADDRESS)]; // The space allocated for MAX LENGTH of 4 DNS address
1223 TUint32 iAlign; // A dummy member to force the 4 byte alignment
1226 #endif //SYMBIAN_TCPIPDHCP_UPDATE
1230 * @name ICMPv6 Error Message Types (0-127)
1233 const TUint8 KInet6ICMP_Unreachable = 1;
1234 const TUint8 KInet6ICMP_PacketTooBig = 2;
1235 const TUint8 KInet6ICMP_TimeExceeded = 3;
1236 const TUint8 KInet6ICMP_ParameterProblem= 4;
1239 * @name ICMPv6 Informational Message Types (128-255)
1242 /** Echo Request. See TInet6HeaderICMP_Echo. */
1243 const TUint8 KInet6ICMP_EchoRequest = 128;
1244 /** Echo Reply. See TInet6HeaderICMP_Echo. */
1245 const TUint8 KInet6ICMP_EchoReply = 129;
1246 /** Not implemented. */
1247 const TUint8 KInet6ICMP_GroupQuery = 130;
1248 /** Not implemented. */
1249 const TUint8 KInet6ICMP_GroupReport = 131;
1250 /** Not implemented. */
1251 const TUint8 KInet6ICMP_GroupDone = 132;
1252 /** Router Solicitation. See TInet6HeaderICMP_RouterSol. */
1253 const TUint8 KInet6ICMP_RouterSol = 133;
1254 /** Router Advertisement. See TInet6HeaderICMP_RouterAdv. */
1255 const TUint8 KInet6ICMP_RouterAdv = 134;
1256 /** Neighbor Solicitation. See TInet6HeaderICMP_NeighborSol. */
1257 const TUint8 KInet6ICMP_NeighborSol = 135;
1258 /** Neighbor Advertisement. See TInet6HeaderICMP_NeighborAdv. */
1259 const TUint8 KInet6ICMP_NeighborAdv = 136;
1260 /** Redirect. See TInet6HeaderICMP_Redirect. */
1261 const TUint8 KInet6ICMP_Redirect = 137;
1265 * @name ICMPv6 Option types.
1266 * The default derivation of the symbol
1267 * is from the name of the header class by replacing 'T' with 'K' (or
1272 /** Source Link-Layer Address. See TInet6OptionICMP_LinkLayer. */
1273 const TInt KInet6OptionICMP_SourceLink = 1;
1274 /** Target Link-Layer Address. See TInet6OptionICMP_LinkLayer. */
1275 const TInt KInet6OptionICMP_TargetLink = 2;
1276 /** Prefix Information. See TInet6OptionICMP_Prefix. */
1277 const TInt KInet6OptionICMP_Prefix = 3;
1278 /** Redirect Header. (not implemented). */
1279 const TInt KInet6OptionICMP_Redirect = 4;
1280 /** MTU. See TInet6OptionICMP_Mtu. */
1281 const TInt KInet6OptionICMP_Mtu = 5;
1282 #ifdef SYMBIAN_TCPIPDHCP_UPDATE
1283 /** RFC 5006: Recursive DNS Server Option. See TInet6OptionICMP_DnsInformationV1*/
1284 const TInt KInet6OptionICMP_RDNSS = 25;
1285 #endif //SYMBIAN_TCPIPDHCP_UPDATE
1287 // Experimental: draft-draves-ipngwg-router-selection-01.txt
1288 // Default Router Preferences and More-Specific Routes
1289 // *UNOFFICIAL NUMBER ASSIGNMENT (SAME AS MSR STACK)--REAL VALUE TBD*
1290 /** Route Information. See TInet6OptionICMP_RouteInformation. */
1291 const TInt KInet6OptionICMP_RouteInformation = 9;