|
1 /* |
|
2 * Copyright (c) 2005-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: Capability Test helper |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MUSAVACAPABILITYTESTHELPER_H |
|
20 #define MUSAVACAPABILITYTESTHELPER_H |
|
21 |
|
22 |
|
23 #include <e32std.h> |
|
24 #include <bamdesca.h> |
|
25 #include <siperr.h> |
|
26 #include <sipaddress.h> |
|
27 #include <sipextensionheader.h> |
|
28 #include <sipcontactheader.h> |
|
29 #include <sipacceptcontactheader.h> |
|
30 #include <sipacceptheader.h> |
|
31 |
|
32 #include <sipaddress.h> |
|
33 #include <sipcontenttypeheader.h> |
|
34 #include <sipfromheader.h> |
|
35 #include <siptoheader.h> |
|
36 #include <sipstrings.h> |
|
37 #include <SipStrConsts.h> |
|
38 #include <Uri8.h> |
|
39 #include <SdpDocument.h> |
|
40 #include <sdpcodecstringconstants.h> |
|
41 #include <sdpcodecstringpool.h> |
|
42 |
|
43 |
|
44 |
|
45 // INTERNAL INCLUDES |
|
46 #include "SIP.h" |
|
47 #include "SIPConnection.h" |
|
48 #include "SIPProfile.h" |
|
49 #include "SIPClientTransaction.h" |
|
50 #include "SIPServerTransaction.h" |
|
51 #include "SIPRequestElements.h" |
|
52 #include "SIPResponseElements.h" |
|
53 #include "SIPMessageElements.h" |
|
54 |
|
55 |
|
56 #include "musavacapabilitycontext.h" |
|
57 #include "musavacapability.h" |
|
58 #include "musavacapabilityexchange.h" |
|
59 |
|
60 // Next row is to disable warning emerging from EUnit code. |
|
61 // Placement is due to a fact that most test case files |
|
62 // include this file. Directive can be removed when |
|
63 // EUnit is fixed. |
|
64 #pragma warn_illtokenpasting off |
|
65 |
|
66 _LIT8( KCapabilityTestTerminalID_A, "Terminal_A"); |
|
67 _LIT8( KCapabilityTestTerminalID_B, "Terminal_B"); |
|
68 _LIT8( KPAssertedIdentity_B, "sip:4455667788@foobar.com" ); |
|
69 _LIT( KPAssertedIdentity_B_16, "sip:4455667788@foobar.com" ); |
|
70 _LIT8( KPAssertedIdentity_B1, "tel:+4455667788"); |
|
71 _LIT( KPAssertedIdentity_B1_16, "tel:+4455667788"); |
|
72 _LIT8( KCapabilityTestAddress_A, "sip:a@foobar.com"); |
|
73 _LIT8( KCapabilityTestAddress_B, "sip:b@foobar.com"); |
|
74 _LIT8( KCapabilityPAssertedIdentity, "sip:passertedid@foobar.com"); |
|
75 |
|
76 |
|
77 |
|
78 _LIT8( KCapabilityTestSDP,"v=0\r\n\ |
|
79 o=- 452027953 452027953 IN IP4 foobar.com\r\n\ |
|
80 s=-\r\n\ |
|
81 c=IN IP4 foobar.com\r\n\ |
|
82 t=0 0\r\n\ |
|
83 a=application:com.gsma.rts\r\n\ |
|
84 a=type:videolive\r\n\ |
|
85 m=video 0 RTP/AVP 96\r\n\ |
|
86 a=rtpmap:96 H263-2000/90000\r\n"); |
|
87 |
|
88 _LIT8( KCapabilityTestSDPWrongCodec,"v=0\r\n\ |
|
89 o=- 452027953 452027953 IN IP4 foobar.com\r\n\ |
|
90 s=-\r\n\ |
|
91 c=IN IP4 foobar.com\r\n\ |
|
92 t=0 0\r\n\ |
|
93 a=application:com.gsma.rts\r\n\ |
|
94 a=type:videolive\r\n\ |
|
95 m=video 0 RTP/AVP 96\r\n\ |
|
96 a=rtpmap:96 MPEG-4/90000\r\n"); |
|
97 |
|
98 _LIT8( KCapabilityTestSDPWrongType,"v=0\r\n\ |
|
99 o=- 452027953 452027953 IN IP4 foobar.com\r\n\ |
|
100 s=-\r\n\ |
|
101 c=IN IP4 foobar.com\r\n\ |
|
102 t=0 0\r\n\ |
|
103 a=application:com.gsma.rts\r\n\ |
|
104 a=type:wrongtype\r\n\ |
|
105 m=video 0 RTP/AVP 96\r\n\ |
|
106 a=rtpmap:96 H263-2000/90000\r\n"); |
|
107 |
|
108 _LIT8( KCapabilityTestSDPWrongApplication,"v=0\r\n\ |
|
109 o=- 452027953 452027953 IN IP4 foobar.com\r\n\ |
|
110 s=-\r\n\ |
|
111 c=IN IP4 foobar.com\r\n\ |
|
112 t=0 0\r\n\ |
|
113 a=application:com.gsma.xxx\r\n\ |
|
114 a=type:videolive\r\n\ |
|
115 m=video 0 RTP/AVP 96\r\n\ |
|
116 a=rtpmap:96 H263-2000/90000\r\n"); |
|
117 |
|
118 _LIT8( KCapabilityTestSDPNoApplication,"v=0\r\n\ |
|
119 o=- 452027953 452027953 IN IP4 foobar.com\r\n\ |
|
120 s=-\r\n\ |
|
121 c=IN IP4 foobar.com\r\n\ |
|
122 t=0 0\r\n\ |
|
123 a=type:videolive\r\n\ |
|
124 m=video 0 RTP/AVP 96\r\n\ |
|
125 a=rtpmap:96 H263-2000/90000\r\n"); |
|
126 |
|
127 _LIT8( KCapabilityTestSDPNoAppNoType,"v=0\r\n\ |
|
128 o=- 452027953 452027953 IN IP4 foobar.com\r\n\ |
|
129 s=-\r\n\ |
|
130 c=IN IP4 foobar.com\r\n\ |
|
131 t=0 0\r\n\ |
|
132 m=video 0 RTP/AVP 96\r\n\ |
|
133 a=rtpmap:96 H263-2000/90000\r\n"); |
|
134 |
|
135 _LIT8( KCapabilityTestSDPNoAppWrongType,"v=0\r\n\ |
|
136 o=- 452027953 452027953 IN IP4 foobar.com\r\n\ |
|
137 s=-\r\n\ |
|
138 c=IN IP4 foobar.com\r\n\ |
|
139 t=0 0\r\n\ |
|
140 a=type:wrongtype\r\n\ |
|
141 m=video 0 RTP/AVP 96\r\n\ |
|
142 a=rtpmap:96 H263-2000/90000\r\n"); |
|
143 |
|
144 _LIT8( KCapabilityTestSDPNoType,"v=0\r\n\ |
|
145 o=- 452027953 452027953 IN IP4 foobar.com\r\n\ |
|
146 s=-\r\n\ |
|
147 c=IN IP4 foobar.com\r\n\ |
|
148 t=0 0\r\n\ |
|
149 a=application:com.gsma.rts\r\n\ |
|
150 m=video 0 RTP/AVP 96\r\n\ |
|
151 a=rtpmap:96 H263-2000/90000\r\n"); |
|
152 |
|
153 _LIT8( KCapabilityTestSDP264,"v=0\r\n\ |
|
154 o=- 452027953 452027953 IN IP4 foobar.com\r\n\ |
|
155 s=-\r\n\ |
|
156 c=IN IP4 foobar.com\r\n\ |
|
157 t=0 0\r\n\ |
|
158 a=application:com.gsma.rts\r\n\ |
|
159 a=type:videolive\r\n\ |
|
160 m=video 0 RTP/AVP 98\r\n\ |
|
161 a=rtpmap:98 H264/90000\r\n"); |
|
162 |
|
163 _LIT8( KCapabilityTestSDP264And263,"v=0\r\n\ |
|
164 o=- 452027953 452027953 IN IP4 foobar.com\r\n\ |
|
165 s=-\r\n\ |
|
166 c=IN IP4 foobar.com\r\n\ |
|
167 t=0 0\r\n\ |
|
168 a=application:com.gsma.rts\r\n\ |
|
169 a=type:videolive\r\n\ |
|
170 m=video 0 RTP/AVP 98 96\r\n\ |
|
171 a=rtpmap:98 H264/90000\r\n\ |
|
172 a=rtpmap:96 H263-2000/90000\r\n"); |
|
173 |
|
174 _LIT8( KCapabilityTestSDP263And264,"v=0\r\n\ |
|
175 o=- 452027953 452027953 IN IP4 foobar.com\r\n\ |
|
176 s=-\r\n\ |
|
177 c=IN IP4 foobar.com\r\n\ |
|
178 t=0 0\r\n\ |
|
179 a=application:com.gsma.rts\r\n\ |
|
180 a=type:videolive\r\n\ |
|
181 m=video 0 RTP/AVP 96 98\r\n\ |
|
182 a=rtpmap:98 H264/90000\r\n\ |
|
183 a=rtpmap:96 H263-2000/90000\r\n"); |
|
184 |
|
185 _LIT8( KCapabilityTestSDP264And263AndMpeg,"v=0\r\n\ |
|
186 o=- 452027953 452027953 IN IP4 foobar.com\r\n\ |
|
187 s=-\r\n\ |
|
188 c=IN IP4 foobar.com\r\n\ |
|
189 t=0 0\r\n\ |
|
190 a=application:com.gsma.rts\r\n\ |
|
191 a=type:videolive\r\n\ |
|
192 m=video 0 RTP/AVP 98 96 99\r\n\ |
|
193 a=rtpmap:98 H264/90000\r\n\ |
|
194 a=rtpmap:96 H263-2000/90000\r\n\ |
|
195 a=rtpmap:99 MPEG4/90000\r\n"); |
|
196 |
|
197 _LIT8( KCapabilityTestSDPFastMode,"v=0\r\n\ |
|
198 o=- 452027953 452027953 IN IP4 foobar.com\r\n\ |
|
199 s=-\r\n\ |
|
200 c=IN IP4 foobar.com\r\n\ |
|
201 t=0 0\r\n\ |
|
202 a=application:com.gsma.rts\r\n\ |
|
203 a=type:videolive\r\n\ |
|
204 a=keywds:fastmode\r\n\ |
|
205 m=video 0 RTP/AVP 96\r\n\ |
|
206 a=rtpmap:96 H263-2000/90000\r\n"); |
|
207 |
|
208 |
|
209 _LIT8( KCapabilityTestContentTypeOther, "application/text"); |
|
210 |
|
211 _LIT8( KRegisteredContact, "sip:registeredcontact@domain.com" ); |
|
212 |
|
213 _LIT8( KCapabilityTestAcceptContactHeader, "Accept-Contact: *;+g.3gpp.cs-voice;explicit"); |
|
214 _LIT8( KCapabilityTestAcceptHeader, "Accept: application/sdp"); |
|
215 _LIT8( KCapabilityTestContactHeader_A, "Contact: <sip:a@foobar.com>;+g.3gpp.cs-voice"); |
|
216 _LIT8( KCapabilityTestContactHeaderNoFeaturetag_A, "Contact: <sip:a@foobar.com>"); |
|
217 _LIT8( KCapabilityTestContactHeader_A1, "Contact: <user@aa>;+g.3gpp.cs-voice"); |
|
218 _LIT8( KCapabilityTestContactHeader_A1Updated, "Contact: <sip:registeredcontact@domain.com>;+g.3gpp.cs-voice"); |
|
219 _LIT8( KCapabilityTestContactHeader_B, "Contact: sip:b@foobar.com;+g.3gpp.cs-voice"); |
|
220 _LIT8( KCapabilityTestSIPAddress_B, "b@localhost"); |
|
221 _LIT8( KCapabilityTestUserAgent_A, "User-Agent: Terminal_A"); |
|
222 _LIT8( KCapabilityTestUserAgent_B, "User-Agent: Terminal_B"); |
|
223 _LIT( KCapabilityTestSIPAddressUri_B, "b@foobar.com"); |
|
224 _LIT( KCapabilityTestSIPAddressUri_BSIP, "sip:b@foobar.com"); |
|
225 _LIT8( KCapabilityTestSIPAddressUri8_B, "b@foobar.com"); |
|
226 |
|
227 _LIT8( KCapabilityTestDataFeature, "+g.3gpp.cs-data"); |
|
228 _LIT8( KCapabilitySwisFeatureFalse, "+g.3gpp.cs-voice;false"); |
|
229 |
|
230 #define MUS_HEADER_ASSERT( r, ndx, test )\ |
|
231 if ( r )\ |
|
232 {\ |
|
233 HBufC8* header = r->MessageElements().UserHeaders()[ ndx ]->ToTextLC();\ |
|
234 EUNIT_ASSERT( header->Compare( test ) == 0 );\ |
|
235 CleanupStack::PopAndDestroy( header );\ |
|
236 } |
|
237 |
|
238 |
|
239 /** |
|
240 * Capability Test helper |
|
241 * |
|
242 * @lib musavailabilityplugin.lib |
|
243 * @since S60 v3.2 |
|
244 */ |
|
245 class CapabilityTestHelper |
|
246 { |
|
247 |
|
248 public: // static API |
|
249 |
|
250 |
|
251 static CSIPServerTransaction* OptionsRequestL( const TDesC8& aRequestUri, |
|
252 const TDesC8& aFrom, |
|
253 const TDesC8& aAcceptContact, |
|
254 const TDesC8& aContact, |
|
255 const TDesC8& aAccept, |
|
256 const TDesC8& aUserAgent ); |
|
257 |
|
258 static CSIPServerTransaction* OptionsRequestL( const TDesC8& aRequestUri, |
|
259 const TDesC8& aFrom, |
|
260 const TDesC8& aAcceptContact, |
|
261 const TDesC8& aContact, |
|
262 const TDesC8& aAccept, |
|
263 const TDesC8& aUserAgent, |
|
264 const TDesC8& aAssertId); |
|
265 |
|
266 |
|
267 static CSIPClientTransaction* OptionsResponseL( TUint aResponse, |
|
268 TInt aPhrase, |
|
269 const TDesC8& aFrom, |
|
270 const TDesC8& aContact, |
|
271 const TDesC8& aUserAgent, |
|
272 const TDesC8& aPAssertedId, |
|
273 const TDesC8& aSdp ); |
|
274 |
|
275 static void SetResponseL( CSIPClientTransaction& aTrx, |
|
276 TUint aResponse, |
|
277 TInt aPhrase, |
|
278 const TDesC8& aFrom, |
|
279 const TDesC8& aContact, |
|
280 const TDesC8& aUserAgent, |
|
281 const TDesC8& aPAssertedId, |
|
282 const TDesC8& aSdp, |
|
283 const TDesC8& aContentType = KNullDesC8 ); |
|
284 |
|
285 static void SetResponse2L( CSIPClientTransaction& aTrx, |
|
286 TUint aResponse, |
|
287 TInt aPhrase, |
|
288 const TDesC8& aFrom, |
|
289 const TDesC8& aContact, |
|
290 const TDesC8& aUserAgent, |
|
291 const TDesC8& aPAssertedId, |
|
292 const TDesC8& aPAssertedId2, |
|
293 const TDesC8& aSdp, |
|
294 const TDesC8& aContentType = KNullDesC8 ); |
|
295 |
|
296 |
|
297 }; |
|
298 |
|
299 |
|
300 class HelpFlags |
|
301 { |
|
302 public: |
|
303 static CSIPAddress* iTestSipAddress; |
|
304 static TBool iUseTestSipAddress; |
|
305 static TBool iEmptyContactHeader; |
|
306 }; |
|
307 |
|
308 |
|
309 #endif // MUSAVACAPABILITYTESTHELPER_H |