Microsoft Information Protection (MIP) SDK for C++: Reference 1.16
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, ignored if cacheStorageType is specified in MipConfiguration
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 */
178 const std::shared_ptr<MipContext>& mipContext,
179 CacheStorageType cacheStorageType,
180 const std::shared_ptr<ConsentDelegate>& consentDelegate,
181 const std::shared_ptr<ProtectionProfile::Observer>& observer)
182 : mMipContext(mipContext),
183 mCacheStorageType(cacheStorageType),
184 mConsentDelegate(consentDelegate),
185 mObserver(observer),
186 mCanCacheLicenses(true),
187#if defined(MIP_OFFLINE_PUBLISHING_ENABLED) || defined(SWIG) || defined(SWIG_DIRECTORS)
188 mOfflinePublishing(false),
189#endif // MIP_OFFLINE_PUBLISHING_ENABLED
190 mDnsRedirection(DnsRedirection::MDEDiscovery) {
191 }
192
193 /**
194 * @brief ProtectionProfile::Settings constructor, used for synchronous operations
195 *
196 * @param mipContext Global context settings
197 * @param cacheStorageType Store any cached state in memory or on disk, ignored if cacheStorageType is specified in MipConfiguration
198 * @param consentDelegate Delegate used to obtain user permission to access external resources
199 */
201 const std::shared_ptr<MipContext>& mipContext,
202 CacheStorageType cacheStorageType,
203 const std::shared_ptr<ConsentDelegate>& consentDelegate)
204 : Settings(mipContext, cacheStorageType, consentDelegate, nullptr /*observer*/) {
205 }
206
207 /** @cond DOXYGEN_HIDE */
208 ~Settings() { }
209 /** @endcond */
210
211 /**
212 * @brief Get whether caches are stored in memory or on disk
213 *
214 * @return storage type used
215 */
216 CacheStorageType GetCacheStorageType() const { return mCacheStorageType; }
217
218 /**
219 * @brief Gets the consent delegate used for connecting to services
220 *
221 * @return Consent delegate used for connecting to services
222 */
223 std::shared_ptr<ConsentDelegate> GetConsentDelegate() const { return mConsentDelegate; }
224
225 /**
226 * @brief Gets the observer that receives notifications of events related to ProtectionProfile
227 *
228 * @return Observer that receives notifications of events related to ProtectionProfile
229 */
230 std::shared_ptr<ProtectionProfile::Observer> GetObserver() const { return mObserver; }
231
232 /**
233 * @brief Get MIP context which represents shared state across all profiles
234 *
235 * @return MIP context
236 */
237 std::shared_ptr<MipContext> GetMipContext() const { return mMipContext; }
238
239 /**
240 * @brief Get the HTTP delegate (if any) provided by the application
241 *
242 * @return HTTP delegate to be used for HTTP operations
243 */
244 std::shared_ptr<HttpDelegate> GetHttpDelegate() const { return mHttpDelegate; }
245
246 /**
247 * @brief Override default HTTP stack with client's own
248 *
249 * @param httpDelegate HTTP callback interface implemented by client application
250 */
251 void SetHttpDelegate(const std::shared_ptr<HttpDelegate>& httpDelegate) { mHttpDelegate = httpDelegate; }
252
253 /**
254 * @brief Get the #StorageDelegate (if any) provided by the application
255 *
256 * @return #StorageDelegate to be used for caching
257 */
258 std::shared_ptr<StorageDelegate> GetStorageDelegate() const { return mStorageDelegate; }
259
260 /**
261 * @brief Override default storage cache with client's own implementation.
262 *
263 * @param storageDelegate #StorageDelegate interface implemented by client application
264 */
265 void SetStorageDelegate(const std::shared_ptr<StorageDelegate>& storageDelegate) { mStorageDelegate = storageDelegate; }
266
267 /**
268 * @brief Get the TaskDispatcher delegate (if any) provided by the application
269 *
270 * @return TaskDispatcher delegate to be used for executing asynchronous tasks
271 */
272 std::shared_ptr<TaskDispatcherDelegate> GetTaskDispatcherDelegate() const { return mTaskDispatcherDelegate; }
273
274 /**
275 * @brief Override default asynchonous task dispatching handling with client's own
276 *
277 * @param taskDispatcherDelegate Task dispatching callback interface implemented by client application
278 *
279 * @note tasks can reference profile objects preventing its destruction as a result
280 * taskdispatcher queues should not be shared.
281 */
282 void SetTaskDispatcherDelegate(const std::shared_ptr<TaskDispatcherDelegate>& taskDispatcherDelegate) {
283 mTaskDispatcherDelegate = taskDispatcherDelegate;
284 }
285
286 /**
287 * @brief Sets the session ID
288 *
289 * @param sessionId Session ID that will be used to correlate logs/telemetry
290 */
291 void SetSessionId(const std::string& sessionId) { mSessionId = sessionId; }
292
293 /**
294 * @brief Gets the session ID
295 *
296 * @return Session ID that will be used to correlate logs/telemetry
297 */
298 const std::string& GetSessionId() const { return mSessionId; }
299
300 /**
301 * @brief Configures whether or not end user licenses (EULs) will be cached locally
302 *
303 * @param canCacheLicenses Whether or not engine should cache a license when opening protected content
304 *
305 * @note If true, opening protected content will cache the associated license locally. If false, opening protected
306 * content will always perform HTTP operation to acquire the license from the RMS service.
307 */
308 void SetCanCacheLicenses(bool canCacheLicenses) {
309 mCanCacheLicenses = canCacheLicenses;
310 }
311
312 /**
313 * @brief Gets whether or not end user licenses (EULs) are cached locally
314 *
315 * @return License caching configuration
316 */
317 bool CanCacheLicenses() const {
318 return mCanCacheLicenses;
319 }
320
321 /**
322 * @brief Set the custom settings, used for feature gating and testing.
323 *
324 * @param customSettings List of name/value pairs.
325 */
326 void SetCustomSettings(const std::vector<std::pair<std::string, std::string>>& customSettings) {
327 mCustomSettings = customSettings;
328 }
329
330 /**
331 * @brief Get the custom settings, used for feature gating and testing.
332 *
333 * @return List of name/value pairs.
334 */
335 const std::vector<std::pair<std::string, std::string>>& GetCustomSettings() const {
336 return mCustomSettings;
337 }
338
339#if !defined(SWIG) && !defined(SWIG_DIRECTORS)
340 /**
341 * @brief Get logger context that will be opaquely passed to the logger delegate for logs associated with the created profile
342 *
343 * @return The logger context
344 */
345 const std::shared_ptr<void>& GetLoggerContext() const { return mLoggerContext; }
346#endif
347
348 /**
349 * @brief Sets the logger context that will be opaquely passed to the logger delegate for logs associated with the created profile
350 *
351 * @param loggerContext The logger context
352 *
353 */
354 void SetLoggerContext(const std::shared_ptr<void>& loggerContext) {
355 mLoggerContext = loggerContext;
356 }
357
358 /**
359 * @brief Adds a redirect uri
360 *
361 * @param originalUri The uri that should be redirected from
362 * @param redirectUri The uri that will replace the originalUri
363 *
364 * @note Use this function to provide a domain that should be redirected to another Uri
365 * The originalUri will be normalized before comparison with the domain for the current request.
366 * If the domain of the current request matches that of the originalUri then the redirectUri will be used instead
367 * This redirection will occur before DNS lookup redirection
368 */
369 void AddRedirectionUri(const std::string& originalUri, const std::string& redirectUri) {
370 mRedirectionUris[originalUri] = redirectUri;
371 }
372
373 /**
374 * @brief Gets the redirection uris
375 *
376 * @return Map of redirection uris
377 */
378 const std::map<std::string, std::string>& GetRedirectionUris() const {
379 return mRedirectionUris;
380 }
381#if defined(MIP_OFFLINE_PUBLISHING_ENABLED) || defined(SWIG) || defined(SWIG_DIRECTORS)
382 /**
383 * @brief Gets offline publishing status
384 *
385 * @return A boolean value indicating whether or not offline publishing is enabled
386 */
387 bool GetOfflinePublishing() const {
388 return mOfflinePublishing;
389 }
390
391 /**
392 * @brief Enables or disables offline publishing
393 *
394 * @param offlinePublishing A boolean value indicating whether or not offline publishing is enabled
395 *
396 */
397 void SetOfflinePublishing(bool offlinePublishing) {
398 mOfflinePublishing = offlinePublishing;
399 }
400#endif // MIP_OFFLINE_PUBLISHING_ENABLED
401
402 /**
403 * @brief Gets the dns redirect mode
404 *
405 * @return The redirect mode used
406 */
408 return mDnsRedirection;
409 }
410
411 /**
412 * @brief Sets the dns redirection mode that controls how redirection is handled during online operations
413 *
414 * @param dnsRedirection The redirection mode to use
415 */
416 void SetDnsRedirection(DnsRedirection dnsRedirection) {
417 mDnsRedirection = dnsRedirection;
418 }
419
420 private:
421 std::shared_ptr<MipContext> mMipContext;
422 CacheStorageType mCacheStorageType;
423 std::shared_ptr<ConsentDelegate> mConsentDelegate;
424 std::shared_ptr<ProtectionProfile::Observer> mObserver;
425 std::shared_ptr<HttpDelegate> mHttpDelegate;
426 std::shared_ptr<TaskDispatcherDelegate> mTaskDispatcherDelegate;
427 std::string mSessionId;
428 bool mCanCacheLicenses = true;
429 std::vector<std::pair<std::string, std::string>> mCustomSettings;
430 std::shared_ptr<void> mLoggerContext;
431 std::map<std::string, std::string> mRedirectionUris;
432 std::shared_ptr<StorageDelegate> mStorageDelegate;
433#if defined(MIP_OFFLINE_PUBLISHING_ENABLED) || defined(SWIG) || defined(SWIG_DIRECTORS)
434 bool mOfflinePublishing;
435#endif // MIP_OFFLINE_PUBLISHING_ENABLED
436 DnsRedirection mDnsRedirection;
437 };
438
439 /**
440 * @brief Starts loading a profile based on the provided settings.
441 *
442 * @param settings Settings used by ProtectionProfile during its initialization and throughout its lifetime
443 * @param context This same context will be forwarded to ProtectionProfile::Observer::OnLoadSuccess or
444 * ProtectionProfile::Observer::OnLoadFailure as-is.
445 *
446 * @return Async control object.
447 *
448 * @note ProtectionProfile::Observer will be called upon success or failure.
449 */
450 MIP_API static std::shared_ptr<AsyncControl> __CDECL LoadAsync(
451 const Settings& settings,
452 const std::shared_ptr<void>& context);
453
454 /**
455 * @brief Loading a profile based on the provided settings.
456 *
457 * @param settings Settings used by ProtectionProfile during its initialization and throughout its lifetime
458 *
459 * @return Newly created profile
460 */
461 MIP_API static std::shared_ptr<ProtectionProfile> __CDECL Load(const Settings& settings);
462
463 /**
464 * @brief Gets library version
465 *
466 * @return Library version
467 */
468 MIP_API static const char* __CDECL GetVersion();
469
470 /**
471 * @brief Gets settings used by ProtectionProfile during its initialization and throughout its lifetime
472 *
473 * @return Settings used by ProtectionProfile during its initialization and throughout its lifetime
474 */
475 virtual const Settings& GetSettings() const = 0;
476
477 /**
478 * @brief Starts list engines operation.
479 *
480 * @param context Client context that will be opaquely passed back to observers
481 *
482 * @return Async control object.
483 *
484 * @note ProtectionProfile::Observer will be called upon success or failure.
485 */
486 virtual std::shared_ptr<AsyncControl> ListEnginesAsync(const std::shared_ptr<void>& context) = 0;
487
488 /**
489 * @brief List engines.
490 *
491 * @return Cached engine IDs
492 */
493 virtual std::vector<std::string> ListEngines() = 0;
494
495 /**
496 * @brief Starts adding a new protection engine to the profile.
497 *
498 * @param settings the mip::ProtectionEngine::Settings object that specifies the engine's settings.
499 * @param context Client context that will be opaquely passed back to observers
500 *
501 * @return Async control object.
502 *
503 * @note ProtectionProfile::Observer will be called upon success or failure.
504 */
505 virtual std::shared_ptr<AsyncControl> AddEngineAsync(
506 const ProtectionEngine::Settings& settings,
507 const std::shared_ptr<void>& context) = 0;
508
509 /**
510 * @brief Add a new protection engine to the profile.
511 *
512 * @param settings the mip::ProtectionEngine::Settings object that specifies the engine's settings.
513 *
514 * @return Newly created ProtectionEngine
515 */
516 virtual std::shared_ptr<ProtectionEngine> AddEngine(const ProtectionEngine::Settings& settings) = 0;
517
518 /**
519 * @brief Starts deleting the protection engine with the given ID. All data for the given engine will be deleted.
520 *
521 * @param id the unique engine ID.
522 * @param context Client context that will be opaquely passed back to observers
523 *
524 * @return Async control object.
525 *
526 * @note ProtectionProfile::Observer will be called upon success or failure.
527 */
528 virtual std::shared_ptr<AsyncControl> DeleteEngineAsync(
529 const std::string& engineId,
530 const std::shared_ptr<void>& context) = 0;
531
532 /**
533 * @brief Delete the protection engine with the given ID. All data for the given engine will be deleted.
534 *
535 * @param id the unique engine ID.
536 */
537 virtual void DeleteEngine(const std::string& engineId) = 0;
538
539#ifndef MIP_CORE_PACKAGE
540 /**
541 * @brief Creates a holder for details of a Publishing License and can be used to create a Protection Handler
542 *
543 * @param serializedPublishingLicense the serialized publishing license.
544 *
545 * @return a holder for details of a Publishing License
546 *
547 * @note The returned PublishingLicenseInfo is parsed
548 */
549#if !defined(SWIG) && !defined(SWIG_DIRECTORS)
550 [[deprecated("ProtectionProfile::GetPublishingLicenseInfo(const std::vector<uint8_t>&) is deprecated, use ProtectionProfile::GetPublishingLicenseInfo(const std::vector<uint8_t>&, const std::shared_ptr<MipContext>&)")]]
551#endif
552 MIP_API static std::shared_ptr<PublishingLicenseInfo> __CDECL GetPublishingLicenseInfo(
553 const std::vector<uint8_t>& serializedPublishingLicense);
554#endif // !MIP_CORE_PACKAGE
555
556 /**
557 * @brief Creates a holder for details of a Publishing License and can be used to create a Protection Handler. Allows delegate overrides.
558 *
559 * @param serializedPublishingLicense the serialized publishing license.
560 * @param mipContext a MIP context containing delegate overrides.
561 *
562 * @return a holder for details of a Publishing License
563 *
564 * @note The returned PublishingLicenseInfo is parsed
565 */
566 MIP_API static std::shared_ptr<PublishingLicenseInfo> __CDECL GetPublishingLicenseInfo(
567 const std::vector<uint8_t>& serializedPublishingLicense,
568 const std::shared_ptr<MipContext>& mipContext);
569
570 /** @cond DOXYGEN_HIDE */
571 virtual ~ProtectionProfile() { }
572 /** @endcond */
573 };
574
575MIP_NAMESPACE_END
576
577#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. All data for the given engine will be deleted.
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. All data for the given engine will be delete...
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.
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...