realtimenetprots/sipfw/SIP/SigCompController/Common/inc/MSigCompController.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          : MSigCompController.h
       
    16 * Part of       : ConnectionMgr
       
    17 * Version       : SIP/4.0 
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @internalComponent
       
    26 */
       
    27 #ifndef __MSIGCOMPCONTROLLER_H__
       
    28 #define __MSIGCOMPCONTROLLER_H__
       
    29 
       
    30 #include <in_sock.h>
       
    31 class CSIPRequest;
       
    32 class CSIPResponse;
       
    33 class TSIPTransportParams;
       
    34 
       
    35 /**
       
    36  * Interface class for sigcomp controller
       
    37  */
       
    38 
       
    39 class MSigCompController 
       
    40 	{
       
    41 	public:
       
    42 
       
    43     /**
       
    44      * Destructor.
       
    45 	 */
       
    46 
       
    47     virtual ~MSigCompController () { };
       
    48 
       
    49     /**
       
    50      * Checks if signalling compression is installed.
       
    51      *
       
    52      * @returns ETrue if installed, EFalse otherwise.
       
    53 	 */
       
    54     virtual TBool IsSupported () const = 0;
       
    55 
       
    56     /**
       
    57      * After calling this function Connection Mgr always uses
       
    58      * signalling compression for requests sent with compartmentId
       
    59      * returned by this function.      
       
    60      * Multiple users can share a compression to one host:
       
    61      * In sending phase remote inetaddr and compartmentid are mapped together.
       
    62      * If some other compartmentid has already same remote destination address
       
    63      * mapped with it, ids share the same compartment.
       
    64      *
       
    65      * @returns compartmentId
       
    66 	 */
       
    67     virtual TUint32 CreateCompartmentL (TUint32 aIapId) = 0;
       
    68 
       
    69     /**
       
    70      * Removes compression for passed compartmentId.
       
    71      * If no compression for the host was found, the function silently returns.
       
    72 	 */
       
    73     virtual void RemoveCompartment (TUint32 aCompartmentId) = 0;
       
    74 
       
    75 	/**
       
    76 	 * The function encodes the Request and compresses 
       
    77 	 * it if there is compartment matching compartmentId. After calling
       
    78 	 * this function, next-hop address is mapped with compartmentId.
       
    79 	 * Leaves with a system wide error if encoding or compressing fails.
       
    80 	 * 
       
    81 	 * @param aTransportParams contains compartmentId and iapId
       
    82 	 *
       
    83 	 * @param aRequest a request to encode and compress	
       
    84 	 *			
       
    85 	 * @param aAddress	A remote destination address
       
    86 	 *					
       
    87 	 * @returns encoded data, the ownership is transferred
       
    88 	 */
       
    89 	virtual CBufBase* EncodeL (const TSIPTransportParams& aTransportParams,
       
    90 	                           CSIPRequest& aRequest,
       
    91                                const TInetAddr& aAddress,
       
    92 							   TBool aStreambasedProtocol,
       
    93 							   TBool& aCompressed) = 0;
       
    94 
       
    95 	/**
       
    96 	 * The function encodes the Response and compresses 
       
    97      * it if there is compartment matching compartmentId. After calling
       
    98 	 * this function, next-hop address is mapped with compartmentId.
       
    99 	 * Leaves with a system wide error if encoding or compressing fails.
       
   100 	 * 
       
   101 	 * @param aTransportParams contains compartmentId and iapId
       
   102 	 *
       
   103 	 * @param aResponse a response to encode and compress	
       
   104 	 *				
       
   105 	 * @param aAddress	A remote destination address					
       
   106 	 * 
       
   107 	 * @returns encoded data, the ownership is transferred
       
   108 	 */
       
   109 	virtual CBufBase* EncodeL (const TSIPTransportParams& aTransportParams,
       
   110 	                           CSIPResponse& aResponse,
       
   111                                const TInetAddr& aAddress,
       
   112 							   TBool aStreambasedProtocol,
       
   113 							   TBool& aCompressed) = 0;
       
   114 
       
   115 	/**
       
   116 	 * Checks if the message contains the delimeter indicating SigComp
       
   117 	 * message end. This function must be used only with stream-based
       
   118 	 * transports, otherwise it will always return EFalse.
       
   119 	 *
       
   120 	 * @pre IsSigCompMsg()==ETrue
       
   121 	 *
       
   122 	 * @returns ETrue is the SigComp message is complete, EFalse otherwise
       
   123 	 */
       
   124 	virtual TBool IsCompleteSigCompMessageL (const TDesC8& aMessage) const = 0;
       
   125 
       
   126 	
       
   127 	/**
       
   128 	 * Checks if the first byte contains bit pattern indicating the start
       
   129 	 * of the SigComp message. Function examines only the first byte.
       
   130 	 *
       
   131 	 * @returns ETrue if the first byte indicates the start of the SigComp message,
       
   132 	 *          EFalse otherwise
       
   133 	 */
       
   134 	virtual TBool IsSigCompMsg (const TDesC8& aMessage) const = 0;
       
   135 
       
   136 
       
   137   	/**
       
   138 	 * Decompress the message; leaves on failure. 
       
   139 	 * Leaves with a system wide error decompressing fails.
       
   140 	 * The function expects the client to provide complete SigComp message.
       
   141 	 *
       
   142 	 * @pre IsSigCompMsg()==ETrue
       
   143 	 * 
       
   144 	 * @param aMessage a message to decompress. The message must start with SigComp specific
       
   145 	 *                 delimeter and end with SigComp specific delimeter
       
   146 	 *
       
   147 	 * @param aBytesConsumed on return will contain the number of bytes consumed by the decompression
       
   148 	 *                       from the original message 
       
   149 	 * @returns decompressed message, the ownership is transferred
       
   150 	 */
       
   151 	virtual CBufBase* DecompressL (const TDesC8& aMessage,
       
   152                                    TUint& aBytesConsumed,
       
   153                                    TBool aIsStreamBased) = 0;
       
   154 
       
   155 	/**
       
   156 	 * The function returns count of compartments
       
   157 	 *
       
   158 	 * @returns count of compartments
       
   159 	 */
       
   160 	virtual TInt CompartmentCount () = 0;
       
   161 
       
   162 	/**
       
   163      * If the compartment has been previously used for decompressing,
       
   164      * resets the compartment. If not, deletes the compartment. 
       
   165      *
       
   166      * @param aCompartmentId the IAP for which the sending failed
       
   167      *
       
   168      */
       
   169 	virtual void SendFailedL (TUint32 aCompartmentId) = 0;
       
   170 
       
   171 	/**
       
   172 	 * Allows the state of the decompressed message to be saved; leaves on failure.
       
   173 	 * 
       
   174 	 * @param aAddress	A remote destination address					
       
   175 	 * @param aIapId	A iap id
       
   176 	 */
       
   177 	virtual void AllowL(const TInetAddr& aAddress, TUint32 aIapId) = 0;
       
   178 
       
   179 	/**
       
   180 	 * Denies the state of the message to be saved.
       
   181 	 */
       
   182 	virtual void Deny() = 0;
       
   183 
       
   184     };
       
   185 
       
   186 #endif // end of __MSIGCOMPCONTROLLER_H__
       
   187