|
1 /* |
|
2 * Copyright (c) 2000 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: Implementation of policymanagement components |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __ACL_STORAGE_H__ |
|
20 #define __ACL_STORAGE_H__ |
|
21 |
|
22 // INCLUDES |
|
23 |
|
24 |
|
25 #include <e32base.h> |
|
26 #include <ssl.h> |
|
27 #include "DMUtilClientServer.h" |
|
28 |
|
29 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
30 #include <dmtree.h> |
|
31 #else |
|
32 #include <nsmldmmodule.h> //Private SyncML header |
|
33 #include <nsmldmtreedbclient.h> //Private SyncML header |
|
34 #endif |
|
35 |
|
36 |
|
37 // FORWARD DECLARATIONS |
|
38 class CNSmlDmDbHandler; |
|
39 |
|
40 |
|
41 |
|
42 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
43 class CChildInfo : public CBase |
|
44 #else |
|
45 class CChildInfo : public CBase, public MNSmlDmModuleCallBack |
|
46 #endif |
|
47 { |
|
48 public: |
|
49 |
|
50 typedef RArray<TPtrC8> RChildNodes; |
|
51 |
|
52 CChildInfo( RChildNodes& aNodes); |
|
53 ~CChildInfo(); |
|
54 |
|
55 TInt GetChildsL( const TDesC8& aURI); |
|
56 |
|
57 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
58 // nothing |
|
59 #else |
|
60 /** |
|
61 * Function for setting result in callback interface |
|
62 * @param aResultsRef Reference to result element |
|
63 * @param aObject Data |
|
64 * @param aType Mime type |
|
65 * @param aFormat Format of the object |
|
66 * @param aTotalSize Total size |
|
67 */ |
|
68 virtual void SetResultsL( TInt aResultsRef, |
|
69 const CBufBase& aObject, |
|
70 const TDesC8& aType, |
|
71 const TDesC8& aFormat, |
|
72 TInt aTotalSize ); |
|
73 |
|
74 /** |
|
75 * Function for setting status in callback interface |
|
76 * @param aStatusRef Reference to result element |
|
77 * @param aStatusCode Status of command |
|
78 */ |
|
79 virtual void SetStatusL( TInt aStatusRef, TInt aStatusCode ); |
|
80 #endif |
|
81 private: |
|
82 |
|
83 RChildNodes& iChilds; |
|
84 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
85 // nothing |
|
86 #else |
|
87 HBufC8* iBuffer; |
|
88 #endif |
|
89 TInt iErr; |
|
90 }; |
|
91 |
|
92 class CCommand : public CBase |
|
93 { |
|
94 public: |
|
95 static CCommand* NewL( const TCertInfo& aCertInfo, const TAclCommands& aCommand); |
|
96 static CCommand* NewL( const TDesC8& aServerUid, const TAclCommands& aCommand); |
|
97 |
|
98 void CommandString( TDes8& aStr); |
|
99 |
|
100 //save and load |
|
101 TInt Length(); |
|
102 HBufC8 * SaveStringL(); |
|
103 static CCommand * LoadFromStringL( TPtrC8& aString); |
|
104 public: |
|
105 TCertInfo iCertInfo; |
|
106 HBufC8* iServerId; |
|
107 TAclCommands iCommand; |
|
108 }; |
|
109 |
|
110 class CACLNode : public CBase |
|
111 { |
|
112 public: |
|
113 CACLNode(); |
|
114 ~CACLNode(); |
|
115 |
|
116 //URI handling |
|
117 void SetURIL( const TDesC8& aURI ); |
|
118 |
|
119 //ACL content handling |
|
120 void ClearACL(); |
|
121 void SetServerIdToACLL( const TAclCommands& aCommandType, const TDesC8& aServerId); |
|
122 void SetCertificateToACLL( const TACLDestination& aDestination, const TAclCommands& aCommandType, const TCertInfo& aCertInfo); |
|
123 |
|
124 //save and load |
|
125 TInt Length(); |
|
126 HBufC8 * SaveStringL(); |
|
127 static CACLNode * LoadFromStringL( TDes8& aString); |
|
128 |
|
129 //list functions |
|
130 static TInt CompareElements( CACLNode const& aNode1, CACLNode const& aNode2); |
|
131 CCommand* FindCorrespondingCommand( const CCommand* aCommand); |
|
132 |
|
133 //ACL factory, creates ACL from string |
|
134 static CACLNode * CreateACLL( const TDesC8& aACLString); |
|
135 HBufC8 * GetNodeACLStringL(); |
|
136 private: |
|
137 friend class CACLStorage; |
|
138 |
|
139 RPointerArray<CCommand> iCommands; |
|
140 |
|
141 TACLDestination iDestination; |
|
142 TBool iClearFlag; |
|
143 HBufC8* iURI; |
|
144 TPtrC8 iURIPtr; |
|
145 }; |
|
146 |
|
147 class CACLStorage : public CBase |
|
148 { |
|
149 public: |
|
150 //constructors |
|
151 CACLStorage(); |
|
152 ~CACLStorage(); |
|
153 |
|
154 static CACLStorage* NewL(); |
|
155 void ConstructL(); |
|
156 |
|
157 //save and load |
|
158 void SaveACLL(); |
|
159 void LoadACLL(); |
|
160 |
|
161 //API calls |
|
162 TCertInfo& MngSessionCertificate(); |
|
163 TInt RemoveACL( const TDesC8& aURI, TBool aRestoreDefaults); |
|
164 void AddACLForNodeL( const TDesC8& aURI, const TACLDestination& aDestination, const TAclCommands& aCommandType); |
|
165 void SetACLForNodeL( const TDesC8& aURI, const TACLDestination& aDestination, const TAclCommands& aCommandType); |
|
166 |
|
167 //Certificate handling |
|
168 void NewSessionL( const TCertInfo& aCertInfo, const TDesC8& aServerID); |
|
169 void CloseSession( ); |
|
170 TInt CertInfo( TCertInfo &aCertInfo ); |
|
171 HBufC8* ServerIDL(); |
|
172 private: |
|
173 void SetCertInfo( const TCertInfo &aCertInfo ); |
|
174 CACLNode * FindNodeL( const TDesC8& aURI, TBool aCreateNewIfDoesntExist); |
|
175 TInt RemoveNode( const TDesC8& aURI); |
|
176 |
|
177 void UpdateACLsL(); |
|
178 void UpdateACLL( const CACLNode *aACLNode); |
|
179 private: |
|
180 void UpdateACLL( const CACLNode *aACLNode, const TDesC8& aURI); |
|
181 |
|
182 RPointerArray<CACLNode> iNodes; |
|
183 |
|
184 TBool iCertificateReceived; |
|
185 TCertInfo iMngSessionCertificate; |
|
186 TCertInfo iCurrentCertificate; |
|
187 HBufC8* iCurrentServerId; |
|
188 |
|
189 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
190 // nothing |
|
191 #else |
|
192 RNSmlDMCallbackSession iDbSession; |
|
193 #endif |
|
194 }; |
|
195 |
|
196 #endif //__ACL_STORAGE_H__ |