33#ifndef API_MIP_PROTECTION_PROTECTION_PROFILE_H_
34#define API_MIP_PROTECTION_PROTECTION_PROFILE_H_
83 const std::shared_ptr<ProtectionProfile>& profile,
84 const std::shared_ptr<void>& context) { UNUSED(profile); UNUSED(context); }
97 const std::exception_ptr& error,
98 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
107 const std::vector<std::string>& engineIds,
108 const std::shared_ptr<void>& context) { UNUSED(engineIds); UNUSED(context); }
117 const std::exception_ptr& error,
118 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
127 const std::shared_ptr<ProtectionEngine>& engine,
128 const std::shared_ptr<void>& context) { UNUSED(engine); UNUSED(context); }
137 const std::exception_ptr& error,
138 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
146 const std::shared_ptr<void>& context) { UNUSED(context); }
155 const std::exception_ptr& error,
156 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
179 const std::shared_ptr<MipContext>& mipContext,
181 const std::shared_ptr<ConsentDelegate>& consentDelegate,
182 const std::shared_ptr<ProtectionProfile::Observer>& observer)
183 : mMipContext(mipContext),
184 mCacheStorageType(cacheStorageType),
185 mConsentDelegate(consentDelegate),
187 mCanCacheLicenses(true),
188#if defined(MIP_OFFLINE_PUBLISHING_ENABLED) || defined(SWIG) || defined(SWIG_DIRECTORS)
189 mOfflinePublishing(false),
203 const std::shared_ptr<MipContext>& mipContext,
205 const std::shared_ptr<ConsentDelegate>& consentDelegate)
206 :
Settings(mipContext, cacheStorageType, consentDelegate, nullptr ) {
232 std::shared_ptr<ProtectionProfile::Observer>
GetObserver()
const {
return mObserver; }
253 void SetHttpDelegate(
const std::shared_ptr<HttpDelegate>& httpDelegate) { mHttpDelegate = httpDelegate; }
267 void SetStorageDelegate(
const std::shared_ptr<StorageDelegate>& storageDelegate) { mStorageDelegate = storageDelegate; }
285 mTaskDispatcherDelegate = taskDispatcherDelegate;
293 void SetSessionId(
const std::string& sessionId) { mSessionId = sessionId; }
311 mCanCacheLicenses = canCacheLicenses;
320 return mCanCacheLicenses;
328 void SetCustomSettings(
const std::vector<std::pair<std::string, std::string>>& customSettings) {
329 mCustomSettings = customSettings;
338 return mCustomSettings;
341#if !defined(SWIG) && !defined(SWIG_DIRECTORS)
357 mLoggerContext = loggerContext;
372 mRedirectionUris[originalUri] = redirectUri;
381 return mRedirectionUris;
383#if defined(MIP_OFFLINE_PUBLISHING_ENABLED) || defined(SWIG) || defined(SWIG_DIRECTORS)
389 bool GetOfflinePublishing()
const {
390 return mOfflinePublishing;
399 void SetOfflinePublishing(
bool offlinePublishing) {
400 mOfflinePublishing = offlinePublishing;
410 return mDnsRedirection;
419 mDnsRedirection = dnsRedirection;
423 std::shared_ptr<MipContext> mMipContext;
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;
452 MIP_API
static std::shared_ptr<AsyncControl> __CDECL
LoadAsync(
454 const std::shared_ptr<void>& context);
463 MIP_API
static std::shared_ptr<ProtectionProfile> __CDECL
Load(
const Settings& settings);
488 virtual std::shared_ptr<AsyncControl>
ListEnginesAsync(
const std::shared_ptr<void>& context) = 0;
509 const std::shared_ptr<void>& context) = 0;
531 const std::string& engineId,
532 const std::shared_ptr<void>& context) = 0;
541#ifndef MIP_CORE_PACKAGE
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>&)")]]
555 const std::vector<uint8_t>& serializedPublishingLicense);
569 const std::vector<uint8_t>& serializedPublishingLicense,
570 const std::shared_ptr<MipContext>& mipContext);
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.
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.
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.