|
1 /* |
|
2 * Copyright (c) 2005-2007 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: Data sink API for chunked receiving of large messages |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef MMMSCODECDATASINK_H |
|
21 #define MMMSCODECDATASINK_H |
|
22 |
|
23 #include <e32base.h> |
|
24 |
|
25 |
|
26 /** |
|
27 * Defines the interface for chunked data supply |
|
28 * |
|
29 * When MMS messages are sent in chunks this provides the interface |
|
30 * that can be called to get next encoded data chunk |
|
31 * |
|
32 * @since v3.1 |
|
33 */ |
|
34 class MMmsCodecDataSink |
|
35 { |
|
36 |
|
37 public: |
|
38 |
|
39 /** |
|
40 * Gives the next data part to be decoded. |
|
41 * Decoding is synchronous. When the code returns, data can be released. |
|
42 * |
|
43 * @since v3.1 |
|
44 * @param aBuffer flat buffer containing the data to be decoded. |
|
45 * @param aPosition start of data to be decoded. |
|
46 * Decoding will start from aPosition. |
|
47 * At return aPosition will point to the data that has not been |
|
48 * decoded yet (in case data ends with an incomplete header) or |
|
49 * past the end of data if everything has been decoded. |
|
50 * The caller can discard the beginning of data up to aPosition. |
|
51 * If there is data left in the buffer it must be shifted to the |
|
52 * beginning of buffer and new data appended to the end to allow |
|
53 * an incomplete header to be decoded at next round. |
|
54 * @param aLastChunk ETrue if the data chunk in the buffer is the last one. |
|
55 * @return error code, KErrNone if decoding succeeds |
|
56 * If returns some other error, transaction must be cancelled. |
|
57 */ |
|
58 virtual TInt NextDataPart( |
|
59 CBufFlat& aBuffer, |
|
60 TInt& aPosition, |
|
61 TBool aLastDataChunk ) = 0; |
|
62 |
|
63 /** |
|
64 * Release data sink and free any resources |
|
65 * This function must be called after last data chunk has been processed |
|
66 * This function must also be called if the process is terminated by an error |
|
67 * |
|
68 * @since v3.1 |
|
69 */ |
|
70 virtual void RelaseDataSink() = 0; |
|
71 |
|
72 /** |
|
73 * Reset data sink. |
|
74 * Delete all attachments from current message. |
|
75 * Reset MMS headers |
|
76 * Start message decoding from the beginning |
|
77 * |
|
78 * This function must be called if transaction is interrupted and restarted |
|
79 * |
|
80 * @since v3.1 |
|
81 */ |
|
82 virtual void ResetDataSink() = 0; |
|
83 |
|
84 }; |
|
85 |
|
86 #endif // MMMSCODECDATASINK_H |