sl@0
|
1 |
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#ifndef __SIPURIANDAUTHORITYTESTS_H__
|
sl@0
|
17 |
#define __SIPURIANDAUTHORITYTESTS_H__
|
sl@0
|
18 |
|
sl@0
|
19 |
// System includes
|
sl@0
|
20 |
//
|
sl@0
|
21 |
#include <e32base.h>
|
sl@0
|
22 |
|
sl@0
|
23 |
template<class TUriParserType, class TDesCType>
|
sl@0
|
24 |
TInt DoSipUriValidation(const TDesCType& aSipUri);
|
sl@0
|
25 |
|
sl@0
|
26 |
template<class TUriParserType, class TDesCType>
|
sl@0
|
27 |
TInt DoSipUriEquivalence(const TDesCType& aSipUriA, const TDesCType& aSipUriB, TInt &aSipUriError);
|
sl@0
|
28 |
|
sl@0
|
29 |
//
|
sl@0
|
30 |
//
|
sl@0
|
31 |
// SIP Uri and Authority component extraction test data
|
sl@0
|
32 |
// This data is used for parsing & generating, validating and comparing SIP URIs
|
sl@0
|
33 |
//
|
sl@0
|
34 |
//
|
sl@0
|
35 |
|
sl@0
|
36 |
_LIT(KCompsSip0, "sip:alice@atlanta.com");
|
sl@0
|
37 |
_LIT(KSchemeSip0, "sip");
|
sl@0
|
38 |
_LIT(KPathSip0, "");
|
sl@0
|
39 |
_LIT(KQuerySip0, "");
|
sl@0
|
40 |
_LIT(KFragmentSip0, "");
|
sl@0
|
41 |
_LIT(KUserSip0, "alice");
|
sl@0
|
42 |
_LIT(KPassSip0, "");
|
sl@0
|
43 |
_LIT(KHostSip0, "atlanta.com");
|
sl@0
|
44 |
_LIT(KUserInfoSip0, "alice");
|
sl@0
|
45 |
_LIT(KPortSip0, "");
|
sl@0
|
46 |
|
sl@0
|
47 |
_LIT(KCompsSip1, "siP:alice:SecretwoRd@atlaNta.com;transPort=tcp");
|
sl@0
|
48 |
_LIT(KSchemeSip1, "siP");
|
sl@0
|
49 |
_LIT(KPathSip1, ";transPort=tcp");
|
sl@0
|
50 |
_LIT(KQuerySip1, "");
|
sl@0
|
51 |
_LIT(KFragmentSip1, "");
|
sl@0
|
52 |
_LIT(KUserSip1, "alice");
|
sl@0
|
53 |
_LIT(KPassSip1, "SecretwoRd");
|
sl@0
|
54 |
_LIT(KHostSip1, "atlaNta.com");
|
sl@0
|
55 |
_LIT(KUserInfoSip1, "alice:SecretwoRd");
|
sl@0
|
56 |
_LIT(KPortSip1, "");
|
sl@0
|
57 |
|
sl@0
|
58 |
_LIT(KCompsSip2, "sipS:atlanta.coM;method=REGISTER?to=alice%40atlanta.com");
|
sl@0
|
59 |
_LIT(KSchemeSip2, "sipS");
|
sl@0
|
60 |
_LIT(KPathSip2, ";method=REGISTER");
|
sl@0
|
61 |
_LIT(KQuerySip2, "to=alice%40atlanta.com");
|
sl@0
|
62 |
_LIT(KFragmentSip2, "");
|
sl@0
|
63 |
_LIT(KUserSip2, "");
|
sl@0
|
64 |
_LIT(KPassSip2, "");
|
sl@0
|
65 |
_LIT(KHostSip2, "atlanta.coM");
|
sl@0
|
66 |
_LIT(KUserInfoSip2, "");
|
sl@0
|
67 |
_LIT(KPortSip2, "");
|
sl@0
|
68 |
|
sl@0
|
69 |
_LIT(KCompsSip3, "sipS:alice:Wor%64@atlanta.coM?subject=project%20x&priority=urgent");
|
sl@0
|
70 |
_LIT(KSchemeSip3, "sipS");
|
sl@0
|
71 |
_LIT(KPathSip3, "");
|
sl@0
|
72 |
_LIT(KQuerySip3, "subject=project%20x&priority=urgent");
|
sl@0
|
73 |
_LIT(KFragmentSip3, "");
|
sl@0
|
74 |
_LIT(KUserSip3, "alice");
|
sl@0
|
75 |
_LIT(KPassSip3, "");
|
sl@0
|
76 |
_LIT(KHostSip3, "atlanta.coM");
|
sl@0
|
77 |
_LIT(KUserInfoSip3, "alice:Wor%64");
|
sl@0
|
78 |
_LIT(KPortSip3, "");
|
sl@0
|
79 |
|
sl@0
|
80 |
_LIT(KCompsSip4, "sIp:boB@192.168.2.0:6000;transport=tcp;method=REGISTER?to=sip:bob%40biloxi.com");
|
sl@0
|
81 |
_LIT(KSchemeSip4, "sIp");
|
sl@0
|
82 |
_LIT(KPathSip4, ";transport=tcp;method=REGISTER");
|
sl@0
|
83 |
_LIT(KQuerySip4, "to=sip:bob%40biloxi.com");
|
sl@0
|
84 |
_LIT(KFragmentSip4, "");
|
sl@0
|
85 |
_LIT(KUserSip4, "boB");
|
sl@0
|
86 |
_LIT(KPassSip4, "");
|
sl@0
|
87 |
_LIT(KHostSip4, "192.168.2.0");
|
sl@0
|
88 |
_LIT(KUserInfoSip4, "boB");
|
sl@0
|
89 |
_LIT(KPortSip4, "6000");
|
sl@0
|
90 |
|
sl@0
|
91 |
//The path Parameter begins with , foot note 1 in PREQ748 Analysis.doc
|
sl@0
|
92 |
_LIT(KCompsSip5, "sIp:bobA:pas%73@192.168.2.100:2000;transport=tcp;method=REGISTER?to=sip:bob%40biloxi.com");
|
sl@0
|
93 |
_LIT(KSchemeSip5, "sIp");
|
sl@0
|
94 |
_LIT(KPathSip5, ";transport=tcp;method=REGISTER");
|
sl@0
|
95 |
_LIT(KQuerySip5, "to=sip:bob%40biloxi.com");
|
sl@0
|
96 |
_LIT(KFragmentSip5, "");
|
sl@0
|
97 |
_LIT(KUserSip5, "bobA");
|
sl@0
|
98 |
_LIT(KPassSip5, "pas%73");
|
sl@0
|
99 |
_LIT(KHostSip5, "192.168.2.100");
|
sl@0
|
100 |
_LIT(KUserInfoSip5, "bobA:pas%73");
|
sl@0
|
101 |
_LIT(KPortSip5, "2000");
|
sl@0
|
102 |
|
sl@0
|
103 |
// IPv6 test cases for SIP URIs
|
sl@0
|
104 |
_LIT(KSipUri_IPv6Fragment0, "sip:userinfo@[::FfFf:129.144.52.38]:port;transport=tcp?query#fragment"); // with fragment
|
sl@0
|
105 |
_LIT(KSipUri_IPv6Query0, "sip:userinfo@[::FfFf:129.144.52.38]:port;transport=tcp?query"); // with query
|
sl@0
|
106 |
_LIT(KSipUri_IPv6Path0, "sip:userinfo@[::FfFf:129.144.52.38]:port;transport=tcp"); // with path
|
sl@0
|
107 |
_LIT(KSipUri_IPv6Port0, "sip:userinfo@[::FfFf:129.144.52.38]:port"); // with port
|
sl@0
|
108 |
_LIT(KSipUri_IPv6UserInfo0, "sip:userinfo@[::FfFf:129.144.52.38]"); // with userinfo
|
sl@0
|
109 |
_LIT(KSipUri_IPv6Host0, "sip:[::FfFf:129.144.52.38]"); // with scheme
|
sl@0
|
110 |
|
sl@0
|
111 |
// Sip URI construction test
|
sl@0
|
112 |
_LIT(KSipUri_Fragment0, "sip:userinfo@host:port;transport=tcp?query#fragment"); //
|
sl@0
|
113 |
_LIT(KSipUri_Query0, "sip:userinfo@host:port;transport=tcp?query");
|
sl@0
|
114 |
_LIT(KSipUri_Path0, "sip:userinfo@host:port;transport=tcp");
|
sl@0
|
115 |
_LIT(KSipUri_Port0, "sip:userinfo@host:port");
|
sl@0
|
116 |
_LIT(KSipUri_Userinfo0, "sip:userinfo@host");
|
sl@0
|
117 |
_LIT(KSipUri_Host0, "sip:host");
|
sl@0
|
118 |
_LIT(KSipUri_Scheme0, "sip:");
|
sl@0
|
119 |
|
sl@0
|
120 |
_LIT(KSipUri_SchemeComp0, "sip");
|
sl@0
|
121 |
_LIT(KSipUri_HostComp0, "host");
|
sl@0
|
122 |
_LIT(KSipUri_UserinfoComp0, "userinfo");
|
sl@0
|
123 |
_LIT(KSipUri_PortComp0, "port");
|
sl@0
|
124 |
_LIT(KSipUri_PathComp0, ";transport=tcp");
|
sl@0
|
125 |
_LIT(KSipUri_QueryComp0, "query");
|
sl@0
|
126 |
_LIT(KSipUri_FragmentComp0, "fragment");//
|
sl@0
|
127 |
|
sl@0
|
128 |
// Sip URI destruction test
|
sl@0
|
129 |
_LIT(KSipUri_Whole0, "sip:userinfo@host:port;transport=tcp?query#fragment"); // Whole uri
|
sl@0
|
130 |
_LIT(KSipUri_NoFragment0, "sip:userinfo@host:port;transport=tcp?query"); // Without fragment
|
sl@0
|
131 |
_LIT(KSipUri_NoQuery0, "sip:userinfo@host:port;transport=tcp"); // Without query
|
sl@0
|
132 |
_LIT(KSipUri_NoPath0, "sip:userinfo@host:port"); // Without path
|
sl@0
|
133 |
_LIT(KSipUri_NoPort0, "sip:userinfo@host"); // Without port
|
sl@0
|
134 |
_LIT(KSipUri_NoUserinfo0, "sip:host"); // Without userinfo
|
sl@0
|
135 |
_LIT(KSipUri_NoHost0, "sip:"); // Without host
|
sl@0
|
136 |
_LIT(KSipUri_NoScheme0, ""); // Without scheme
|
sl@0
|
137 |
|
sl@0
|
138 |
// IPv6 test cases for SIP URIs
|
sl@0
|
139 |
_LIT(KSipUri_IPv6Whole0, "sip:userinfo@[::FfFf:129.144.52.38]:port;transport=tcp?query#fragment"); // Whole uri
|
sl@0
|
140 |
_LIT(KSipUri_IPv6NoFragment0, "sip:userinfo@[::FfFf:129.144.52.38]:port;transport=tcp?query"); // Without fragment
|
sl@0
|
141 |
_LIT(KSipUri_IPv6NoQuery0, "sip:userinfo@[::FfFf:129.144.52.38]:port;transport=tcp"); // Without query
|
sl@0
|
142 |
_LIT(KSipUri_IPv6NoPath0, "sip:userinfo@[::FfFf:129.144.52.38]:port"); // Without path
|
sl@0
|
143 |
_LIT(KSipUri_IPv6NoPort0, "sip:userinfo@[::FfFf:129.144.52.38]"); // Without port
|
sl@0
|
144 |
_LIT(KSipUri_IPv6NoUserinfo0, "sip:[::FfFf:129.144.52.38]"); // Without userinfo
|
sl@0
|
145 |
_LIT(KSipUri_IPv6NoHost0, "sip:"); // Without host
|
sl@0
|
146 |
_LIT(KSipUri_IPv6NoScheme0, ""); // Without scheme
|
sl@0
|
147 |
|
sl@0
|
148 |
_LIT(KUri_IPv6HostComp, "::FfFf:129.144.52.38");
|
sl@0
|
149 |
|
sl@0
|
150 |
//
|
sl@0
|
151 |
//
|
sl@0
|
152 |
// SIP Uri Valiadtion and Equivalence
|
sl@0
|
153 |
//
|
sl@0
|
154 |
//
|
sl@0
|
155 |
|
sl@0
|
156 |
const TInt KErrBadSipUriA=(-5000);
|
sl@0
|
157 |
const TInt KErrBadSipUriB=(-6000);
|
sl@0
|
158 |
|
sl@0
|
159 |
_LIT(KCompsSipUriFileName, "Z:\\T_UriParser\\T_UriParserSipUri.txt");
|
sl@0
|
160 |
_LIT(KCompsSipUriComment, "//");
|
sl@0
|
161 |
_LIT(KCompsSipUriValidate, "Validate");
|
sl@0
|
162 |
_LIT(KCompsSipUriEquivalence, "Equivalence");
|
sl@0
|
163 |
_LIT(KCompsSipUriValidateStart, "Starting Validating of SIP URIs");
|
sl@0
|
164 |
_LIT(KCompsSipUriFileSystemError, "***** ERROR IN FILE SYSTEM. T_UriParserSipUri.txt NOT FOUND*****");
|
sl@0
|
165 |
_LIT(KCompsSipUriNoValidate, "***** NO VALIDATE SECTION IN FILE *****");
|
sl@0
|
166 |
_LIT(KCompsSipUriNoValidateData, "***** NO VALIDATION DATA IN FILE *****");
|
sl@0
|
167 |
_LIT(KCompsSipUriNoEquivalence, "***** NO EQUIVALENCE SECTION IN FILE *****");
|
sl@0
|
168 |
_LIT(KCompsSipUriNoEquivalenceData, "***** NO EQUIVALENCE DATA IN FILE *****");
|
sl@0
|
169 |
|
sl@0
|
170 |
//Valid SIP URIs that we use in code to compare the errors with
|
sl@0
|
171 |
_LIT(KCompsSipUriValid0, "sip:user@host:5061;lr");
|
sl@0
|
172 |
_LIT(KCompsSipUriValid1, "SIPS:bob@Symbian.com?to=");
|
sl@0
|
173 |
|
sl@0
|
174 |
//Invalid SIP URIs that we use in code to compare the errors with
|
sl@0
|
175 |
_LIT(KCompsSipUriInvalid0, "Sim:10.0.1.10:port:%61lice:pass;transport=tcp&subject=wor%6B");
|
sl@0
|
176 |
_LIT(KCompsSipUriInvalid1, "sIps:atalanta.com:8830/04-1.html");
|
sl@0
|
177 |
_LIT(KCompsSipUriInvalid2, "SIPS:bob@Symbian.com?to=1123&to=678");
|
sl@0
|
178 |
_LIT(KCompsSipUriInvalid3, "SiP:%89ob999:-~_*.!pass@:;transport=udp?subject=Proj&subject=Test!**");
|
sl@0
|
179 |
_LIT(KCompsSipUriInvalid4, "siP:userinfo@[::FfFf:129.144.52.38]:port/a/b/c?query");
|
sl@0
|
180 |
_LIT(KCompsSipUriInvalid5, "sips:userinfo@192.168.2.1;geo.position:=33.51_-119.94_72&subject=Symbi%71n");
|
sl@0
|
181 |
_LIT(KCompsSipUriInvalid6, "sip:user@host:5061;lr=");
|
sl@0
|
182 |
_LIT(KCompsSipUriInvalid7, "sip:@atlanta.com");
|
sl@0
|
183 |
|
sl@0
|
184 |
//Should be equal
|
sl@0
|
185 |
_LIT(KCompsSipUriEqual0, "sip:alice:SecretWord@192.168.0.1:80;transport=tcp?to=alice&subject=project&content-type=text&call-id=100&contact=bob&from=fred");
|
sl@0
|
186 |
_LIT(KCompsSipUriEqual1, "sipS:Bob+11111;ext=22@[::FfFf:129.144.52.38];%74ransport=//(:t.c*%70);method=SET?c=tests&from=Bob");
|
sl@0
|
187 |
_LIT(KCompsSipUriEqual2, "sipS:+358-555-1234567;postd=carol:**PASS**@SymBian.com");
|
sl@0
|
188 |
|
sl@0
|
189 |
//Should NOT be equal
|
sl@0
|
190 |
_LIT(KCompsSipUriNotEqual0, "sip:alice:Word@192.168.0.1:80;transport=tcp?to=alice& subject=project&content-type=text&call-id=100&contact=bob&from=fred");
|
sl@0
|
191 |
_LIT(KCompsSipUriNotEqual1, "sip:alice@atlanta.com;maddr=239.255.255.1;ttl=15");
|
sl@0
|
192 |
_LIT(KCompsSipUriNotEqual2, "sip:alice:SecretWord@192.168.0.5:80;transport=tcp?to=alice&subject=project&content-type=text&call-id=100&contact=bob&from=fred");
|
sl@0
|
193 |
|
sl@0
|
194 |
_LIT(KCompsSipUriValidMess0, "Correct Error should have been:- KErrNone");
|
sl@0
|
195 |
|
sl@0
|
196 |
_LIT(KCompsSipUriInvalidMess0, "Correct Error should have been:- Not Supported");
|
sl@0
|
197 |
_LIT(KCompsSipUriInvalidMess1, "Correct Error should have been:- Invalid Parameter");
|
sl@0
|
198 |
_LIT(KCompsSipUriInvalidMess2, "Correct Error should have been:- Invalid Host");
|
sl@0
|
199 |
_LIT(KCompsSipUriInvalidMess3, "Correct Error should have been:- Invalid Port");
|
sl@0
|
200 |
_LIT(KCompsSipUriInvalidMess4, "Correct Error should have been:- Not Supported");
|
sl@0
|
201 |
_LIT(KCompsSipUriInvalidMess5, "***** INCORRECT ERROR RETURNED FROM CURI *****");
|
sl@0
|
202 |
_LIT(KCompsSipUriInvalidMess6, "Invalid Path");
|
sl@0
|
203 |
_LIT(KCompsSipUriInvalidMess7, "Correct Error should have been:- Invalid UserInfo");
|
sl@0
|
204 |
_LIT(KCompsSipUriInvalidMess8, "Correct Error should have been:- Invalid Headers");
|
sl@0
|
205 |
_LIT(KCompsSipUriInvalidMess9, "Correct Error should have been:- Invalid Path");
|
sl@0
|
206 |
|
sl@0
|
207 |
_LIT(KCompsSipUriEqualMess0, "The SIP URIs are EQUAL ");
|
sl@0
|
208 |
_LIT(KCompsSipUriEqualMess1, "The SIP URIs are NOT EQUAL ");
|
sl@0
|
209 |
|
sl@0
|
210 |
#endif // __SIPURIANDAUTHORITYTESTS_H__
|