|
1 /** @file |
|
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: UPnP plugin interface for RSFW |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CUPNPACCESS_H |
|
20 #define C_CUPNPACCESS_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <rsfwremoteaccess.h> |
|
24 #include "upnpavcpenginerfsclient.h" |
|
25 |
|
26 // CLASS DECLARATION |
|
27 |
|
28 /** |
|
29 * UPnP plugin for Rsfw. |
|
30 * It enables mounting MS as new filesystem. |
|
31 * |
|
32 * @lib upnpaccess.lib |
|
33 * @since Series 60 3.1 |
|
34 */ |
|
35 class CUpnpAccess: public CRsfwRemoteAccess |
|
36 { |
|
37 public: // Constructors and destructor |
|
38 /** |
|
39 * Two-phased constructor. |
|
40 */ |
|
41 static CUpnpAccess* NewL(); |
|
42 |
|
43 /** |
|
44 * Destructor. |
|
45 */ |
|
46 virtual ~CUpnpAccess(); |
|
47 /** |
|
48 * Set up parameters for operation. |
|
49 * @param aRsfwRemoteAccessObserver MRsfwRemoteAccessObserver for receiving |
|
50 * asynchronous events from the accessor plugin, |
|
51 * e.g. changes in connectivity. |
|
52 * This parameter may be NULL |
|
53 * NOTICE: this function is not supported by UPnP access plugin |
|
54 */ |
|
55 void SetupL(MRsfwRemoteAccessObserver* /* aRsfwRemoteAccessObserver */); |
|
56 |
|
57 /** |
|
58 * Opens a connection to the server given by aServerName parameter. |
|
59 * For UPnPAccess only serve has to be defined and |
|
60 * value should be equal to UDN of MS |
|
61 * So format URI for mounting has to be: |
|
62 * upnp://UDN |
|
63 * |
|
64 * @param aUri URI of the remote repository. |
|
65 * The URI must not contain authority part (user name/password) |
|
66 * @param aFriendlyName server friendly name for access control dialog |
|
67 * (can be empty) |
|
68 * @param aUserName user name for access control (can be empty) |
|
69 * @param aPassword password for access control (can be empty) |
|
70 * @param aAuxData auxiliary parameters for connection setup (eg IAP info) |
|
71 * @param aResponseHandler response handler |
|
72 * @return identifier of the created transaction |
|
73 */ |
|
74 TUint OpenL(const TUriC& aUri, |
|
75 const TDesC& aFriendlyName, |
|
76 const TDesC& aUserName, |
|
77 const TDesC& aPassword, |
|
78 const TDesC& aAuxData, |
|
79 MRsfwRemoteAccessResponseHandler* aResponseHandler) ; |
|
80 |
|
81 /** |
|
82 * Gets contents of the directory given by aPathName parameter. |
|
83 * |
|
84 * @param aPathName path name of the directory |
|
85 * @param aDirentsp an array of directory entries to be filled. |
|
86 * @param aResponseHandler response handler |
|
87 * @return identifier of the created transaction |
|
88 */ |
|
89 TUint GetDirectoryL(const TDesC& aPathName, |
|
90 RPointerArray<CRsfwDirEnt>& aDirEnts, |
|
91 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
92 |
|
93 /** |
|
94 * Gets attributes of the directory given by aPathName parameter. |
|
95 * This function may also be called if the type of the object is |
|
96 * not yet known (e.g., the object could be a file). |
|
97 * |
|
98 * @param aPathName path name of the directory |
|
99 * @param aAttr attribute structure to be filled |
|
100 * @param aResponseHandler response handler |
|
101 * @return identifier of the created transaction |
|
102 */ |
|
103 TUint GetDirectoryAttributesL( |
|
104 const TDesC& aPathName, |
|
105 CRsfwDirEntAttr*& aAttr, |
|
106 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
107 /** |
|
108 * Gets attributes of the file given by aPathName parameter. |
|
109 * |
|
110 * @param aPathName path name of the file |
|
111 * @param aAttr attribute structure to be filled |
|
112 * @param aResponseHandler response handler |
|
113 * @return identifier of the created transaction |
|
114 */ |
|
115 TUint GetFileAttributesL(const TDesC& aPathName, CRsfwDirEntAttr*& aAttr, |
|
116 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
117 /** |
|
118 * Sets attributes of the file or directory given by aPathName parameter. |
|
119 * This function is typically only used for files and even then |
|
120 * the implementation may do nothing since standard file attributes |
|
121 * are implied by the contents of the file or set in conjunction with |
|
122 * other operations on the file system object. |
|
123 * NOTICE: this function is not supported by UPnP access plugin |
|
124 * |
|
125 * @param aPathName path name of the file or directory |
|
126 * @param aAttr attribute structure |
|
127 * @param aResponseHandler response handler |
|
128 * @return identifier of the created transaction |
|
129 */ |
|
130 TUint SetAttributesL(const TDesC& aPathName, |
|
131 CRsfwDirEntAttr& aAttr, |
|
132 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
133 /** |
|
134 * Gets a remote file and copies it to a local file. |
|
135 * Note that byte ranges are not be implemented by all |
|
136 * file access protocols. |
|
137 * |
|
138 * @param aRemotePathName path name of the remote file |
|
139 * @param aLocalPathName path name of the local file |
|
140 * @param aOffset offset of the first byte to be accessed |
|
141 * @param aLength length of data to be accessed/was accessed (NULL/0=all) |
|
142 * @param aFlags operation qualifier. |
|
143 * The following flags have been defined: |
|
144 * KRemoteAccessOptionGetToStartOfFile: even if an offset is specified |
|
145 * the fetched data is still put at the beginning of the local file. |
|
146 * @param aResponseHandler response handler |
|
147 * @return identifier of the created transaction |
|
148 */ |
|
149 TUint GetFileL(const TDesC& aRemotePathName, |
|
150 const TDesC& aLocalPathName, |
|
151 TInt aOffset, |
|
152 TInt* aLength, |
|
153 TUint aFlags, |
|
154 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
155 /** |
|
156 * Puts a file to the server. |
|
157 * NOTICE: this function is not supported by UPnP access plugin |
|
158 * |
|
159 * @param aLocalPathName path name of the local file |
|
160 * @param aRemotePathName path name of the remote file |
|
161 * @param aMimeType MIME-type of the file |
|
162 * (will be put to Content-Type, e.g. text/plain or |
|
163 * application/octet-stream) |
|
164 * @param aOffset offset of the first byte to be accessed |
|
165 * @param aLength length of data to be accessed (NULL/0=all) |
|
166 * @param aTotalLength total length of the file |
|
167 * @param aResponseHandler response handler |
|
168 * @return identifier of the created transaction |
|
169 */ |
|
170 TUint PutFileL(const TDesC& aLocalPathName, |
|
171 const TDesC& aRemotePathName, |
|
172 const TDesC8& aMimeType, |
|
173 TInt aOffset, |
|
174 TInt aLength, |
|
175 TInt aTotalLength, |
|
176 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
177 /** |
|
178 * Puts a file to the server. |
|
179 * |
|
180 * @param aLocalPathName path name of the local file |
|
181 * @param aRemotePathName path name of the remote file |
|
182 * @param aMimeType MIME-type of the file (will be put to Content-Type, |
|
183 * e.g. text/plain or application/octet-stream) |
|
184 * @param aResponseHandler response handler |
|
185 * @return identifier of the created transaction |
|
186 */ |
|
187 TUint PutFileL(const TDesC& aLocalPathName, |
|
188 const TDesC& aRemotePathName, |
|
189 const TDesC8& aMimeType, |
|
190 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
191 /** |
|
192 * Creates an empty file on the remote server |
|
193 * |
|
194 * @param aPathName path name of the new file |
|
195 * @param aOverWriting whether we are overwriting an existing file |
|
196 * @param aResponseHandler response handler |
|
197 * @return identifier of the created transaction |
|
198 */ |
|
199 TUint CreateFileL(const TDesC& aPathName, TBool aOverWriting, |
|
200 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
201 /** |
|
202 * Makes a directory. |
|
203 * |
|
204 * @param aPathName path name of the new directory |
|
205 * @param aResponseHandler response handler |
|
206 * @return identifier of the created transaction |
|
207 */ |
|
208 TUint MakeDirectoryL(const TDesC& aPathName, |
|
209 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
210 /** |
|
211 * Deletes a directory. |
|
212 * |
|
213 * @param aPathName path name of the directory to be deleted |
|
214 * @param aResponseHandler response handler |
|
215 * @return identifier of the created transaction |
|
216 */ |
|
217 TUint DeleteDirectoryL(const TDesC& aPathName, |
|
218 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
219 /** |
|
220 * Deletes a file. |
|
221 * |
|
222 * @param aPathName path name of the file to be deleted |
|
223 * @param aResponseHandler response handler |
|
224 * @return identifier of the created transaction |
|
225 */ |
|
226 TUint DeleteFileL(const TDesC& aPathName, |
|
227 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
228 /** |
|
229 * Renames a file or a directory. |
|
230 * (may involve movement to another directory). |
|
231 * NOTICE: this function is not supported by UPnP access plugin |
|
232 * |
|
233 * @param aSrcPathName path name of the object to be renamed |
|
234 * @param aDstPathName new path name of the object |
|
235 * @param aOverwrite allow overwriting an existing object |
|
236 * @param aResponseHandler response handler |
|
237 * @return identifier of the created transaction |
|
238 */ |
|
239 TUint RenameL(const TDesC& aSrcPathName, |
|
240 const TDesC& aDstPathName, |
|
241 TBool aOverwrite, |
|
242 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
243 |
|
244 /** |
|
245 * Obtains a lock for the given file system object |
|
246 * NOTICE: this function is not supported by UPnP access plugin |
|
247 * |
|
248 * @param aPathName path name of the object to be locked |
|
249 * @param aLockFlags indicates whether a write or read lock is requested |
|
250 * @param aTimeout the timeout that is requested and granted |
|
251 * @param aLockToken lock token |
|
252 * @param aResponseHandler response handler |
|
253 * @return identifier of the created transaction |
|
254 */ |
|
255 TUint ObtainLockL(const TDesC& aPathName, |
|
256 TUint aLockFlags, |
|
257 TUint& aTimeout, |
|
258 TDesC8*& aLockToken, |
|
259 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
260 /** |
|
261 * Releases the lock of the given file system object |
|
262 * NOTICE: this function is not supported by UPnP access plugin |
|
263 * |
|
264 * @param aPathName path name of the object to be locked |
|
265 * @param aResponseHandler response handler |
|
266 */ |
|
267 TUint ReleaseLockL(const TDesC& aPathName, |
|
268 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
269 /** |
|
270 * Refreshes the lock of the given file system object |
|
271 * NOTICE: this function is not supported by UPnP access plugin |
|
272 * |
|
273 * @param aPathName path name of the object to be locked |
|
274 * @param aTimeout the timeout that is requested and granted |
|
275 * @param aResponseHandler response handler |
|
276 * @return identifier of the created transaction |
|
277 */ |
|
278 TUint RefreshLockL(const TDesC& aPathName, |
|
279 TUint& aTimeout, |
|
280 MRsfwRemoteAccessResponseHandler* aResponseHandler); |
|
281 |
|
282 /** |
|
283 * Sets lock token for the a given resource |
|
284 * This lock token value replaces any previously cached token value |
|
285 * |
|
286 * @param aPathName path name |
|
287 * @param aLockToken lock token |
|
288 * @return error code |
|
289 */ |
|
290 TInt SetLockToken(const TDesC& aPathName, const TDesC8& aLockToken); |
|
291 |
|
292 /** |
|
293 * Cancels a transaction |
|
294 * Eventually the transaction will/should call HandleRemoteAccessResponseL |
|
295 * with status KErrCancel |
|
296 * NOTICE: this function is not supported by UPnP access plugin |
|
297 * |
|
298 * @param aId the identifier of the transaction to be canceled |
|
299 */ |
|
300 void Cancel(TUint aId); |
|
301 |
|
302 /** |
|
303 * Cancels a transaction |
|
304 * Eventually the transaction will/should call HandleRemoteAccessResponseL |
|
305 * with status KErrCancel |
|
306 * NOTICE: this function is not supported by UPnP access plugin |
|
307 * |
|
308 * @param aTargetPath the identifier of the transaction to be canceled |
|
309 */ |
|
310 void Cancel(TDesC& aTargetPath); |
|
311 |
|
312 private: |
|
313 /** |
|
314 * Symbian 2nd phase constructor. |
|
315 */ |
|
316 void ConstructL(); |
|
317 |
|
318 private: |
|
319 // UDN of MS |
|
320 HBufC8* iUUID; |
|
321 // client to target server |
|
322 RUpnpAVCPEngineRFSClient iAVCPEngineClient; |
|
323 }; |
|
324 |
|
325 #endif // C_CUPNPACCESS_H |
|
326 |
|
327 // End of File |