The Sleuth Kit Framework  4.1
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
TskFileManager Class Referenceabstract

Responsible for managing TskFile objects in the system. More...

#include <TskFileManager.h>

Inheritance diagram for TskFileManager:
TskFileManagerImpl

Classes

class  AutoFilePtrList
 This nested class should be used to hold a FilePtrList object returned by methods such as findFilesByName() so that the file objects will be automatically freed. More...
 

Public Types

typedef TskFileFilePtr
 
typedef std::vector< FilePtrFilePtrList
 

Public Member Functions

virtual void addFile (const uint64_t fileId, std::istream &istr)=0
 Add a file to the system using the given file id and input stream. More...
 
virtual void addFile (const uint64_t fileId, std::wstring &filePath)=0
 Add a file to the system using the given file id and path. More...
 
virtual void copyDirectory (TskFile *directoryToCopy, const std::wstring &destinationPath, const bool bRecurse=false)=0
 Copy the contents of a directory to the given fully qualifed file path. More...
 
virtual void copyDirectory (uint64_t directoryIdToCopy, const std::wstring &destinationPath, const bool bRecurse=false)
 Copy the contents of a directory to the given fully qualifed file path. More...
 
virtual void copyFile (TskFile *fileToSave, const std::wstring &filePath)=0
 Copy the file to the given fully qualifed file path. More...
 
virtual void copyFile (const uint64_t fileId, const std::wstring &filePath)
 Copy the file to the given fully qualifed file path. More...
 
virtual void deleteFile (TskFile *fileToDelete)=0
 Delete the local copy of a file. More...
 
virtual void deleteFile (const uint64_t fileId)
 Delete the local copy of a file. More...
 
virtual FilePtrList findFilesByExtension (const std::vector< std::string > &extensions)=0
 Return a list of any TskFile objects matching the given filename extension. More...
 
virtual FilePtrList findFilesByFsFileType (TSK_FS_META_TYPE_ENUM fsFileType)=0
 Return a list of any TskFile objects that match the given file meta type. More...
 
virtual FilePtrList findFilesByName (const std::string &name, const TSK_FS_META_TYPE_ENUM fsFileType=TSK_FS_META_TYPE_UNDEF)=0
 Return a list of any TskFile objects matching the given filename. More...
 
virtual FilePtrList findFilesByParent (const uint64_t parentFileId)=0
 Return a list of any TskFile objects that are children of the given file id. More...
 
virtual FilePtrList findFilesByPattern (const std::string &namePattern, const std::string &pathPattern)=0
 Return a list of any TskFile objects that match the given file and path patterns. More...
 
virtual TskFilegetFile (const uint64_t fileId)=0
 Return a TskFile object for a given file ID. More...
 
virtual FilePtrList getFiles (const std::vector< uint64_t > &fileIds)=0
 Return a list of TskFile objects mapped to the given list of file ids. More...
 
virtual std::wstring getPath (const uint64_t fileId)=0
 Return the fully qualified path to where the local instance of the file with the given ID should exist. More...
 
virtual void saveFile (TskFile *fileToSave)=0
 Save the file to the default location. More...
 
virtual void saveFile (const uint64_t fileId)
 Save the file to the default location. More...
 

Protected Member Functions

 TskFileManager ()
 Default Constructor.
 
 TskFileManager (TskFileManager const &)
 Copy Constructor.
 
virtual ~TskFileManager ()
 Destructor.
 

Detailed Description

Responsible for managing TskFile objects in the system.

Member Function Documentation

virtual void TskFileManager::addFile ( const uint64_t  fileId,
std::istream &  istr 
)
pure virtual

Add a file to the system using the given file id and input stream.

This method saves a local copy of the content contained in the input stream.

Parameters
fileIdID of the new file.
istrInput stream containing the file content to save.
Exceptions
TskFileExceptionif a file with the given fileId already exists or if an error is encountered while saving the input stream.

Implemented in TskFileManagerImpl.

virtual void TskFileManager::addFile ( const uint64_t  fileId,
std::wstring &  filePath 
)
pure virtual

Add a file to the system using the given file id and path.

This method saves a local copy of the file given in the path.

Parameters
fileIdID of the new file.
filePathThe path of the file to save.
Exceptions
TskFileExceptionif a file with the given fileId already exists, the file specified in filePath does not exist or an error is encountered while saving the file.

Implemented in TskFileManagerImpl.

virtual void TskFileManager::copyDirectory ( TskFile directoryToCopy,
const std::wstring &  destinationPath,
const bool  bRecurse = false 
)
pure virtual

Copy the contents of a directory to the given fully qualifed file path.

Directories along the path will be created if they do not exist. If the destination directory exists it will be replaced. Defaults to a non-recursive copy.

Parameters
directoryToCopyThe TskFile object representing the directory to copy.
destinationPathThe path to save directory contents to, including the directory name.
bRecurseWhether to recursively copy directory contents.
Exceptions
variousexceptions on errors

Implemented in TskFileManagerImpl.

virtual void TskFileManager::copyDirectory ( uint64_t  directoryIdToCopy,
const std::wstring &  destinationPath,
const bool  bRecurse = false 
)
inlinevirtual

Copy the contents of a directory to the given fully qualifed file path.

Directories along the path will be created if they do not exist. If the destination directory exists it will be replaced. Defaults to a non-recursive copy.

Parameters
directoryIdToCopyThe id representing the directory to copy.
destinationPathThe path to save directory contents to, including the directory name.
bRecurseWhether to recursively copy directory contents.
Exceptions
variousexceptions on errors
virtual void TskFileManager::copyFile ( TskFile fileToSave,
const std::wstring &  filePath 
)
pure virtual

Copy the file to the given fully qualifed file path.

Directories along the path will be created if they do not exist. If the destination file exists it will be replaced.

Parameters
fileToSaveThe file to save.
filePathThe path to save to, including the file name.
Exceptions
variousexceptions on errors

Implemented in TskFileManagerImpl.

virtual void TskFileManager::copyFile ( const uint64_t  fileId,
const std::wstring &  filePath 
)
inlinevirtual

Copy the file to the given fully qualifed file path.

Directories along the path will be created if they do not exist. If the destination file exists it will be replaced.

Parameters
fileIdID of the file to save.
filePathThe path to save to, including the file name.
Exceptions
variousexceptions on errors
virtual void TskFileManager::deleteFile ( TskFile fileToDelete)
pure virtual

Delete the local copy of a file.

Parameters
fileToDeleteObject of file to delete local copy of
Exceptions
variousexceptions on errors

Implemented in TskFileManagerImpl.

virtual void TskFileManager::deleteFile ( const uint64_t  fileId)
inlinevirtual

Delete the local copy of a file.

Parameters
fileIdID of file to delete local copy of
Exceptions
variousexceptions on errors
virtual FilePtrList TskFileManager::findFilesByExtension ( const std::vector< std::string > &  extensions)
pure virtual

Return a list of any TskFile objects matching the given filename extension.

Parameters
extensionsList of file name extension strings.
Returns
List of pointers to file objects. Caller must use AutoFilePtrList or manually free them.

Implemented in TskFileManagerImpl.

virtual FilePtrList TskFileManager::findFilesByFsFileType ( TSK_FS_META_TYPE_ENUM  fsFileType)
pure virtual

Return a list of any TskFile objects that match the given file meta type.

Parameters
fsFileTypeFile meta type.
Returns
List of pointers to file objects. Caller must use AutoFilePtrList or manually free them.

Implemented in TskFileManagerImpl.

virtual FilePtrList TskFileManager::findFilesByName ( const std::string &  name,
const TSK_FS_META_TYPE_ENUM  fsFileType = TSK_FS_META_TYPE_UNDEF 
)
pure virtual

Return a list of any TskFile objects matching the given filename.

Parameters
nameThe file name.
fsFileTypeOptional file meta type. Will not filter on meta_type if this is omitted.
Returns
List of pointers to file objects. Caller must use AutoFilePtrList or manually free them.

Implemented in TskFileManagerImpl.

virtual FilePtrList TskFileManager::findFilesByParent ( const uint64_t  parentFileId)
pure virtual

Return a list of any TskFile objects that are children of the given file id.

Parameters
parentFileIdID of parent file.
Returns
List of pointers to file objects. Caller must use AutoFilePtrList or manually free them.

Implemented in TskFileManagerImpl.

virtual FilePtrList TskFileManager::findFilesByPattern ( const std::string &  namePattern,
const std::string &  pathPattern 
)
pure virtual

Return a list of any TskFile objects that match the given file and path patterns.

Parameters
namePatternFile name pattern. Can include "%" wildcards.
pathPatternFile path pattern. Can include "%" wildcards.
Returns
List of pointers to file objects. Caller must use AutoFilePtrList or manually free them.

Implemented in TskFileManagerImpl.

virtual TskFile* TskFileManager::getFile ( const uint64_t  fileId)
pure virtual

Return a TskFile object for a given file ID.

Parameters
fileIdID of file to return object of.
Returns
Pointer to file object. Caller must free it.
Exceptions
TskExceptionin case of error.

Implemented in TskFileManagerImpl.

virtual FilePtrList TskFileManager::getFiles ( const std::vector< uint64_t > &  fileIds)
pure virtual

Return a list of TskFile objects mapped to the given list of file ids.

Parameters
fileIdsList of fileId IDs.
Returns
List of pointers to file objects.

Implemented in TskFileManagerImpl.

virtual std::wstring TskFileManager::getPath ( const uint64_t  fileId)
pure virtual

Return the fully qualified path to where the local instance of the file with the given ID should exist.

This does not validate that the ID is for a file and does not validate that the file actually exists.

Parameters
fileIdId of the file.
Returns
Path to where local file should exist.

Implemented in TskFileManagerImpl.

virtual void TskFileManager::saveFile ( TskFile fileToSave)
pure virtual

Save the file to the default location.

Parameters
fileToSaveFile object of the file to save.
Exceptions
variousexceptions on errors

Implemented in TskFileManagerImpl.

Referenced by TskFile::save().

virtual void TskFileManager::saveFile ( const uint64_t  fileId)
inlinevirtual

Save the file to the default location.

Parameters
fileIdID of the file to save.
Exceptions
variousexceptions on errors

The documentation for this class was generated from the following file:

Copyright © 2011-2013 Brian Carrier. (carrier -at- sleuthkit -dot- org)
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.