|
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 : siprequestelements.h |
|
16 * Part of : SIP Client |
|
17 * Interface : SDK API, SIP API |
|
18 * Version : 1.0 |
|
19 * |
|
20 */ |
|
21 |
|
22 |
|
23 |
|
24 #ifndef CSIPREQUESTELEMENTS_H |
|
25 #define CSIPREQUESTELEMENTS_H |
|
26 |
|
27 // INCLUDES |
|
28 #include <e32base.h> |
|
29 #include <s32strm.h> |
|
30 #include <stringpool.h> |
|
31 #include <uri8.h> |
|
32 #include "_sipcodecdefs.h" |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class CSIPMessageElements; |
|
36 class CSIPFromHeader; |
|
37 class CSIPToHeader; |
|
38 class CSIPCSeqHeader; |
|
39 class CURIContainer; |
|
40 |
|
41 // CLASS DECLARATION |
|
42 |
|
43 /** |
|
44 * @publishedAll |
|
45 * @released |
|
46 * |
|
47 * Class provides functions for creation and manipulation of originator's and |
|
48 * recipient's addresses in a SIP request. It also provide functions for |
|
49 * manipulation of SIP method for unknown SIP requests. |
|
50 * @lib sipclient.lib |
|
51 */ |
|
52 class CSIPRequestElements : public CBase |
|
53 { |
|
54 public: // Constructors and destructor |
|
55 /** |
|
56 * Two-phased constructor. |
|
57 * If the URI is SIP URI, no SIP URI headers are allowed. |
|
58 * @pre aRemoteURi != 0 |
|
59 * @param aRemoteUri Remote target URI that identifies a resource that |
|
60 * the request is addressed to. The ownership is transferred. |
|
61 */ |
|
62 IMPORT_C static CSIPRequestElements* NewL(CUri8* aRemoteUri); |
|
63 |
|
64 /** |
|
65 * Two-phased constructor. |
|
66 * If the URI is SIP URI, no SIP URI headers are allowed. |
|
67 * @pre aRemoteURi != 0 |
|
68 * @param aRemoteUri Remote target URI that identifies a resource that |
|
69 * the request is addressed to. The ownership is transferred. |
|
70 */ |
|
71 IMPORT_C static CSIPRequestElements* NewLC(CUri8* aRemoteUri); |
|
72 |
|
73 /** |
|
74 * Destructor. |
|
75 */ |
|
76 IMPORT_C ~CSIPRequestElements(); |
|
77 |
|
78 public: // New functions |
|
79 /** |
|
80 * Sets/resets the recipient's To-header |
|
81 * To-header must not contain tag-parameter. |
|
82 * @pre aTo != 0 |
|
83 * @param aTo a To-header to be set, the ownership is transferred. |
|
84 */ |
|
85 IMPORT_C void SetToHeaderL(CSIPToHeader* aTo); |
|
86 |
|
87 /** |
|
88 * Gets the recipient's To-header |
|
89 * @return To-header or a 0-pointer if not present. Ownership is not |
|
90 * transferred. |
|
91 */ |
|
92 IMPORT_C const CSIPToHeader* ToHeader() const; |
|
93 |
|
94 /** |
|
95 * Sets/resets the originator's From-header. |
|
96 * From-header must not contain tag-parameter. |
|
97 * @pre aFrom != 0 |
|
98 * @param aFrom a From-header to be set, the ownership is transferred. |
|
99 * @leave KErrArgument if aFrom == 0 |
|
100 */ |
|
101 IMPORT_C void SetFromHeaderL(CSIPFromHeader* aFrom); |
|
102 |
|
103 /** |
|
104 * Gets the originator's From-header |
|
105 * @return From-header or a 0-pointer if not present. Ownership is not |
|
106 * transferred. |
|
107 */ |
|
108 IMPORT_C const CSIPFromHeader* FromHeader() const; |
|
109 |
|
110 /** |
|
111 * Gets CSeq-header. Available for only incoming requests. |
|
112 * @return a CSeq-header or a 0-pointer if not present. |
|
113 * Ownership is not transferred. |
|
114 */ |
|
115 IMPORT_C const CSIPCSeqHeader* CSeqHeader() const; |
|
116 |
|
117 /** |
|
118 * Sets the remote URI. |
|
119 * If the URI is a SIP URI, no SIP URI headers are allowed. |
|
120 * @pre aRemoteUri != 0 |
|
121 * @param aRemoteUri |
|
122 * @leave KErrArgument if aRemoteUri==0 |
|
123 */ |
|
124 IMPORT_C void SetRemoteUriL(CUri8* aRemoteUri); |
|
125 |
|
126 /** |
|
127 * Gets the remote target URI |
|
128 * @return remote target URI |
|
129 */ |
|
130 IMPORT_C const CUri8& RemoteUri() const; |
|
131 |
|
132 /** |
|
133 * Sets the SIP request method |
|
134 * @param aMethod a SIP method name. |
|
135 * @leave KErrArgument if method name given is syntactically |
|
136 * incorrect |
|
137 */ |
|
138 IMPORT_C void SetMethodL(RStringF aMethod); |
|
139 |
|
140 /** |
|
141 * Gets the SIP Method for a request |
|
142 * @return a SIP method name or a an empty string if the method |
|
143 * is not defined |
|
144 */ |
|
145 IMPORT_C RStringF Method() const; |
|
146 |
|
147 /** |
|
148 * Gets message elements (contains all SIP user headers and content) |
|
149 * @return message elements |
|
150 */ |
|
151 IMPORT_C const CSIPMessageElements& MessageElements() const; |
|
152 |
|
153 /** |
|
154 * Gets message elements (contains all SIP user headers and content) |
|
155 * The response elements can be populated with SIP user headers |
|
156 * and content using returned reference to the message elements. |
|
157 * @return message elements |
|
158 */ |
|
159 IMPORT_C CSIPMessageElements& MessageElements(); |
|
160 |
|
161 public: // New functions, for internal use |
|
162 static CSIPRequestElements* InternalizeL (RReadStream& aReadStream); |
|
163 void ExternalizeL (RWriteStream& aWriteStream) const; |
|
164 |
|
165 private: |
|
166 CSIPRequestElements(); |
|
167 void ConstructL(CUri8* aRemoteUri); |
|
168 void DoInternalizeL(RReadStream& aReadStream); |
|
169 |
|
170 private: // Data |
|
171 RStringF iMethod; |
|
172 CURIContainer* iRemoteURI; |
|
173 CSIPMessageElements* iMessageElements; |
|
174 |
|
175 private: // For testing purposes |
|
176 UNIT_TEST(CSIPRequestElementsTest) |
|
177 }; |
|
178 |
|
179 #endif |