1 /* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18 #ifndef PVMF_CPMPLUGIN_CONTENTMANAGEMENT_INTERFACE_H_INCLUDED 19 #define PVMF_CPMPLUGIN_CONTENTMANAGEMENT_INTERFACE_H_INCLUDED 20 21 #ifndef OSCL_BASE_H_INCLUDED 22 #include "oscl_base.h" 23 #endif 24 #ifndef OSCL_TYPES_H_INCLUDED 25 #include "oscl_types.h" 26 #endif 27 #ifndef OSCL_VECTOR_H_INCLUDED 28 #include "oscl_vector.h" 29 #endif 30 #ifndef OSCL_STRING_H_INCLUDED 31 #include "oscl_string.h" 32 #endif 33 #ifndef PV_UUID_H_INCLUDED 34 #include "pv_uuid.h" 35 #endif 36 #ifndef PV_INTERFACE_H_INCLUDED 37 #include "pv_interface.h" 38 #endif 39 40 #define PVMF_CPMPLUGIN_CONTENTMANAGEMENT_INTERFACE_MIMETYPE "pvxxx/pvmf/cpm/plugin/contentmanagement_interface" 41 #define PVMFCPMPluginContentManagementInterfaceUuid PVUuid(0x8cf5b9d3, 0x14f9, 0x4ae0, 0xba, 0x46, 0x5c, 0xd7, 0xab, 0x4a, 0xfb, 0x48) 42 43 #define PVMF_CONTENT_ENTRY_ATTRIB_UNDEFINED 0xFFFFFFFF 44 #define PVMF_CONTENT_ENTRY_ATTRIB_NORMAL 0x00 45 #define PVMF_CONTENT_ENTRY_ATTRIB_RDONLY 0x01 46 #define PVMF_CONTENT_ENTRY_ATTRIB_HIDDEN 0x02 47 #define PVMF_CONTENT_ENTRY_ATTRIB_SYSTEM 0x04 48 #define PVMF_CONTENT_ENTRY_ATTRIB_DIRENTRY 0x10 49 #define PVMF_CONTENT_ENTRY_ATTRIB_ARCHIVE 0x20 50 51 class PVMFContentEntryProperties 52 { 53 public: 54 PVMFContentEntryProperties() 55 { 56 iIsWChar = false; 57 iEntrySizeOnDisk = 0; 58 iEntryAttributes = PVMF_CONTENT_ENTRY_ATTRIB_UNDEFINED; 59 }; 60 61 PVMFContentEntryProperties(const PVMFContentEntryProperties& a) 62 { 63 iShortEntryName = a.iShortEntryName; 64 iLongEntryName = a.iLongEntryName; 65 iModificationDateTime = a.iModificationDateTime; 66 iEntrySizeOnDisk = a.iEntrySizeOnDisk; 67 iEntryAttributes = a.iEntryAttributes; 68 iIsWChar = a.iIsWChar; 69 }; 70 71 virtual ~PVMFContentEntryProperties() 72 { 73 }; 74 75 PVMFContentEntryProperties& operator=(const PVMFContentEntryProperties& a) 76 { 77 if (&a != this) 78 { 79 iShortEntryName = a.iShortEntryName; 80 iLongEntryName = a.iLongEntryName; 81 iModificationDateTime = a.iModificationDateTime; 82 iEntrySizeOnDisk = a.iEntrySizeOnDisk; 83 iEntryAttributes = a.iEntryAttributes; 84 iIsWChar = a.iIsWChar; 85 } 86 return *this; 87 }; 88 89 void SetWideCharMode() 90 { 91 iIsWChar = true; 92 } 93 94 bool IsWideChar() 95 { 96 return iIsWChar; 97 } 98 99 /* Indicates if wide char or reg char strings are in use */ 100 bool iIsWChar; 101 /* Just the entry name with extension */ 102 OSCL_wHeapString<OsclMemAllocator> iShortEntryNameW; 103 OSCL_HeapString<OsclMemAllocator> iShortEntryName; 104 /* Complete path of the entry from the root drive */ 105 OSCL_wHeapString<OsclMemAllocator> iLongEntryNameW; 106 OSCL_HeapString<OsclMemAllocator> iLongEntryName; 107 /* Entry Modification date and time in ISO 8601 format */ 108 OSCL_wHeapString<OsclMemAllocator> iModificationDateTimeW; 109 OSCL_HeapString<OsclMemAllocator> iModificationDateTime; 110 /* Entry size on disk - if entry is a file it would be the file size */ 111 uint32 iEntrySizeOnDisk; 112 /* Entry attributes - viz. read only, directory etc */ 113 uint32 iEntryAttributes; 114 }; 115 116 /** 117 * Content Management interface for all Content Policy Manager Plugins 118 */ 119 class PVMFCPMPluginContentManagementInterface : public PVInterface 120 { 121 public: 122 /** 123 * Method to mount a partition 124 * 125 * @param [in] The assigned plugin session ID to use for this request 126 * @param [in] Null terminated unicode string containing the drive letter 127 * say, X:\\ 128 * @param [in] Null terminated unicode string containing the partition id 129 * - not required for public partitions 130 * 131 * @returns PVMFSuccess 132 * PVMFFailure - In case of errors 133 */ 134 virtual PVMFStatus MountPartition(PVMFSessionId aSessionId, 135 OSCL_wString& aDriveLetter, 136 OSCL_wString& aPartitionID) = 0; 137 138 /** 139 * Method to mount a partition 140 * 141 * @param [in] The assigned plugin session ID to use for this request 142 * @param [in] Null terminated string containing the drive letter 143 * say, X:\\ 144 * @param [in] Null terminated string containing the partition id 145 * - not required for public partitions 146 * 147 * @returns PVMFSuccess 148 * PVMFFailure - In case of errors 149 */ 150 virtual PVMFStatus MountPartition(PVMFSessionId aSessionId, 151 OSCL_String& aDriveLetter, 152 OSCL_String& aPartitionID) = 0; 153 154 /** 155 * Method to unmount a partition 156 * 157 * @param [in] The assigned plugin session ID to use for this request 158 * @param [in] Null terminated unicode string containing the drive letter 159 * say, X:\\ 160 * 161 * @returns PVMFSuccess 162 * PVMFFailure - In case of errors 163 */ 164 virtual PVMFStatus UnMountPartition(PVMFSessionId aSessionId, 165 OSCL_wString& aDriveLetter) = 0; 166 167 /** 168 * Method to unmount a partition 169 * 170 * @param [in] The assigned plugin session ID to use for this request 171 * @param [in] Null terminated string containing the drive letter 172 * say, X:\\ 173 * 174 * @returns PVMFSuccess 175 * PVMFFailure - In case of errors 176 */ 177 virtual PVMFStatus UnMountPartition(PVMFSessionId aSessionId, 178 OSCL_String& aDriveLetter) = 0; 179 180 /** 181 * Method to get the current directory in a drive 182 * 183 * @param [in] The assigned plugin session ID to use for this request 184 * @param [in] Null terminated unicode string containing the drive letter 185 * say, X:\\ 186 * @param [out] Path name of the current working directory, say 187 * X:\\My Content 188 * 189 * @returns PVMFSuccess 190 * PVMFFailure - In case of errors 191 */ 192 virtual PVMFStatus GetCurrentDirectory(PVMFSessionId aSessionId, 193 OSCL_wString& aDriveLetter, 194 OSCL_wString& aPath) = 0; 195 196 /** 197 * Method to get the current directory in a drive 198 * 199 * @param [in] The assigned plugin session ID to use for this request 200 * @param [in] Null terminated string containing the drive letter 201 * say, X:\\ 202 * @param [out] Path name of the current working directory, say 203 * X:\\My Content 204 * 205 * @returns PVMFSuccess 206 * PVMFFailure - In case of errors 207 */ 208 virtual PVMFStatus GetCurrentDirectory(PVMFSessionId aSessionId, 209 OSCL_String& aDriveLetter, 210 OSCL_String& aPath) = 0; 211 212 /** 213 * Method to set current directory 214 * 215 * @param [in] The assigned plugin session ID to use for this request 216 * @param [in] Null terminated unicode string containing the path 217 * including the drive letter say, X:\\My Audios\\Album1 218 * 219 * @returns PVMFSuccess 220 * PVMFFailure - In case of errors 221 */ 222 virtual PVMFStatus SetCurrentDirectory(PVMFSessionId aSessionId, 223 OSCL_wString& aPath) = 0; 224 225 /** 226 * Method to set current directory 227 * 228 * @param [in] The assigned plugin session ID to use for this request 229 * @param [in] Null terminated string containing the path 230 * including the drive letter say, X:\\My Audios\\Album1 231 * 232 * @returns PVMFSuccess 233 * PVMFFailure - In case of errors 234 */ 235 virtual PVMFStatus SetCurrentDirectory(PVMFSessionId aSessionId, 236 OSCL_String& aPath) = 0; 237 238 /** 239 * Method to get a listing of all the entries that match a pattern 240 * within a path 241 * 242 * @param aSessionId The assigned plugin session ID to use for this request 243 * @param aPath[in] Unicode string containing the path, say 244 * X:\\My Videos 245 * @param aPatternList[in] List containing search pattern for entries, say *.3gp, *.wma etc 246 * @param aEntryList[out] List containing entry properties 247 * 248 * @returns PVMFSuccess 249 * PVMFFailure - In case of errors 250 */ 251 virtual PVMFStatus GetEntriesInPath(PVMFSessionId aSessionId, 252 OSCL_wString& aPath, 253 Oscl_Vector<OSCL_wHeapString<OsclMemAllocator>, OsclMemAllocator> aPatternList, 254 Oscl_Vector<PVMFContentEntryProperties, OsclMemAllocator>& aEntryList) = 0; 255 256 /** 257 * Method to get a listing of all the entries that match a pattern 258 * within a path 259 * 260 * @param aSessionId The assigned plugin session ID to use for this request 261 * @param aPath[in] string containing the path, say 262 * X:\\My Videos 263 * @param aPatternList[in] List containing search pattern for entries, say *.3gp, *.wma etc 264 * @param aEntryList[out] List containing entry properties 265 * 266 * @returns PVMFSuccess 267 * PVMFFailure - In case of errors 268 */ 269 virtual PVMFStatus GetEntriesInPath(PVMFSessionId aSessionId, 270 OSCL_String& aPath, 271 Oscl_Vector<OSCL_HeapString<OsclMemAllocator>, OsclMemAllocator> aPatternList, 272 Oscl_Vector<PVMFContentEntryProperties, OsclMemAllocator>& aEntryList) = 0; 273 274 /** 275 * Method to rename a directory or file 276 * 277 * @param aSessionId The assigned plugin session ID to use for this request 278 * @param aOldPath Unicode string with current complete path 279 * @param aNewPath Unicode string with new complete path 280 * 281 * @returns PVMFSuccess 282 * PVMFFailure - In case of errors 283 */ 284 virtual PVMFStatus RenamePath(PVMFSessionId aSessionId, 285 OSCL_wString& aOldPath, 286 OSCL_wString& aNewPath) = 0; 287 288 /** 289 * Method to rename a directory or file 290 * 291 * @param aSessionId The assigned plugin session ID to use for this request 292 * @param aOldPath string with current complete path 293 * @param aNewPath string with new complete path 294 * 295 * @returns PVMFSuccess 296 * PVMFFailure - In case of errors 297 */ 298 virtual PVMFStatus RenamePath(PVMFSessionId aSessionId, 299 OSCL_String& aOldPath, 300 OSCL_String& aNewPath) = 0; 301 302 /** 303 * Method to create a directory 304 * 305 * @param aSessionId The assigned plugin session ID to use for this request 306 * @param aPath Unicode string with the complete path 307 * 308 * @returns PVMFSuccess 309 * PVMFFailure - In case of errors 310 */ 311 virtual PVMFStatus CreateDirectory(PVMFSessionId aSessionId, 312 OSCL_wString& aPath) = 0; 313 314 /** 315 * Method to create a directory 316 * 317 * @param aSessionId The assigned plugin session ID to use for this request 318 * @param aPath string with the complete path 319 * 320 * @returns PVMFSuccess 321 * PVMFFailure - In case of errors 322 */ 323 virtual PVMFStatus CreateDirectory(PVMFSessionId aSessionId, 324 OSCL_String& aPath) = 0; 325 326 /** 327 * Method to remove a directory 328 * 329 * @param aSessionId The assigned plugin session ID to use for this request 330 * @param aPath Unicode string with the complete path 331 * @param aRecursive For recursive removal 332 * 333 * @returns PVMFSuccess 334 * PVMFFailure - In case of errors 335 */ 336 virtual PVMFStatus DeleteDirectory(PVMFSessionId aSessionId, 337 OSCL_wString& aPath, 338 bool aRecursive) = 0; 339 340 /** 341 * Method to remove a directory 342 * 343 * @param aSessionId The assigned plugin session ID to use for this request 344 * @param aPath string with the complete path 345 * @param aRecursive For recursive removal 346 * 347 * @returns PVMFSuccess 348 * PVMFFailure - In case of errors 349 */ 350 virtual PVMFStatus DeleteDirectory(PVMFSessionId aSessionId, 351 OSCL_String& aPath, 352 bool aRecursive) = 0; 353 354 /** 355 * Method to remove a file 356 * 357 * @param aSessionId The assigned plugin session ID to use for this request 358 * @param aFileName Unicode string with the complete path 359 * 360 * @returns PVMFSuccess 361 * PVMFFailure - In case of errors 362 */ 363 virtual PVMFStatus DeleteFile(PVMFSessionId aSessionId, 364 OSCL_wString& aFileName) = 0; 365 366 /** 367 * Method to remove a file 368 * 369 * @param aSessionId The assigned plugin session ID to use for this request 370 * @param aFileName string with the complete path 371 * 372 * @returns PVMFSuccess 373 * PVMFFailure - In case of errors 374 */ 375 virtual PVMFStatus DeleteFile(PVMFSessionId aSessionId, 376 OSCL_String& aFileName) = 0; 377 378 379 /** 380 * Method to copy a file 381 * 382 * @param aSessionId The assigned plugin session ID to use for this request 383 * @param aSourceFileName unicode string with source file name, with complete path 384 * @param aTargetFileName unicode string with target file name, with complete path 385 * 386 * @returns PVMFSuccess 387 * PVMFFailure - In case of errors 388 */ 389 virtual PVMFStatus CopyFile(PVMFSessionId aSessionId, 390 OSCL_wString& aSourceFileName, 391 OSCL_wString& aTargetFileName) = 0; 392 393 /** 394 * Method to copy a file 395 * 396 * @param aSessionId The assigned plugin session ID to use for this request 397 * @param aSourceFileName string with source file name, with complete path 398 * @param aTargetFileName string with target file name, with complete path 399 * 400 * @returns PVMFSuccess 401 * PVMFFailure - In case of errors 402 */ 403 virtual PVMFStatus CopyFile(PVMFSessionId aSessionId, 404 OSCL_String& aSourceFileName, 405 OSCL_String& aTargetFileName) = 0; 406 407 virtual PVMFStatus IsFileProtected(PVMFSessionId aSessionId, 408 OSCL_wString& aFileName, 409 bool& aProtected) = 0; 410 411 virtual PVMFStatus IsFileProtected(PVMFSessionId aSessionId, 412 OSCL_String& aFileName, 413 bool& aProtected) = 0; 414 415 virtual PVMFStatus GetNumExportsLeft(PVMFSessionId aSessionId, 416 OSCL_wString& aFileName, 417 uint32& aNumExports) = 0; 418 419 virtual PVMFStatus GetNumExportsLeft(PVMFSessionId aSessionId, 420 OSCL_String& aFileName, 421 uint32& aNumExports) = 0; 422 }; 423 424 425 #endif //PVMF_CPMPLUGIN_CONTENTMANAGEMENT_INTERFACE_H_INCLUDED 426 427