realtimenetprots/sipfw/SigComp/CompDeflate/inc/SigCompDeflateContext.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2003-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        : SigCompDeflate.h
       
    16 * Part of     : CDeflateComp
       
    17 * Interface   : 
       
    18 * compression context
       
    19 * Version     : 1.0
       
    20 *
       
    21 */
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 /**
       
    27  @internalComponent
       
    28 */
       
    29 
       
    30 
       
    31 #ifndef SIGCOMPCOMPDEFLATECONTEXT_H
       
    32 #define SIGCOMPCOMPDEFLATECONTEXT_H
       
    33 
       
    34 #include "SigCompCompressionContext.h"
       
    35 
       
    36 class TStateItem;
       
    37 
       
    38 /*
       
    39 * deflate compression context saved in compartment beetwen
       
    40 * CompressMessageL() calls.
       
    41 */
       
    42 
       
    43 class CSigCompDeflateContext: public CSigCompCompressionContext
       
    44     {
       
    45     public:
       
    46         CSigCompDeflateContext();
       
    47 
       
    48         virtual ~CSigCompDeflateContext();
       
    49 
       
    50         /** 
       
    51          * save the window size for future use.
       
    52          *
       
    53          * @param aWindowSize window size
       
    54          */
       
    55         void SetWindowSize(TInt aWindowSize);
       
    56 
       
    57         /** 
       
    58          * return previously saved window size
       
    59          *
       
    60          * @returns window size
       
    61          */
       
    62         TInt WindowSize();
       
    63 
       
    64         /** 
       
    65          * save the current position for future use.
       
    66          *
       
    67          * @param aCurrentPosition current position
       
    68          */
       
    69         void SetCurrentPosition(TInt aCurrentPosition);
       
    70 
       
    71         /** 
       
    72          * return previously saved 'current position'
       
    73          *
       
    74          * @returns saved 'current position'
       
    75          */
       
    76         TInt CurrentPosition();
       
    77 
       
    78         /** 
       
    79          * save the window for future use. ownership is transfered
       
    80          *
       
    81          * @param aWindow window pointer
       
    82          */
       
    83         void SetWindow(CArrayFixFlat<TUint8>* aWindow);
       
    84 
       
    85         /** 
       
    86          * return saved window pointer.
       
    87          *
       
    88          * @returns window size
       
    89          */
       
    90         CArrayFixFlat<TUint8>* Window();
       
    91 
       
    92         /**
       
    93         * set dictionary state item
       
    94         *
       
    95         * @params aStateItem to be set
       
    96         * @params aStateItemLength length of state item
       
    97         */
       
    98         void SetStateItem(TStateItem* aStateItem, TInt aStateItemLength);
       
    99 
       
   100         /**
       
   101         * get dictionary state item
       
   102         *
       
   103         * @returns state item, may be null.
       
   104         */
       
   105         TStateItem* StateItem();
       
   106 
       
   107         /**
       
   108         * get dictionary state item length
       
   109         *
       
   110         * @returns state item length
       
   111         */
       
   112         TInt StateItemLength();
       
   113 
       
   114         /** 
       
   115          * set bytecode confirmation
       
   116          *
       
   117          * @param aBytecodeStateConfirmed is bytecode state confirmed
       
   118          *
       
   119          */
       
   120 		void SetBytecodeStateConfirmed(TBool aBytecodeStateConfirmed);
       
   121 
       
   122         /** 
       
   123          * get bytecode confirmation
       
   124          *
       
   125          * @returns is bytecode state confirmed
       
   126          *
       
   127          */
       
   128 		TBool BytecodeStateConfirmed() const;
       
   129 
       
   130         /** 
       
   131          * set bytecode state hash
       
   132          *
       
   133          * @param aHash bytecode state hash
       
   134          *
       
   135          */
       
   136 		void SetBytecodeHash(const TUint8* aHash);
       
   137 
       
   138         /** 
       
   139          * get bytecode state hash
       
   140          *
       
   141          * @returns bytecode state hash
       
   142          *
       
   143          */
       
   144 		const TUint8* BytecodeHash() const;
       
   145 
       
   146         /** 
       
   147          * set circular buffer confirmation
       
   148          *
       
   149          * @param aStateConfirmed is circular buffer state confirmed
       
   150          *
       
   151          */
       
   152         void SetCBStateConfirmed(TBool aStateConfirmed);
       
   153 
       
   154         /** 
       
   155          * get circular buffer confirmation
       
   156          *
       
   157          * @returns is circular buffer state confirmed
       
   158          *
       
   159          */
       
   160 		TBool CBStateConfirmed() const;
       
   161 
       
   162         /** 
       
   163          * set circular buffer state hash
       
   164          *
       
   165          * @param aHash circular buffer state hash
       
   166          *
       
   167          */
       
   168         void SetCBStateHash(const TUint8* aHash);
       
   169 
       
   170         /** 
       
   171          * get circular buffer state hash
       
   172          *
       
   173          * @returns circular buffer state hash
       
   174          *
       
   175          */
       
   176 		const TUint8* CBStateHash() const;
       
   177 
       
   178         /** 
       
   179          * set circular buffer state length
       
   180          *
       
   181          * @param aLength circular buffer state length
       
   182          *
       
   183          */
       
   184         void SetCBStateLength(TInt aLength);
       
   185 
       
   186         /** 
       
   187          * get circular buffer state length
       
   188          *
       
   189          * @returns circular buffer state length
       
   190          *
       
   191          */
       
   192         TInt CBStateLength() const;
       
   193 
       
   194         /**
       
   195          * Set iUploadState flag
       
   196          *
       
   197          * @param aUploadState value to be set
       
   198          *
       
   199          */
       
   200         void SetUploadState(TBool aUploadState);
       
   201 
       
   202         /**
       
   203          * get iUploadState
       
   204          *
       
   205          * @returns iUploadstate field
       
   206          *
       
   207          */
       
   208         TBool UploadState();
       
   209 
       
   210         /**
       
   211         * returns ETrue if user state was already uploaded to the other side,
       
   212         * EFalse if it was not.
       
   213         *
       
   214         * @returns iStateUploaded.
       
   215         */
       
   216         TBool StateUploaded();
       
   217 
       
   218         /**
       
   219         * set uploaded state flag
       
   220         *
       
   221         * @params aState state to be set
       
   222         */
       
   223         void SetStateUploaded(TBool aState);
       
   224 
       
   225         /** 
       
   226          * set remote state memory size
       
   227          *
       
   228          * @param aSms remote state memory size
       
   229          *
       
   230          */
       
   231 		void SetSms(TInt aSms);
       
   232 
       
   233         /** 
       
   234          * get remote state memory size
       
   235          *
       
   236          * @returns remote state memory size
       
   237          *
       
   238          */
       
   239 		TInt Sms() const;
       
   240 
       
   241         /** 
       
   242          * set decompression state memory size
       
   243          *
       
   244          * @param aDms remote decompression memory size
       
   245          *
       
   246          */
       
   247 		void SetDms(TInt aDms);
       
   248 
       
   249         /** 
       
   250          * get remote decompression memory size
       
   251          *
       
   252          * @returns remote decompression memory size
       
   253          *
       
   254          */
       
   255 		TInt Dms() const;
       
   256 
       
   257 
       
   258         /** 
       
   259          * set local udvm memory size
       
   260          *
       
   261          * @param aUdvmSize local udvm memory size
       
   262          *
       
   263          */
       
   264         void SetUdvmSize(TInt aUdvmSize);
       
   265 
       
   266         /** 
       
   267          * get local udvm memory size
       
   268          *
       
   269          * @returns local udvm memory size
       
   270          *
       
   271          */
       
   272    	    TInt UdvmSize() const;
       
   273 
       
   274         /** 
       
   275          * set local circular buffer size
       
   276          *
       
   277          * @param aCBSize local circular buffer size
       
   278          *
       
   279          */
       
   280         void SetCBSize(TInt aCBSize);
       
   281 
       
   282         /** 
       
   283          * get local circular buffer size
       
   284          *
       
   285          * @returns local circular buffer size
       
   286          *
       
   287          */
       
   288    	    TInt CBSize() const;
       
   289 
       
   290     private:
       
   291 
       
   292         /** should the state given by user be uploaded? */
       
   293         TBool iUploadState;
       
   294 
       
   295         /** dictionary state item */
       
   296         TStateItem* iStateItem;
       
   297 
       
   298         /** length of string part of dictionary state item */
       
   299         TInt iStateItemLength;
       
   300 
       
   301 
       
   302         /** current position within window, points to currently encoded char */
       
   303         TInt iCurrentPosition;
       
   304 
       
   305         /** size of window */
       
   306         TInt iWindowSize;
       
   307 
       
   308         /** compression window, dynamic dictionary*/
       
   309         CArrayFixFlat<TUint8>* iWindow;
       
   310         
       
   311         /** hash id, used to determine whenever we lost sync or not*/
       
   312         TUint8 iCBStateHash[6];
       
   313         TInt iCBStateLength;
       
   314 
       
   315         /** hash id, used to determine whenever we lost sync or not*/
       
   316         TUint8 iBytecodeStateHash[6];
       
   317 
       
   318         /** circular buffer state confirmed */
       
   319         TBool iCBStateConfirmed;
       
   320 
       
   321         /** bytecode state confirmed */
       
   322         TBool iBytecodeStateConfirmed;
       
   323 
       
   324         /** remote state memory size */
       
   325 		TInt iStateMemorySize;
       
   326 
       
   327         /** remote decompression memory size */
       
   328 		TInt iDecompressionMemorySize;
       
   329 
       
   330         /** local udvm memory size */
       
   331         TInt iUdvmSize;
       
   332 
       
   333         /** local circular buffer size */
       
   334         TInt iCBSize;
       
   335 
       
   336     };
       
   337 
       
   338 #endif