|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __MHTTPMESSAGECOMPOSEROBSERVER_H__ |
|
17 #define __MHTTPMESSAGECOMPOSEROBSERVER_H__ |
|
18 |
|
19 #include <e32std.h> |
|
20 |
|
21 class MHTTPDataSupplier; |
|
22 |
|
23 class MHttpMessageComposerObserver |
|
24 /** |
|
25 The MHttpMessageComposerObserver class is the observer API for the http |
|
26 message composer. It allows the composer to notify its observer when it has |
|
27 http message data ready to send and when the message has been completed. |
|
28 |
|
29 Also, the composer uses this API to obtain the http message info, e.g the |
|
30 required start-line. The observer is responsible for ensuring that the |
|
31 supplied tokens remain valid until the composer notifies it that it has |
|
32 completed the message. |
|
33 |
|
34 The observer is notified of any errors that occur in the composer. |
|
35 @see RHttpMessageComposer |
|
36 */ |
|
37 { |
|
38 public: // methods |
|
39 |
|
40 /** |
|
41 Provides the start-line tokens. |
|
42 @param aToken1 An output argument set to the first token. |
|
43 @param aToken2 An output argument set to the second token. |
|
44 @param aToken3 An output argument set to the third token. |
|
45 */ |
|
46 virtual void StartLineL(TPtrC8& aToken1, TPtrC8& aToken2, TPtrC8& aToken3) =0; |
|
47 |
|
48 /** |
|
49 Provides the next header field tokens. The return value indicates whether |
|
50 there is a header or not. If there is no more headers, then the output |
|
51 arguments are not valid and therefore should not be used. |
|
52 @param aHeaderName An output argument set to the header field name. |
|
53 @param aHeaderValue An output argument set to the header field value. |
|
54 @return A value of KErrNotFound if there are no more headers. A value |
|
55 of KErrNone if a header field is specified in the output |
|
56 arguments. |
|
57 */ |
|
58 virtual TInt NextHeaderL(TPtrC8& aHeaderName, TPtrC8& aHeaderValue) =0; |
|
59 |
|
60 /** |
|
61 Request to see if there is an entity body. |
|
62 @return A value of NULL if there is no entity body. If there is a entity |
|
63 body a pointer to the data supplier object that will supply the |
|
64 entity body data is returned. |
|
65 */ |
|
66 virtual MHTTPDataSupplier* HasBodyL() =0; |
|
67 |
|
68 /** |
|
69 Provides the next trailer header field tokens. The return value indicates |
|
70 whether there is a trailer header or not. If there is no more headers, then |
|
71 the output arguments are not valid and therefore should not be used. |
|
72 @param aHeaderName An output argument set to the header field name. |
|
73 @param aHeaderValue An output argument set to the header field value. |
|
74 @return A value of KErrNotFound if there are no more trailers. A value |
|
75 of KErrNone if a trailer header field is specified in the output |
|
76 arguments. |
|
77 */ |
|
78 virtual TInt NextTrailerL(TPtrC8& aHeaderName, TPtrC8& aHeaderValue) =0; |
|
79 |
|
80 /** |
|
81 Notifies the observer that the message has been completed. |
|
82 */ |
|
83 virtual void MessageComplete() =0; |
|
84 |
|
85 /** |
|
86 Notifies the observer that there is message data ready to be sent. |
|
87 */ |
|
88 virtual void MessageDataReadyL() =0; |
|
89 |
|
90 /** |
|
91 Notifies the observer that an error has ocurred in the composer. The |
|
92 composer has reset itself. |
|
93 @param aError The error code that has occurred. |
|
94 @return A value of KErrNone if the error has been handled. Any other |
|
95 value if the error has not been handled. |
|
96 */ |
|
97 virtual TInt HandleComposeError(TInt aError) =0; |
|
98 |
|
99 private: // methods |
|
100 |
|
101 /** |
|
102 Reserved function. |
|
103 */ |
|
104 // virtual void Reserved_MHttpMessageComposerObserver() =0; |
|
105 |
|
106 }; |
|
107 |
|
108 #endif // __MHTTPMESSAGECOMPOSEROBSERVER_H__ |