realtimenetprots/sipfw/SIP/SigCompController/DefaultPlugin/inc/SipSigCompHandlerImp.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * Name          : sipsigcomphandlerimp.h
       
    16 * Part of       : SIPSigComp
       
    17 * Version       : SIP/4.0
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @internalComponent
       
    26 */
       
    27 #ifndef __SIPSIGCOMPHANDLERIMP_H__
       
    28 #define __SIPSIGCOMPHANDLERIMP_H__
       
    29 
       
    30 
       
    31 #include "msiGcompowner.h"
       
    32 #include "sipsigcomphandler.h"
       
    33 #include "MCompartmentCtxOwner.h"
       
    34 #include "MCompartmentUserOwner.h"
       
    35 
       
    36 class CSigComp;
       
    37 class CSipSigCompCompartmentCtx;
       
    38 class CSipSigCompCompartmentUser;
       
    39 class CSigCompCompressingLogic;
       
    40 class TSIPSigCompHandlerInitParams;
       
    41 class MLocalName;
       
    42 
       
    43 class CSipSigCompHandlerImpl :
       
    44 		public CSigCompHandler,
       
    45 		public MSigCompOwner,
       
    46 		public MCompartmentCtxOwner,
       
    47 		public MCompartmentUserOwner
       
    48 {
       
    49 public:
       
    50 
       
    51 
       
    52 	static CSipSigCompHandlerImpl* NewL( TAny* aInitParams );
       
    53 
       
    54 	static CSipSigCompHandlerImpl* NewLC( TAny* aInitParams );
       
    55 
       
    56 	/**
       
    57 	* Destructor.
       
    58 	*
       
    59 	* @post All objects and members created by the SigComp Handler are deleted
       
    60 	*
       
    61 	*/
       
    62     ~CSipSigCompHandlerImpl ();
       
    63 
       
    64 public: // From MSigCompController
       
    65 
       
    66     TUint32 CreateCompartmentL( TUint32 aIapId );
       
    67 
       
    68     void RemoveCompartment( TUint32 aCompartmentId );
       
    69 
       
    70 	CBufBase* DecompressL( const TDesC8& aMessage,
       
    71                            TUint& aBytesConsumed,
       
    72                            TBool aIsStreamBased );
       
    73 
       
    74 	CBufBase* EncodeL( const TSIPTransportParams& aTransportParams,
       
    75 	                   CSIPRequest& aRequest,
       
    76                        const TInetAddr& aAddress,
       
    77 					   TBool aStreambasedProtocol,
       
    78                        TBool& aCompressed );
       
    79 
       
    80 	CBufBase* EncodeL( const TSIPTransportParams& aTransportParams,
       
    81 	                   CSIPResponse& aResponse,
       
    82                        const TInetAddr& aAddress,
       
    83                        TBool aStreambasedProtocol,
       
    84                        TBool& aCompressed );
       
    85 
       
    86 	TBool IsCompleteSigCompMessageL( const TDesC8& aMessage ) const;
       
    87 
       
    88 	TBool IsSigCompMsg( const TDesC8& aMessage ) const;
       
    89 
       
    90 	TBool IsSupported() const;
       
    91 
       
    92 	TInt CompartmentCount();
       
    93 
       
    94 	void SendFailedL( TUint32 aCompartmentId );
       
    95 
       
    96 	void AllowL( const TInetAddr& aAddress, TUint32 aIapId );
       
    97 
       
    98 	void Deny();
       
    99 	
       
   100 
       
   101 public: // From MSigCompOwner
       
   102 
       
   103 
       
   104 	CBufBase* EncodeSipL( CSIPResponse& aResponse,
       
   105 		                  TBool aStreambasedProtocol );
       
   106 
       
   107 	CBufBase* EncodeSipL( CSIPRequest& aRequest,
       
   108 		                  TBool aStreambasedProtocol );
       
   109 
       
   110 	CBufBase* EncodeSipAndCompressL( const TSIPTransportParams& aTransportParams,
       
   111 	                                 CSIPResponse& aResponse,
       
   112             					     const TInetAddr& aAddress,
       
   113             						 TBool aStreambasedProtocol );
       
   114 
       
   115 	CBufBase* EncodeSipAndCompressL( const TSIPTransportParams& aTransportParams,
       
   116 	                                 CSIPRequest& aRequest,
       
   117                                      const TInetAddr& aAddress,
       
   118                                      TBool aStreambasedProtocol );
       
   119 
       
   120 	CSigComp* SigComp() {return iSigComp;}
       
   121 
       
   122 	TBool Match( const TDesC8& aAddress );
       
   123 
       
   124 	TBool HasCompartmentUser( const TSIPTransportParams& aTransportParams );
       
   125 	
       
   126 
       
   127 public: // From MCompartmentCtxOwner
       
   128 	
       
   129 	void KillMe( CSipSigCompCompartmentCtx* aCompartmentCtx );	
       
   130 	
       
   131 	
       
   132 public: // From MCompartmentCtxUser
       
   133 	
       
   134 	CSipSigCompCompartmentCtx* CreateCompartmentL( const TInetAddr& aAddress,
       
   135                                             	   TUint32 aIapId,
       
   136 	                                               TBool aDynamicCompression );
       
   137 	
       
   138     CSipSigCompCompartmentCtx* SearchCompartmentByInetAddr( const TInetAddr& aAddress,
       
   139 	                                                        TUint32 aIapId );
       
   140 	                                                                                                                
       
   141 protected:
       
   142 
       
   143     void ConstructL();
       
   144 
       
   145 private:
       
   146 
       
   147 	CSipSigCompHandlerImpl( TSIPSigCompHandlerInitParams* aInitParams );
       
   148 
       
   149 private:
       
   150 
       
   151     TUint32 CreateCompartmentId();
       
   152 												   
       
   153 	TUint32 CreateCompartmentUserL( TUint32 aIapId );
       
   154 
       
   155 	TInt DeleteCompartmentUser( TUint32 aCompartmentId );					
       
   156 
       
   157 	CSipSigCompCompartmentUser* SearchCompartmentUserL( TUint32 aCompartmentId,
       
   158                                                         const TInetAddr& aAddress );  
       
   159                                                                                                       
       
   160 	CSipSigCompCompartmentUser* SearchCompartmentUserByCompId( TUint32 aCompartmentId );
       
   161 	
       
   162 	void RemoveAllCompartments();
       
   163      
       
   164 
       
   165 private: // Data
       
   166 
       
   167 	CSigComp* iSigComp;
       
   168 	TSglQue<CSipSigCompCompartmentCtx> iCompartmentList;
       
   169 	TSglQue<CSipSigCompCompartmentUser> iCompartmentUserList;
       
   170 	CSigCompCompressingLogic* iCompressingLogic;
       
   171 	MLocalName& iLocalName;
       
   172 	TInt iMaxCompartmentCount;
       
   173 	TUint32 iCompartmentIdCounter;
       
   174 	
       
   175 private: //For testing purposes
       
   176 #ifdef CPPUNIT_TEST	
       
   177 	friend class CSigCompHandlerTest;
       
   178 #endif
       
   179 };
       
   180 
       
   181 #endif // end of __SIPSIGCOMPHANDLERIMP_H__