linklayerprotocols/pppnif/INC/PPPCCP.H
changeset 0 af10295192d8
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 // Copyright (c) 1997-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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalComponent 
       
    19 */
       
    20 
       
    21 #if !defined(__PPPCCP_H__)
       
    22 #define __PPPCCP_H__
       
    23 
       
    24 #include <networking/pppbase.h>
       
    25 #include <networking/pppcfg.h>
       
    26 
       
    27 const TUint16 KPppIdCcp = 0x80fd;
       
    28 const TUint8 KPppCcpResetReq	= 14;	
       
    29 const TUint8 KPppCcpResetAck	= 15;	
       
    30 
       
    31 const TUint8 KPppCcpOptOui       = 0;
       
    32 const TUint8 KPppCcpOptPred1     = 1;
       
    33 const TUint8 KPppCcpOptPred2     = 2;
       
    34 const TUint8 KPppCcpOptPuddle    = 3;
       
    35 const TUint8 KPppCcpOptHP        = 16;
       
    36 const TUint8 KPppCcpOptStac      = 17;
       
    37 const TUint8 KPppCcpOptMsoft     = 18;
       
    38 const TUint8 KPppCcpOptGandalf   = 19;
       
    39 const TUint8 KPppCcpOptV42bis    = 20;
       
    40 const TUint8 KPppCcpOptBSDLzw    = 21;
       
    41 const TUint8 KPppCcpOptMagnalink = 24;
       
    42 const TUint8 KPppCcpOptDeflate   = 26;
       
    43 const TUint8 KPppCcpOptReserved  = 255;
       
    44 
       
    45 const TUint8 KCcpSendPriority    = 10;
       
    46 
       
    47 //const TUint32 KPppCcpOptMsoftSupport = 1;
       
    48 
       
    49 /** @internalTechnology
       
    50 @{ */
       
    51 const TUint32 KUidPppCompressionModule = 0x10000C47;
       
    52 const TUint32 KUidUnicodePppCompressionModule = 0x10003d45;
       
    53 const TUint32 KUidPppMsCompression = 0x10000C49;
       
    54 //@}
       
    55 
       
    56 class CPppIniData;
       
    57 
       
    58 NONSHARABLE_CLASS(CPppCcp) : public CBase, public MPppFsm
       
    59 /**
       
    60 PPP Compression Control Protocol class (RFC 1962)
       
    61 @internalComponent
       
    62 */
       
    63 	{
       
    64 public:
       
    65 	CPppCcp(CPppLcp* aLcp);
       
    66 	~CPppCcp();
       
    67 	static CPppCcp* NewL(CPppLcp* aLcp);
       
    68 	void  ConstructL();
       
    69 	void	RemoveRegistration();
       
    70 	// Esock
       
    71 	virtual TInt State();
       
    72 	virtual TInt Send(RMBufChain& aPdu, TAny* aSource);
       
    73 	virtual void Info(TNifIfInfo& aInfo) const;
       
    74 	static void FillInInfo(TNifIfInfo& aInfo);
       
    75 
       
    76 	void SendFlowOn();
       
    77 	//
       
    78 	void Recv(RMBufChain& aPacket);
       
    79 	//
       
    80 	void KillProtocol();
       
    81 	void FrameError();
       
    82 
       
    83 	void UnloadCompressor() ;
       
    84 	// Added for Predictor
       
    85 	virtual void ReConfigLink();
       
    86 
       
    87 	virtual void SendResetRequestL();
       
    88 	virtual void RemoteCompressorHasReset();
       
    89 protected:
       
    90 	// PPP FSM Upcalls
       
    91 	virtual TInt FsmLayerStarted();
       
    92 	virtual void FsmLayerFinished(TInt aReason=KErrNone);
       
    93 	virtual void FsmLayerUp();
       
    94 	virtual void FsmLayerDown(TInt aReason=KErrNone);
       
    95 	virtual void FsmFillinConfigRequestL(RPppOptionList& aRequestList);
       
    96 	virtual void FsmCheckConfigRequest(RPppOptionList& aRequestList, RPppOptionList& aAckList, RPppOptionList& aNakList, RPppOptionList& aRejList);
       
    97 	virtual void FsmApplyConfigRequest(RPppOptionList& aRequestList);
       
    98 	virtual void FsmRecvConfigAck(RPppOptionList& aReplyList);
       
    99 	virtual void FsmRecvConfigNak(RPppOptionList& aReplyList, RPppOptionList& aReqList);
       
   100 	virtual void FsmRecvConfigReject(RPppOptionList& aReplyList, RPppOptionList& aReqList);
       
   101 	virtual TBool FsmRecvUnknownCode(TUint8 aCode, TUint8 aId, TInt aLength, RMBufChain& aPacket);
       
   102 	virtual void FsmTerminationPhaseComplete();
       
   103 private:
       
   104 	static TInt SendCallBack(TAny* aCProtocol);
       
   105 	void	DoSend();
       
   106 	void	SendResetAckL(TUint8 aId);
       
   107 	CPppDeCompressor* LoadDeCompressorL( CPppCompConfig& aPPPCompConfig, TInt aMaxFrameLength);
       
   108 	CPppCompressor*   LoadCompressorL(	 CPppCompConfig& aPPPCompConfig, TInt aMaxFrameLength);
       
   109 	void AddToRequestListL(RPppOptionList& aRequestList, TSglQueIter<CPppCompConfig>& aIterator);
       
   110 private:
       
   111 
       
   112 	/** Whether compression has been enabled in the configuration database */
       
   113 	TBool	iSoftwareCompressionOn;
       
   114 	//
       
   115 	//TUint				iCurrentCompressor;
       
   116 	//TUint				iCurrentDeCompressor;
       
   117 	
       
   118 	/** Queue of packets to send */
       
   119 	RMBufPktQ			iSendQ;
       
   120 	
       
   121 	/** Active object used to schedule sending packets */
       
   122 	CAsyncCallBack*		iSendCallBack;
       
   123 	//
       
   124 	TBool	iLowerFlowOn;
       
   125 	TBool	iUpperFlowOn;
       
   126 	
       
   127 	/** Object to take outgoing packets */
       
   128 	TPppExtraRecvr<CPppCcp> iRecvr;
       
   129 	
       
   130 	/** Identification code of the last Reset Request packet sent */
       
   131 	TUint8	iResetId;	
       
   132 	
       
   133 	/** Static compressor configuration information */
       
   134 	TSglQue<CPppCompConfig> iCompressorConfig;
       
   135 	
       
   136 	//CObjectConIx*		iContainerForDlls;
       
   137 	CObjectCon*			iCompressorCon;
       
   138 	CObjectCon*			iDeCompressorCon;
       
   139 	
       
   140 	/** Object implementing the negotiated compression algorithm */
       
   141 	CPppCompressor*		iCompressor;
       
   142 
       
   143 	/** Object implementing the negotiated decompression algorithm */
       
   144 	CPppDeCompressor*	iDeCompressor;
       
   145 	
       
   146 	/** Set to ETrue once KillProtocol has been called */
       
   147 	TBool				iDead;
       
   148 	
       
   149 	/** PPP .ini file parsing object */
       
   150 	CPppIniData*		iIniFilePtr;
       
   151 	
       
   152 	/** Working list of compressor configurations left to try */
       
   153 	RPppOptionList iRequestWorkList;	
       
   154 
       
   155 	};
       
   156 
       
   157 class CPppCompFactory : public CNifFactory
       
   158 /**
       
   159 Factory base for creating a concrete instance of a compressor
       
   160 or decompressor object.
       
   161 @internalComponent
       
   162 */
       
   163 	{
       
   164 public:
       
   165 	virtual void InstallL()=0;
       
   166 	virtual CPppCompressor*   NewPppCompressorL(  CPppCcp* aCcp, TInt aMaxFrameLength, const TUint8* aMode = NULL)=0;
       
   167 	virtual CPppDeCompressor* NewPppDeCompressorL(CPppCcp* aCcp, TInt aMaxFrameLength, const TUint8* aMode = NULL)=0;
       
   168 	};
       
   169 
       
   170 
       
   171 #endif // __PPPCCP_H_