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