epoc32/include/icmp6_hdr.h
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
       
     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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // icmp6_hdr.h - ICMPv6 header structure
       
    15 // This module defines the basic classes for accessing the header
       
    16 // structures within ICMPv6 packets.
       
    17 //
       
    18 
       
    19 
       
    20 
       
    21 /**
       
    22  @file icmp6_hdr.h
       
    23  @ingroup ip_packet_formats
       
    24  @publishedAll
       
    25  @released
       
    26 */
       
    27 
       
    28 #ifndef __ICMP6_HDR_H__
       
    29 #define __ICMP6_HDR_H__
       
    30 
       
    31 #include <e32def.h>
       
    32 #include "in_hdr.h"
       
    33 #include <in_sock.h> // IPv6 enhanced in_sock.h
       
    34 
       
    35 /**
       
    36 * @addtogroup ip_packet_formats
       
    37 */
       
    38 //@{
       
    39 
       
    40 // TInet6HeaderICMP
       
    41 class TInet6HeaderICMP
       
    42 /**
       
    43 * ICMPv6 header common part layout.
       
    44 *
       
    45 * The basic ICMP header format only covers the common part (4 bytes)
       
    46 * and 4 bytes of the Message Body (can be accesses as "Parameter")
       
    47 @verbatim
       
    48 Extract from RFC-2462: General format of ICMP message
       
    49 
       
    50  0                   1                   2                   3
       
    51  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
       
    52 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
    53 |     Type      |     Code      |          Checksum             |
       
    54 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
    55 |                                                               |
       
    56 +                         Message Body                          +
       
    57 |                                                               |
       
    58 @endverbatim
       
    59 * @publishedAll
       
    60 * @released
       
    61 */
       
    62 	{
       
    63 public:
       
    64 	inline TInt HeaderLength() const
       
    65 		/**
       
    66 		* Gets the header length.	
       
    67 		* 
       
    68 		* @note
       
    69 		*	This length is not the true length of the
       
    70 		*	ICMP header. This only covers the fixed part.
       
    71 		* 
       
    72 		* @return	Header length.
       
    73 		*/
       
    74 		{return 4;}
       
    75 	inline static TInt MinHeaderLength()
       
    76 		/**
       
    77 		* Gets the minimum header length.
       
    78 		* 
       
    79 		* @return	Minimum header length
       
    80 		*/
       
    81 		{return 4; }
       
    82 	inline static TInt MaxHeaderLength()
       
    83 		/**
       
    84 		* Gets the maximum header length.
       
    85 		* 
       
    86 		* @note
       
    87 		*	This length is not the true length of the
       
    88 		*	ICMP header. This only covers the fixed part.
       
    89 		* 
       
    90 		* @return	Maximum header length
       
    91 		*/
       
    92 		{return 4; }
       
    93 	inline TUint8 *EndPtr() const
       
    94 		/**
       
    95 		* Gets a pointer to the byte following the header.
       
    96 		* 
       
    97 		* @return
       
    98 		*	Pointer to the byte following the minimum
       
    99 		*	fixed header
       
   100 		*/
       
   101 		{return (TUint8 *)i + HeaderLength();}
       
   102 	//
       
   103 	// Access, get ICMP header field values from the packet
       
   104 	//
       
   105 	inline TUint8 Type() const
       
   106 		/**
       
   107 		* Gets the ICMPv6 type from the header.
       
   108 		* @return ICMPv6 type [0..255]
       
   109 		*/
       
   110 		{
       
   111 		return i[0];
       
   112 		}
       
   113 	inline TUint8 Code() const
       
   114 		/**
       
   115 		* Gets the ICMPv6 code from the header.
       
   116 		* @return ICMPv6 code [0..255]
       
   117 		*/
       
   118 		{
       
   119 		return i[1];
       
   120 		}
       
   121 	inline TInt Checksum() const
       
   122 		/**
       
   123 		* Gets the Checksum from the header.
       
   124 		* @return Header Checksum (TUint16 in NETWORK byte order)
       
   125 		*/
       
   126 		{
       
   127 		// Checksum is used in network byte order
       
   128 		return *((TUint16 *)&i[2]);
       
   129 		}
       
   130 	inline TUint32 Parameter() const
       
   131 		/**
       
   132 		* Gets the ICMPv6 Parameter.
       
   133 		*
       
   134 		* Accesses the first 4 bytes of ICMP message body, and assumes
       
   135 		* they form a 32 bit integer in network byte order. Returns
       
   136 		* this integer in host order.
       
   137 		*
       
   138 		* @return ICMPv6 Parameter (as an integer)
       
   139 		*/
       
   140 		{
       
   141 		return (i[4] << 24) | (i[5] << 16) | (i[6] << 8) | i[7];
       
   142 		}
       
   143 	//
       
   144 	// Build, set IP header field values into the packet
       
   145 	//
       
   146 	inline void SetType(TUint8 aType)
       
   147 		/**
       
   148 		* Sets the ICMPv6 type.
       
   149 		* @param aType ICMPv6 type [0..255]
       
   150 		*/
       
   151 		{
       
   152 		i[0] = aType;
       
   153 		}
       
   154 	inline void SetCode(TUint8 aCode)
       
   155 		/**
       
   156 		* Sets the ICMPv6 code.
       
   157 		* @param aCode ICMPv6 code [0..255]
       
   158 		*/
       
   159 		{
       
   160 		i[1] = aCode;
       
   161 		}
       
   162 	inline void SetChecksum(TInt aSum)
       
   163 		/**
       
   164 		* Sets the Checksum.
       
   165 		*
       
   166 		* @param aSum
       
   167 		*	The Checksum [0..65535] (16 least significant bits
       
   168 		*	stored as is (assumed to be in NETWORK byte order).					
       
   169 		*/
       
   170 		{
       
   171 		*((TUint16 *)&i[2]) = (TUint16)aSum;
       
   172 		}
       
   173 	inline void SetParameter(TUint32 aValue)
       
   174 		/**
       
   175 		* Sets the ICMPv6 Parameter.
       
   176 		*
       
   177 		* The value is converted into network byte order and
       
   178 		* stored as the first 4 bytes of the ICMP message body.
       
   179 		*
       
   180 		* @param aValue
       
   181 		*	The parameter.
       
   182 		*/
       
   183 		{
       
   184 		i[7] = (TUint8)aValue;
       
   185 		i[6] = (TUint8)(aValue >> 8);
       
   186 		i[5] = (TUint8)(aValue >> 16);
       
   187 		i[4] = (TUint8)(aValue >> 24);
       
   188 		}
       
   189 
       
   190 protected:
       
   191 	union
       
   192 		{
       
   193 		TUint8 i[8];
       
   194 		TUint32 iAlign;	// A dummy member to force the 4 byte alignment
       
   195 		};
       
   196 	};
       
   197 
       
   198 
       
   199 //
       
   200 // TInet6HeaderICMP_Echo
       
   201 //
       
   202 class TInet6HeaderICMP_Echo : public TInet6HeaderICMP
       
   203 /**
       
   204 * ICMPv6 Echo Request and Echo Reply layout.
       
   205 *
       
   206 * Describes the ICMP Echo Request and Replay layout. The space for
       
   207 * Identifier and Sequence is already covered by the base class.
       
   208 *
       
   209 @verbatim
       
   210 RFC-2463:
       
   211 
       
   212  0                   1                   2                   3
       
   213  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
       
   214 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   215 |     Type      |     Code      |          Checksum             |
       
   216 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   217 |           Identifier          |        Sequence Number        |
       
   218 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   219 |     Data ...
       
   220 +-+-+-+-+-
       
   221 @endverbatim
       
   222 @publishedAll
       
   223 @released
       
   224 */
       
   225 	{
       
   226 public:
       
   227 	//
       
   228 	// General
       
   229 	//
       
   230 	inline TInt HeaderLength() const
       
   231 		/**
       
   232 		* Gets the header length.
       
   233 		* @return The length
       
   234 		*/
       
   235 		{return 8;}
       
   236 	inline static TInt MinHeaderLength()
       
   237 		/**
       
   238 		* Gets the minimum header length.	
       
   239 		* @return The length
       
   240 		*/
       
   241 		{return 8; }
       
   242 	inline static TInt MaxHeaderLength()
       
   243 		/**
       
   244 		* Gets the maximum header length.	
       
   245 		* @return The length
       
   246 		*/
       
   247 		{return 8; }
       
   248 
       
   249 	//
       
   250 	// Access, get ICMP header field values from the packet
       
   251 	//
       
   252 	inline TInt Identifier() const
       
   253 		/**
       
   254 		* Gets the Idenfifier
       
   255 		* @return The Identifier
       
   256 		*/
       
   257 		{
       
   258 		return (i[4] << 8) + i[5];
       
   259 		}
       
   260 	inline TInt Sequence() const
       
   261 		/**
       
   262 		* Gets the Sequence Number
       
   263 		* @return The number
       
   264 		*/
       
   265 		{
       
   266 		return (i[6] << 8) + i[7];
       
   267 		}
       
   268 	//
       
   269 	// Build, set IP header field values into the packet
       
   270 	//
       
   271 	inline void SetIdentifier(TUint16 aIdentifier)
       
   272 		/**
       
   273 		* Sets the Idenfifier
       
   274 		* @param aIdentifier The Identifier
       
   275 		*/
       
   276 		{
       
   277 		i[4] = (TUint8)(aIdentifier >> 8);
       
   278 		i[5] = (TUint8)aIdentifier;
       
   279 		}
       
   280 	inline void SetSequence(TUint16 aSequence)
       
   281 		/**
       
   282 		* Sets the Sequence Number
       
   283 		* @param aSequence The number
       
   284 		*/
       
   285 		{
       
   286 		i[6] = (TUint8)(aSequence >> 8);
       
   287 		i[7] = (TUint8)aSequence;
       
   288 		}
       
   289 private:
       
   290 	};
       
   291 
       
   292 
       
   293 class TInet6HeaderICMP_RouterSol: public TInet6HeaderICMP
       
   294 /**
       
   295 * ICMPv6 Router Solicitation layout.
       
   296 *
       
   297 @verbatim
       
   298 Router Solicitation Message Format (from RFC-2461)
       
   299 
       
   300  0                   1                   2                   3
       
   301  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
       
   302 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   303 |     Type      |     Code      |          Checksum             |
       
   304 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   305 |                            Reserved                           |
       
   306 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   307 |   Options ...
       
   308 +-+-+-+-+-+-+-+-+-+-+-+-
       
   309 @endverbatim
       
   310 * Aside from the fields provided by the base class, there is nothing
       
   311 * else here.
       
   312 *
       
   313 * Valid options:
       
   314 *
       
   315 * - #KInet6OptionICMP_SourceLink
       
   316 *
       
   317 * @publishedAll
       
   318 * @released
       
   319 */
       
   320 	{
       
   321 public:
       
   322 	inline static TInt MinHeaderLength() {return 8; }
       
   323 	inline static TInt MaxHeaderLength() {return 8; }
       
   324 	inline TInt HeaderLength() const {return 8;}
       
   325 	};
       
   326 
       
   327 // Router Advertisement Message Format from RFC-2461
       
   328 class TInet6HeaderICMP_RouterAdv : public TInet6HeaderICMP
       
   329 /**
       
   330 * ICMPv6 Router Advertisement layout.
       
   331 *
       
   332 * (Neighbour Discovery for IP version 6)
       
   333 * (+ Home Agent flag from draft-ietf-mobileip-ipv6-08)
       
   334 @verbatim
       
   335 Type=134, Code=0
       
   336 
       
   337  0                   1                   2                   3
       
   338  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
       
   339 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   340 |     Type      |     Code      |          Checksum             |
       
   341 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   342 | Cur Hop Limit |M|O|H|Prf|Rsrvd|       Router Lifetime         |
       
   343 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   344 |                         Reachable Time                        |
       
   345 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   346 |                          Retrans Timer                        |
       
   347 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   348 |   Options ...
       
   349 +-+-+-+-+-+-+-+-+-+-+-+-
       
   350 @endverbatim
       
   351 *
       
   352 * @note
       
   353 *	Above is longer thant what is declared in the base class
       
   354 *	i-member. The user must verify the sufficient length of
       
   355 *	the packet, when using this.
       
   356 *
       
   357 * Valid options:
       
   358 *
       
   359 * - #KInet6OptionICMP_SourceLink
       
   360 * - #KInet6OptionICMP_Mtu
       
   361 * - #KInet6OptionICMP_Prefix
       
   362 * - #KInet6OptionICMP_RouteInformation (draft)
       
   363 *
       
   364 * @publishedAll
       
   365 * @released
       
   366 */
       
   367 	{
       
   368 public:
       
   369 	//
       
   370 	// General
       
   371 	//
       
   372 	inline static TInt MinHeaderLength() {return 16; }
       
   373 	inline static TInt MaxHeaderLength() {return 16; }
       
   374 	inline TInt HeaderLength() const {return 16;}
       
   375 	//
       
   376 	// Access, get ICMP header field values from the packet
       
   377 	//
       
   378 	inline TInt CurHopLimit() const
       
   379 		/**
       
   380 		* Gets Cur Hop Limit.
       
   381 		* @return Hop Limit
       
   382 		*/
       
   383 		{
       
   384 		return i[4];
       
   385 		}
       
   386 	inline TInt Flags() const
       
   387 		/**
       
   388 		* Gets flags byte
       
   389 		* @return Flags (M, O, H, Prf and Rsrvd)
       
   390 		*/
       
   391 		{
       
   392 		return i[5];		// M + O + Reserved as one unit
       
   393 		}
       
   394 	inline TInt M() const
       
   395 		/** Gets Managed Address Configuration (M) flag */
       
   396 		{
       
   397 		return i[5] & 0x80;
       
   398 		}
       
   399 	inline TInt O() const
       
   400 		/** Gets Other Address Configuartion (O) flag */
       
   401 		{
       
   402 		return i[5] & 0x40;
       
   403 		}
       
   404 	inline TInt H() const
       
   405 		/** Gets Home Agent Configuration (H) flag */
       
   406 		{
       
   407 		return i[5] & 0x20;
       
   408 		}
       
   409 #if 1
       
   410 	inline TInt Prf() const
       
   411 		/**
       
   412 		* Gets default route preference.
       
   413 		*
       
   414 		* Experimental: draft-draves-ipngwg-router-selection-01.txt
       
   415 		* Default Router Preferences and More-Specific Routes
       
   416 		*/
       
   417 		{
       
   418 		return (i[5] >> 3) & 0x3;	// should be treated as 2bit signed int
       
   419 		}
       
   420 #endif
       
   421 	inline TInt RouterLifetime() const
       
   422 		/**
       
   423 		* Gets the lifetime of the defaul route.
       
   424 		*
       
   425 		* If non-zero, specifies how long (in seconds) this
       
   426 		* router is willing to act as a default router.
       
   427 		*
       
   428 		* @return The life time of the default route.
       
   429 		*
       
   430 		* @note
       
   431 		*	This is badly named. The parameter controls
       
   432 		*	only the default route processing. The value
       
   433 		*	ZERO does not mean that the sender is not a
       
   434 		*	router.
       
   435 		*/
       
   436 		{
       
   437 		return (i[6] << 8) + i[7];
       
   438 		}
       
   439 	inline TUint32 ReachableTime() const
       
   440 		/**
       
   441 		* Gets the value of reachable timer.
       
   442 		*/
       
   443 		{
       
   444 		return (i[8] << 24) | (i[9] << 16) | (i[10] << 8) | i[11];
       
   445 		}
       
   446 	inline TUint32 RetransTimer() const
       
   447 		/**
       
   448 		* Gets the value of retransmit timer.
       
   449 		*/
       
   450 		{
       
   451 		return (i[12] << 24) | (i[13] << 16) | (i[14] << 8) | i[15];
       
   452 		}
       
   453 	//
       
   454 	// Build, set IP header field values into the packet
       
   455 	//
       
   456 	inline void SetCurHopLimit(TInt aLimit)
       
   457 		/**
       
   458 		* Sets the Cur Hoplimit.
       
   459 		* @param	aLimit	The Hoplimit [0..255]
       
   460 		*/
       
   461 		{
       
   462 		i[4] = (TUint8)aLimit;
       
   463 		}
       
   464 	inline void SetFlags(TInt aFlags)
       
   465 		/**
       
   466 		* Sets the flags.
       
   467 		* @param	aFlags	The flags bits [0..255].
       
   468 		*/
       
   469 		{
       
   470 		i[5] = (TUint8)aFlags;
       
   471 		}
       
   472 	inline void SetRouterLifetime(TInt aTime)
       
   473 		/**
       
   474 		* Sets the lifetime of the default route.
       
   475 		* @param aTime The lifetime.
       
   476 		*/
       
   477 		{
       
   478 		i[7] = (TUint8)aTime;
       
   479 		i[6] = (TUint8)(aTime >> 8);
       
   480 		}
       
   481 	inline void SetReachableTime(TUint32 aTime)
       
   482 		/**
       
   483 		* Sets the value of reachable timer
       
   484 		* @param aTime The timer value
       
   485 		*/
       
   486 		{
       
   487 		i[11] = (TUint8)aTime;
       
   488 		i[10] = (TUint8)(aTime >> 8);
       
   489 		i[9] = (TUint8)(aTime >> 16);
       
   490 		i[8] = (TUint8)(aTime >> 24);
       
   491 		}
       
   492 	inline void SetRetransTimer(TUint32 aTimer)
       
   493 		/**
       
   494 		* Sets the value of the retransmit timer
       
   495 		* @param aTimer The timer value
       
   496 		*/
       
   497 		{
       
   498 		i[15] = (TUint8)aTimer;
       
   499 		i[14] = (TUint8)(aTimer >> 8);
       
   500 		i[13] = (TUint8)(aTimer >> 16);
       
   501 		i[12] = (TUint8)(aTimer >> 24);
       
   502 		}
       
   503 
       
   504 private:
       
   505 	};
       
   506 
       
   507 class TInet6HeaderICMP_NeighborSol : public TInet6HeaderICMP
       
   508 /**
       
   509 * ICMPv6 Neighbour Solicitation layout.
       
   510 @verbatim
       
   511 Neigbour Solicitation Message Format from RFC-2461
       
   512 
       
   513  0                   1                   2                   3
       
   514  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
       
   515 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   516 |     Type      |     Code      |          Checksum             |
       
   517 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   518 |                           Reserved                            |
       
   519 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   520 |                                                               |
       
   521 +                                                               +
       
   522 |                                                               |
       
   523 +                       Target Address                          +
       
   524 |                                                               |
       
   525 +                                                               +
       
   526 |                                                               |
       
   527 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   528 |   Options ...
       
   529 +-+-+-+-+-+-+-+-+-+-+-+-
       
   530 @endverbatim
       
   531 *
       
   532 * @note
       
   533 *	Above is longer thant what is declared in the base class
       
   534 *	i-member. The user must verify the sufficient length of
       
   535 *	the packet, when using this.
       
   536 *
       
   537 * Valid options:
       
   538 *
       
   539 * - #KInet6OptionICMP_SourceLink
       
   540 *
       
   541 * @publishedAll
       
   542 * @released
       
   543 */
       
   544 	{
       
   545 public:
       
   546 	//
       
   547 	// General
       
   548 	//
       
   549 	inline static TInt MinHeaderLength() {return 24; }
       
   550 	inline static TInt MaxHeaderLength() {return 24; }
       
   551 	inline TInt HeaderLength() const {return 24;}
       
   552 	inline TIp6Addr &Target() const
       
   553 		/**
       
   554 		* Gets the Target Address.
       
   555 		*
       
   556 		* @return The target address (reference).
       
   557 		*/
       
   558 		{
       
   559 		return (TIp6Addr &)i[8];
       
   560 		}
       
   561 private:
       
   562 	};
       
   563 
       
   564 
       
   565 class TInet6HeaderICMP_NeighborAdv : public TInet6HeaderICMP
       
   566 /**
       
   567 * ICMPv6 Neighbour Advertisement layout.
       
   568 @verbatim
       
   569 Neighbor Advertisement Message Format (from RFC-2461)
       
   570 
       
   571  0                   1                   2                   3
       
   572  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
       
   573 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   574 |     Type      |     Code      |          Checksum             |
       
   575 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   576 |R|S|O|                     Reserved                            |
       
   577 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   578 |                                                               |
       
   579 +                                                               +
       
   580 |                                                               |
       
   581 +                       Target Address                          +
       
   582 |                                                               |
       
   583 +                                                               +
       
   584 |                                                               |
       
   585 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   586 |   Options ...
       
   587 +-+-+-+-+-+-+-+-+-+-+-+-
       
   588 @endverbatim
       
   589 * @note
       
   590 *	Above is longer thant what is declared in the base class
       
   591 *	i-member. The user must verify the sufficient length of
       
   592 *	the packet, when using this.
       
   593 *
       
   594 * Valid options:
       
   595 *
       
   596 * - #KInet6OptionICMP_TargetLink
       
   597 *
       
   598 * @publishedAll
       
   599 * @released
       
   600 */
       
   601 	{
       
   602 public:
       
   603 	//
       
   604 	// General
       
   605 	//
       
   606 	inline static TInt MinHeaderLength() {return 24; }
       
   607 	inline static TInt MaxHeaderLength() {return 24; }
       
   608 	inline TInt HeaderLength() const {return 24;}
       
   609 
       
   610 	//
       
   611 	// Set and Access the Target Address
       
   612 	//
       
   613 	inline TIp6Addr &Target() const
       
   614 		/**
       
   615 		* Gets the Target Address.
       
   616 		*
       
   617 		* @return The target address (reference).
       
   618 		*/
       
   619 		{
       
   620 		return (TIp6Addr &)i[8];
       
   621 		}
       
   622 
       
   623 	inline TInt R()
       
   624 		{
       
   625 		return 0x80 & i[4];
       
   626 		}
       
   627 	inline TInt S()
       
   628 		{
       
   629 		return 0x40 & i[4];
       
   630 		}
       
   631 	inline TInt O()
       
   632 		{
       
   633 		return 0x20 & i[4];
       
   634 		}
       
   635 	inline void SetR(TInt aValue)
       
   636 		{
       
   637 		if (aValue) i[4] |= 0x80; else i[4] &= ~0x80;
       
   638 		}
       
   639 	inline void SetS(TInt aValue)
       
   640 		{
       
   641 		if (aValue) i[4] |= 0x40; else i[4] &= ~0x40;
       
   642 		}
       
   643 	inline void SetO(TInt aValue)
       
   644 		{
       
   645 		if (aValue) i[4] |= 0x20; else i[4] &= ~0x20;
       
   646 		}
       
   647 
       
   648 	};
       
   649 
       
   650 
       
   651 class TInet6HeaderICMP_Redirect : public TInet6HeaderICMP
       
   652 /**
       
   653 * ICMPv6 Redirect layout.
       
   654 @verbatim
       
   655 Redirect Message Format (RFC-2461)
       
   656 
       
   657  0                   1                   2                   3
       
   658  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
       
   659 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   660 |     Type      |     Code      |          Checksum             |
       
   661 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   662 |                           Reserved                            |
       
   663 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   664 |                                                               |
       
   665 +                                                               +
       
   666 |                                                               |
       
   667 +                       Target Address                          +
       
   668 |                                                               |
       
   669 +                                                               +
       
   670 |                                                               |
       
   671 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   672 |                                                               |
       
   673 +                                                               +
       
   674 |                                                               |
       
   675 +                     Destination Address                       +
       
   676 |                                                               |
       
   677 +                                                               +
       
   678 |                                                               |
       
   679 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   680 |   Options ...
       
   681 +-+-+-+-+-+-+-+-+-+-+-+-
       
   682 
       
   683 @endverbatim
       
   684 * @note
       
   685 *	Above is longer thant what is declared in the base class
       
   686 *	i-member. The user must verify the sufficient length of
       
   687 *	the packet, when using this.
       
   688 *
       
   689 * Valid options:
       
   690 *
       
   691 * - #KInet6OptionICMP_TargetLink
       
   692 * - #KInet6OptionICMP_Redirect
       
   693 *
       
   694 * @publishedAll
       
   695 * @released
       
   696 */
       
   697 	{
       
   698 public:
       
   699 	//
       
   700 	// General
       
   701 	//
       
   702 	inline static TInt MinHeaderLength() {return 40; }
       
   703 	inline static TInt MaxHeaderLength() {return 40; }
       
   704 	inline TInt HeaderLength() const {return 40;}
       
   705 
       
   706 	inline TIp6Addr &Target() const
       
   707 		/**
       
   708 		* Gets the Target Address.
       
   709 		*
       
   710 		* @return The target address (reference).
       
   711 		*/
       
   712 		{
       
   713 		return (TIp6Addr &)i[8];
       
   714 		}
       
   715 	inline TIp6Addr &Destination() const
       
   716 		/**
       
   717 		* Gets the Destination Address.
       
   718 		*
       
   719 		* @return The destination address (reference).
       
   720 		*/
       
   721 		{
       
   722 		return (TIp6Addr &)i[24];
       
   723 		}
       
   724 	};
       
   725 
       
   726 
       
   727 class TInet6OptionICMP_LinkLayer
       
   728 /**
       
   729 * ICMPv6 Link-layer Address layout.
       
   730 @verbatim
       
   731 Source/Target Link-layer Address Option (RFC-2461)
       
   732 
       
   733  0                   1                   2                   3
       
   734  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
       
   735 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   736 |     Type      |    Length     |    Link-Layer Address ...
       
   737 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   738 @endverbatim
       
   739 * @publishedAll
       
   740 * @released
       
   741 */
       
   742 	{
       
   743 public:
       
   744 	inline static TInt MinHeaderLength() {return 8; }
       
   745 	inline static TInt MaxHeaderLength() {return 8; }	// Not very useful
       
   746 	inline TInt HeaderLength() const {return Length() * 8; }
       
   747 	//
       
   748 	// Access
       
   749 	//
       
   750 	inline TInt Type() const
       
   751 		{
       
   752 		return i[0];
       
   753 		}
       
   754 	inline TInt Length() const
       
   755 		{
       
   756 		return i[1];
       
   757 		}
       
   758 	//
       
   759 	// Access and Set
       
   760 	//
       
   761 	inline TPtr8 Address() const
       
   762 		{
       
   763 		return TPtr8((TUint8 *)&i[2], i[1] * 8 - 2, i[1] * 8 - 2);
       
   764 		}
       
   765 	//
       
   766 	// Construct methods
       
   767 	//
       
   768 	inline void SetType(TInt aType)
       
   769 		{
       
   770 		i[0] = (TUint8)aType;
       
   771 		}
       
   772 	inline void SetLength(TInt aLength)
       
   773 		{
       
   774 		i[1] = (TUint8)aLength;
       
   775 		}
       
   776 private:
       
   777 	union
       
   778 		{
       
   779 		TUint8 i[8];
       
   780 		TUint32 iAlign;	// A dummy member to force the 4 byte alignment
       
   781 		};
       
   782 	};
       
   783 
       
   784 
       
   785 class TInet6OptionICMP_Prefix
       
   786 /**
       
   787 * ICMPv6 Prefix Infotmation Option.
       
   788 @verbatim
       
   789 Prefix Information Option (RFC-2461)
       
   790 (+ Router Address flag from draft-ietf-mobileip-ipv6-08)
       
   791  0                   1                   2                   3
       
   792  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
       
   793 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   794 |     Type      |    Length     | Prefix Length |L|A|R| Rsrvd1  |
       
   795 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   796 |                         Valid Lifetime                        |
       
   797 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   798 |                       Preferred Lifetime                      |
       
   799 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   800 |                           Reserved2                           |
       
   801 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   802 |                                                               |
       
   803 +                                                               +
       
   804 |                                                               |
       
   805 +                            Prefix                             +
       
   806 |                                                               |
       
   807 +                                                               +
       
   808 |                                                               |
       
   809 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   810 
       
   811 @endverbatim
       
   812 * @publishedAll
       
   813 * @released
       
   814 */
       
   815 	{
       
   816 public:
       
   817 	inline static TInt MinHeaderLength() {return 4*8; }
       
   818 	inline static TInt MaxHeaderLength() {return 4*8; }	// Not very useful
       
   819 	inline TInt HeaderLength() const {return 4*8; }
       
   820 
       
   821 	inline TInt Type() const
       
   822 		{
       
   823 		return i[0];
       
   824 		}
       
   825 	inline TInt Length() const
       
   826 		{
       
   827 		return i[1];
       
   828 		}
       
   829 	inline TInt PrefixLength() const
       
   830 		{
       
   831 		return i[2];	// 0..128
       
   832 		}
       
   833 	inline TInt LFlag() const
       
   834 		{
       
   835 		return i[3] & 0x80;
       
   836 		}
       
   837 	inline TInt AFlag() const
       
   838 		{
       
   839 		return i[3] & 0x40;
       
   840 		}
       
   841 	inline TInt RFlag() const
       
   842 		{
       
   843 		return i[3] & 0x20;
       
   844 		}
       
   845 	inline TUint32 ValidLifetime() const
       
   846 		{
       
   847 		return (i[4] << 24) | (i[5] << 16) | (i[6] << 8) | i[7];
       
   848 		}
       
   849 	inline TUint32 PreferredLifetime() const
       
   850 		{
       
   851 		return (i[8] << 24) | (i[9] << 16) | (i[10] << 8) | i[11];
       
   852 		}
       
   853 	//
       
   854 	//
       
   855 	inline TIp6Addr &Prefix() const
       
   856 		{
       
   857 		return (TIp6Addr &)i[16];
       
   858 		}
       
   859 	//
       
   860 	// Construct methods
       
   861 	//
       
   862 	inline void SetType(TInt aType)
       
   863 		{
       
   864 		i[0] = (TUint8)aType;
       
   865 		}
       
   866 	inline void SetLength(TInt aLength)
       
   867 		{
       
   868 		i[1] = (TUint8)aLength;
       
   869 		}
       
   870 	inline void SetPrefixLength(TInt aLength)
       
   871 		{
       
   872 		i[2] = (TUint8)aLength;
       
   873 		}
       
   874 	inline void SetFlags(TInt aFlags)
       
   875 		{
       
   876 		i[3] = (TUint8)aFlags;
       
   877 		}
       
   878 	inline void SetValidLifetime(TUint32 aTime)
       
   879 		{
       
   880 		i[7] = (TUint8)aTime;
       
   881 		i[6] = (TUint8)(aTime >> 8);
       
   882 		i[5] = (TUint8)(aTime >> 16);
       
   883 		i[4] = (TUint8)(aTime >> 24);
       
   884 		}
       
   885 	inline void SetPreferredLifetime(TUint32 aTime)
       
   886 		{
       
   887 		i[11] = (TUint8)aTime;
       
   888 		i[10] = (TUint8)(aTime >> 8);
       
   889 		i[9] = (TUint8)(aTime >> 16);
       
   890 		i[8] = (TUint8)(aTime >> 24);
       
   891 		}
       
   892 	inline void SetReserved2(TUint32 aFiller)
       
   893 		{
       
   894 		i[15] = (TUint8)aFiller;
       
   895 		i[14] = (TUint8)(aFiller >> 8);
       
   896 		i[13] = (TUint8)(aFiller >> 16);
       
   897 		i[12] = (TUint8)(aFiller >> 24);
       
   898 		}
       
   899 
       
   900 
       
   901 private:
       
   902 	union
       
   903 		{
       
   904 		TUint8 i[4*8];
       
   905 		TUint32 iAlign;	// A dummy member to force the 4 byte alignment
       
   906 		};
       
   907 	};
       
   908 
       
   909 
       
   910 class TInet6OptionICMP_Mtu
       
   911 /**
       
   912 * ICMPv6 MTU Option.
       
   913 @verbatim
       
   914 MTU Option (RFC-2461)
       
   915 
       
   916  0                   1                   2                   3
       
   917  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
       
   918 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   919 |     Type      |    Length     |           Reserved            |
       
   920 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   921 |                              MTU                              |
       
   922 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
   923 @endverbatim
       
   924 * @publishedAll
       
   925 * @released
       
   926 */
       
   927 	{
       
   928 public:
       
   929 	inline static TInt MinHeaderLength() {return 8; }
       
   930 	inline static TInt MaxHeaderLength() {return 8; }	// Not very useful
       
   931 	inline TInt HeaderLength() const {return 8; }
       
   932 
       
   933 	inline TInt Type() const
       
   934 		{
       
   935 		return i[0];
       
   936 		}
       
   937 	inline TInt Length() const
       
   938 		{
       
   939 		return i[1];
       
   940 		}
       
   941 	inline TInt Mtu() const
       
   942 		{
       
   943 		return (i[4] << 24) | (i[5] << 16) | (i[6] << 8) | i[7];
       
   944 		}
       
   945 	//
       
   946 	// Construct methods
       
   947 	//
       
   948 	inline void SetType(TInt aType)
       
   949 		{
       
   950 		i[0] = (TUint8)aType;
       
   951 		}
       
   952 	inline void SetLength(TInt aLength)
       
   953 		{
       
   954 		i[1] = (TUint8)aLength;
       
   955 		// Silently ZERO the reserved bits... not too nice --- msa
       
   956 		i[2] = 0;
       
   957 		i[3] = 0;
       
   958 		}
       
   959 	inline void SetMtu(TUint32 aMtu)
       
   960 		{
       
   961 		i[7] = (TUint8)aMtu;
       
   962 		i[6] = (TUint8)(aMtu >> 8);
       
   963 		i[5] = (TUint8)(aMtu >> 16);
       
   964 		i[4] = (TUint8)(aMtu >> 24);
       
   965 		}
       
   966 private:
       
   967 	TUint8 i[8];
       
   968 	};
       
   969 
       
   970 
       
   971 #if 1
       
   972 class TInet6OptionICMP_RouteInformation
       
   973 // Route Information Option 
       
   974 // Experimental: draft-draves-ipngwg-router-selection-01.txt
       
   975 /**
       
   976 *  ICMPv6 Route Information Option.
       
   977 @verbatim
       
   978 Default Router Preferences and More-Specific Routes
       
   979 
       
   980  0                   1                   2                   3 
       
   981  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 
       
   982 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
       
   983 |     Type      |    Length     | Prefix Length |Resvd|Prf|Resvd| 
       
   984 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
       
   985 |                        Route Lifetime                         | 
       
   986 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
       
   987 |                                                               | 
       
   988 +                                                               + 
       
   989 |                                                               | 
       
   990 +                            Prefix                             + 
       
   991 |                                                               | 
       
   992 +                                                               + 
       
   993 |                                                               | 
       
   994 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
       
   995 @endverbatim
       
   996 * @publishedAll
       
   997 * @released
       
   998 */
       
   999 	{
       
  1000 public:
       
  1001 	inline static TInt MinHeaderLength() {return 8; }
       
  1002 	inline static TInt MaxHeaderLength() {return 3*8; }
       
  1003 	inline TInt HeaderLength() const {return Length()*8; }
       
  1004 
       
  1005 	inline TInt Type() const
       
  1006 		{
       
  1007 		return i[0];
       
  1008 		}
       
  1009 	inline TInt Length() const
       
  1010 		{
       
  1011 		return i[1];
       
  1012 		}
       
  1013 	inline TInt PrefixLength() const
       
  1014 		{
       
  1015 		return i[2];	// 0..128
       
  1016 		}
       
  1017 	inline TInt Prf() const
       
  1018 		{
       
  1019 		return (i[3] >> 3) & 0x3;	// should be treated as 2bit signed int
       
  1020 		}
       
  1021 	inline TUint32 RouteLifetime() const
       
  1022 		{
       
  1023 		return (i[4] << 24) | (i[5] << 16) | (i[6] << 8) | i[7];
       
  1024 		}
       
  1025 	//
       
  1026 	// *WARNING* The "Prefix" returns a raw reference to the beginning
       
  1027 	// of the prefix field in the option structure. HOWEVER, the option
       
  1028 	// field can be shorter than 128 bits! If used to allocate space,
       
  1029 	// the maximum is allocated and the method is safe, but that is not
       
  1030 	// true if header is mapped directly to the received packet! -- msa
       
  1031 	inline TIp6Addr &Prefix() const
       
  1032 		{
       
  1033 		return (TIp6Addr &)i[8];
       
  1034 		}
       
  1035 	//
       
  1036 	// Construct methods
       
  1037 	//
       
  1038 	inline void SetType(TInt aType)
       
  1039 		{
       
  1040 		i[0] = (TUint8)aType;
       
  1041 		}
       
  1042 	inline void SetLength(TInt aLength)
       
  1043 		{
       
  1044 		i[1] = (TUint8)aLength;
       
  1045 		}
       
  1046 	inline void SetPrefixLength(TInt aLength)
       
  1047 		{
       
  1048 		i[2] = (TUint8)aLength;
       
  1049 		}
       
  1050 	inline void SetPrefixLifetime(TUint32 aTime)
       
  1051 		{
       
  1052 		i[7] = (TUint8)aTime;
       
  1053 		i[6] = (TUint8)(aTime >> 8);
       
  1054 		i[5] = (TUint8)(aTime >> 16);
       
  1055 		i[4] = (TUint8)(aTime >> 24);
       
  1056 		}
       
  1057 
       
  1058 private:
       
  1059 	union
       
  1060 		{
       
  1061 		TUint8 i[3*8];	// The space allocated for MAX LENGTH
       
  1062 		TUint32 iAlign;	// A dummy member to force the 4 byte alignment
       
  1063 		};
       
  1064 	};
       
  1065 
       
  1066 class TInet6OptionICMP_DnsInformation
       
  1067 /**
       
  1068 *  ICMPv6 Recursive DNS Server Option.
       
  1069 * IPv6 DNS Configuration based on Router Advertisement
       
  1070 *
       
  1071 * Experimental: draft-jeong-dnsop-ipv6-discovery-03.txt
       
  1072 @verbatim
       
  1073 Recursive DNS Server Option
       
  1074 
       
  1075  0                   1                   2                   3
       
  1076  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
       
  1077 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
  1078 |     Type      |     Length    |  Pref |        Reserved       |
       
  1079 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
  1080 |                           Lifetime                            |
       
  1081 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
  1082 |                                                               |
       
  1083 :                     IPv6 Address of RDNSS                     :
       
  1084 |                                                               |
       
  1085 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
  1086      
       
  1087 @endverbatim
       
  1088 * @publishedAll
       
  1089 * @released
       
  1090 */
       
  1091 	{
       
  1092 public:
       
  1093 	inline static TInt MinHeaderLength() {return 24; }
       
  1094 	inline static TInt MaxHeaderLength() {return 24; }
       
  1095 	inline TInt HeaderLength() const {return Length()*8; }
       
  1096 
       
  1097 	inline TInt Type() const
       
  1098 		{
       
  1099 		return i[0];
       
  1100 		}
       
  1101 	inline TInt Length() const
       
  1102 		{
       
  1103 		return i[1];
       
  1104 		}
       
  1105 	inline TInt Pref() const
       
  1106 		{
       
  1107 		return (i[3] >> 4) & 0xF;
       
  1108 		}
       
  1109 	inline TUint32 Lifetime() const
       
  1110 		{
       
  1111 		return (i[4] << 24) | (i[5] << 16) | (i[6] << 8) | i[7];
       
  1112 		}
       
  1113 	inline TIp6Addr &Address() const
       
  1114 		{
       
  1115 		return (TIp6Addr &)i[8];
       
  1116 		}
       
  1117 	//
       
  1118 	// Construct methods
       
  1119 	//
       
  1120 	inline void SetType(TInt aType)
       
  1121 		{
       
  1122 		i[0] = (TUint8)aType;
       
  1123 		}
       
  1124 	inline void SetLength(TInt aLength)
       
  1125 		{
       
  1126 		i[1] = (TUint8)aLength;
       
  1127 		}
       
  1128 	inline void SetPref(TInt aPref)
       
  1129 		{
       
  1130 		i[2] = (TUint8)(((aPref << 4) & 0xF0) | (i[2] & 0xF));
       
  1131 		}
       
  1132 	inline void SetLifetime(TUint32 aTime)
       
  1133 		{
       
  1134 		i[7] = (TUint8)aTime;
       
  1135 		i[6] = (TUint8)(aTime >> 8);
       
  1136 		i[5] = (TUint8)(aTime >> 16);
       
  1137 		i[4] = (TUint8)(aTime >> 24);
       
  1138 		}
       
  1139 
       
  1140 private:
       
  1141 	union
       
  1142 		{
       
  1143 		TUint8 i[24];	// The space allocated for MAX LENGTH
       
  1144 		TUint32 iAlign;	// A dummy member to force the 4 byte alignment
       
  1145 		};
       
  1146 	};
       
  1147 
       
  1148 #endif
       
  1149 
       
  1150 /**
       
  1151 * @name ICMPv6 Error Message Types (0-127)
       
  1152 */
       
  1153 //@{
       
  1154 const TUint8 KInet6ICMP_Unreachable		= 1;
       
  1155 const TUint8 KInet6ICMP_PacketTooBig	= 2;
       
  1156 const TUint8 KInet6ICMP_TimeExceeded	= 3;
       
  1157 const TUint8 KInet6ICMP_ParameterProblem= 4;
       
  1158 //@}
       
  1159 /**
       
  1160 * @name ICMPv6 Informational Message Types (128-255)
       
  1161 */
       
  1162 //@{
       
  1163 /** Echo Request. See TInet6HeaderICMP_Echo. */
       
  1164 const TUint8 KInet6ICMP_EchoRequest		= 128;
       
  1165 /** Echo Reply. See TInet6HeaderICMP_Echo. */
       
  1166 const TUint8 KInet6ICMP_EchoReply		= 129;
       
  1167 /** Not implemented. */
       
  1168 const TUint8 KInet6ICMP_GroupQuery		= 130;
       
  1169 /** Not implemented. */
       
  1170 const TUint8 KInet6ICMP_GroupReport		= 131;
       
  1171 /** Not implemented. */
       
  1172 const TUint8 KInet6ICMP_GroupDone		= 132;
       
  1173 /** Router Solicitation. See TInet6HeaderICMP_RouterSol. */
       
  1174 const TUint8 KInet6ICMP_RouterSol		= 133;
       
  1175 /** Router Advertisement. See TInet6HeaderICMP_RouterAdv. */
       
  1176 const TUint8 KInet6ICMP_RouterAdv		= 134;
       
  1177 /** Neighbor Solicitation. See TInet6HeaderICMP_NeighborSol. */
       
  1178 const TUint8 KInet6ICMP_NeighborSol		= 135;
       
  1179 /** Neighbor Advertisement. See TInet6HeaderICMP_NeighborAdv. */
       
  1180 const TUint8 KInet6ICMP_NeighborAdv		= 136;
       
  1181 /** Redirect. See TInet6HeaderICMP_Redirect. */
       
  1182 const TUint8 KInet6ICMP_Redirect		= 137;
       
  1183 //@}
       
  1184 
       
  1185 /**
       
  1186 * @name ICMPv6 Option types.
       
  1187 * The default derivation of the symbol
       
  1188 * is from the name of the header class by replacing 'T' with 'K' (or
       
  1189 * vice versa).
       
  1190 *
       
  1191 */
       
  1192 //@{
       
  1193 /** Source Link-Layer Address. See TInet6OptionICMP_LinkLayer. */
       
  1194 const TInt KInet6OptionICMP_SourceLink	= 1;
       
  1195 /** Target Link-Layer Address. See TInet6OptionICMP_LinkLayer. */
       
  1196 const TInt KInet6OptionICMP_TargetLink	= 2;
       
  1197 /** Prefix Information. See TInet6OptionICMP_Prefix. */
       
  1198 const TInt KInet6OptionICMP_Prefix		= 3;
       
  1199 /** Redirect Header. (not implemented). */
       
  1200 const TInt KInet6OptionICMP_Redirect	= 4;
       
  1201 /** MTU.  See TInet6OptionICMP_Mtu. */
       
  1202 const TInt KInet6OptionICMP_Mtu			= 5;
       
  1203 
       
  1204 #if 1
       
  1205 	// Experimental: draft-draves-ipngwg-router-selection-01.txt
       
  1206 	// Default Router Preferences and More-Specific Routes
       
  1207 	// *UNOFFICIAL NUMBER ASSIGNMENT (SAME AS MSR STACK)--REAL VALUE TBD*
       
  1208 /** Route Information. See TInet6OptionICMP_RouteInformation. */
       
  1209 const TInt KInet6OptionICMP_RouteInformation = 9;
       
  1210 #endif
       
  1211 //@}
       
  1212 
       
  1213 //@}
       
  1214 #endif