epoc32/include/icmp6_hdr.h
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/icmp6_hdr.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,1214 @@
     1.4 +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// 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
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// icmp6_hdr.h - ICMPv6 header structure
    1.18 +// This module defines the basic classes for accessing the header
    1.19 +// structures within ICMPv6 packets.
    1.20 +//
    1.21 +
    1.22 +
    1.23 +
    1.24 +/**
    1.25 + @file icmp6_hdr.h
    1.26 + @ingroup ip_packet_formats
    1.27 + @publishedAll
    1.28 + @released
    1.29 +*/
    1.30 +
    1.31 +#ifndef __ICMP6_HDR_H__
    1.32 +#define __ICMP6_HDR_H__
    1.33 +
    1.34 +#include <e32def.h>
    1.35 +#include "in_hdr.h"
    1.36 +#include <in_sock.h> // IPv6 enhanced in_sock.h
    1.37 +
    1.38 +/**
    1.39 +* @addtogroup ip_packet_formats
    1.40 +*/
    1.41 +//@{
    1.42 +
    1.43 +// TInet6HeaderICMP
    1.44 +class TInet6HeaderICMP
    1.45 +/**
    1.46 +* ICMPv6 header common part layout.
    1.47 +*
    1.48 +* The basic ICMP header format only covers the common part (4 bytes)
    1.49 +* and 4 bytes of the Message Body (can be accesses as "Parameter")
    1.50 +@verbatim
    1.51 +Extract from RFC-2462: General format of ICMP message
    1.52 +
    1.53 + 0                   1                   2                   3
    1.54 + 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
    1.55 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    1.56 +|     Type      |     Code      |          Checksum             |
    1.57 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    1.58 +|                                                               |
    1.59 ++                         Message Body                          +
    1.60 +|                                                               |
    1.61 +@endverbatim
    1.62 +* @publishedAll
    1.63 +* @released
    1.64 +*/
    1.65 +	{
    1.66 +public:
    1.67 +	inline TInt HeaderLength() const
    1.68 +		/**
    1.69 +		* Gets the header length.	
    1.70 +		* 
    1.71 +		* @note
    1.72 +		*	This length is not the true length of the
    1.73 +		*	ICMP header. This only covers the fixed part.
    1.74 +		* 
    1.75 +		* @return	Header length.
    1.76 +		*/
    1.77 +		{return 4;}
    1.78 +	inline static TInt MinHeaderLength()
    1.79 +		/**
    1.80 +		* Gets the minimum header length.
    1.81 +		* 
    1.82 +		* @return	Minimum header length
    1.83 +		*/
    1.84 +		{return 4; }
    1.85 +	inline static TInt MaxHeaderLength()
    1.86 +		/**
    1.87 +		* Gets the maximum header length.
    1.88 +		* 
    1.89 +		* @note
    1.90 +		*	This length is not the true length of the
    1.91 +		*	ICMP header. This only covers the fixed part.
    1.92 +		* 
    1.93 +		* @return	Maximum header length
    1.94 +		*/
    1.95 +		{return 4; }
    1.96 +	inline TUint8 *EndPtr() const
    1.97 +		/**
    1.98 +		* Gets a pointer to the byte following the header.
    1.99 +		* 
   1.100 +		* @return
   1.101 +		*	Pointer to the byte following the minimum
   1.102 +		*	fixed header
   1.103 +		*/
   1.104 +		{return (TUint8 *)i + HeaderLength();}
   1.105 +	//
   1.106 +	// Access, get ICMP header field values from the packet
   1.107 +	//
   1.108 +	inline TUint8 Type() const
   1.109 +		/**
   1.110 +		* Gets the ICMPv6 type from the header.
   1.111 +		* @return ICMPv6 type [0..255]
   1.112 +		*/
   1.113 +		{
   1.114 +		return i[0];
   1.115 +		}
   1.116 +	inline TUint8 Code() const
   1.117 +		/**
   1.118 +		* Gets the ICMPv6 code from the header.
   1.119 +		* @return ICMPv6 code [0..255]
   1.120 +		*/
   1.121 +		{
   1.122 +		return i[1];
   1.123 +		}
   1.124 +	inline TInt Checksum() const
   1.125 +		/**
   1.126 +		* Gets the Checksum from the header.
   1.127 +		* @return Header Checksum (TUint16 in NETWORK byte order)
   1.128 +		*/
   1.129 +		{
   1.130 +		// Checksum is used in network byte order
   1.131 +		return *((TUint16 *)&i[2]);
   1.132 +		}
   1.133 +	inline TUint32 Parameter() const
   1.134 +		/**
   1.135 +		* Gets the ICMPv6 Parameter.
   1.136 +		*
   1.137 +		* Accesses the first 4 bytes of ICMP message body, and assumes
   1.138 +		* they form a 32 bit integer in network byte order. Returns
   1.139 +		* this integer in host order.
   1.140 +		*
   1.141 +		* @return ICMPv6 Parameter (as an integer)
   1.142 +		*/
   1.143 +		{
   1.144 +		return (i[4] << 24) | (i[5] << 16) | (i[6] << 8) | i[7];
   1.145 +		}
   1.146 +	//
   1.147 +	// Build, set IP header field values into the packet
   1.148 +	//
   1.149 +	inline void SetType(TUint8 aType)
   1.150 +		/**
   1.151 +		* Sets the ICMPv6 type.
   1.152 +		* @param aType ICMPv6 type [0..255]
   1.153 +		*/
   1.154 +		{
   1.155 +		i[0] = aType;
   1.156 +		}
   1.157 +	inline void SetCode(TUint8 aCode)
   1.158 +		/**
   1.159 +		* Sets the ICMPv6 code.
   1.160 +		* @param aCode ICMPv6 code [0..255]
   1.161 +		*/
   1.162 +		{
   1.163 +		i[1] = aCode;
   1.164 +		}
   1.165 +	inline void SetChecksum(TInt aSum)
   1.166 +		/**
   1.167 +		* Sets the Checksum.
   1.168 +		*
   1.169 +		* @param aSum
   1.170 +		*	The Checksum [0..65535] (16 least significant bits
   1.171 +		*	stored as is (assumed to be in NETWORK byte order).					
   1.172 +		*/
   1.173 +		{
   1.174 +		*((TUint16 *)&i[2]) = (TUint16)aSum;
   1.175 +		}
   1.176 +	inline void SetParameter(TUint32 aValue)
   1.177 +		/**
   1.178 +		* Sets the ICMPv6 Parameter.
   1.179 +		*
   1.180 +		* The value is converted into network byte order and
   1.181 +		* stored as the first 4 bytes of the ICMP message body.
   1.182 +		*
   1.183 +		* @param aValue
   1.184 +		*	The parameter.
   1.185 +		*/
   1.186 +		{
   1.187 +		i[7] = (TUint8)aValue;
   1.188 +		i[6] = (TUint8)(aValue >> 8);
   1.189 +		i[5] = (TUint8)(aValue >> 16);
   1.190 +		i[4] = (TUint8)(aValue >> 24);
   1.191 +		}
   1.192 +
   1.193 +protected:
   1.194 +	union
   1.195 +		{
   1.196 +		TUint8 i[8];
   1.197 +		TUint32 iAlign;	// A dummy member to force the 4 byte alignment
   1.198 +		};
   1.199 +	};
   1.200 +
   1.201 +
   1.202 +//
   1.203 +// TInet6HeaderICMP_Echo
   1.204 +//
   1.205 +class TInet6HeaderICMP_Echo : public TInet6HeaderICMP
   1.206 +/**
   1.207 +* ICMPv6 Echo Request and Echo Reply layout.
   1.208 +*
   1.209 +* Describes the ICMP Echo Request and Replay layout. The space for
   1.210 +* Identifier and Sequence is already covered by the base class.
   1.211 +*
   1.212 +@verbatim
   1.213 +RFC-2463:
   1.214 +
   1.215 + 0                   1                   2                   3
   1.216 + 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
   1.217 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.218 +|     Type      |     Code      |          Checksum             |
   1.219 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.220 +|           Identifier          |        Sequence Number        |
   1.221 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.222 +|     Data ...
   1.223 ++-+-+-+-+-
   1.224 +@endverbatim
   1.225 +@publishedAll
   1.226 +@released
   1.227 +*/
   1.228 +	{
   1.229 +public:
   1.230 +	//
   1.231 +	// General
   1.232 +	//
   1.233 +	inline TInt HeaderLength() const
   1.234 +		/**
   1.235 +		* Gets the header length.
   1.236 +		* @return The length
   1.237 +		*/
   1.238 +		{return 8;}
   1.239 +	inline static TInt MinHeaderLength()
   1.240 +		/**
   1.241 +		* Gets the minimum header length.	
   1.242 +		* @return The length
   1.243 +		*/
   1.244 +		{return 8; }
   1.245 +	inline static TInt MaxHeaderLength()
   1.246 +		/**
   1.247 +		* Gets the maximum header length.	
   1.248 +		* @return The length
   1.249 +		*/
   1.250 +		{return 8; }
   1.251 +
   1.252 +	//
   1.253 +	// Access, get ICMP header field values from the packet
   1.254 +	//
   1.255 +	inline TInt Identifier() const
   1.256 +		/**
   1.257 +		* Gets the Idenfifier
   1.258 +		* @return The Identifier
   1.259 +		*/
   1.260 +		{
   1.261 +		return (i[4] << 8) + i[5];
   1.262 +		}
   1.263 +	inline TInt Sequence() const
   1.264 +		/**
   1.265 +		* Gets the Sequence Number
   1.266 +		* @return The number
   1.267 +		*/
   1.268 +		{
   1.269 +		return (i[6] << 8) + i[7];
   1.270 +		}
   1.271 +	//
   1.272 +	// Build, set IP header field values into the packet
   1.273 +	//
   1.274 +	inline void SetIdentifier(TUint16 aIdentifier)
   1.275 +		/**
   1.276 +		* Sets the Idenfifier
   1.277 +		* @param aIdentifier The Identifier
   1.278 +		*/
   1.279 +		{
   1.280 +		i[4] = (TUint8)(aIdentifier >> 8);
   1.281 +		i[5] = (TUint8)aIdentifier;
   1.282 +		}
   1.283 +	inline void SetSequence(TUint16 aSequence)
   1.284 +		/**
   1.285 +		* Sets the Sequence Number
   1.286 +		* @param aSequence The number
   1.287 +		*/
   1.288 +		{
   1.289 +		i[6] = (TUint8)(aSequence >> 8);
   1.290 +		i[7] = (TUint8)aSequence;
   1.291 +		}
   1.292 +private:
   1.293 +	};
   1.294 +
   1.295 +
   1.296 +class TInet6HeaderICMP_RouterSol: public TInet6HeaderICMP
   1.297 +/**
   1.298 +* ICMPv6 Router Solicitation layout.
   1.299 +*
   1.300 +@verbatim
   1.301 +Router Solicitation Message Format (from RFC-2461)
   1.302 +
   1.303 + 0                   1                   2                   3
   1.304 + 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
   1.305 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.306 +|     Type      |     Code      |          Checksum             |
   1.307 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.308 +|                            Reserved                           |
   1.309 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.310 +|   Options ...
   1.311 ++-+-+-+-+-+-+-+-+-+-+-+-
   1.312 +@endverbatim
   1.313 +* Aside from the fields provided by the base class, there is nothing
   1.314 +* else here.
   1.315 +*
   1.316 +* Valid options:
   1.317 +*
   1.318 +* - #KInet6OptionICMP_SourceLink
   1.319 +*
   1.320 +* @publishedAll
   1.321 +* @released
   1.322 +*/
   1.323 +	{
   1.324 +public:
   1.325 +	inline static TInt MinHeaderLength() {return 8; }
   1.326 +	inline static TInt MaxHeaderLength() {return 8; }
   1.327 +	inline TInt HeaderLength() const {return 8;}
   1.328 +	};
   1.329 +
   1.330 +// Router Advertisement Message Format from RFC-2461
   1.331 +class TInet6HeaderICMP_RouterAdv : public TInet6HeaderICMP
   1.332 +/**
   1.333 +* ICMPv6 Router Advertisement layout.
   1.334 +*
   1.335 +* (Neighbour Discovery for IP version 6)
   1.336 +* (+ Home Agent flag from draft-ietf-mobileip-ipv6-08)
   1.337 +@verbatim
   1.338 +Type=134, Code=0
   1.339 +
   1.340 + 0                   1                   2                   3
   1.341 + 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
   1.342 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.343 +|     Type      |     Code      |          Checksum             |
   1.344 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.345 +| Cur Hop Limit |M|O|H|Prf|Rsrvd|       Router Lifetime         |
   1.346 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.347 +|                         Reachable Time                        |
   1.348 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.349 +|                          Retrans Timer                        |
   1.350 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.351 +|   Options ...
   1.352 ++-+-+-+-+-+-+-+-+-+-+-+-
   1.353 +@endverbatim
   1.354 +*
   1.355 +* @note
   1.356 +*	Above is longer thant what is declared in the base class
   1.357 +*	i-member. The user must verify the sufficient length of
   1.358 +*	the packet, when using this.
   1.359 +*
   1.360 +* Valid options:
   1.361 +*
   1.362 +* - #KInet6OptionICMP_SourceLink
   1.363 +* - #KInet6OptionICMP_Mtu
   1.364 +* - #KInet6OptionICMP_Prefix
   1.365 +* - #KInet6OptionICMP_RouteInformation (draft)
   1.366 +*
   1.367 +* @publishedAll
   1.368 +* @released
   1.369 +*/
   1.370 +	{
   1.371 +public:
   1.372 +	//
   1.373 +	// General
   1.374 +	//
   1.375 +	inline static TInt MinHeaderLength() {return 16; }
   1.376 +	inline static TInt MaxHeaderLength() {return 16; }
   1.377 +	inline TInt HeaderLength() const {return 16;}
   1.378 +	//
   1.379 +	// Access, get ICMP header field values from the packet
   1.380 +	//
   1.381 +	inline TInt CurHopLimit() const
   1.382 +		/**
   1.383 +		* Gets Cur Hop Limit.
   1.384 +		* @return Hop Limit
   1.385 +		*/
   1.386 +		{
   1.387 +		return i[4];
   1.388 +		}
   1.389 +	inline TInt Flags() const
   1.390 +		/**
   1.391 +		* Gets flags byte
   1.392 +		* @return Flags (M, O, H, Prf and Rsrvd)
   1.393 +		*/
   1.394 +		{
   1.395 +		return i[5];		// M + O + Reserved as one unit
   1.396 +		}
   1.397 +	inline TInt M() const
   1.398 +		/** Gets Managed Address Configuration (M) flag */
   1.399 +		{
   1.400 +		return i[5] & 0x80;
   1.401 +		}
   1.402 +	inline TInt O() const
   1.403 +		/** Gets Other Address Configuartion (O) flag */
   1.404 +		{
   1.405 +		return i[5] & 0x40;
   1.406 +		}
   1.407 +	inline TInt H() const
   1.408 +		/** Gets Home Agent Configuration (H) flag */
   1.409 +		{
   1.410 +		return i[5] & 0x20;
   1.411 +		}
   1.412 +#if 1
   1.413 +	inline TInt Prf() const
   1.414 +		/**
   1.415 +		* Gets default route preference.
   1.416 +		*
   1.417 +		* Experimental: draft-draves-ipngwg-router-selection-01.txt
   1.418 +		* Default Router Preferences and More-Specific Routes
   1.419 +		*/
   1.420 +		{
   1.421 +		return (i[5] >> 3) & 0x3;	// should be treated as 2bit signed int
   1.422 +		}
   1.423 +#endif
   1.424 +	inline TInt RouterLifetime() const
   1.425 +		/**
   1.426 +		* Gets the lifetime of the defaul route.
   1.427 +		*
   1.428 +		* If non-zero, specifies how long (in seconds) this
   1.429 +		* router is willing to act as a default router.
   1.430 +		*
   1.431 +		* @return The life time of the default route.
   1.432 +		*
   1.433 +		* @note
   1.434 +		*	This is badly named. The parameter controls
   1.435 +		*	only the default route processing. The value
   1.436 +		*	ZERO does not mean that the sender is not a
   1.437 +		*	router.
   1.438 +		*/
   1.439 +		{
   1.440 +		return (i[6] << 8) + i[7];
   1.441 +		}
   1.442 +	inline TUint32 ReachableTime() const
   1.443 +		/**
   1.444 +		* Gets the value of reachable timer.
   1.445 +		*/
   1.446 +		{
   1.447 +		return (i[8] << 24) | (i[9] << 16) | (i[10] << 8) | i[11];
   1.448 +		}
   1.449 +	inline TUint32 RetransTimer() const
   1.450 +		/**
   1.451 +		* Gets the value of retransmit timer.
   1.452 +		*/
   1.453 +		{
   1.454 +		return (i[12] << 24) | (i[13] << 16) | (i[14] << 8) | i[15];
   1.455 +		}
   1.456 +	//
   1.457 +	// Build, set IP header field values into the packet
   1.458 +	//
   1.459 +	inline void SetCurHopLimit(TInt aLimit)
   1.460 +		/**
   1.461 +		* Sets the Cur Hoplimit.
   1.462 +		* @param	aLimit	The Hoplimit [0..255]
   1.463 +		*/
   1.464 +		{
   1.465 +		i[4] = (TUint8)aLimit;
   1.466 +		}
   1.467 +	inline void SetFlags(TInt aFlags)
   1.468 +		/**
   1.469 +		* Sets the flags.
   1.470 +		* @param	aFlags	The flags bits [0..255].
   1.471 +		*/
   1.472 +		{
   1.473 +		i[5] = (TUint8)aFlags;
   1.474 +		}
   1.475 +	inline void SetRouterLifetime(TInt aTime)
   1.476 +		/**
   1.477 +		* Sets the lifetime of the default route.
   1.478 +		* @param aTime The lifetime.
   1.479 +		*/
   1.480 +		{
   1.481 +		i[7] = (TUint8)aTime;
   1.482 +		i[6] = (TUint8)(aTime >> 8);
   1.483 +		}
   1.484 +	inline void SetReachableTime(TUint32 aTime)
   1.485 +		/**
   1.486 +		* Sets the value of reachable timer
   1.487 +		* @param aTime The timer value
   1.488 +		*/
   1.489 +		{
   1.490 +		i[11] = (TUint8)aTime;
   1.491 +		i[10] = (TUint8)(aTime >> 8);
   1.492 +		i[9] = (TUint8)(aTime >> 16);
   1.493 +		i[8] = (TUint8)(aTime >> 24);
   1.494 +		}
   1.495 +	inline void SetRetransTimer(TUint32 aTimer)
   1.496 +		/**
   1.497 +		* Sets the value of the retransmit timer
   1.498 +		* @param aTimer The timer value
   1.499 +		*/
   1.500 +		{
   1.501 +		i[15] = (TUint8)aTimer;
   1.502 +		i[14] = (TUint8)(aTimer >> 8);
   1.503 +		i[13] = (TUint8)(aTimer >> 16);
   1.504 +		i[12] = (TUint8)(aTimer >> 24);
   1.505 +		}
   1.506 +
   1.507 +private:
   1.508 +	};
   1.509 +
   1.510 +class TInet6HeaderICMP_NeighborSol : public TInet6HeaderICMP
   1.511 +/**
   1.512 +* ICMPv6 Neighbour Solicitation layout.
   1.513 +@verbatim
   1.514 +Neigbour Solicitation Message Format from RFC-2461
   1.515 +
   1.516 + 0                   1                   2                   3
   1.517 + 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
   1.518 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.519 +|     Type      |     Code      |          Checksum             |
   1.520 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.521 +|                           Reserved                            |
   1.522 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.523 +|                                                               |
   1.524 ++                                                               +
   1.525 +|                                                               |
   1.526 ++                       Target Address                          +
   1.527 +|                                                               |
   1.528 ++                                                               +
   1.529 +|                                                               |
   1.530 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.531 +|   Options ...
   1.532 ++-+-+-+-+-+-+-+-+-+-+-+-
   1.533 +@endverbatim
   1.534 +*
   1.535 +* @note
   1.536 +*	Above is longer thant what is declared in the base class
   1.537 +*	i-member. The user must verify the sufficient length of
   1.538 +*	the packet, when using this.
   1.539 +*
   1.540 +* Valid options:
   1.541 +*
   1.542 +* - #KInet6OptionICMP_SourceLink
   1.543 +*
   1.544 +* @publishedAll
   1.545 +* @released
   1.546 +*/
   1.547 +	{
   1.548 +public:
   1.549 +	//
   1.550 +	// General
   1.551 +	//
   1.552 +	inline static TInt MinHeaderLength() {return 24; }
   1.553 +	inline static TInt MaxHeaderLength() {return 24; }
   1.554 +	inline TInt HeaderLength() const {return 24;}
   1.555 +	inline TIp6Addr &Target() const
   1.556 +		/**
   1.557 +		* Gets the Target Address.
   1.558 +		*
   1.559 +		* @return The target address (reference).
   1.560 +		*/
   1.561 +		{
   1.562 +		return (TIp6Addr &)i[8];
   1.563 +		}
   1.564 +private:
   1.565 +	};
   1.566 +
   1.567 +
   1.568 +class TInet6HeaderICMP_NeighborAdv : public TInet6HeaderICMP
   1.569 +/**
   1.570 +* ICMPv6 Neighbour Advertisement layout.
   1.571 +@verbatim
   1.572 +Neighbor Advertisement Message Format (from RFC-2461)
   1.573 +
   1.574 + 0                   1                   2                   3
   1.575 + 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
   1.576 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.577 +|     Type      |     Code      |          Checksum             |
   1.578 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.579 +|R|S|O|                     Reserved                            |
   1.580 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.581 +|                                                               |
   1.582 ++                                                               +
   1.583 +|                                                               |
   1.584 ++                       Target Address                          +
   1.585 +|                                                               |
   1.586 ++                                                               +
   1.587 +|                                                               |
   1.588 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.589 +|   Options ...
   1.590 ++-+-+-+-+-+-+-+-+-+-+-+-
   1.591 +@endverbatim
   1.592 +* @note
   1.593 +*	Above is longer thant what is declared in the base class
   1.594 +*	i-member. The user must verify the sufficient length of
   1.595 +*	the packet, when using this.
   1.596 +*
   1.597 +* Valid options:
   1.598 +*
   1.599 +* - #KInet6OptionICMP_TargetLink
   1.600 +*
   1.601 +* @publishedAll
   1.602 +* @released
   1.603 +*/
   1.604 +	{
   1.605 +public:
   1.606 +	//
   1.607 +	// General
   1.608 +	//
   1.609 +	inline static TInt MinHeaderLength() {return 24; }
   1.610 +	inline static TInt MaxHeaderLength() {return 24; }
   1.611 +	inline TInt HeaderLength() const {return 24;}
   1.612 +
   1.613 +	//
   1.614 +	// Set and Access the Target Address
   1.615 +	//
   1.616 +	inline TIp6Addr &Target() const
   1.617 +		/**
   1.618 +		* Gets the Target Address.
   1.619 +		*
   1.620 +		* @return The target address (reference).
   1.621 +		*/
   1.622 +		{
   1.623 +		return (TIp6Addr &)i[8];
   1.624 +		}
   1.625 +
   1.626 +	inline TInt R()
   1.627 +		{
   1.628 +		return 0x80 & i[4];
   1.629 +		}
   1.630 +	inline TInt S()
   1.631 +		{
   1.632 +		return 0x40 & i[4];
   1.633 +		}
   1.634 +	inline TInt O()
   1.635 +		{
   1.636 +		return 0x20 & i[4];
   1.637 +		}
   1.638 +	inline void SetR(TInt aValue)
   1.639 +		{
   1.640 +		if (aValue) i[4] |= 0x80; else i[4] &= ~0x80;
   1.641 +		}
   1.642 +	inline void SetS(TInt aValue)
   1.643 +		{
   1.644 +		if (aValue) i[4] |= 0x40; else i[4] &= ~0x40;
   1.645 +		}
   1.646 +	inline void SetO(TInt aValue)
   1.647 +		{
   1.648 +		if (aValue) i[4] |= 0x20; else i[4] &= ~0x20;
   1.649 +		}
   1.650 +
   1.651 +	};
   1.652 +
   1.653 +
   1.654 +class TInet6HeaderICMP_Redirect : public TInet6HeaderICMP
   1.655 +/**
   1.656 +* ICMPv6 Redirect layout.
   1.657 +@verbatim
   1.658 +Redirect Message Format (RFC-2461)
   1.659 +
   1.660 + 0                   1                   2                   3
   1.661 + 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
   1.662 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.663 +|     Type      |     Code      |          Checksum             |
   1.664 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.665 +|                           Reserved                            |
   1.666 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.667 +|                                                               |
   1.668 ++                                                               +
   1.669 +|                                                               |
   1.670 ++                       Target Address                          +
   1.671 +|                                                               |
   1.672 ++                                                               +
   1.673 +|                                                               |
   1.674 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.675 +|                                                               |
   1.676 ++                                                               +
   1.677 +|                                                               |
   1.678 ++                     Destination Address                       +
   1.679 +|                                                               |
   1.680 ++                                                               +
   1.681 +|                                                               |
   1.682 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.683 +|   Options ...
   1.684 ++-+-+-+-+-+-+-+-+-+-+-+-
   1.685 +
   1.686 +@endverbatim
   1.687 +* @note
   1.688 +*	Above is longer thant what is declared in the base class
   1.689 +*	i-member. The user must verify the sufficient length of
   1.690 +*	the packet, when using this.
   1.691 +*
   1.692 +* Valid options:
   1.693 +*
   1.694 +* - #KInet6OptionICMP_TargetLink
   1.695 +* - #KInet6OptionICMP_Redirect
   1.696 +*
   1.697 +* @publishedAll
   1.698 +* @released
   1.699 +*/
   1.700 +	{
   1.701 +public:
   1.702 +	//
   1.703 +	// General
   1.704 +	//
   1.705 +	inline static TInt MinHeaderLength() {return 40; }
   1.706 +	inline static TInt MaxHeaderLength() {return 40; }
   1.707 +	inline TInt HeaderLength() const {return 40;}
   1.708 +
   1.709 +	inline TIp6Addr &Target() const
   1.710 +		/**
   1.711 +		* Gets the Target Address.
   1.712 +		*
   1.713 +		* @return The target address (reference).
   1.714 +		*/
   1.715 +		{
   1.716 +		return (TIp6Addr &)i[8];
   1.717 +		}
   1.718 +	inline TIp6Addr &Destination() const
   1.719 +		/**
   1.720 +		* Gets the Destination Address.
   1.721 +		*
   1.722 +		* @return The destination address (reference).
   1.723 +		*/
   1.724 +		{
   1.725 +		return (TIp6Addr &)i[24];
   1.726 +		}
   1.727 +	};
   1.728 +
   1.729 +
   1.730 +class TInet6OptionICMP_LinkLayer
   1.731 +/**
   1.732 +* ICMPv6 Link-layer Address layout.
   1.733 +@verbatim
   1.734 +Source/Target Link-layer Address Option (RFC-2461)
   1.735 +
   1.736 + 0                   1                   2                   3
   1.737 + 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
   1.738 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.739 +|     Type      |    Length     |    Link-Layer Address ...
   1.740 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.741 +@endverbatim
   1.742 +* @publishedAll
   1.743 +* @released
   1.744 +*/
   1.745 +	{
   1.746 +public:
   1.747 +	inline static TInt MinHeaderLength() {return 8; }
   1.748 +	inline static TInt MaxHeaderLength() {return 8; }	// Not very useful
   1.749 +	inline TInt HeaderLength() const {return Length() * 8; }
   1.750 +	//
   1.751 +	// Access
   1.752 +	//
   1.753 +	inline TInt Type() const
   1.754 +		{
   1.755 +		return i[0];
   1.756 +		}
   1.757 +	inline TInt Length() const
   1.758 +		{
   1.759 +		return i[1];
   1.760 +		}
   1.761 +	//
   1.762 +	// Access and Set
   1.763 +	//
   1.764 +	inline TPtr8 Address() const
   1.765 +		{
   1.766 +		return TPtr8((TUint8 *)&i[2], i[1] * 8 - 2, i[1] * 8 - 2);
   1.767 +		}
   1.768 +	//
   1.769 +	// Construct methods
   1.770 +	//
   1.771 +	inline void SetType(TInt aType)
   1.772 +		{
   1.773 +		i[0] = (TUint8)aType;
   1.774 +		}
   1.775 +	inline void SetLength(TInt aLength)
   1.776 +		{
   1.777 +		i[1] = (TUint8)aLength;
   1.778 +		}
   1.779 +private:
   1.780 +	union
   1.781 +		{
   1.782 +		TUint8 i[8];
   1.783 +		TUint32 iAlign;	// A dummy member to force the 4 byte alignment
   1.784 +		};
   1.785 +	};
   1.786 +
   1.787 +
   1.788 +class TInet6OptionICMP_Prefix
   1.789 +/**
   1.790 +* ICMPv6 Prefix Infotmation Option.
   1.791 +@verbatim
   1.792 +Prefix Information Option (RFC-2461)
   1.793 +(+ Router Address flag from draft-ietf-mobileip-ipv6-08)
   1.794 + 0                   1                   2                   3
   1.795 + 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
   1.796 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.797 +|     Type      |    Length     | Prefix Length |L|A|R| Rsrvd1  |
   1.798 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.799 +|                         Valid Lifetime                        |
   1.800 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.801 +|                       Preferred Lifetime                      |
   1.802 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.803 +|                           Reserved2                           |
   1.804 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.805 +|                                                               |
   1.806 ++                                                               +
   1.807 +|                                                               |
   1.808 ++                            Prefix                             +
   1.809 +|                                                               |
   1.810 ++                                                               +
   1.811 +|                                                               |
   1.812 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.813 +
   1.814 +@endverbatim
   1.815 +* @publishedAll
   1.816 +* @released
   1.817 +*/
   1.818 +	{
   1.819 +public:
   1.820 +	inline static TInt MinHeaderLength() {return 4*8; }
   1.821 +	inline static TInt MaxHeaderLength() {return 4*8; }	// Not very useful
   1.822 +	inline TInt HeaderLength() const {return 4*8; }
   1.823 +
   1.824 +	inline TInt Type() const
   1.825 +		{
   1.826 +		return i[0];
   1.827 +		}
   1.828 +	inline TInt Length() const
   1.829 +		{
   1.830 +		return i[1];
   1.831 +		}
   1.832 +	inline TInt PrefixLength() const
   1.833 +		{
   1.834 +		return i[2];	// 0..128
   1.835 +		}
   1.836 +	inline TInt LFlag() const
   1.837 +		{
   1.838 +		return i[3] & 0x80;
   1.839 +		}
   1.840 +	inline TInt AFlag() const
   1.841 +		{
   1.842 +		return i[3] & 0x40;
   1.843 +		}
   1.844 +	inline TInt RFlag() const
   1.845 +		{
   1.846 +		return i[3] & 0x20;
   1.847 +		}
   1.848 +	inline TUint32 ValidLifetime() const
   1.849 +		{
   1.850 +		return (i[4] << 24) | (i[5] << 16) | (i[6] << 8) | i[7];
   1.851 +		}
   1.852 +	inline TUint32 PreferredLifetime() const
   1.853 +		{
   1.854 +		return (i[8] << 24) | (i[9] << 16) | (i[10] << 8) | i[11];
   1.855 +		}
   1.856 +	//
   1.857 +	//
   1.858 +	inline TIp6Addr &Prefix() const
   1.859 +		{
   1.860 +		return (TIp6Addr &)i[16];
   1.861 +		}
   1.862 +	//
   1.863 +	// Construct methods
   1.864 +	//
   1.865 +	inline void SetType(TInt aType)
   1.866 +		{
   1.867 +		i[0] = (TUint8)aType;
   1.868 +		}
   1.869 +	inline void SetLength(TInt aLength)
   1.870 +		{
   1.871 +		i[1] = (TUint8)aLength;
   1.872 +		}
   1.873 +	inline void SetPrefixLength(TInt aLength)
   1.874 +		{
   1.875 +		i[2] = (TUint8)aLength;
   1.876 +		}
   1.877 +	inline void SetFlags(TInt aFlags)
   1.878 +		{
   1.879 +		i[3] = (TUint8)aFlags;
   1.880 +		}
   1.881 +	inline void SetValidLifetime(TUint32 aTime)
   1.882 +		{
   1.883 +		i[7] = (TUint8)aTime;
   1.884 +		i[6] = (TUint8)(aTime >> 8);
   1.885 +		i[5] = (TUint8)(aTime >> 16);
   1.886 +		i[4] = (TUint8)(aTime >> 24);
   1.887 +		}
   1.888 +	inline void SetPreferredLifetime(TUint32 aTime)
   1.889 +		{
   1.890 +		i[11] = (TUint8)aTime;
   1.891 +		i[10] = (TUint8)(aTime >> 8);
   1.892 +		i[9] = (TUint8)(aTime >> 16);
   1.893 +		i[8] = (TUint8)(aTime >> 24);
   1.894 +		}
   1.895 +	inline void SetReserved2(TUint32 aFiller)
   1.896 +		{
   1.897 +		i[15] = (TUint8)aFiller;
   1.898 +		i[14] = (TUint8)(aFiller >> 8);
   1.899 +		i[13] = (TUint8)(aFiller >> 16);
   1.900 +		i[12] = (TUint8)(aFiller >> 24);
   1.901 +		}
   1.902 +
   1.903 +
   1.904 +private:
   1.905 +	union
   1.906 +		{
   1.907 +		TUint8 i[4*8];
   1.908 +		TUint32 iAlign;	// A dummy member to force the 4 byte alignment
   1.909 +		};
   1.910 +	};
   1.911 +
   1.912 +
   1.913 +class TInet6OptionICMP_Mtu
   1.914 +/**
   1.915 +* ICMPv6 MTU Option.
   1.916 +@verbatim
   1.917 +MTU Option (RFC-2461)
   1.918 +
   1.919 + 0                   1                   2                   3
   1.920 + 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
   1.921 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.922 +|     Type      |    Length     |           Reserved            |
   1.923 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.924 +|                              MTU                              |
   1.925 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   1.926 +@endverbatim
   1.927 +* @publishedAll
   1.928 +* @released
   1.929 +*/
   1.930 +	{
   1.931 +public:
   1.932 +	inline static TInt MinHeaderLength() {return 8; }
   1.933 +	inline static TInt MaxHeaderLength() {return 8; }	// Not very useful
   1.934 +	inline TInt HeaderLength() const {return 8; }
   1.935 +
   1.936 +	inline TInt Type() const
   1.937 +		{
   1.938 +		return i[0];
   1.939 +		}
   1.940 +	inline TInt Length() const
   1.941 +		{
   1.942 +		return i[1];
   1.943 +		}
   1.944 +	inline TInt Mtu() const
   1.945 +		{
   1.946 +		return (i[4] << 24) | (i[5] << 16) | (i[6] << 8) | i[7];
   1.947 +		}
   1.948 +	//
   1.949 +	// Construct methods
   1.950 +	//
   1.951 +	inline void SetType(TInt aType)
   1.952 +		{
   1.953 +		i[0] = (TUint8)aType;
   1.954 +		}
   1.955 +	inline void SetLength(TInt aLength)
   1.956 +		{
   1.957 +		i[1] = (TUint8)aLength;
   1.958 +		// Silently ZERO the reserved bits... not too nice --- msa
   1.959 +		i[2] = 0;
   1.960 +		i[3] = 0;
   1.961 +		}
   1.962 +	inline void SetMtu(TUint32 aMtu)
   1.963 +		{
   1.964 +		i[7] = (TUint8)aMtu;
   1.965 +		i[6] = (TUint8)(aMtu >> 8);
   1.966 +		i[5] = (TUint8)(aMtu >> 16);
   1.967 +		i[4] = (TUint8)(aMtu >> 24);
   1.968 +		}
   1.969 +private:
   1.970 +	TUint8 i[8];
   1.971 +	};
   1.972 +
   1.973 +
   1.974 +#if 1
   1.975 +class TInet6OptionICMP_RouteInformation
   1.976 +// Route Information Option 
   1.977 +// Experimental: draft-draves-ipngwg-router-selection-01.txt
   1.978 +/**
   1.979 +*  ICMPv6 Route Information Option.
   1.980 +@verbatim
   1.981 +Default Router Preferences and More-Specific Routes
   1.982 +
   1.983 + 0                   1                   2                   3 
   1.984 + 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 
   1.985 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
   1.986 +|     Type      |    Length     | Prefix Length |Resvd|Prf|Resvd| 
   1.987 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
   1.988 +|                        Route Lifetime                         | 
   1.989 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
   1.990 +|                                                               | 
   1.991 ++                                                               + 
   1.992 +|                                                               | 
   1.993 ++                            Prefix                             + 
   1.994 +|                                                               | 
   1.995 ++                                                               + 
   1.996 +|                                                               | 
   1.997 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
   1.998 +@endverbatim
   1.999 +* @publishedAll
  1.1000 +* @released
  1.1001 +*/
  1.1002 +	{
  1.1003 +public:
  1.1004 +	inline static TInt MinHeaderLength() {return 8; }
  1.1005 +	inline static TInt MaxHeaderLength() {return 3*8; }
  1.1006 +	inline TInt HeaderLength() const {return Length()*8; }
  1.1007 +
  1.1008 +	inline TInt Type() const
  1.1009 +		{
  1.1010 +		return i[0];
  1.1011 +		}
  1.1012 +	inline TInt Length() const
  1.1013 +		{
  1.1014 +		return i[1];
  1.1015 +		}
  1.1016 +	inline TInt PrefixLength() const
  1.1017 +		{
  1.1018 +		return i[2];	// 0..128
  1.1019 +		}
  1.1020 +	inline TInt Prf() const
  1.1021 +		{
  1.1022 +		return (i[3] >> 3) & 0x3;	// should be treated as 2bit signed int
  1.1023 +		}
  1.1024 +	inline TUint32 RouteLifetime() const
  1.1025 +		{
  1.1026 +		return (i[4] << 24) | (i[5] << 16) | (i[6] << 8) | i[7];
  1.1027 +		}
  1.1028 +	//
  1.1029 +	// *WARNING* The "Prefix" returns a raw reference to the beginning
  1.1030 +	// of the prefix field in the option structure. HOWEVER, the option
  1.1031 +	// field can be shorter than 128 bits! If used to allocate space,
  1.1032 +	// the maximum is allocated and the method is safe, but that is not
  1.1033 +	// true if header is mapped directly to the received packet! -- msa
  1.1034 +	inline TIp6Addr &Prefix() const
  1.1035 +		{
  1.1036 +		return (TIp6Addr &)i[8];
  1.1037 +		}
  1.1038 +	//
  1.1039 +	// Construct methods
  1.1040 +	//
  1.1041 +	inline void SetType(TInt aType)
  1.1042 +		{
  1.1043 +		i[0] = (TUint8)aType;
  1.1044 +		}
  1.1045 +	inline void SetLength(TInt aLength)
  1.1046 +		{
  1.1047 +		i[1] = (TUint8)aLength;
  1.1048 +		}
  1.1049 +	inline void SetPrefixLength(TInt aLength)
  1.1050 +		{
  1.1051 +		i[2] = (TUint8)aLength;
  1.1052 +		}
  1.1053 +	inline void SetPrefixLifetime(TUint32 aTime)
  1.1054 +		{
  1.1055 +		i[7] = (TUint8)aTime;
  1.1056 +		i[6] = (TUint8)(aTime >> 8);
  1.1057 +		i[5] = (TUint8)(aTime >> 16);
  1.1058 +		i[4] = (TUint8)(aTime >> 24);
  1.1059 +		}
  1.1060 +
  1.1061 +private:
  1.1062 +	union
  1.1063 +		{
  1.1064 +		TUint8 i[3*8];	// The space allocated for MAX LENGTH
  1.1065 +		TUint32 iAlign;	// A dummy member to force the 4 byte alignment
  1.1066 +		};
  1.1067 +	};
  1.1068 +
  1.1069 +class TInet6OptionICMP_DnsInformation
  1.1070 +/**
  1.1071 +*  ICMPv6 Recursive DNS Server Option.
  1.1072 +* IPv6 DNS Configuration based on Router Advertisement
  1.1073 +*
  1.1074 +* Experimental: draft-jeong-dnsop-ipv6-discovery-03.txt
  1.1075 +@verbatim
  1.1076 +Recursive DNS Server Option
  1.1077 +
  1.1078 + 0                   1                   2                   3
  1.1079 + 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
  1.1080 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1.1081 +|     Type      |     Length    |  Pref |        Reserved       |
  1.1082 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1.1083 +|                           Lifetime                            |
  1.1084 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1.1085 +|                                                               |
  1.1086 +:                     IPv6 Address of RDNSS                     :
  1.1087 +|                                                               |
  1.1088 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1.1089 +     
  1.1090 +@endverbatim
  1.1091 +* @publishedAll
  1.1092 +* @released
  1.1093 +*/
  1.1094 +	{
  1.1095 +public:
  1.1096 +	inline static TInt MinHeaderLength() {return 24; }
  1.1097 +	inline static TInt MaxHeaderLength() {return 24; }
  1.1098 +	inline TInt HeaderLength() const {return Length()*8; }
  1.1099 +
  1.1100 +	inline TInt Type() const
  1.1101 +		{
  1.1102 +		return i[0];
  1.1103 +		}
  1.1104 +	inline TInt Length() const
  1.1105 +		{
  1.1106 +		return i[1];
  1.1107 +		}
  1.1108 +	inline TInt Pref() const
  1.1109 +		{
  1.1110 +		return (i[3] >> 4) & 0xF;
  1.1111 +		}
  1.1112 +	inline TUint32 Lifetime() const
  1.1113 +		{
  1.1114 +		return (i[4] << 24) | (i[5] << 16) | (i[6] << 8) | i[7];
  1.1115 +		}
  1.1116 +	inline TIp6Addr &Address() const
  1.1117 +		{
  1.1118 +		return (TIp6Addr &)i[8];
  1.1119 +		}
  1.1120 +	//
  1.1121 +	// Construct methods
  1.1122 +	//
  1.1123 +	inline void SetType(TInt aType)
  1.1124 +		{
  1.1125 +		i[0] = (TUint8)aType;
  1.1126 +		}
  1.1127 +	inline void SetLength(TInt aLength)
  1.1128 +		{
  1.1129 +		i[1] = (TUint8)aLength;
  1.1130 +		}
  1.1131 +	inline void SetPref(TInt aPref)
  1.1132 +		{
  1.1133 +		i[2] = (TUint8)(((aPref << 4) & 0xF0) | (i[2] & 0xF));
  1.1134 +		}
  1.1135 +	inline void SetLifetime(TUint32 aTime)
  1.1136 +		{
  1.1137 +		i[7] = (TUint8)aTime;
  1.1138 +		i[6] = (TUint8)(aTime >> 8);
  1.1139 +		i[5] = (TUint8)(aTime >> 16);
  1.1140 +		i[4] = (TUint8)(aTime >> 24);
  1.1141 +		}
  1.1142 +
  1.1143 +private:
  1.1144 +	union
  1.1145 +		{
  1.1146 +		TUint8 i[24];	// The space allocated for MAX LENGTH
  1.1147 +		TUint32 iAlign;	// A dummy member to force the 4 byte alignment
  1.1148 +		};
  1.1149 +	};
  1.1150 +
  1.1151 +#endif
  1.1152 +
  1.1153 +/**
  1.1154 +* @name ICMPv6 Error Message Types (0-127)
  1.1155 +*/
  1.1156 +//@{
  1.1157 +const TUint8 KInet6ICMP_Unreachable		= 1;
  1.1158 +const TUint8 KInet6ICMP_PacketTooBig	= 2;
  1.1159 +const TUint8 KInet6ICMP_TimeExceeded	= 3;
  1.1160 +const TUint8 KInet6ICMP_ParameterProblem= 4;
  1.1161 +//@}
  1.1162 +/**
  1.1163 +* @name ICMPv6 Informational Message Types (128-255)
  1.1164 +*/
  1.1165 +//@{
  1.1166 +/** Echo Request. See TInet6HeaderICMP_Echo. */
  1.1167 +const TUint8 KInet6ICMP_EchoRequest		= 128;
  1.1168 +/** Echo Reply. See TInet6HeaderICMP_Echo. */
  1.1169 +const TUint8 KInet6ICMP_EchoReply		= 129;
  1.1170 +/** Not implemented. */
  1.1171 +const TUint8 KInet6ICMP_GroupQuery		= 130;
  1.1172 +/** Not implemented. */
  1.1173 +const TUint8 KInet6ICMP_GroupReport		= 131;
  1.1174 +/** Not implemented. */
  1.1175 +const TUint8 KInet6ICMP_GroupDone		= 132;
  1.1176 +/** Router Solicitation. See TInet6HeaderICMP_RouterSol. */
  1.1177 +const TUint8 KInet6ICMP_RouterSol		= 133;
  1.1178 +/** Router Advertisement. See TInet6HeaderICMP_RouterAdv. */
  1.1179 +const TUint8 KInet6ICMP_RouterAdv		= 134;
  1.1180 +/** Neighbor Solicitation. See TInet6HeaderICMP_NeighborSol. */
  1.1181 +const TUint8 KInet6ICMP_NeighborSol		= 135;
  1.1182 +/** Neighbor Advertisement. See TInet6HeaderICMP_NeighborAdv. */
  1.1183 +const TUint8 KInet6ICMP_NeighborAdv		= 136;
  1.1184 +/** Redirect. See TInet6HeaderICMP_Redirect. */
  1.1185 +const TUint8 KInet6ICMP_Redirect		= 137;
  1.1186 +//@}
  1.1187 +
  1.1188 +/**
  1.1189 +* @name ICMPv6 Option types.
  1.1190 +* The default derivation of the symbol
  1.1191 +* is from the name of the header class by replacing 'T' with 'K' (or
  1.1192 +* vice versa).
  1.1193 +*
  1.1194 +*/
  1.1195 +//@{
  1.1196 +/** Source Link-Layer Address. See TInet6OptionICMP_LinkLayer. */
  1.1197 +const TInt KInet6OptionICMP_SourceLink	= 1;
  1.1198 +/** Target Link-Layer Address. See TInet6OptionICMP_LinkLayer. */
  1.1199 +const TInt KInet6OptionICMP_TargetLink	= 2;
  1.1200 +/** Prefix Information. See TInet6OptionICMP_Prefix. */
  1.1201 +const TInt KInet6OptionICMP_Prefix		= 3;
  1.1202 +/** Redirect Header. (not implemented). */
  1.1203 +const TInt KInet6OptionICMP_Redirect	= 4;
  1.1204 +/** MTU.  See TInet6OptionICMP_Mtu. */
  1.1205 +const TInt KInet6OptionICMP_Mtu			= 5;
  1.1206 +
  1.1207 +#if 1
  1.1208 +	// Experimental: draft-draves-ipngwg-router-selection-01.txt
  1.1209 +	// Default Router Preferences and More-Specific Routes
  1.1210 +	// *UNOFFICIAL NUMBER ASSIGNMENT (SAME AS MSR STACK)--REAL VALUE TBD*
  1.1211 +/** Route Information. See TInet6OptionICMP_RouteInformation. */
  1.1212 +const TInt KInet6OptionICMP_RouteInformation = 9;
  1.1213 +#endif
  1.1214 +//@}
  1.1215 +
  1.1216 +//@}
  1.1217 +#endif