|
1 /* |
|
2 * Copyright (c) 2002-2004 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: WebDAV plugin interface for RSFW |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CRSFWDAVACCESS_H |
|
20 #define CRSFWDAVACCESS_H |
|
21 |
|
22 // INCLUDES |
|
23 //#include <HttpErr.h> |
|
24 |
|
25 #include "rsfwremoteaccess.h" |
|
26 #include "rsfwdavsession.h" |
|
27 //#include "rsfwdavfileinfo.h" |
|
28 #include "rsfwconnectionmanager.h" |
|
29 |
|
30 // CONSTANTS |
|
31 const TInt KCommRetries = 3; |
|
32 |
|
33 // DATA TYPES |
|
34 enum TRemoteAccessOp |
|
35 { |
|
36 ERemoteAccessOpNone = 0, |
|
37 ERemoteAccessOpOpen, |
|
38 ERemoteAccessOpGetDirectory, |
|
39 ERemoteAccessOpGetDirectoryAttributes, |
|
40 ERemoteAccessOpGetFileAttributes, |
|
41 ERemoteAccessOpSetAttributes, |
|
42 ERemoteAccessOpGetFile, |
|
43 ERemoteAccessOpMakeDirectory, |
|
44 ERemoteAccessOpCreateFile, |
|
45 ERemoteAccessOpPutFile, |
|
46 ERemoteAccessOpDeleteDirectory, |
|
47 ERemoteAccessOpDeleteFile, |
|
48 ERemoteAccessOpRename, |
|
49 ERemoteAccessOpObtainLock, |
|
50 ERemoteAccessOpReleaseLock, |
|
51 ERemoteAccessOpRefreshLock |
|
52 }; |
|
53 |
|
54 // FORWARD DECLARATIONS |
|
55 class CRsfwDavAccessContext; |
|
56 //class CRsfwDirEnt; |
|
57 //class CRsfwDirEntAttr; |
|
58 |
|
59 // CLASS DECLARATION |
|
60 |
|
61 /** |
|
62 * WebDAV protocol plugin for Rsfw |
|
63 * |
|
64 * @lib davaccess.lib |
|
65 * @since Series 60 3.1 |
|
66 */ |
|
67 |
|
68 class CRsfwDavAccess: public CRsfwRemoteAccess, |
|
69 public MRsfwDavResponseObserver, |
|
70 public MRsfwConnectionObserver |
|
71 { |
|
72 public: // Constructors and destructor |
|
73 /** |
|
74 * Two-phased constructor. |
|
75 */ |
|
76 static CRsfwDavAccess* NewL(); |
|
77 |
|
78 /** |
|
79 * Destructor. |
|
80 */ |
|
81 virtual ~CRsfwDavAccess(); |
|
82 |
|
83 public: // New functions |
|
84 |
|
85 /** |
|
86 Return information about the given object |
|
87 @param aPath path of the object |
|
88 @return file information |
|
89 */ |
|
90 CRsfwDavFileInfo* DavFileInfoL(const TDesC& aPath); |
|
91 |
|
92 /** |
|
93 Add information about the given object |
|
94 @param aDavFileInfo information about the object |
|
95 */ |
|
96 void AddDavFileInfo(CRsfwDavFileInfo* aDavFileInfo); |
|
97 |
|
98 /** |
|
99 Remove all information about the given object |
|
100 @param aPath path of the object |
|
101 @return file information |
|
102 */ |
|
103 void RemoveDavFileInfoL(const TDesC& aPath); |
|
104 |
|
105 /** |
|
106 Return the WebDAV session object |
|
107 @return WebDAV session |
|
108 */ |
|
109 inline CRsfwDavSession* WebDavSession() { return iWebDavSession; }; |
|
110 |
|
111 /** |
|
112 Return next access context id |
|
113 @return id |
|
114 */ |
|
115 inline TUint GetNextAccessContextId() { return ++iCurrentDavContextId; }; |
|
116 |
|
117 public: // Functions from base classes |
|
118 // From CRsfwRemoteAccess |
|
119 void SetupL(MRsfwRemoteAccessObserver* aRsfwRemoteAccessObserver); |
|
120 |
|
121 /* In this plug-in aAuxData is the access point |
|
122 special values for IAP selection |
|
123 DefaultPreferences = * |
|
124 AskUser = ? |
|
125 */ |
|
126 TUint OpenL(const TUriC& aUri, |
|
127 const TDesC& aFriendlyName, |
|
128 const TDesC& aUserName, |
|
129 const TDesC& aPassword, |
|
130 const TDesC& aAuxData, |
|
131 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
132 |
|
133 TUint GetDirectoryL(const TDesC& aPathName, |
|
134 RPointerArray<CRsfwDirEnt>& aDirEnts, |
|
135 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
136 |
|
137 TUint GetDirectoryAttributesL( |
|
138 const TDesC& aPathName, |
|
139 CRsfwDirEntAttr*& aAttr, |
|
140 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
141 |
|
142 TUint GetFileAttributesL(const TDesC& aPathName, |
|
143 CRsfwDirEntAttr*& aAttr, |
|
144 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
145 |
|
146 TUint SetAttributesL(const TDesC& aPathName, |
|
147 CRsfwDirEntAttr& aAttr, |
|
148 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
149 |
|
150 TUint GetFileL(const TDesC& aRemotePathName, |
|
151 const TDesC& aLocalPathName, |
|
152 TInt aOffset, |
|
153 TInt* aLength, |
|
154 TUint aFlags, |
|
155 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
156 |
|
157 TUint PutFileL(const TDesC& aLocalPathName, |
|
158 const TDesC& aRemotePathName, |
|
159 const TDesC8& aMimeType, |
|
160 TInt aOffset, |
|
161 TInt aLength, |
|
162 TInt aTotalLength, |
|
163 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
164 |
|
165 TUint PutFileL(const TDesC& aLocalPathName, |
|
166 const TDesC& aRemotePathName, |
|
167 const TDesC8& aMimeType, |
|
168 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
169 |
|
170 TUint CreateFileL(const TDesC& aPathName, |
|
171 TBool aIsOverwriting, |
|
172 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
173 |
|
174 TUint MakeDirectoryL(const TDesC& aPathName, |
|
175 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
176 |
|
177 TUint DeleteDirectoryL(const TDesC& aPathName, |
|
178 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
179 |
|
180 TUint DeleteFileL(const TDesC& aPathName, |
|
181 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
182 |
|
183 TUint RenameL(const TDesC& aSrcPathName, |
|
184 const TDesC& aDstPathName, |
|
185 TBool aOverwrite, |
|
186 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
187 |
|
188 TUint ObtainLockL(const TDesC& aPathName, |
|
189 TUint aLockFlags, |
|
190 TUint& aTimeout, |
|
191 TDesC8*& aLockToken, |
|
192 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
193 |
|
194 TUint ReleaseLockL(const TDesC& aPathName, |
|
195 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
196 |
|
197 TUint RefreshLockL(const TDesC& aPathName, |
|
198 TUint& aTimeout, |
|
199 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
200 |
|
201 void Cancel(TUint aId); |
|
202 |
|
203 void Cancel(TDesC& aTargetPath); |
|
204 |
|
205 TInt SetLockToken(const TDesC& aPathName, const TDesC8& aLockToken); |
|
206 |
|
207 // From MRsfwDavResponseObserver |
|
208 void RequestCompleteL(TUint aWebDavTransactionId); |
|
209 void RequestError(TUint aWebDavTransactionId, TInt aStatus); |
|
210 |
|
211 // From MRsfwConnectionObserver |
|
212 void HandleConnectionEventL(TInt aConnectionEvent, TAny* aArg); |
|
213 |
|
214 private: |
|
215 void ConstructL(); |
|
216 TUint AddAccessContext(CRsfwDavAccessContext* aDavAccessContext); |
|
217 TInt LookupAccessContextByTransactionId(TUint aWebDavTransactionId); |
|
218 TInt LookupAccessContextByContextId(TUint aId); |
|
219 TInt LookupAccessContextByPath(TDesC& aTargetPath); |
|
220 TInt DavFileInfoIndexL(const TDesC& aPath); |
|
221 TUint OptionsL(MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
222 void SetLockTokenL(const TDesC& aPathName, const TDesC8& aLockToken); |
|
223 |
|
224 private: // Data |
|
225 TBuf<KMaxPath> iRootDirectory; |
|
226 CRsfwDavSession* iWebDavSession; |
|
227 RPointerArray<CRsfwDavFileInfo> iDavFileInfos; |
|
228 RPointerArray<CRsfwDavAccessContext> iDavAccessContexts; |
|
229 TUint iCurrentDavContextId; |
|
230 MRsfwRemoteAccessObserver* iRsfwRemoteAccessObserver; |
|
231 }; |
|
232 |
|
233 #endif // CRSFWDAVACCESS_H |
|
234 |
|
235 // End of File |