28#ifndef API_MIP_FILE_FILE_HANDLER_H_
29#define API_MIP_FILE_FILE_HANDLER_H_
71 const std::shared_ptr<FileHandler>& fileHandler,
72 const std::shared_ptr<void>& context) { UNUSED(fileHandler); UNUSED(context); }
78 const std::exception_ptr& error,
79 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
85 const std::vector<std::shared_ptr<Action>>& actions,
const std::shared_ptr<void>& context) {
93 virtual void OnClassifyFailure(
const std::exception_ptr& error,
const std::shared_ptr<void>& context) {
102 const std::string& decryptedFilePath,
const std::shared_ptr<void>& context) {
103 UNUSED(decryptedFilePath);
119 const std::shared_ptr<Stream>& decryptedStream,
const std::shared_ptr<void>& context) {
120 UNUSED(decryptedStream);
128 const std::exception_ptr& error,
const std::shared_ptr<void>& context) {
138 const std::shared_ptr<void>& context) { UNUSED(committed); UNUSED(context); }
144 const std::exception_ptr& error,
145 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
151 const std::shared_ptr<FileInspector>& fileInspector,
const std::shared_ptr<void>& context) {
152 UNUSED(fileInspector);
159 virtual void OnInspectFailure(
const std::exception_ptr& error,
const std::shared_ptr<void>& context) {
174 virtual std::shared_ptr<ContentLabel>
GetLabel() = 0;
179 virtual std::vector<std::pair<std::string, std::string>>
GetProperties(uint32_t version) = 0;
197 bool isOwnerNotificationEnabled,
198 const std::shared_ptr<ProtectionEngine::Observer>& observer,
199 const std::shared_ptr<void>& context) = 0;
210 const std::shared_ptr<ProtectionEngine::Observer>& observer,
const std::shared_ptr<void>& context) = 0;
222 const std::string& filePath,
223 const std::shared_ptr<MipContext>& mipContext);
236 const std::string& filePath,
237 const std::shared_ptr<MipContext>& mipContext,
238 const std::shared_ptr<void>& loggerContext);
252 const std::shared_ptr<Stream>& stream,
253 const std::string& filePath,
254 const std::shared_ptr<MipContext>& mipContext);
269 const std::shared_ptr<Stream>& stream,
270 const std::string& filePath,
271 const std::shared_ptr<MipContext>& mipContext,
272 const std::shared_ptr<void>& loggerContext);
289 const std::string& filePath,
290 const std::shared_ptr<MipContext>& mipContext);
308 const std::string& filePath,
309 const std::shared_ptr<MipContext>& mipContext,
310 const std::shared_ptr<void>& loggerContext);
329 const std::shared_ptr<Stream>& stream,
330 const std::string& filePath,
331 const std::shared_ptr<MipContext>& mipContext);
351 const std::shared_ptr<Stream>& stream,
352 const std::string& filePath,
353 const std::shared_ptr<MipContext>& mipContext,
354 const std::shared_ptr<void>& loggerContext);
374 const std::string& filePath,
375 const std::shared_ptr<MipContext>& mipContext,
376 const std::shared_ptr<void>& loggerContext =
nullptr);
398 const std::shared_ptr<Stream>& stream,
399 const std::string& filePath,
400 const std::shared_ptr<MipContext>& mipContext,
401 const std::shared_ptr<void>& loggerContext =
nullptr);
411 const std::string& filePath,
412 const std::shared_ptr<MipContext>& mipContext);
423 const std::string& filePath,
424 const std::shared_ptr<MipContext>& mipContext,
425 const std::shared_ptr<void>& loggerContext);
437 const std::shared_ptr<Stream>& stream,
438 const std::string& filePath,
439 const std::shared_ptr<MipContext>& mipContext);
452 const std::shared_ptr<Stream>& stream,
453 const std::string& filePath,
454 const std::shared_ptr<MipContext>& mipContext,
455 const std::shared_ptr<void>& loggerContext);
483 const std::shared_ptr<Label>& label,
505 const std::shared_ptr<ProtectionDescriptor>& protectionDescriptor,
514 const std::shared_ptr<ProtectionHandler>& protectionHandler) = 0;
534 virtual void CommitAsync(
const std::string& outputFilePath,
const std::shared_ptr<void>& context) = 0;
546 virtual void CommitAsync(
const std::shared_ptr<Stream>& outputStream,
const std::shared_ptr<void>& context) = 0;
A file containing the Action base class and the ActionType enumerator.
Observer interface for clients to get notifications events related to file handler.
virtual void OnCommitFailure(const std::exception_ptr &error, const std::shared_ptr< void > &context)
Called when committing the changes to the file failed.
virtual void OnCreateFileHandlerFailure(const std::exception_ptr &error, const std::shared_ptr< void > &context)
Called when creating the handler failed.
virtual void OnInspectSuccess(const std::shared_ptr< FileInspector > &fileInspector, const std::shared_ptr< void > &context)
Called when inspect success.
virtual void OnGetDecryptedTemporaryFileFailure(const std::exception_ptr &error, const std::shared_ptr< void > &context)
Called when getting the decrypted temporary file failed.
virtual void OnGetDecryptedTemporaryFileSuccess(const std::string &decryptedFilePath, const std::shared_ptr< void > &context)
Called when getting the decrypted temporary file success.
virtual void OnGetDecryptedTemporaryStreamSuccess(const std::shared_ptr< Stream > &decryptedStream, const std::shared_ptr< void > &context)
Called when getting the decrypted temporary stream success.
virtual void OnClassifySuccess(const std::vector< std::shared_ptr< Action > > &actions, const std::shared_ptr< void > &context)
Called when classify success.
virtual void OnGetDecryptedTemporaryStreamFailure(const std::exception_ptr &error, const std::shared_ptr< void > &context)
Called when getting the decrypted temporary stream failed.
virtual void OnClassifyFailure(const std::exception_ptr &error, const std::shared_ptr< void > &context)
Called when classify failed.
virtual void OnCommitSuccess(bool committed, const std::shared_ptr< void > &context)
Called when committing the changes to the file were successful.
virtual void OnInspectFailure(const std::exception_ptr &error, const std::shared_ptr< void > &context)
Called when inspect failed.
virtual void OnCreateFileHandlerSuccess(const std::shared_ptr< FileHandler > &fileHandler, const std::shared_ptr< void > &context)
Called when the handler is created successfully.
Interface for all file handling functions.
virtual void DeleteLabel(const LabelingOptions &labelingOptions)=0
Deletes the sensitivity label from the file.
static FILE_API bool __CDECL IsLabeledOrProtected(const std::shared_ptr< Stream > &stream, const std::string &filePath, const std::shared_ptr< MipContext > &mipContext, const std::shared_ptr< void > &loggerContext)
Checks whether a file is labeled/protected or not.
static FILE_API bool __CDECL IsProtected(const std::string &filePath, const std::shared_ptr< MipContext > &mipContext, const std::shared_ptr< void > &loggerContext)
Checks whether a file is protected or not.
static FILE_API std::shared_ptr< FileStatus > __CDECL GetFileStatus(const std::string &filePath, const std::shared_ptr< MipContext > &mipContext, const std::shared_ptr< void > &loggerContext=nullptr)
Checks whether a file is labeled, protected, or contains protected objects.
virtual void SetLabel(const std::shared_ptr< Label > &label, const LabelingOptions &labelingOptions, const ProtectionSettings &protectionSettings)=0
Sets the sensitivity label to the file.
static FILE_API std::shared_ptr< FileStatus > __CDECL GetFileStatus(const std::shared_ptr< Stream > &stream, const std::string &filePath, const std::shared_ptr< MipContext > &mipContext, const std::shared_ptr< void > &loggerContext=nullptr)
Checks whether a file is labeled, protected, or contains protected objects.
static FILE_API bool __CDECL IsProtected(const std::shared_ptr< Stream > &stream, const std::string &filePath, const std::shared_ptr< MipContext > &mipContext, const std::shared_ptr< void > &loggerContext)
Checks whether a file is protected or not.
static FILE_API bool __CDECL IsProtected(const std::string &filePath, const std::shared_ptr< MipContext > &mipContext)
Checks whether a file is protected or not.
static FILE_API std::vector< uint8_t > __CDECL GetSerializedPublishingLicense(const std::string &filePath, const std::shared_ptr< MipContext > &mipContext)
Get publishing license from the file.
virtual void RemoveProtection()=0
Removes protection from the file.
virtual void CommitAsync(const std::shared_ptr< Stream > &outputStream, const std::shared_ptr< void > &context)=0
Writes the changes to the stream specified by the |outputStream| parameter.
static FILE_API std::vector< uint8_t > __CDECL GetSerializedPublishingLicense(const std::shared_ptr< Stream > &stream, const std::string &filePath, const std::shared_ptr< MipContext > &mipContext)
Get publishing license from the file.
virtual void SetProtection(const std::shared_ptr< ProtectionHandler > &protectionHandler)=0
Sets protection on a document using an existing protection handler.
virtual void InspectAsync(const std::shared_ptr< void > &context)=0
Create a file inspector object, used to retrieve file contents from compatible file formats.
static FILE_API bool __CDECL IsLabeledOrProtected(const std::string &filePath, const std::shared_ptr< MipContext > &mipContext)
Checks whether a file is labeled/protected or not.
static FILE_API bool __CDECL IsProtected(const std::shared_ptr< Stream > &stream, const std::string &filePath, const std::shared_ptr< MipContext > &mipContext)
Checks whether a file is protected or not.
virtual void RegisterContentForTrackingAndRevocationAsync(bool isOwnerNotificationEnabled, const std::shared_ptr< ProtectionEngine::Observer > &observer, const std::shared_ptr< void > &context)=0
Register the content for tracking and revocation.
virtual std::shared_ptr< ProtectionHandler > GetProtection()=0
Starts retrieving the protection policy from the file.
virtual void GetDecryptedTemporaryStreamAsync(const std::shared_ptr< void > &context)=0
Returns a stream - representing the decrypted content.
virtual std::shared_ptr< ContentLabel > GetLabel()=0
Starts retrieving the sensitivity label from the file.
virtual void SetProtection(const std::shared_ptr< ProtectionDescriptor > &protectionDescriptor, const ProtectionSettings &protectionSettings)=0
Sets either custom or template-based permissions (according to protectionDescriptor->GetProtectionTyp...
virtual void GetDecryptedTemporaryFileAsync(const std::shared_ptr< void > &context)=0
Returns a path to a temporary file (that will be deleted if possible) - representing the decrypted co...
static FILE_API std::vector< uint8_t > __CDECL GetSerializedPublishingLicense(const std::shared_ptr< Stream > &stream, const std::string &filePath, const std::shared_ptr< MipContext > &mipContext, const std::shared_ptr< void > &loggerContext)
Get publishing license from the file.
virtual void RevokeContentAsync(const std::shared_ptr< ProtectionEngine::Observer > &observer, const std::shared_ptr< void > &context)=0
Perform revocation for the content.
virtual std::vector< std::pair< std::string, std::string > > GetProperties(uint32_t version)=0
Retrieves the file properties according to version.
virtual void NotifyCommitSuccessful(const std::string &actualFilePath)=0
To be called when the changes have been committed to disk.
static FILE_API bool __CDECL IsLabeledOrProtected(const std::string &filePath, const std::shared_ptr< MipContext > &mipContext, const std::shared_ptr< void > &loggerContext)
Checks whether a file is labeled/protected or not.
virtual void ClassifyAsync(const std::shared_ptr< void > &context)=0
Executes the rules in the handler and returns the list of actions to be executed.
static FILE_API bool __CDECL IsLabeledOrProtected(const std::shared_ptr< Stream > &stream, const std::string &filePath, const std::shared_ptr< MipContext > &mipContext)
Checks whether a file is labeled/protected or not.
virtual std::string GetOutputFileName()=0
Calculates the output file name and extension based on the original file name and the accumulated cha...
static FILE_API std::vector< uint8_t > __CDECL GetSerializedPublishingLicense(const std::string &filePath, const std::shared_ptr< MipContext > &mipContext, const std::shared_ptr< void > &loggerContext)
Get publishing license from the file.
virtual bool IsModified()=0
Checks if there are changes to commit to the file.
virtual void CommitAsync(const std::string &outputFilePath, const std::shared_ptr< void > &context)=0
Writes the changes to the file specified by the |outputFilePath| parameter.
Interface for configuring labeling options for the SetLabel/DeleteLabel methods.
Interface for configuring protection options for the SetLabel method.
A file Containing the ContentLabel class.
File containing definition of MipContext.
Defines ProtectionDescriptor interface.
Defines ProtectionEngine interface.
Defines ProtectionHandler interface.
A file containing the Stream interface/class definition.