Microsoft Information Protection (MIP) SDK for C++: Reference 1.16
Doxygen-generated documentation for MIP SDK written in C++
Loading...
Searching...
No Matches
file_engine.h
Go to the documentation of this file.
1/*
2 *
3 * Copyright (c) Microsoft Corporation.
4 * All rights reserved.
5 *
6 * This code is licensed under the MIT License.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 *
26 */
27
28/**
29 * @file file_engine.h
30 * @brief Provides an interface for file-related engine functions.
31 */
32
33#ifndef API_MIP_FILE_FILE_ENGINE_H_
34#define API_MIP_FILE_FILE_ENGINE_H_
35
36#include <memory>
37#include <string>
38#include <vector>
39#include <map>
40#include <chrono>
41
42#include "mip/common_types.h"
43#include "mip/error.h"
46#include "mip/mip_namespace.h"
47#include "mip/upe/label.h"
49
50MIP_NAMESPACE_BEGIN
51
52/**
53 * @brief Provides an interface for file-related engine functions.
54 *
55 * The `FileEngine` class allows creation of file handlers, management
56 * of sensitivity labels, and other file operations.
57 */
59public:
60
61 /**
62 * @brief Represents the settings for a FileEngine instance.
63 */
64 class Settings {
65 public:
66 // Constructor for loading an existing engine
68 const std::string& engineId,
69 const std::shared_ptr<AuthDelegate>& authDelegate,
70 const std::string& clientData,
71 const std::string& locale = "",
72 bool loadSensitivityTypes = false)
73 : mEngineId(engineId),
74 mAuthDelegate(authDelegate),
75 mClientData(clientData),
76 mLocale(locale),
77 mIsLoadSensitivityTypesEnabled(loadSensitivityTypes) {
78 if (mLocale.empty()) {
79 mLocale = "en-US";
80 }
81 }
82
83 // Constructor for creating a new engine
85 const Identity& identity,
86 const std::shared_ptr<AuthDelegate>& authDelegate,
87 const std::string& clientData,
88 const std::string& locale = "",
89 bool loadSensitivityTypes = false)
90 : mIdentity(identity),
91 mAuthDelegate(authDelegate),
92 mClientData(clientData),
93 mLocale(locale),
94 mIsLoadSensitivityTypesEnabled(loadSensitivityTypes) {
95 if (mLocale.empty()) {
96 mLocale = "en-US";
97 }
98 }
99
100 // Accessors and mutators
101 const std::string& GetEngineId() const { return mEngineId; }
102 void SetEngineId(const std::string& id) { mEngineId = id; }
103 const Identity& GetIdentity() const { return mIdentity; }
104 void SetIdentity(const Identity& identity) { mIdentity = identity; }
105 const std::string& GetClientData() const { return mClientData; }
106 const std::string& GetLocale() const { return mLocale; }
108
109 // Other functionality omitted for brevity...
110
111 private:
112 std::string mEngineId;
114 std::shared_ptr<AuthDelegate> mAuthDelegate;
115 std::string mClientData;
116 std::string mLocale;
118 };
119
120 /**
121 * @brief Returns the engine settings.
122 *
123 * @return A reference to the settings object.
124 */
125 virtual const Settings& GetSettings() const = 0;
126
127 /**
128 * @brief Lists the sensitivity types associated with the policy engine.
129 *
130 * @return A vector of sensitivity types.
131 */
132 virtual const std::vector<std::shared_ptr<SensitivityTypesRulePackage>>& ListSensitivityTypes() const = 0;
133
134 /**
135 * @brief Gets the default sensitivity label.
136 *
137 * @return A shared pointer to the default sensitivity label.
138 */
139 virtual const std::shared_ptr<Label> GetDefaultSensitivityLabel() const = 0;
140
141 /** @cond DOXYGEN_HIDE */
142 // Destructor: hidden from documentation
143 virtual ~FileEngine() {}
144 // Protected constructor: hidden from documentation
145protected:
146 FileEngine() {}
147 /** @endcond */
148};
149
150MIP_NAMESPACE_END
151
152#endif // API_MIP_FILE_FILE_ENGINE_H_
Represents the settings for a FileEngine instance.
Definition file_engine.h:64
Settings(const Identity &identity, const std::shared_ptr< AuthDelegate > &authDelegate, const std::string &clientData, const std::string &locale="", bool loadSensitivityTypes=false)
Definition file_engine.h:84
const std::string & GetClientData() const
bool mIsLoadSensitivityTypesEnabled
bool IsLoadSensitivityTypesEnabled() const
const std::string & GetEngineId() const
void SetIdentity(const Identity &identity)
const Identity & GetIdentity() const
Settings(const std::string &engineId, const std::shared_ptr< AuthDelegate > &authDelegate, const std::string &clientData, const std::string &locale="", bool loadSensitivityTypes=false)
Definition file_engine.h:67
std::shared_ptr< AuthDelegate > mAuthDelegate
std::string mClientData
std::string mEngineId
void SetEngineId(const std::string &id)
const std::string & GetLocale() const
Provides an interface for file-related engine functions.
Definition file_engine.h:58
virtual const std::vector< std::shared_ptr< SensitivityTypesRulePackage > > & ListSensitivityTypes() const =0
Lists the sensitivity types associated with the policy engine.
virtual const std::shared_ptr< Label > GetDefaultSensitivityLabel() const =0
Gets the default sensitivity label.
virtual const Settings & GetSettings() const =0
Returns the engine settings.
Abstraction for identity.
A file Containing the common types used by the upe, file and protection modules.
A file containing the MIP SDK error types.
This file contains the Label class.
MIP namespace macros.