|
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( KCapabilityTestContentTypeOther, "application/text"); |
|
198 |
|
199 _LIT8( KRegisteredContact, "sip:registeredcontact@domain.com" ); |
|
200 |
|
201 _LIT8( KCapabilityTestAcceptContactHeader, "Accept-Contact: *;+g.3gpp.cs-voice;explicit"); |
|
202 _LIT8( KCapabilityTestAcceptHeader, "Accept: application/sdp"); |
|
203 _LIT8( KCapabilityTestContactHeader_A, "Contact: <sip:a@foobar.com>;+g.3gpp.cs-voice"); |
|
204 _LIT8( KCapabilityTestContactHeaderNoFeaturetag_A, "Contact: <sip:a@foobar.com>"); |
|
205 _LIT8( KCapabilityTestContactHeader_A1, "Contact: <user@aa>;+g.3gpp.cs-voice"); |
|
206 _LIT8( KCapabilityTestContactHeader_A1Updated, "Contact: <sip:registeredcontact@domain.com>;+g.3gpp.cs-voice"); |
|
207 _LIT8( KCapabilityTestContactHeader_B, "Contact: sip:b@foobar.com;+g.3gpp.cs-voice"); |
|
208 _LIT8( KCapabilityTestSIPAddress_B, "b@localhost"); |
|
209 _LIT8( KCapabilityTestUserAgent_A, "User-Agent: Terminal_A"); |
|
210 _LIT8( KCapabilityTestUserAgent_B, "User-Agent: Terminal_B"); |
|
211 _LIT( KCapabilityTestSIPAddressUri_B, "b@foobar.com"); |
|
212 _LIT( KCapabilityTestSIPAddressUri_BSIP, "sip:b@foobar.com"); |
|
213 _LIT8( KCapabilityTestSIPAddressUri8_B, "b@foobar.com"); |
|
214 |
|
215 _LIT8( KCapabilityTestDataFeature, "+g.3gpp.cs-data"); |
|
216 _LIT8( KCapabilitySwisFeatureFalse, "+g.3gpp.cs-voice;false"); |
|
217 |
|
218 #define MUS_HEADER_ASSERT( r, ndx, test )\ |
|
219 if ( r )\ |
|
220 {\ |
|
221 HBufC8* header = r->MessageElements().UserHeaders()[ ndx ]->ToTextLC();\ |
|
222 EUNIT_ASSERT( header->Compare( test ) == 0 );\ |
|
223 CleanupStack::PopAndDestroy( header );\ |
|
224 } |
|
225 |
|
226 |
|
227 /** |
|
228 * Capability Test helper |
|
229 * |
|
230 * @lib musavailabilityplugin.lib |
|
231 * @since S60 v3.2 |
|
232 */ |
|
233 class CapabilityTestHelper |
|
234 { |
|
235 |
|
236 public: // static API |
|
237 |
|
238 |
|
239 static CSIPServerTransaction* OptionsRequestL( const TDesC8& aRequestUri, |
|
240 const TDesC8& aFrom, |
|
241 const TDesC8& aAcceptContact, |
|
242 const TDesC8& aContact, |
|
243 const TDesC8& aAccept, |
|
244 const TDesC8& aUserAgent); |
|
245 |
|
246 static CSIPServerTransaction* OptionsRequestL( const TDesC8& aRequestUri, |
|
247 const TDesC8& aFrom, |
|
248 const TDesC8& aAcceptContact, |
|
249 const TDesC8& aContact, |
|
250 const TDesC8& aAccept, |
|
251 const TDesC8& aUserAgent, |
|
252 const TDesC8& aAssertId, |
|
253 const TDesC8& aSdp = KNullDesC8); |
|
254 |
|
255 |
|
256 static CSIPClientTransaction* OptionsResponseL( TUint aResponse, |
|
257 TInt aPhrase, |
|
258 const TDesC8& aFrom, |
|
259 const TDesC8& aContact, |
|
260 const TDesC8& aUserAgent, |
|
261 const TDesC8& aPAssertedId, |
|
262 const TDesC8& aSdp ); |
|
263 |
|
264 static void SetResponseL( CSIPClientTransaction& aTrx, |
|
265 TUint aResponse, |
|
266 TInt aPhrase, |
|
267 const TDesC8& aFrom, |
|
268 const TDesC8& aContact, |
|
269 const TDesC8& aUserAgent, |
|
270 const TDesC8& aPAssertedId, |
|
271 const TDesC8& aSdp, |
|
272 const TDesC8& aContentType = KNullDesC8 ); |
|
273 |
|
274 static void SetResponse2L( CSIPClientTransaction& aTrx, |
|
275 TUint aResponse, |
|
276 TInt aPhrase, |
|
277 const TDesC8& aFrom, |
|
278 const TDesC8& aContact, |
|
279 const TDesC8& aUserAgent, |
|
280 const TDesC8& aPAssertedId, |
|
281 const TDesC8& aPAssertedId2, |
|
282 const TDesC8& aSdp, |
|
283 const TDesC8& aContentType = KNullDesC8 ); |
|
284 |
|
285 |
|
286 }; |
|
287 |
|
288 |
|
289 class HelpFlags |
|
290 { |
|
291 public: |
|
292 static CSIPAddress* iTestSipAddress; |
|
293 static TBool iUseTestSipAddress; |
|
294 static TBool iEmptyContactHeader; |
|
295 }; |
|
296 |
|
297 |
|
298 #endif // MUSAVACAPABILITYTESTHELPER_H |