|
1 // Copyright (c) 2007-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 // |
|
15 |
|
16 #ifndef __URILISTINTERFACE_H__ |
|
17 #define __URILISTINTERFACE_H__ |
|
18 #include <s32mem.h> |
|
19 #include <uri8.h> |
|
20 #include <stringpool.h> |
|
21 #include <ineturilistdef.h> |
|
22 #include <tldlistdef.h> |
|
23 #include "dbaccessor.h" |
|
24 |
|
25 class CInetUriImpl; |
|
26 class CTldProperties; |
|
27 class CInetUriProperties; |
|
28 class CUriListStream; |
|
29 class CUriQueryFilter; |
|
30 |
|
31 /** |
|
32 This class is the interface between the server session class and the data storage. The methods |
|
33 provided in this class will make calls to the data storage class for the operations requested |
|
34 by the client. |
|
35 */ |
|
36 class CUriListInterface : public CBase |
|
37 { |
|
38 public: |
|
39 |
|
40 static CUriListInterface* NewL (); |
|
41 ~CUriListInterface (); |
|
42 |
|
43 void AddUriL ( RReadStream& aUriStream, TInt& aUriId, TInt& aPropId ); |
|
44 void RemoveUriL ( TInt aUriId, TInt aPropId ); |
|
45 void UpdateUriL ( TInt aUriId, InetUriList::TListType aListType, const TDesC8& aFavouriteName ); |
|
46 |
|
47 TInt CountUriL ( InetUriList::TServiceType aServiceType, InetUriList::TListType aListType ); |
|
48 |
|
49 InetUriList::TListType GetListTypeL ( const TDesC8& aUri, InetUriList::TServiceType aSt ); |
|
50 |
|
51 CUriQueryFilter* QueryL ( const TQueryArgs& aQueryArgs ); |
|
52 CUriQueryFilter* QueryWithUriL ( const TDesC8& aUri, const TQueryArgs& aQueryArgs ); |
|
53 |
|
54 InetUriList::TListType GetHostTypeL ( const TDesC8& aUri ); |
|
55 |
|
56 HBufC8* QueryTldInfoL(const TDesC8& aUri, const TPolicyQueryArgs& aQueryArgs ); |
|
57 |
|
58 TInt PolicyDataLengthL ( const TDesC8& aUri, const TPolicyQueryArgs& aQueryArgs ); |
|
59 |
|
60 void InsertL ( CInetUriImpl& aInetUri ); |
|
61 void InsertTldPolicyDataL ( CTldProperties& aTldPolicydata ); |
|
62 |
|
63 private: |
|
64 CUriListInterface (); |
|
65 void ConstructL (); |
|
66 |
|
67 TInt UpdateL ( const TDesC8& aSchemaName, TInt aUriId, InetUriList::TListType aListType, const TDesC8& aFavouriteName ); |
|
68 void DeleteL ( const TDesC8& aSchemaName, TInt aFieldPos, TInt aId ); |
|
69 |
|
70 HBufC8* ExtractHostL( const TDesC8& aUri ); |
|
71 HBufC8* ExtractTldL( const TDesC8& aUri ); |
|
72 const TDesC8& DoNormalisationLC ( const TDesC8& aUri ); |
|
73 |
|
74 TBool CheckDependencyL ( TInt aId ); |
|
75 TBool FileExist(const TDesC& aFilePath); |
|
76 TBool IsDuplicateEntryL ( const CTldProperties& aTldProps ); |
|
77 |
|
78 TInt InsertIntoUriTblL ( const TUriC8& aUri, TInt& aUriId ); |
|
79 TInt InsertIntoUriPropsTblL ( TInt aUriId, const CInetUriProperties& aUriProps, TInt& aPropId ); |
|
80 TInt InsertIntoViewL ( const CInetUriImpl& aInetUri ); |
|
81 TInt InsertIntoTldTblL ( const CTldProperties& aTldProps ); |
|
82 |
|
83 TInt GetMaxIdValueL ( const TDesC8& aTblName, const TDesC8& aFieldName ); |
|
84 |
|
85 MDBTransaction* DoSearchExactUriLC ( const TUriC8& aUri, TInt aServiceType, TInt aListType = KErrNotFound ); |
|
86 MDBTransaction* DoSearchUriPathLC ( const TUriC8& aUri, InetUriList::TURIMatch aMatch, TInt aServiceType, TInt aListType = KErrNotFound ); |
|
87 MDBTransaction* DoSearchUriDomainLC ( const TUriC8& aUri, TInt aServiceType, TInt aListType = KErrNotFound ); |
|
88 |
|
89 CUriQueryFilter* QueryWithTldL ( const TDesC8& aUri,const TPolicyQueryArgs& aQueryArgs ); |
|
90 CUriQueryFilter* DoQueryWithTldL ( const TDesC8& aUri, const TPolicyQueryArgs& aQueryArgs ); |
|
91 |
|
92 static void DestroyTransObj ( TAny* aPtr ); |
|
93 static void RollbackTrans ( TAny* aPtr ); |
|
94 |
|
95 const TDesC8& GetFieldName ( TInt aTableIndex ); |
|
96 void GetInstalledDirectoryL( const TUid aUid, const TDesC& aFile, TDes& aFilePath ); |
|
97 |
|
98 void InitViewQueryLC ( RBuf8& aBuf ); |
|
99 void InitTldQueryLC ( RBuf8& aBuf ); |
|
100 void AppendFieldName ( RBuf8& aBuf, TInt aTableIndex, const TUriC8& aUri, TUriComponent aComponent ); |
|
101 void BindTextL ( MDBTransaction& aDbTrans, TInt aBindPos, const TUriC8& aUri, TUriComponent aComponent ); |
|
102 |
|
103 TBool IsWhiteListedUriL( const TDesC8& aUri ); |
|
104 TBool IsBlackListedUriL( const TDesC8& aUri ); |
|
105 TBool IsBlackListedHost( const TDesC8& aHost, RArray<TChar>& aList ); |
|
106 TBool IsNextCharInList(TChar aChar, RArray<TChar>& aPolicyList); |
|
107 TBool IsWhiteListedHostL( const TDesC8& aHost, RArray<TChar>& aPolicyList ); |
|
108 void StringToCharListL(const TDesC8& aString, RArray<TChar>& aList, TChar aSeparator = '.'); |
|
109 void TokenizeStringL(const TDesC8& aString, RArray<TChar>& aList, TChar aSeparator = ' '); |
|
110 |
|
111 void InitializeDatabaseL (); |
|
112 void InitializePolicyDatabaseL (); |
|
113 void UpgradePolicyDatabaseL(); |
|
114 |
|
115 private: |
|
116 MDBAccessor* iDbAccessor; |
|
117 RStringPool iStringPool; |
|
118 }; |
|
119 |
|
120 #endif // __URILISTINTERFACE_H__ |