Microsoft Information Protection (MIP) SDK for C++: Reference 1.15
Doxygen-generated documentation for MIP SDK written in C++
Loading...
Searching...
No Matches
protection_profile.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 * @brief Defines ProtectionProfile interface
29 *
30 * @file protection_profile.h
31 */
32
33#ifndef API_MIP_PROTECTION_PROTECTION_PROFILE_H_
34#define API_MIP_PROTECTION_PROTECTION_PROFILE_H_
35
36#include <memory>
37#include <string>
38
39#include "mip/common_types.h"
40#include "mip/dns_redirection.h"
41#include "mip/error.h"
42#include "mip/http_delegate.h"
43#include "mip/logger_delegate.h"
44#include "mip/mip_context.h"
45#include "mip/mip_export.h"
46#include "mip/mip_namespace.h"
50#include "mip/xml_delegate.h"
51
52MIP_NAMESPACE_BEGIN
53
54/**
55 * @brief ProtectionProfile is the root class for performing protection operations
56 *
57 * @note An application needs to create a ProtectionProfile before performing any protection operations
58 */
60public:
61 /**
62 * @brief Interface that receives notifications related to ProtectionProfile
63 *
64 * @note This interface must be implemented by applications using the protection SDK
65 */
66 class Observer {
67 public:
68 /** @cond DOXYGEN_HIDE */
69 virtual ~Observer() { }
70 /** @endcond */
71
72 /**
73 * @brief Called when profile was loaded successfully
74 *
75 * @param profile A reference to the newly created ProtectionProfile
76 * @param context The same context that was passed to ProtectionProfile::LoadAsync
77 *
78 * @note An application can pass any type of context (for example, std::promise, std::function) to
79 * ProtectionProfile::LoadAsync and that same context will be forwarded as-is to
80 * ProtectionProfile::Observer::OnLoadSuccess or ProtectionProfile::Observer::OnLoadFailure
81 */
82 virtual void OnLoadSuccess(
83 const std::shared_ptr<ProtectionProfile>& profile,
84 const std::shared_ptr<void>& context) { UNUSED(profile); UNUSED(context); }
85
86 /**
87 * @brief Called when loading a profile caused an error
88 *
89 * @param error Error that occurred while loading
90 * @param context The same context that was passed to ProtectionProfile::LoadAsync
91 *
92 * @note An application can pass any type of context (for example, std::promise, std::function) to
93 * ProtectionProfile::LoadAsync and that same context will be forwarded as-is to
94 * ProtectionProfile::Observer::OnLoadSuccess or ProtectionProfile::Observer::OnLoadFailure
95 */
96 virtual void OnLoadFailure(
97 const std::exception_ptr& error,
98 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
99
100 /**
101 * @brief Called when list of engines was generated successfully.
102 *
103 * @param engineIds a list of engine IDs the are available.
104 * @param context The same context that was passed to ProtectionProfile::ListEnginesAsync
105 */
107 const std::vector<std::string>& engineIds,
108 const std::shared_ptr<void>& context) { UNUSED(engineIds); UNUSED(context); }
109
110 /**
111 * @brief Called when listing engines resulted in an error.
112 *
113 * @param error the error that caused the list engines operation to fail.
114 * @param context The same context that was passed to ProtectionProfile::ListEnginesAsync
115 */
117 const std::exception_ptr& error,
118 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
119
120 /**
121 * @brief Called when a new engine was added successfully.
122 *
123 * @param engine Newly created engine
124 * @param context The same context that was passed to ProtectionProfile::AddEngineAsync
125 */
126 virtual void OnAddEngineSuccess(
127 const std::shared_ptr<ProtectionEngine>& engine,
128 const std::shared_ptr<void>& context) { UNUSED(engine); UNUSED(context); }
129
130 /**
131 * @brief Called when adding a new engine resulted in an error.
132 *
133 * @param error the error that caused the add engine operation to fail.
134 * @param context The same context that was passed to ProtectionProfile::AddEngineAsync
135 */
136 virtual void OnAddEngineFailure(
137 const std::exception_ptr& error,
138 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
139
140 /**
141 * @brief Called when an engine was deleted successfully.
142 *
143 * @param context The same context that was passed to ProtectionProfile::DeleteEngineAsync
144 */
146 const std::shared_ptr<void>& context) { UNUSED(context); }
147
148 /**
149 * @brief Called when deleting an engine resulted in an error.
150 *
151 * @param error the error that caused the delete engine operation to fail.
152 * @param context The same context that was passed to ProtectionProfile::DeleteEngineAsync
153 */
155 const std::exception_ptr& error,
156 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
157
158 /** @cond DOXYGEN_HIDE */
159 protected:
160 Observer() { }
161 /** @endcond */
162 };
163
164 /**
165 * @brief Settings used by ProtectionProfile during its creation and throughout its lifetime
166 */
167 class Settings {
168 public:
169 /**
170 * @brief ProtectionProfile::Settings constructor that specifies an observer to be used for async operations
171 *
172 * @param mipContext Global context settings
173 * @param cacheStorageType Store any cached state in memory or on disk
174 * @param consentDelegate Delegate used to obtain user permission to access external resources
175 * @param observer Observer instance that will receive notifications of events related to ProtectionProfile
176 * @param applicationInfo Info about application that is consuming the protection SDK
177 */
179 const std::shared_ptr<MipContext>& mipContext,
180 CacheStorageType cacheStorageType,
181 const std::shared_ptr<ConsentDelegate>& consentDelegate,
182 const std::shared_ptr<ProtectionProfile::Observer>& observer)
183 : mMipContext(mipContext),
184 mCacheStorageType(cacheStorageType),
185 mConsentDelegate(consentDelegate),
186 mObserver(observer),
187 mCanCacheLicenses(true),
188#if defined(MIP_OFFLINE_PUBLISHING_ENABLED) || defined(SWIG) || defined(SWIG_DIRECTORS)
189 mOfflinePublishing(false),
190#endif // MIP_OFFLINE_PUBLISHING_ENABLED
191 mDnsRedirection(DnsRedirection::MDEDiscovery) {
192 }
193
194 /**
195 * @brief ProtectionProfile::Settings constructor, used for synchronous operations
196 *
197 * @param mipContext Global context settings
198 * @param cacheStorageType Store any cached state in memory or on disk
199 * @param consentDelegate Delegate used to obtain user permission to access external resources
200 * @param applicationInfo Info about application which is consuming the protection SDK
201 */
203 const std::shared_ptr<MipContext>& mipContext,
204 CacheStorageType cacheStorageType,
205 const std::shared_ptr<ConsentDelegate>& consentDelegate)
206 : Settings(mipContext, cacheStorageType, consentDelegate, nullptr /*observer*/) {
207 }
208
209 /** @cond DOXYGEN_HIDE */
210 ~Settings() { }
211 /** @endcond */
212
213 /**
214 * @brief Get whether caches are stored in memory or on disk
215 *
216 * @return storage type used
217 */
218 CacheStorageType GetCacheStorageType() const { return mCacheStorageType; }
219
220 /**
221 * @brief Gets the consent delegate used for connecting to services
222 *
223 * @return Consent delegate used for connecting to services
224 */
225 std::shared_ptr<ConsentDelegate> GetConsentDelegate() const { return mConsentDelegate; }
226
227 /**
228 * @brief Gets the observer that receives notifications of events related to ProtectionProfile
229 *
230 * @return Observer that receives notifications of events related to ProtectionProfile
231 */
232 std::shared_ptr<ProtectionProfile::Observer> GetObserver() const { return mObserver; }
233
234 /**
235 * @brief Get MIP context which represents shared state across all profiles
236 *
237 * @return MIP context
238 */
239 std::shared_ptr<MipContext> GetMipContext() const { return mMipContext; }
240
241 /**
242 * @brief Get the HTTP delegate (if any) provided by the application
243 *
244 * @return HTTP delegate to be used for HTTP operations
245 */
246 std::shared_ptr<HttpDelegate> GetHttpDelegate() const { return mHttpDelegate; }
247
248 /**
249 * @brief Override default HTTP stack with client's own
250 *
251 * @param httpDelegate HTTP callback interface implemented by client application
252 */
253 void SetHttpDelegate(const std::shared_ptr<HttpDelegate>& httpDelegate) { mHttpDelegate = httpDelegate; }
254
255 /**
256 * @brief Get the #StorageDelegate (if any) provided by the application
257 *
258 * @return #StorageDelegate to be used for caching
259 */
260 std::shared_ptr<StorageDelegate> GetStorageDelegate() const { return mStorageDelegate; }
261
262 /**
263 * @brief Override default storage cache with client's own implementation.
264 *
265 * @param storageDelegate #StorageDelegate interface implemented by client application
266 */
267 void SetStorageDelegate(const std::shared_ptr<StorageDelegate>& storageDelegate) { mStorageDelegate = storageDelegate; }
268
269 /**
270 * @brief Get the TaskDispatcher delegate (if any) provided by the application
271 *
272 * @return TaskDispatcher delegate to be used for executing asynchronous tasks
273 */
274 std::shared_ptr<TaskDispatcherDelegate> GetTaskDispatcherDelegate() const { return mTaskDispatcherDelegate; }
275
276 /**
277 * @brief Override default asynchonous task dispatching handling with client's own
278 *
279 * @param taskDispatcherDelegate Task dispatching callback interface implemented by client application
280 *
281 * @note tasks can reference profile objects preventing its destruction as a result
282 * taskdispatcher queues should not be shared.
283 */
284 void SetTaskDispatcherDelegate(const std::shared_ptr<TaskDispatcherDelegate>& taskDispatcherDelegate) {
285 mTaskDispatcherDelegate = taskDispatcherDelegate;
286 }
287
288 /**
289 * @brief Sets the session ID
290 *
291 * @param sessionId Session ID that will be used to correlate logs/telemetry
292 */
293 void SetSessionId(const std::string& sessionId) { mSessionId = sessionId; }
294
295 /**
296 * @brief Gets the session ID
297 *
298 * @return Session ID that will be used to correlate logs/telemetry
299 */
300 const std::string& GetSessionId() const { return mSessionId; }
301
302 /**
303 * @brief Configures whether or not end user licenses (EULs) will be cached locally
304 *
305 * @param canCacheLicenses Whether or not engine should cache a license when opening protected content
306 *
307 * @note If true, opening protected content will cache the associated license locally. If false, opening protected
308 * content will always perform HTTP operation to acquire the license from the RMS service.
309 */
310 void SetCanCacheLicenses(bool canCacheLicenses) {
311 mCanCacheLicenses = canCacheLicenses;
312 }
313
314 /**
315 * @brief Gets whether or not end user licenses (EULs) are cached locally
316 *
317 * @return License caching configuration
318 */
319 bool CanCacheLicenses() const {
320 return mCanCacheLicenses;
321 }
322
323 /**
324 * @brief Set the custom settings, used for feature gating and testing.
325 *
326 * @param customSettings List of name/value pairs.
327 */
328 void SetCustomSettings(const std::vector<std::pair<std::string, std::string>>& customSettings) {
329 mCustomSettings = customSettings;
330 }
331
332 /**
333 * @brief Get the custom settings, used for feature gating and testing.
334 *
335 * @return List of name/value pairs.
336 */
337 const std::vector<std::pair<std::string, std::string>>& GetCustomSettings() const {
338 return mCustomSettings;
339 }
340
341#if !defined(SWIG) && !defined(SWIG_DIRECTORS)
342 /**
343 * @brief Get logger context that will be opaquely passed to the logger delegate for logs associated with the created profile
344 *
345 * @return The logger context
346 */
347 const std::shared_ptr<void>& GetLoggerContext() const { return mLoggerContext; }
348#endif
349
350 /**
351 * @brief Sets the logger context that will be opaquely passed to the logger delegate for logs associated with the created profile
352 *
353 * @param loggerContext The logger context
354 *
355 */
356 void SetLoggerContext(const std::shared_ptr<void>& loggerContext) {
357 mLoggerContext = loggerContext;
358 }
359
360 /**
361 * @brief Adds a redirect uri
362 *
363 * @param originalUri The uri that should be redirected from
364 * @param redirectUri The uri that will replace the originalUri
365 *
366 * @note Use this function to provide a domain that should be redirected to another Uri
367 * The originalUri will be normalized before comparison with the domain for the current request.
368 * If the domain of the current request matches that of the originalUri then the redirectUri will be used instead
369 * This redirection will occur before DNS lookup redirection
370 */
371 void AddRedirectionUri(const std::string& originalUri, const std::string& redirectUri) {
372 mRedirectionUris[originalUri] = redirectUri;
373 }
374
375 /**
376 * @brief Gets the redirection uris
377 *
378 * @return Map of redirection uris
379 */
380 const std::map<std::string, std::string>& GetRedirectionUris() const {
381 return mRedirectionUris;
382 }
383#if defined(MIP_OFFLINE_PUBLISHING_ENABLED) || defined(SWIG) || defined(SWIG_DIRECTORS)
384 /**
385 * @brief Gets offline publishing status
386 *
387 * @return A boolean value indicating whether or not offline publishing is enabled
388 */
389 bool GetOfflinePublishing() const {
390 return mOfflinePublishing;
391 }
392
393 /**
394 * @brief Enables or disables offline publishing
395 *
396 * @param offlinePublishing A boolean value indicating whether or not offline publishing is enabled
397 *
398 */
399 void SetOfflinePublishing(bool offlinePublishing) {
400 mOfflinePublishing = offlinePublishing;
401 }
402#endif // MIP_OFFLINE_PUBLISHING_ENABLED
403
404 /**
405 * @brief Gets the dns redirect mode
406 *
407 * @return The redirect mode used
408 */
410 return mDnsRedirection;
411 }
412
413 /**
414 * @brief Sets the dns redirection mode that controls how redirection is handled during online operations
415 *
416 * @param dnsRedirection The redirection mode to use
417 */
418 void SetDnsRedirection(DnsRedirection dnsRedirection) {
419 mDnsRedirection = dnsRedirection;
420 }
421
422 private:
423 std::shared_ptr<MipContext> mMipContext;
424 CacheStorageType mCacheStorageType;
425 std::shared_ptr<ConsentDelegate> mConsentDelegate;
426 std::shared_ptr<ProtectionProfile::Observer> mObserver;
427 std::shared_ptr<HttpDelegate> mHttpDelegate;
428 std::shared_ptr<TaskDispatcherDelegate> mTaskDispatcherDelegate;
429 std::string mSessionId;
430 bool mCanCacheLicenses = true;
431 std::vector<std::pair<std::string, std::string>> mCustomSettings;
432 std::shared_ptr<void> mLoggerContext;
433 std::map<std::string, std::string> mRedirectionUris;
434 std::shared_ptr<StorageDelegate> mStorageDelegate;
435#if defined(MIP_OFFLINE_PUBLISHING_ENABLED) || defined(SWIG) || defined(SWIG_DIRECTORS)
436 bool mOfflinePublishing;
437#endif // MIP_OFFLINE_PUBLISHING_ENABLED
438 DnsRedirection mDnsRedirection;
439 };
440
441 /**
442 * @brief Starts loading a profile based on the provided settings.
443 *
444 * @param settings Settings used by ProtectionProfile during its initialization and throughout its lifetime
445 * @param context This same context will be forwarded to ProtectionProfile::Observer::OnLoadSuccess or
446 * ProtectionProfile::Observer::OnLoadFailure as-is.
447 *
448 * @return Async control object.
449 *
450 * @note ProtectionProfile::Observer will be called upon success or failure.
451 */
452 MIP_API static std::shared_ptr<AsyncControl> __CDECL LoadAsync(
453 const Settings& settings,
454 const std::shared_ptr<void>& context);
455
456 /**
457 * @brief Loading a profile based on the provided settings.
458 *
459 * @param settings Settings used by ProtectionProfile during its initialization and throughout its lifetime
460 *
461 * @return Newly created profile
462 */
463 MIP_API static std::shared_ptr<ProtectionProfile> __CDECL Load(const Settings& settings);
464
465 /**
466 * @brief Gets library version
467 *
468 * @return Library version
469 */
470 MIP_API static const char* __CDECL GetVersion();
471
472 /**
473 * @brief Gets settings used by ProtectionProfile during its initialization and throughout its lifetime
474 *
475 * @return Settings used by ProtectionProfile during its initialization and throughout its lifetime
476 */
477 virtual const Settings& GetSettings() const = 0;
478
479 /**
480 * @brief Starts list engines operation.
481 *
482 * @param context Client context that will be opaquely passed back to observers
483 *
484 * @return Async control object.
485 *
486 * @note ProtectionProfile::Observer will be called upon success or failure.
487 */
488 virtual std::shared_ptr<AsyncControl> ListEnginesAsync(const std::shared_ptr<void>& context) = 0;
489
490 /**
491 * @brief List engines.
492 *
493 * @return Cached engine IDs
494 */
495 virtual std::vector<std::string> ListEngines() = 0;
496
497 /**
498 * @brief Starts adding a new protection engine to the profile.
499 *
500 * @param settings the mip::ProtectionEngine::Settings object that specifies the engine's settings.
501 * @param context Client context that will be opaquely passed back to observers
502 *
503 * @return Async control object.
504 *
505 * @note ProtectionProfile::Observer will be called upon success or failure.
506 */
507 virtual std::shared_ptr<AsyncControl> AddEngineAsync(
508 const ProtectionEngine::Settings& settings,
509 const std::shared_ptr<void>& context) = 0;
510
511 /**
512 * @brief Add a new protection engine to the profile.
513 *
514 * @param settings the mip::ProtectionEngine::Settings object that specifies the engine's settings.
515 *
516 * @return Newly created ProtectionEngine
517 */
518 virtual std::shared_ptr<ProtectionEngine> AddEngine(const ProtectionEngine::Settings& settings) = 0;
519
520 /**
521 * @brief Starts deleting the protection engine with the given ID. All data for the given engine will be deleted.
522 *
523 * @param id the unique engine ID.
524 * @param context Client context that will be opaquely passed back to observers
525 *
526 * @return Async control object.
527 *
528 * @note ProtectionProfile::Observer will be called upon success or failure.
529 */
530 virtual std::shared_ptr<AsyncControl> DeleteEngineAsync(
531 const std::string& engineId,
532 const std::shared_ptr<void>& context) = 0;
533
534 /**
535 * @brief Delete the protection engine with the given ID. All data for the given engine will be deleted.
536 *
537 * @param id the unique engine ID.
538 */
539 virtual void DeleteEngine(const std::string& engineId) = 0;
540
541#ifndef MIP_CORE_PACKAGE
542 /**
543 * @brief Creates a holder for details of a Publishing License and can be used to create a Protection Handler
544 *
545 * @param serializedPublishingLicense the serialized publishing license.
546 *
547 * @return a holder for details of a Publishing License
548 *
549 * @note The returned PublishingLicenseInfo is parsed
550 */
551#if !defined(SWIG) && !defined(SWIG_DIRECTORS)
552 [[deprecated("ProtectionProfile::GetPublishingLicenseInfo(const std::vector<uint8_t>&) is deprecated, use ProtectionProfile::GetPublishingLicenseInfo(const std::vector<uint8_t>&, const std::shared_ptr<MipContext>&)")]]
553#endif
554 MIP_API static std::shared_ptr<PublishingLicenseInfo> __CDECL GetPublishingLicenseInfo(
555 const std::vector<uint8_t>& serializedPublishingLicense);
556#endif // !MIP_CORE_PACKAGE
557
558 /**
559 * @brief Creates a holder for details of a Publishing License and can be used to create a Protection Handler. Allows delegate overrides.
560 *
561 * @param serializedPublishingLicense the serialized publishing license.
562 * @param mipContext a MIP context containing delegate overrides.
563 *
564 * @return a holder for details of a Publishing License
565 *
566 * @note The returned PublishingLicenseInfo is parsed
567 */
568 MIP_API static std::shared_ptr<PublishingLicenseInfo> __CDECL GetPublishingLicenseInfo(
569 const std::vector<uint8_t>& serializedPublishingLicense,
570 const std::shared_ptr<MipContext>& mipContext);
571
572 /** @cond DOXYGEN_HIDE */
573 virtual ~ProtectionProfile() { }
574 /** @endcond */
575 };
576
577MIP_NAMESPACE_END
578
579#endif // API_MIP_PROTECTION_PROTECTION_PROFILE_H_
Settings used by ProtectionEngine during its creation and throughout its lifetime.
Interface that receives notifications related to ProtectionProfile.
virtual void OnListEnginesSuccess(const std::vector< std::string > &engineIds, const std::shared_ptr< void > &context)
Called when list of engines was generated successfully.
virtual void OnDeleteEngineSuccess(const std::shared_ptr< void > &context)
Called when an engine was deleted successfully.
virtual void OnLoadSuccess(const std::shared_ptr< ProtectionProfile > &profile, const std::shared_ptr< void > &context)
Called when profile was loaded successfully.
virtual void OnAddEngineFailure(const std::exception_ptr &error, const std::shared_ptr< void > &context)
Called when adding a new engine resulted in an error.
virtual void OnDeleteEngineFailure(const std::exception_ptr &error, const std::shared_ptr< void > &context)
Called when deleting an engine resulted in an error.
virtual void OnAddEngineSuccess(const std::shared_ptr< ProtectionEngine > &engine, const std::shared_ptr< void > &context)
Called when a new engine was added successfully.
virtual void OnLoadFailure(const std::exception_ptr &error, const std::shared_ptr< void > &context)
Called when loading a profile caused an error.
virtual void OnListEnginesFailure(const std::exception_ptr &error, const std::shared_ptr< void > &context)
Called when listing engines resulted in an error.
Settings used by ProtectionProfile during its creation and throughout its lifetime.
std::shared_ptr< ConsentDelegate > GetConsentDelegate() const
Gets the consent delegate used for connecting to services.
Settings(const std::shared_ptr< MipContext > &mipContext, CacheStorageType cacheStorageType, const std::shared_ptr< ConsentDelegate > &consentDelegate, const std::shared_ptr< ProtectionProfile::Observer > &observer)
ProtectionProfile::Settings constructor that specifies an observer to be used for async operations.
bool CanCacheLicenses() const
Gets whether or not end user licenses (EULs) are cached locally.
std::shared_ptr< MipContext > GetMipContext() const
Get MIP context which represents shared state across all profiles.
void SetLoggerContext(const std::shared_ptr< void > &loggerContext)
Sets the logger context that will be opaquely passed to the logger delegate for logs associated with ...
std::shared_ptr< HttpDelegate > GetHttpDelegate() const
Get the HTTP delegate (if any) provided by the application.
CacheStorageType GetCacheStorageType() const
Get whether caches are stored in memory or on disk.
void SetDnsRedirection(DnsRedirection dnsRedirection)
Sets the dns redirection mode that controls how redirection is handled during online operations.
void SetTaskDispatcherDelegate(const std::shared_ptr< TaskDispatcherDelegate > &taskDispatcherDelegate)
Override default asynchonous task dispatching handling with client's own.
const std::map< std::string, std::string > & GetRedirectionUris() const
Gets the redirection uris.
void SetCustomSettings(const std::vector< std::pair< std::string, std::string > > &customSettings)
Set the custom settings, used for feature gating and testing.
void SetStorageDelegate(const std::shared_ptr< StorageDelegate > &storageDelegate)
Override default storage cache with client's own implementation.
void SetCanCacheLicenses(bool canCacheLicenses)
Configures whether or not end user licenses (EULs) will be cached locally.
void SetHttpDelegate(const std::shared_ptr< HttpDelegate > &httpDelegate)
Override default HTTP stack with client's own.
void AddRedirectionUri(const std::string &originalUri, const std::string &redirectUri)
Adds a redirect uri.
std::shared_ptr< ProtectionProfile::Observer > GetObserver() const
Gets the observer that receives notifications of events related to ProtectionProfile.
std::shared_ptr< TaskDispatcherDelegate > GetTaskDispatcherDelegate() const
Get the TaskDispatcher delegate (if any) provided by the application.
DnsRedirection GetDnsRedirection() const
Gets the dns redirect mode.
const std::shared_ptr< void > & GetLoggerContext() const
Get logger context that will be opaquely passed to the logger delegate for logs associated with the c...
Settings(const std::shared_ptr< MipContext > &mipContext, CacheStorageType cacheStorageType, const std::shared_ptr< ConsentDelegate > &consentDelegate)
ProtectionProfile::Settings constructor, used for synchronous operations.
void SetSessionId(const std::string &sessionId)
Sets the session ID.
const std::string & GetSessionId() const
Gets the session ID.
std::shared_ptr< StorageDelegate > GetStorageDelegate() const
Get the StorageDelegate (if any) provided by the application.
const std::vector< std::pair< std::string, std::string > > & GetCustomSettings() const
Get the custom settings, used for feature gating and testing.
ProtectionProfile is the root class for performing protection operations.
virtual std::shared_ptr< AsyncControl > AddEngineAsync(const ProtectionEngine::Settings &settings, const std::shared_ptr< void > &context)=0
Starts adding a new protection engine to the profile.
virtual std::vector< std::string > ListEngines()=0
List engines.
static MIP_API std::shared_ptr< PublishingLicenseInfo > __CDECL GetPublishingLicenseInfo(const std::vector< uint8_t > &serializedPublishingLicense)
Creates a holder for details of a Publishing License and can be used to create a Protection Handler.
static MIP_API std::shared_ptr< PublishingLicenseInfo > __CDECL GetPublishingLicenseInfo(const std::vector< uint8_t > &serializedPublishingLicense, const std::shared_ptr< MipContext > &mipContext)
Creates a holder for details of a Publishing License and can be used to create a Protection Handler.
static MIP_API std::shared_ptr< ProtectionProfile > __CDECL Load(const Settings &settings)
Loading a profile based on the provided settings.
static MIP_API const char *__CDECL GetVersion()
Gets library version.
virtual void DeleteEngine(const std::string &engineId)=0
Delete the protection engine with the given ID.
virtual std::shared_ptr< AsyncControl > ListEnginesAsync(const std::shared_ptr< void > &context)=0
Starts list engines operation.
static MIP_API std::shared_ptr< AsyncControl > __CDECL LoadAsync(const Settings &settings, const std::shared_ptr< void > &context)
Starts loading a profile based on the provided settings.
virtual const Settings & GetSettings() const =0
Gets settings used by ProtectionProfile during its initialization and throughout its lifetime.
virtual std::shared_ptr< ProtectionEngine > AddEngine(const ProtectionEngine::Settings &settings)=0
Add a new protection engine to the profile.
virtual std::shared_ptr< AsyncControl > DeleteEngineAsync(const std::string &engineId, const std::shared_ptr< void > &context)=0
Starts deleting the protection engine with the given ID.
A file Containing the common types used by the upe, file and protection modules.
CacheStorageType
Storage type for the caches.
A file Containing types used to control dns redirection.
DnsRedirection
Storage type for the caches.
@ MDEDiscovery
MDE DNS.
A file containing the MIP SDK error types.
Contains HttpDelegate interface definition used to override MIP HTTP stack.
A file containing the LoggerDelegate class to be used to override MIP logger.
File containing definition of MipContext.
A file export/import macros.
MIP namespace macros.
A file containing the common types used by the protection module.
Defines ProtectionEngine interface.
A file containing the TaskDispatcherDelegate interface to be used to override MIP async task executor...
Contains XmlDelegate interface definition used to parse xml recieved by mip.