|
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 : Compressor.h |
|
16 * Part of : deflatecomp |
|
17 * CSigCompCompressor, ecom plugins framework |
|
18 * Version : 1.0 |
|
19 * |
|
20 */ |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 /** |
|
26 @internalComponent |
|
27 */ |
|
28 |
|
29 #ifndef SIGCOMPCOMPRESSOR_H |
|
30 #define SIGCOMPCOMPRESSOR_H |
|
31 |
|
32 #include <ecom/ecom.h> |
|
33 #include <badesca.h> |
|
34 |
|
35 class MSigCompStateMgr; |
|
36 class MSigCompCompartmentContext; |
|
37 class TStateItem; |
|
38 |
|
39 const TUid KCompressorInterfaceUid = {0x101F5D38}; |
|
40 |
|
41 class CSigCompCompressor : public CBase |
|
42 { |
|
43 public: |
|
44 class TCompressorInitParams |
|
45 { |
|
46 public: |
|
47 /** statemgr interface */ |
|
48 MSigCompStateMgr* iStateMgr; |
|
49 /** state item user provided when starting sigcomp, dictionary |
|
50 * usually |
|
51 */ |
|
52 TStateItem* iStateItem; |
|
53 /** length user provided for the given state */ |
|
54 TInt iStateItemLength; |
|
55 /** upload state? */ |
|
56 TBool iUploadState; |
|
57 }; |
|
58 |
|
59 public: |
|
60 static CSigCompCompressor* NewL(const TDesC8& aMatchString, |
|
61 MSigCompStateMgr* aStateMgr, |
|
62 TStateItem* aStateItem, |
|
63 TInt aStateItemLength, |
|
64 TBool aUploadState); |
|
65 |
|
66 static CSigCompCompressor* NewL(const TDesC8& aMatchString, |
|
67 MSigCompStateMgr* aStateMgr); |
|
68 |
|
69 virtual ~CSigCompCompressor(); |
|
70 |
|
71 /** |
|
72 * This function compresses given message, and outputs complete |
|
73 * sigcomp message. |
|
74 * |
|
75 * @param aCompartmentContext compartment context |
|
76 * @param aMessage Message to compress. |
|
77 * @param aForStreamBasedProtocol indicates what kind of |
|
78 * protocol is used (a delimeter at |
|
79 * the end of message |
|
80 * is added based on this parameter). |
|
81 * |
|
82 * @return complete sigcomp message, the ownership is transferred |
|
83 * @leave ECompressionFailure if aMessage.Length() == 0 |
|
84 */ |
|
85 virtual CBufBase* CompressMessageL( |
|
86 MSigCompCompartmentContext* aCompartmentContext, |
|
87 const TDesC8& aMessage, |
|
88 TBool aForStreamBasedProtocol) = 0; |
|
89 |
|
90 /** |
|
91 * This method is used to ask compressor whenever it supports |
|
92 * dynamic compression or not |
|
93 * |
|
94 * @return ETrue if it supports dynamic compression, EFalse otherwise |
|
95 */ |
|
96 virtual TBool IsDynamicCompressionSupported() = 0; |
|
97 |
|
98 protected: |
|
99 inline CSigCompCompressor(); |
|
100 |
|
101 private: |
|
102 /** unique key */ |
|
103 TUid iUniqueKey; |
|
104 }; |
|
105 |
|
106 #include "Compressor.inl" |
|
107 |
|
108 #endif |