|
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 : 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 |
|
32 // FORWARD DECLARATIONS |
|
33 class CSIPMessageElements; |
|
34 class CSIPFromHeader; |
|
35 class CSIPToHeader; |
|
36 class CSIPCSeqHeader; |
|
37 |
|
38 // CLASS DECLARATION |
|
39 |
|
40 /** |
|
41 * @publishedAll |
|
42 * @released |
|
43 * |
|
44 * Class provides services for creating and manipulating SIP responses |
|
45 * This class is used for creating and manipulating SIP responses including |
|
46 * status code, reason phrase and optional elements such user headers, |
|
47 * content and its type. |
|
48 * |
|
49 * @lib sipclient.lib |
|
50 */ |
|
51 class CSIPResponseElements : public CBase |
|
52 { |
|
53 public: // Constructors and destructor |
|
54 /** |
|
55 * Two-phased constructor. |
|
56 * @pre aStatusCode > 100 && aStatusCode < 700 |
|
57 * @param aStatusCode a known SIP response status code. Cannot be 100. |
|
58 * @param aReasonPhrase a SIP response reason phrase. |
|
59 */ |
|
60 IMPORT_C static CSIPResponseElements* NewL(TUint aStatusCode, |
|
61 RStringF aReasonPhrase); |
|
62 |
|
63 /** |
|
64 * Two-phased constructor. |
|
65 * @pre aStatusCode > 100 && aStatusCode < 700 |
|
66 * @param aStatusCode a known SIP response status code. Cannot be 100. |
|
67 * @param aReasonPhrase a SIP response reason phrase. |
|
68 */ |
|
69 IMPORT_C static CSIPResponseElements* NewLC(TUint aStatusCode, |
|
70 RStringF aReasonPhrase); |
|
71 |
|
72 /** |
|
73 * Destructor. |
|
74 */ |
|
75 IMPORT_C ~CSIPResponseElements(); |
|
76 |
|
77 public: // New functions |
|
78 /** |
|
79 * Sets a SIP Response extension status code. It is not possible to set |
|
80 * value 100. |
|
81 * @pre aStatusCode > 100 && aStatusCode < 700 |
|
82 * @param aStatusCode extension status code |
|
83 * @leave KErrArgument if aStatusCode < 100 or aStatusCode >= 700 |
|
84 */ |
|
85 IMPORT_C void SetStatusCodeL(TUint aStatusCode); |
|
86 |
|
87 /** |
|
88 * Gets the SIP Response status code |
|
89 * @return SIP Response status code |
|
90 */ |
|
91 IMPORT_C TUint StatusCode() const; |
|
92 |
|
93 /** |
|
94 * Sets a SIP Response Reason Phrase. |
|
95 * @param aReasonPhrase a SIP response reason phrase. |
|
96 */ |
|
97 IMPORT_C void SetReasonPhraseL(RStringF aReasonPhrase); |
|
98 |
|
99 /** |
|
100 * Gets a SIP Response Reason Phrase. |
|
101 * @return a SIP response reason phrase or an empty string if |
|
102 * the reason phrase is not defined. |
|
103 */ |
|
104 IMPORT_C RStringF ReasonPhrase() const; |
|
105 |
|
106 /** |
|
107 * Gets the originator's From-header |
|
108 * @return a From-header or a 0-pointer if not present. Ownership is |
|
109 * not transferred. |
|
110 */ |
|
111 IMPORT_C const CSIPFromHeader* FromHeader() const; |
|
112 |
|
113 /** |
|
114 * Gets the recipient's To-header |
|
115 * @return a To-header or a 0-pointer if not present. Ownership is |
|
116 * not transferred. |
|
117 */ |
|
118 IMPORT_C const CSIPToHeader* ToHeader() const; |
|
119 |
|
120 /** |
|
121 * Gets CSeq-header |
|
122 * @return a CSeq-header or a 0-pointer if not present. Ownership is |
|
123 * not transferred. |
|
124 */ |
|
125 IMPORT_C const CSIPCSeqHeader* CSeqHeader() const; |
|
126 |
|
127 /** |
|
128 * Gets message elements (contains all SIP user headers and content) |
|
129 * @return message elements |
|
130 */ |
|
131 IMPORT_C const CSIPMessageElements& MessageElements() const; |
|
132 |
|
133 /** |
|
134 * Gets message elements (contains all SIP user headers and content) |
|
135 * The response elements can be populated with SIP user headers |
|
136 * and content using returned reference to the message elements. |
|
137 * @return message elements |
|
138 */ |
|
139 IMPORT_C CSIPMessageElements& MessageElements(); |
|
140 |
|
141 public: // New functions, for internal use |
|
142 static CSIPResponseElements* InternalizeL (RReadStream& aReadStream); |
|
143 static CSIPResponseElements* InternalizeLC (RReadStream& aReadStream); |
|
144 void ExternalizeL (RWriteStream& aWriteStream) const; |
|
145 |
|
146 private: |
|
147 CSIPResponseElements(); |
|
148 void ConstructL(TUint aStatusCode, RStringF aReasonPhrase); |
|
149 void DoInternalizeL (RReadStream& aReadStream); |
|
150 |
|
151 private: // Data |
|
152 TUint iStatusCode; |
|
153 RStringF iReasonPhrase; |
|
154 CSIPMessageElements* iMessageElements; |
|
155 }; |
|
156 |
|
157 #endif // end of CSIPRESPONSEELEMENTS_H |