|
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 : MSigCompHandler.h |
|
16 * Part of : ConnectionMgr |
|
17 * Version : SIP/4.0 |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 |
|
23 #ifndef __MSIGCOMPHANDLER_H__ |
|
24 |
|
25 /** |
|
26 * @internalComponent |
|
27 */ |
|
28 #define __MSIGCOMPHANDLER_H__ |
|
29 |
|
30 #include <in_sock.h> |
|
31 #include "SipHostPort.h" |
|
32 |
|
33 |
|
34 /** |
|
35 * Interface class for sigcomp handler. |
|
36 */ |
|
37 class MSigCompHandler |
|
38 { |
|
39 public: |
|
40 |
|
41 /** |
|
42 * Destructor. |
|
43 */ |
|
44 virtual ~MSigCompHandler () {} |
|
45 |
|
46 /** |
|
47 * After calling this function Connection Mgr always uses |
|
48 * signalling compression for requests sent to this host. |
|
49 * Multiple users can share a compression to a given host. |
|
50 * This is implemented as a reference count. |
|
51 * If a compression already exists, the referrence count is |
|
52 * incremented by one. |
|
53 * |
|
54 * @param aHostPort for which all the outgoing requests should be sent |
|
55 * compressed. |
|
56 */ |
|
57 virtual void UseL (const CSIPHostPort& aHostPort) = 0; |
|
58 |
|
59 /** |
|
60 * Decrements the reference count to a initiated compression. |
|
61 * When reference count reaches zero, |
|
62 * the compression for this host is stopped. |
|
63 * If no compression for the host was found, the function silently returns. |
|
64 * |
|
65 * @param aHostPort for which to unuse compression. |
|
66 */ |
|
67 virtual void UnUse (const CSIPHostPort& aHostPort) = 0; |
|
68 |
|
69 /** |
|
70 * Decompress the message; leaves on failure. |
|
71 * |
|
72 * SigComp specífic leave codes: |
|
73 * EDecompressionFailure - the decompressor failed to decompress the |
|
74 * message. |
|
75 * EIncompleteMessage - the SigComp message was incomplete |
|
76 * The function expects the client to provide complete SigComp message. |
|
77 * |
|
78 * @pre IsSigCompMsg()==ETrue |
|
79 * |
|
80 * @param aMessage a message to decompress. The message must start with |
|
81 * SigComp specific delimeter and end with SigComp specific |
|
82 * delimeter |
|
83 * |
|
84 * @param aBytesConsumed on return will contain the number of bytes |
|
85 * consumed by the decompression from the original |
|
86 message |
|
87 * @returns decompressed message, the ownership is transferred |
|
88 */ |
|
89 virtual HBufC8* |
|
90 DecompressL(const TDesC8& aMessage, TUint& aBytesConsumed) = 0; |
|
91 |
|
92 /** |
|
93 * Compress the message using the algorith provided while |
|
94 * creating the instance of the CSigComp class. |
|
95 * |
|
96 * Leaves with CSigComp::TError::ECompressionError error code if the |
|
97 * compression fails. |
|
98 * Leaves with KErrNotFound error code if compartment is not found. |
|
99 * |
|
100 * @param aMessage a message to compress. |
|
101 * |
|
102 * @param aAddress A remote destination address |
|
103 * |
|
104 * @param aSIPHostPort The host where message will be sent after |
|
105 * compression. |
|
106 * The hostport identifies the compartment that will be used for |
|
107 * compression. |
|
108 * |
|
109 * @returns Compressed message, ownership is transfered to the client. |
|
110 */ |
|
111 virtual HBufC8* CompressL(const TDesC8& aMessage, TInetAddr aAddress, |
|
112 const CSIPHostPort& aHostPort, |
|
113 TBool aStreamBasedProtocol) = 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 |
|
132 * message, EFalse otherwise |
|
133 */ |
|
134 virtual TBool IsSigCompMsg(const TDesC8& aMessage) const = 0; |
|
135 |
|
136 /** |
|
137 * Checks if signalling compression is installed. |
|
138 * |
|
139 * @returns ETrue if installed, EFalse otherwise. |
|
140 */ |
|
141 virtual TBool Available() const = 0; |
|
142 |
|
143 /** |
|
144 * Allows the state of the decompressed message to be saved; leaves on |
|
145 * failure. |
|
146 * |
|
147 * @param aAddress A remote destination address |
|
148 * |
|
149 * @param aHostPort A host port |
|
150 */ |
|
151 virtual void AllowL(TInetAddr aAddr, const CSIPHostPort& aHostPort) = 0; |
|
152 |
|
153 /** |
|
154 * Denies the state of the message to be saved. |
|
155 */ |
|
156 virtual void Deny() = 0; |
|
157 |
|
158 /** |
|
159 * Checks if hostport has compartment already |
|
160 * |
|
161 * @param aHostPort A host port |
|
162 * |
|
163 * @returns ETrue if compartment exists |
|
164 */ |
|
165 virtual TBool HasCompartment(const CSIPHostPort& aHostPort) = 0; |
|
166 }; |
|
167 |
|
168 #endif // end of __MSIGCOMPHANDLER_H__ |
|
169 |
|
170 // End of File |