|
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 : sipresponse.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 CSIPRESPONSE_H |
|
30 #define CSIPRESPONSE_H |
|
31 |
|
32 // INCLUDES |
|
33 #include "sipmessage.h" |
|
34 #include "_sipcodecdefs.h" |
|
35 |
|
36 // CLASS DECLARATION |
|
37 /** |
|
38 * Class provides functions for manipulating a SIP response |
|
39 * and the reason phrase. |
|
40 * |
|
41 * @lib sipcodec.lib |
|
42 */ |
|
43 class CSIPResponse : public CSIPMessage |
|
44 { |
|
45 public: // Constructors and destructor |
|
46 |
|
47 /** Response classes */ |
|
48 enum TType |
|
49 { |
|
50 E1XX = 1, |
|
51 E2XX, |
|
52 E3XX, |
|
53 E4XX, |
|
54 E5XX, |
|
55 E6XX |
|
56 }; |
|
57 |
|
58 /** |
|
59 * Creates a new instance of CSIPResponse |
|
60 * @pre (aResponseCode >= 100 && aResponseCode < 700) |
|
61 * @param aResponseCode a response code |
|
62 * @param aReasonPhrase a textual description of the response reason |
|
63 * @return new instance of CSIPResponse |
|
64 */ |
|
65 IMPORT_C static CSIPResponse* NewL(TUint aResponseCode, |
|
66 RStringF aReasonPhrase); |
|
67 |
|
68 /** |
|
69 * Creates a new instance of CSIPResponse and pushes it to CleanupStack |
|
70 * @pre (aResponseCode >= 100 && aResponseCode < 700) |
|
71 * @param aResponseCode a response code |
|
72 * @param aReasonPhrase a textual description of the response reason |
|
73 * @return new instance of CSIPResponse |
|
74 */ |
|
75 IMPORT_C static CSIPResponse* NewLC(TUint aResponseCode, |
|
76 RStringF aReasonPhrase); |
|
77 |
|
78 /** |
|
79 * Destructor |
|
80 */ |
|
81 IMPORT_C ~CSIPResponse(); |
|
82 |
|
83 public: // From CSIPMessage |
|
84 |
|
85 /** |
|
86 * From CSIPMessage IsRequest |
|
87 */ |
|
88 IMPORT_C TBool IsRequest() const; |
|
89 |
|
90 public: // New functions |
|
91 |
|
92 /** |
|
93 * Sets the SIP response code |
|
94 * @pre (aResponseCode >= 100 && aResponseCode < 700) |
|
95 * @param aResponseCode a response code |
|
96 */ |
|
97 IMPORT_C void SetResponseCodeL(TUint aResponseCode); |
|
98 |
|
99 /** |
|
100 * Gets the SIP response code |
|
101 * @return the SIP response code |
|
102 */ |
|
103 IMPORT_C TUint ResponseCode() const; |
|
104 |
|
105 /** |
|
106 * Gets the SIP response class of the response |
|
107 * @return the SIP response class |
|
108 */ |
|
109 IMPORT_C TType Type() const; |
|
110 |
|
111 /** |
|
112 * Checks if the response is an error response (>=300) |
|
113 * @return ETrue if response code >= 300, otherwise EFalse |
|
114 */ |
|
115 IMPORT_C TBool IsErrorResponse() const; |
|
116 |
|
117 /** |
|
118 * Sets the SIP reason phrase |
|
119 * @param aReasonPhrase a reason phrase |
|
120 */ |
|
121 IMPORT_C void SetReasonPhraseL(RStringF aReasonPhrase); |
|
122 |
|
123 /** |
|
124 * Gets the SIP reason phrase |
|
125 * @return the SIP reason phrase |
|
126 */ |
|
127 IMPORT_C RStringF ReasonPhrase() const; |
|
128 |
|
129 public: // New functions, for internal use |
|
130 |
|
131 static CSIPResponse* NewL(); |
|
132 |
|
133 static CSIPResponse* NewLC(); |
|
134 |
|
135 void SetReasonPhraseL(const TDesC8& aReasonPhrase); |
|
136 |
|
137 private: // Constructors |
|
138 |
|
139 CSIPResponse(); |
|
140 |
|
141 void ConstructL(); |
|
142 |
|
143 void ConstructL( |
|
144 TUint aResponseCode, |
|
145 RStringF aReasonPhrase); |
|
146 |
|
147 private: // From CSIPMessage |
|
148 |
|
149 HBufC8* ToTextFirstLineLC () const; |
|
150 |
|
151 private: // Data |
|
152 |
|
153 TUint iResponseCode; |
|
154 RStringF iReasonPhrase; |
|
155 }; |
|
156 |
|
157 #endif // CSIPRESPONSE_H |
|
158 |
|
159 // End of File |