1 sipresponseelements.h |
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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Name : sipresponseelements.h |
|
16 * Part of : SIP Client |
|
17 * Interface : SDK API, SIP API |
|
18 * Version : 1.0 |
|
19 * |
|
20 */ |
|
21 |
|
22 |
|
23 |
|
24 #ifndef CSIPRESPONSEELEMENTS_H |
|
25 #define CSIPRESPONSEELEMENTS_H |
|
26 |
|
27 // INCLUDES |
|
28 #include <e32base.h> |
|
29 #include <s32strm.h> |
|
30 #include <stringpool.h> |
|
31 #include "_sipcodecdefs.h" |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class CSIPMessageElements; |
|
35 class CSIPFromHeader; |
|
36 class CSIPToHeader; |
|
37 class CSIPCSeqHeader; |
|
38 |
|
39 // CLASS DECLARATION |
|
40 |
|
41 /** |
|
42 * @publishedAll |
|
43 * @released |
|
44 * |
|
45 * Class provides services for creating and manipulating SIP responses |
|
46 * This class is used for creating and manipulating SIP responses including |
|
47 * status code, reason phrase and optional elements such user headers, |
|
48 * content and its type. |
|
49 * |
|
50 * @lib sipclient.lib |
|
51 */ |
|
52 class CSIPResponseElements : public CBase |
|
53 { |
|
54 public: // Constructors and destructor |
|
55 /** |
|
56 * Two-phased constructor. |
|
57 * @pre aStatusCode > 100 && aStatusCode < 700 |
|
58 * @param aStatusCode a known SIP response status code. Cannot be 100. |
|
59 * @param aReasonPhrase a SIP response reason phrase. |
|
60 */ |
|
61 IMPORT_C static CSIPResponseElements* NewL(TUint aStatusCode, |
|
62 RStringF aReasonPhrase); |
|
63 |
|
64 /** |
|
65 * Two-phased constructor. |
|
66 * @pre aStatusCode > 100 && aStatusCode < 700 |
|
67 * @param aStatusCode a known SIP response status code. Cannot be 100. |
|
68 * @param aReasonPhrase a SIP response reason phrase. |
|
69 */ |
|
70 IMPORT_C static CSIPResponseElements* NewLC(TUint aStatusCode, |
|
71 RStringF aReasonPhrase); |
|
72 |
|
73 /** |
|
74 * Destructor. |
|
75 */ |
|
76 IMPORT_C ~CSIPResponseElements(); |
|
77 |
|
78 public: // New functions |
|
79 /** |
|
80 * Sets a SIP Response extension status code. It is not possible to set |
|
81 * value 100. |
|
82 * @pre aStatusCode > 100 && aStatusCode < 700 |
|
83 * @param aStatusCode extension status code |
|
84 * @leave KErrArgument if aStatusCode < 100 or aStatusCode >= 700 |
|
85 */ |
|
86 IMPORT_C void SetStatusCodeL(TUint aStatusCode); |
|
87 |
|
88 /** |
|
89 * Gets the SIP Response status code |
|
90 * @return SIP Response status code |
|
91 */ |
|
92 IMPORT_C TUint StatusCode() const; |
|
93 |
|
94 /** |
|
95 * Sets a SIP Response Reason Phrase. |
|
96 * @param aReasonPhrase a SIP response reason phrase. |
|
97 */ |
|
98 IMPORT_C void SetReasonPhraseL(RStringF aReasonPhrase); |
|
99 |
|
100 /** |
|
101 * Gets a SIP Response Reason Phrase. |
|
102 * @return a SIP response reason phrase or an empty string if |
|
103 * the reason phrase is not defined. |
|
104 */ |
|
105 IMPORT_C RStringF ReasonPhrase() const; |
|
106 |
|
107 /** |
|
108 * Gets the originator's From-header |
|
109 * @return a From-header or a 0-pointer if not present. Ownership is |
|
110 * not transferred. |
|
111 */ |
|
112 IMPORT_C const CSIPFromHeader* FromHeader() const; |
|
113 |
|
114 /** |
|
115 * Gets the recipient's To-header |
|
116 * @return a To-header or a 0-pointer if not present. Ownership is |
|
117 * not transferred. |
|
118 */ |
|
119 IMPORT_C const CSIPToHeader* ToHeader() const; |
|
120 |
|
121 /** |
|
122 * Gets CSeq-header |
|
123 * @return a CSeq-header or a 0-pointer if not present. Ownership is |
|
124 * not transferred. |
|
125 */ |
|
126 IMPORT_C const CSIPCSeqHeader* CSeqHeader() const; |
|
127 |
|
128 /** |
|
129 * Gets message elements (contains all SIP user headers and content) |
|
130 * @return message elements |
|
131 */ |
|
132 IMPORT_C const CSIPMessageElements& MessageElements() const; |
|
133 |
|
134 /** |
|
135 * Gets message elements (contains all SIP user headers and content) |
|
136 * The response elements can be populated with SIP user headers |
|
137 * and content using returned reference to the message elements. |
|
138 * @return message elements |
|
139 */ |
|
140 IMPORT_C CSIPMessageElements& MessageElements(); |
|
141 |
|
142 public: // New functions, for internal use |
|
143 static CSIPResponseElements* InternalizeL (RReadStream& aReadStream); |
|
144 static CSIPResponseElements* InternalizeLC (RReadStream& aReadStream); |
|
145 void ExternalizeL (RWriteStream& aWriteStream) const; |
|
146 |
|
147 private: |
|
148 CSIPResponseElements(); |
|
149 void ConstructL(TUint aStatusCode, RStringF aReasonPhrase); |
|
150 void DoInternalizeL (RReadStream& aReadStream); |
|
151 |
|
152 private: // Data |
|
153 TUint iStatusCode; |
|
154 RStringF iReasonPhrase; |
|
155 CSIPMessageElements* iMessageElements; |
|
156 }; |
|
157 |
|
158 #endif // end of CSIPRESPONSEELEMENTS_H |