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