|
1 // Copyright (c) 2003-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 #include "rhttpmessageparser.h" |
|
17 |
|
18 #include "chttpmessageparser.h" |
|
19 |
|
20 EXPORT_C void RHttpMessageParser::OpenL(MHttpMessageParserObserver& aObserver) |
|
21 /** |
|
22 Opens the object. |
|
23 @param aObserver The observer for the parser. |
|
24 @panic EInvariantFalse This RHttpMessageParser has already been opened. |
|
25 */ |
|
26 { |
|
27 __ASSERT_ALWAYS( iImplementation == NULL, User::Invariant() ); |
|
28 |
|
29 iImplementation = CHttpMessageParser::NewL(aObserver); |
|
30 } |
|
31 |
|
32 EXPORT_C void RHttpMessageParser::Close() |
|
33 /** |
|
34 Closes the object. Any resources are freed. |
|
35 */ |
|
36 { |
|
37 delete iImplementation; |
|
38 iImplementation = NULL; |
|
39 } |
|
40 |
|
41 EXPORT_C void RHttpMessageParser::ReceivedMessageData() |
|
42 /** |
|
43 Notifies the parser of more message data. The parser gets the data packet |
|
44 from the observer and continues processing its state machine. |
|
45 @panic EHttpMessagePanicBadDataState The current data packet has not |
|
46 been completely parsed. |
|
47 */ |
|
48 { |
|
49 iImplementation->ReceivedMessageData(); |
|
50 } |
|
51 |
|
52 EXPORT_C void RHttpMessageParser::CompletedBodyDataL() |
|
53 /** |
|
54 Notifies the parser of that there is no more body data and should complete |
|
55 its processing. This is used for HTTP 1.0 style responses where the content |
|
56 length is unknown. |
|
57 */ |
|
58 { |
|
59 iImplementation->CompletedBodyDataL(); |
|
60 } |
|
61 |
|
62 EXPORT_C void RHttpMessageParser::Reset() |
|
63 /** |
|
64 Parser reset request. As the observer can reset the parser during one the |
|
65 callback functions, the parser must check for re-entrancy to avoid releasing |
|
66 resources that are still required. If the parser is either waiting for more |
|
67 message data or is waiting to process its state machine, the parser can |
|
68 safely reset immediately. Otherwise the parser is being reset from within |
|
69 its RunL() and so it must defer resetting itself to a safer point. This is |
|
70 the point in the RunL() where the next step is decided. |
|
71 @panic EHttpMessagePanicDoubleReset The parser has been reset twice |
|
72 in one of the observer callback |
|
73 functions. |
|
74 */ |
|
75 { |
|
76 iImplementation->Reset(); |
|
77 } |
|
78 |
|
79 EXPORT_C void RHttpMessageParser::Reserved_RHttpMessageParser() |
|
80 /** |
|
81 Reserved function. |
|
82 @panic EInvariantFalse This function should not be called. |
|
83 */ |
|
84 { |
|
85 User::Invariant(); |
|
86 } |
|
87 |
|
88 /** |
|
89 Tell the parser to finish up with the message if required. |
|
90 */ |
|
91 EXPORT_C void RHttpMessageParser::Flush () |
|
92 { |
|
93 iImplementation->Flush (); |
|
94 } |
|
95 |
|
96 EXPORT_C TBool RHttpMessageParser::CompleteMessage ( const TDesC8& aData ) |
|
97 { |
|
98 return iImplementation->CompleteMessage ( aData ); |
|
99 } |
|
100 |
|
101 |