linklayerprotocols/ethernetnif/INC/CLanIp6Bearer.h
changeset 0 af10295192d8
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // header file for the CLanIp6Bearer implementation
       
    15 // class, a derived from CLanxBearer.
       
    16 // History
       
    17 // 15/11/01 Started by Julian Skidmore.
       
    18 // 
       
    19 //
       
    20 
       
    21 /**
       
    22  @file
       
    23  @internalComponent 
       
    24 */
       
    25 
       
    26 #if !defined( CLanIp6Bearer_H )
       
    27 #define CLanIp6Bearer_H
       
    28 
       
    29 #include "CLanxBearer.h"
       
    30 #include <eui_addr.h>
       
    31 #include "EthProvision.h"
       
    32 
       
    33 /**
       
    34 @internalComponent
       
    35 */
       
    36 const TUint8 KMulticastPrefix[2] = {0x33, 0x33};
       
    37 
       
    38 
       
    39 /**
       
    40 All of this is stored in network byte order.
       
    41 @internalComponent
       
    42 */
       
    43 struct TIpv6Header
       
    44 {
       
    45 	TUint8 GetVersion() { return (TUint8)((iVersionClassHi>>4)&0xff);}
       
    46 	TUint8 GetClass() { return (TUint8)( ((iVersionClassHi<<4)| (iClassLoFlowHi>>4)) &0xff); }
       
    47 	TUint8 iVersionClassHi; // The Upper nybble provides version.
       
    48 	TUint8 iClassLoFlowHi;
       
    49 	TUint16 iFlowLo; // Two bytes, but it doesn't start on a word boundary.
       
    50 	TUint16 iPayloadLength;
       
    51 	TUint8 iNextHeader;
       
    52 	TUint8 iHopLimit;
       
    53 	union
       
    54 		{
       
    55 		TUint8 iSourceAddrB[16];
       
    56 		TUint16 iSourceAddrW[8];
       
    57 		TUint32 iSourceAddrL[4];
       
    58 		};
       
    59 	union
       
    60 		{
       
    61 		TUint8 iDestAddrB[16];
       
    62 		TUint16 iDestAddrW[8];
       
    63 		TUint32 iDestAddrL[4];
       
    64 		};
       
    65 };
       
    66 
       
    67 
       
    68 /**
       
    69 @internalComponent
       
    70 */
       
    71 NONSHARABLE_CLASS(CLanIp6Bearer) : public CLanxBearer
       
    72 {
       
    73 public:
       
    74 	CLanIp6Bearer(CLANLinkCommon* aLink);
       
    75 	virtual void ConstructL();
       
    76 
       
    77 	// MLowerControl
       
    78 	virtual TInt Control(TUint aLevel,TUint aName,TDes8& aOption);
       
    79 	virtual TInt GetConfig(TBinderConfig& aConfig);
       
    80 
       
    81 	// MLowerDataSender
       
    82 	virtual MLowerDataSender::TSendResult Send(RMBufChain& aPdu);
       
    83 
       
    84 	//Additional methods.
       
    85 	// Perhaps need different version of this
       
    86 	virtual TBool WantsProtocol(TUint16 aProtocolCode,const TUint8* aPayload);
       
    87 	virtual void Process(RMBufChain& aPdu,TAny* aLLC);
       
    88 	virtual void UpdateMACAddr();
       
    89 
       
    90 	virtual const TDesC8& ProtocolName() const;
       
    91 	
       
    92 	// Support for provisioning
       
    93 	virtual void SetProvisionL(const Meta::SMetaData* aProvision);
       
    94 
       
    95 private:
       
    96 	void ResolveMulticastIp6(TSockAddr& aDstAddr,RMBufChain& aPdu);
       
    97 	void ShiftLinkLayerAddress(TSockAddr& aDstAddr);
       
    98 	void ReadCommDbLanSettingsL();
       
    99 
       
   100 	enum {KIPProtocol=0x800, KIP6Protocol=6};
       
   101 	// 32-bit addresses in IPv4.
       
   102 	TInetAddr iIpAddr;
       
   103 	TEui64Addr iEuiMac; // yet another variant on the theme.
       
   104 	TIp6Addr iLocalAddr;
       
   105 	TIp6Addr iPrimaryDns;
       
   106 	TIp6Addr iSecondaryDns;
       
   107 
       
   108 	const TLanIp6Provision* iProvision;		// Provisioning information from SCPR
       
   109 };
       
   110 
       
   111 inline CLanIp6Bearer::CLanIp6Bearer(CLANLinkCommon* aLink) : 
       
   112    CLanxBearer(aLink)
       
   113 {
       
   114 }
       
   115 
       
   116 
       
   117 #endif