|
1 /* |
|
2 * Copyright (c) 2005-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 : sipmessageparser.h |
|
16 * Part of : SIP Codec |
|
17 * Interface : SIP Codec API |
|
18 * Version : SIP/4.0 |
|
19 * |
|
20 */ |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 /** |
|
26 @internalComponent |
|
27 */ |
|
28 |
|
29 #ifndef CSIPMESSAGEPARSER_H |
|
30 #define CSIPMESSAGEPARSER_H |
|
31 |
|
32 // INCLUDES |
|
33 #include <e32base.h> |
|
34 #include "_sipcodecdefs.h" |
|
35 |
|
36 // FORWARD DECLARATIONS |
|
37 class CSIPMessage; |
|
38 class CSIPRequest; |
|
39 class CSIPResponse; |
|
40 |
|
41 // CLASS DECLARATION |
|
42 /** |
|
43 * Class provides a function to create a CSIPMessages |
|
44 * from textual representation of a SIP message. |
|
45 * |
|
46 * @lib sipcodec.lib |
|
47 */ |
|
48 class CSIPMessageParser : public CBase |
|
49 { |
|
50 public: // Constructors and destructor |
|
51 |
|
52 /** |
|
53 * Creates a CSIPMessageParser instance |
|
54 * @returns a new instance of CSIPMessageParser |
|
55 */ |
|
56 IMPORT_C static CSIPMessageParser* NewL(); |
|
57 |
|
58 /** |
|
59 * Creates a CSIPMessageParser instance and pushes it to CleanupStack |
|
60 * @returns a new instance of CSIPMessageParser |
|
61 */ |
|
62 IMPORT_C static CSIPMessageParser* NewLC(); |
|
63 |
|
64 /** |
|
65 * Destructor |
|
66 */ |
|
67 IMPORT_C ~CSIPMessageParser(); |
|
68 |
|
69 /** |
|
70 * Constructs a CSIPMessage from its textual representation. |
|
71 * @pre aInputMessage != 0 |
|
72 * @pre *aSIPMessage == 0 |
|
73 * @param aInputMessage the textual representation of a SIP message |
|
74 * @param aSIPMessage, the pointer that points to |
|
75 * the created CSIPMessage, when the function returns. |
|
76 * @return KErrNone if the message was successfully decoded. |
|
77 * In this case aSIPMessage points to a syntactically |
|
78 * correct SIP message. |
|
79 * Returns SIP parser error (@see sipcodecerr.h) or |
|
80 * a system wide error. In this case aSIPMessage may or |
|
81 * may not point to a partially parsed SIP message depending on |
|
82 * which phase of the parsing the error occured. |
|
83 */ |
|
84 IMPORT_C TInt FromText( |
|
85 HBufC8* aInputMessage, |
|
86 CSIPMessage** aSIPMessage); |
|
87 |
|
88 private: // Constructors |
|
89 |
|
90 CSIPMessageParser(); |
|
91 void ConstructL(); |
|
92 |
|
93 private: // New functions |
|
94 |
|
95 CSIPMessage* FromTextL( |
|
96 HBufC8* aInputSIPMessage, |
|
97 TInt& aParseErrorInHeaders); |
|
98 |
|
99 CSIPMessage* CreateSIPMessageLC(const TDesC8& aFirstLine); |
|
100 |
|
101 CSIPRequest* CreateSIPRequestLC(const TDesC8& aRequestLine); |
|
102 |
|
103 CSIPResponse* CreateSIPResponseLC(const TDesC8& aStatusLine); |
|
104 |
|
105 TUint ParseResponseCodeL(const TDesC8& aResponseCode); |
|
106 |
|
107 private: // For testing purposes |
|
108 |
|
109 UNIT_TEST(CSIPMessageParserTest) |
|
110 }; |
|
111 |
|
112 #endif // CSIPMESSAGEPARSER_H |
|
113 |
|
114 // End of File |