|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Place holder for common constants, type definitions and enums. |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @publishedAll |
|
21 @released |
|
22 */ |
|
23 |
|
24 #ifndef __INETURILISTDEF_H__ |
|
25 #define __INETURILISTDEF_H__ |
|
26 |
|
27 #include <e32base.h> |
|
28 |
|
29 /** |
|
30 @publishedAll |
|
31 @released |
|
32 */ |
|
33 namespace InetUriList |
|
34 { |
|
35 /** |
|
36 Types of supported service type. |
|
37 |
|
38 @publishedAll |
|
39 @released |
|
40 */ |
|
41 enum TServiceType |
|
42 { |
|
43 /** Browser */ |
|
44 EBrowser =0x01, |
|
45 /** WapPush */ |
|
46 EWapPush =0x02, |
|
47 /** PushEMail */ |
|
48 EPushEMail =0x03, |
|
49 /** DevProv */ |
|
50 EDevProv =0x04, |
|
51 /** VOIP */ |
|
52 EVoip =0x05 |
|
53 }; |
|
54 |
|
55 /** |
|
56 Types of supported list type. |
|
57 |
|
58 @publishedAll |
|
59 @released |
|
60 */ |
|
61 enum TListType |
|
62 { |
|
63 /** BlackList **/ |
|
64 EBlackList =0x01, |
|
65 /** WhiteList **/ |
|
66 EWhiteList =0x02 |
|
67 }; |
|
68 |
|
69 /** |
|
70 Types of permission. |
|
71 |
|
72 @publishedAll |
|
73 @released |
|
74 */ |
|
75 enum TPermission |
|
76 { |
|
77 /** ReadOnly **/ |
|
78 EReadOnly =0x01, |
|
79 /** ReadWrite **/ |
|
80 EReadWrite =0x02 |
|
81 }; |
|
82 |
|
83 /** |
|
84 Types of TLD Query type. |
|
85 |
|
86 @publishedAll |
|
87 @released |
|
88 */ |
|
89 enum TTLDQueryType |
|
90 { |
|
91 /** Top Level Domain List type **/ |
|
92 EPolicyListType=0x01, |
|
93 /** Top Level Domain Policy data **/ |
|
94 EPolicyCharSet=0x02 |
|
95 }; |
|
96 |
|
97 /** |
|
98 Types of matches. |
|
99 |
|
100 @publishedAll |
|
101 @released |
|
102 */ |
|
103 enum TURIMatch |
|
104 { |
|
105 /** Exact match **/ |
|
106 EExact =0x01, |
|
107 /** Domain match **/ |
|
108 EDomain =0x02, |
|
109 /** Exact path match **/ |
|
110 EExactPath =0x03, |
|
111 /** partial prefix path match **/ |
|
112 EPartialPrefixPath =0x04, |
|
113 /** Partial suffix path match **/ |
|
114 EPartialSuffixPath =0x05 |
|
115 }; |
|
116 |
|
117 /** |
|
118 Error codes error numbers -7650 to -7699 have been reserved for InetUriList. |
|
119 */ |
|
120 static const TInt KErrorBase = -7650; |
|
121 /** |
|
122 URI already exists in database. |
|
123 */ |
|
124 static const TInt KErrUriAlreadyExists = KErrorBase; |
|
125 /** |
|
126 URI not found in database. |
|
127 */ |
|
128 static const TInt KErrUriNotFound = KErrorBase - 1; |
|
129 /** |
|
130 Addition of URI failed. |
|
131 */ |
|
132 static const TInt KErrUriAddFailed = KErrorBase - 2; |
|
133 /** |
|
134 Removal of URI failed. |
|
135 */ |
|
136 static const TInt KErrUriRemoveFailed = KErrorBase - 3; |
|
137 /** |
|
138 Updation of URI properties failed. |
|
139 */ |
|
140 static const TInt KErrUriUpdateFailed = KErrorBase - 4; |
|
141 /** |
|
142 URI is read only. |
|
143 */ |
|
144 static const TInt KErrUriReadOnly = KErrorBase - 5; |
|
145 /** |
|
146 Service type of URI is missing. |
|
147 */ |
|
148 static const TInt KErrServiceTypeNotPresent = KErrorBase - 6; |
|
149 /** |
|
150 Handle is not open. |
|
151 */ |
|
152 static const TInt KErrNotOpen = KErrorBase - 7; |
|
153 /** |
|
154 Invalid stream handle |
|
155 */ |
|
156 static const TInt KErrInvalidStreamHandle = KErrorBase - 8; |
|
157 /** |
|
158 Tld URI is missing. |
|
159 */ |
|
160 static const TInt KErrTldUriNotPresent = KErrorBase - 9; |
|
161 /** |
|
162 Query Type of URI is missing. |
|
163 */ |
|
164 static const TInt KErrTldQueryTypeNotPresent = KErrorBase - 10; |
|
165 /** |
|
166 Policy Data is not present. |
|
167 */ |
|
168 static const TInt KErrPolicyDataNotPresent = KErrorBase - 11; |
|
169 /** |
|
170 TLD list type is not present. |
|
171 */ |
|
172 static const TInt KErrPolicyListTypeNotPresent = KErrorBase - 12; |
|
173 /** |
|
174 Requested TLD type is not supported. |
|
175 */ |
|
176 static const TInt KErrInvalidTLD = KErrorBase - 13; |
|
177 /** |
|
178 Panic text if handle is not open. |
|
179 */ |
|
180 _LIT(KInetUriListErrHandleNotOpen, "Handle not open"); |
|
181 /** |
|
182 Panic text if handle is not open. |
|
183 */ |
|
184 _LIT(KTldInvalidRequest, "Invalid Request"); |
|
185 |
|
186 } |
|
187 |
|
188 /** |
|
189 This class defines the argument parameters for the query operation. It is possible to |
|
190 set the arguments in various combinations. The argument types can be ServiceType, |
|
191 ListType, URI in TDesC8 form, and URIMatch. |
|
192 |
|
193 @publishedAll |
|
194 @released |
|
195 */ |
|
196 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
197 class TQueryArgs |
|
198 { |
|
199 public: |
|
200 /** |
|
201 The argument types. |
|
202 */ |
|
203 enum TArgType |
|
204 { |
|
205 EUri = 1, |
|
206 EServiceType, |
|
207 EListType, |
|
208 EURIMatch |
|
209 }; |
|
210 |
|
211 /** |
|
212 Default constructor |
|
213 */ |
|
214 inline TQueryArgs () |
|
215 :iFlags ( 0 ) |
|
216 {} |
|
217 |
|
218 |
|
219 /** |
|
220 A templated constructor that constructs the query argument. |
|
221 It takes one argument. |
|
222 */ |
|
223 template < class T0 > |
|
224 explicit inline TQueryArgs ( T0 a0 ) |
|
225 { |
|
226 Assign ( a0 ); |
|
227 iFlags=(Type(a0)<<(( Type(a0))*KBitsPerType)); |
|
228 } |
|
229 |
|
230 /** |
|
231 A templated constructor that constructs the query argument. |
|
232 It takes two arguments. |
|
233 */ |
|
234 template < class T0, class T1 > |
|
235 inline TQueryArgs ( T0 a0, T1 a1 ) |
|
236 { |
|
237 Assign ( a0 ); |
|
238 Assign ( a1 ); |
|
239 iFlags=(Type(a0)<<(( Type(a0))*KBitsPerType)) | |
|
240 (Type(a1)<<(( Type(a1))*KBitsPerType)); |
|
241 } |
|
242 |
|
243 /** |
|
244 A templated constructor that constructs the query argument. |
|
245 It takes three arguments. |
|
246 */ |
|
247 template < class T0, class T1, class T2 > |
|
248 inline TQueryArgs ( T0 a0, T1 a1, T2 a2 ) |
|
249 { |
|
250 Assign ( a0 ); |
|
251 Assign ( a1 ); |
|
252 Assign ( a2 ); |
|
253 iFlags=(Type(a0)<<(Type(a0)*KBitsPerType)) | |
|
254 (Type(a1)<<(Type(a1)*KBitsPerType)) | |
|
255 (Type(a2)<<(Type(a2)*KBitsPerType)); |
|
256 } |
|
257 |
|
258 /** |
|
259 A templated constructor that constructs the query argument. |
|
260 It takes four arguments. |
|
261 */ |
|
262 template < class T0, class T1, class T2, class T3 > |
|
263 inline TQueryArgs ( T0 a0, T1 a1, T2 a2, T3 a3 ) |
|
264 { |
|
265 Assign ( a0 ); |
|
266 Assign ( a1 ); |
|
267 Assign ( a2 ); |
|
268 Assign ( a3 ); |
|
269 iFlags=(Type(a0)<<(Type(a0)*KBitsPerType)) | |
|
270 (Type(a1)<<(Type(a1)*KBitsPerType)) | |
|
271 (Type(a2)<<(Type(a2)*KBitsPerType)) | |
|
272 (Type(a3)<<(Type(a3)*KBitsPerType)); |
|
273 } |
|
274 |
|
275 /** |
|
276 Returns the argument if set, otherwise returns KErrNotFound. |
|
277 */ |
|
278 TInt Get ( TArgType aType ) const |
|
279 { |
|
280 if ( IsSet ( aType ) ) |
|
281 return iArgs[aType - 1]; |
|
282 return KErrNotFound; |
|
283 } |
|
284 |
|
285 private: |
|
286 /** |
|
287 Bit width of the type. |
|
288 */ |
|
289 enum |
|
290 { |
|
291 KBitsPerType = 3 |
|
292 }; |
|
293 /** |
|
294 Maximum number of arguments. Currently set as 4. |
|
295 */ |
|
296 enum |
|
297 { |
|
298 KMaxArguments = 4 |
|
299 }; |
|
300 /** |
|
301 Checks whether the flag is set for the given argument type. |
|
302 */ |
|
303 TBool IsSet ( TArgType aType ) const |
|
304 { |
|
305 TInt val = iFlags & ( aType << ( aType * KBitsPerType ) ); |
|
306 return iFlags & ( aType << ( aType * KBitsPerType ) ); |
|
307 } |
|
308 |
|
309 TArgType Type ( const TDesC8* ) |
|
310 { |
|
311 return EUri; |
|
312 } |
|
313 |
|
314 TArgType Type ( InetUriList::TServiceType ) |
|
315 { |
|
316 return EServiceType; |
|
317 } |
|
318 |
|
319 TArgType Type ( InetUriList::TListType ) |
|
320 { |
|
321 return EListType; |
|
322 } |
|
323 |
|
324 TArgType Type ( InetUriList::TURIMatch ) |
|
325 { |
|
326 return EURIMatch; |
|
327 } |
|
328 |
|
329 void Assign ( const TDesC8* aValue ) |
|
330 { |
|
331 iArgs[Type(aValue)-1] = (TInt)aValue; |
|
332 } |
|
333 |
|
334 void Assign ( InetUriList::TServiceType aValue ) |
|
335 { |
|
336 iArgs[Type(aValue)-1] = aValue; |
|
337 } |
|
338 |
|
339 void Assign ( InetUriList::TListType aValue ) |
|
340 { |
|
341 iArgs[Type(aValue)-1] = aValue; |
|
342 } |
|
343 |
|
344 void Assign ( InetUriList::TURIMatch aValue ) |
|
345 { |
|
346 iArgs[Type(aValue)-1] = aValue; |
|
347 } |
|
348 |
|
349 private: |
|
350 TInt iArgs [KMaxArguments]; |
|
351 TInt iFlags; |
|
352 }; |
|
353 |
|
354 #else |
|
355 |
|
356 class TQueryArgs |
|
357 { |
|
358 public: |
|
359 /** |
|
360 The argument types. |
|
361 |
|
362 @internalComponent |
|
363 */ |
|
364 enum TArgType |
|
365 { |
|
366 EUri = 1, |
|
367 EServiceType, |
|
368 EListType, |
|
369 EURIMatch |
|
370 }; |
|
371 /** |
|
372 Bit width of the type. |
|
373 |
|
374 @internalComponent |
|
375 */ |
|
376 enum |
|
377 { |
|
378 KBitsPerType = 3 |
|
379 }; |
|
380 |
|
381 /** |
|
382 Default constructor |
|
383 */ |
|
384 inline TQueryArgs () |
|
385 :iFlags ( 0 ) |
|
386 {} |
|
387 |
|
388 |
|
389 /** |
|
390 A templated constructor that constructs the query argument. |
|
391 It takes one argument. |
|
392 */ |
|
393 template < class T0 > |
|
394 explicit inline TQueryArgs ( T0 a0 ) |
|
395 { |
|
396 Assign ( a0 ); |
|
397 iFlags=(Type(a0)<<(( Type(a0))*KBitsPerType)); |
|
398 } |
|
399 |
|
400 /** |
|
401 A templated constructor that constructs the query argument. |
|
402 It takes two arguments. |
|
403 */ |
|
404 template < class T0, class T1 > |
|
405 inline TQueryArgs ( T0 a0, T1 a1 ) |
|
406 { |
|
407 Assign ( a0 ); |
|
408 Assign ( a1 ); |
|
409 iFlags=(Type(a0)<<(( Type(a0))*KBitsPerType)) | |
|
410 (Type(a1)<<(( Type(a1))*KBitsPerType)); |
|
411 } |
|
412 |
|
413 /** |
|
414 A templated constructor that constructs the query argument. |
|
415 It takes three arguments. |
|
416 */ |
|
417 template < class T0, class T1, class T2 > |
|
418 inline TQueryArgs ( T0 a0, T1 a1, T2 a2 ) |
|
419 { |
|
420 Assign ( a0 ); |
|
421 Assign ( a1 ); |
|
422 Assign ( a2 ); |
|
423 iFlags=(Type(a0)<<(Type(a0)*KBitsPerType)) | |
|
424 (Type(a1)<<(Type(a1)*KBitsPerType)) | |
|
425 (Type(a2)<<(Type(a2)*KBitsPerType)); |
|
426 } |
|
427 |
|
428 /** |
|
429 A templated constructor that constructs the query argument. |
|
430 It takes four arguments. |
|
431 */ |
|
432 template < class T0, class T1, class T2, class T3 > |
|
433 inline TQueryArgs ( T0 a0, T1 a1, T2 a2, T3 a3 ) |
|
434 { |
|
435 Assign ( a0 ); |
|
436 Assign ( a1 ); |
|
437 Assign ( a2 ); |
|
438 Assign ( a3 ); |
|
439 iFlags=(Type(a0)<<(Type(a0)*KBitsPerType)) | |
|
440 (Type(a1)<<(Type(a1)*KBitsPerType)) | |
|
441 (Type(a2)<<(Type(a2)*KBitsPerType)) | |
|
442 (Type(a3)<<(Type(a3)*KBitsPerType)); |
|
443 } |
|
444 |
|
445 |
|
446 /** |
|
447 Checks whether the flag is set for the given argument type. |
|
448 |
|
449 @internalComponent |
|
450 */ |
|
451 TBool IsSet ( TArgType aType ) const |
|
452 { |
|
453 TInt val = iFlags & ( aType << ( aType * KBitsPerType ) ); |
|
454 return iFlags & ( aType << ( aType * KBitsPerType ) ); |
|
455 } |
|
456 |
|
457 /** |
|
458 Returns the argument if set, otherwise returns KErrNotFound. |
|
459 |
|
460 @internalComponent |
|
461 */ |
|
462 TInt Get ( TArgType aType ) const |
|
463 { |
|
464 if ( IsSet ( aType ) ) |
|
465 return iArgs[aType - 1]; |
|
466 return KErrNotFound; |
|
467 } |
|
468 |
|
469 /** |
|
470 Maximum number of arguments. Currently set as 4. |
|
471 |
|
472 @internalComponent |
|
473 */ |
|
474 enum |
|
475 { |
|
476 KMaxArguments = 4 |
|
477 }; |
|
478 |
|
479 private: |
|
480 |
|
481 /** |
|
482 @internalComponent |
|
483 */ |
|
484 TArgType Type ( const TDesC8* ) |
|
485 { |
|
486 return EUri; |
|
487 } |
|
488 |
|
489 TArgType Type ( InetUriList::TServiceType ) |
|
490 { |
|
491 return EServiceType; |
|
492 } |
|
493 |
|
494 TArgType Type ( InetUriList::TListType ) |
|
495 { |
|
496 return EListType; |
|
497 } |
|
498 |
|
499 TArgType Type ( InetUriList::TURIMatch ) |
|
500 { |
|
501 return EURIMatch; |
|
502 } |
|
503 |
|
504 void Assign ( const TDesC8* aValue ) |
|
505 { |
|
506 iArgs[Type(aValue)-1] = (TInt)aValue; |
|
507 } |
|
508 |
|
509 void Assign ( InetUriList::TServiceType aValue ) |
|
510 { |
|
511 iArgs[Type(aValue)-1] = aValue; |
|
512 } |
|
513 |
|
514 void Assign ( InetUriList::TListType aValue ) |
|
515 { |
|
516 iArgs[Type(aValue)-1] = aValue; |
|
517 } |
|
518 |
|
519 void Assign ( InetUriList::TURIMatch aValue ) |
|
520 { |
|
521 iArgs[Type(aValue)-1] = aValue; |
|
522 } |
|
523 |
|
524 private: |
|
525 TInt iArgs [KMaxArguments]; |
|
526 TInt iFlags; |
|
527 }; |
|
528 |
|
529 |
|
530 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
|
531 |
|
532 #endif // __INETURILISTDEF_H__ |