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