Source release v3.3.0
This commit is contained in:
@@ -3,9 +3,11 @@
|
||||
#ifndef WVCDM_CORE_CDM_ENGINE_H_
|
||||
#define WVCDM_CORE_CDM_ENGINE_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "cdm_session_map.h"
|
||||
#include "certificate_provisioning.h"
|
||||
#include "clock.h"
|
||||
#include "crypto_session.h"
|
||||
@@ -26,11 +28,9 @@ class CryptoEngine;
|
||||
class UsagePropertySet;
|
||||
class WvCdmEventListener;
|
||||
|
||||
typedef std::map<CdmSessionId, CdmSession*> CdmSessionMap;
|
||||
typedef std::map<
|
||||
CdmKeySetId,
|
||||
std::pair<CdmSessionId, int64_t /* expiration time in seconds */> >
|
||||
CdmReleaseKeySetMap;
|
||||
// Keep expiration time for each key set
|
||||
typedef std::map<CdmKeySetId,
|
||||
std::pair<CdmSessionId, int64_t> > CdmReleaseKeySetMap;
|
||||
|
||||
class CdmEngine {
|
||||
public:
|
||||
@@ -44,6 +44,20 @@ class CdmEngine {
|
||||
virtual CdmResponseType SetServiceCertificate(
|
||||
const std::string& certificate);
|
||||
|
||||
// Report whether the service certificate has been set.
|
||||
virtual bool HasServiceCertificate();
|
||||
|
||||
// Generate and return a Service Certificate Request message.
|
||||
// This message can be sent to the License Server to get a service
|
||||
// certificate.
|
||||
virtual bool GetServiceCertificateRequest(CdmKeyMessage* request);
|
||||
|
||||
// Parse the message returned by the License Server in response to a
|
||||
// Service Certificate Request message. Return the service certificate
|
||||
// from the parsed response.
|
||||
virtual CdmResponseType ParseServiceCertificateResponse(
|
||||
const std::string& response, std::string* certificate);
|
||||
|
||||
// Session related methods
|
||||
virtual CdmResponseType OpenSession(
|
||||
const CdmKeySystem& key_system, CdmClientPropertySet* property_set,
|
||||
@@ -158,24 +172,45 @@ class CdmEngine {
|
||||
virtual CdmResponseType Unprovision(CdmSecurityLevel security_level);
|
||||
|
||||
// Delete OEMCrypto usage tables. Used by Unprovision().
|
||||
CdmResponseType DeleteUsageTable(CdmSecurityLevel security_level);
|
||||
virtual CdmResponseType DeleteUsageTable(CdmSecurityLevel security_level);
|
||||
|
||||
// Return the list of key_set_ids stored on the current (origin-specific)
|
||||
// file system.
|
||||
virtual CdmResponseType ListStoredLicenses(
|
||||
CdmSecurityLevel security_level, std::vector<std::string>* key_set_ids);
|
||||
|
||||
// Return the list of key_set_ids stored as usage records on the
|
||||
// current (origin-specific) file system.
|
||||
virtual CdmResponseType ListUsageRecords(
|
||||
const std::string& app_id, CdmSecurityLevel security_level,
|
||||
std::vector<std::string>* ksids);
|
||||
|
||||
// Delete the usage record for the given key_set_id. This removes the
|
||||
// usage record in the file system and the OEMCrypto usage record.
|
||||
virtual CdmResponseType DeleteUsageRecord(const std::string& app_id,
|
||||
CdmSecurityLevel security_level,
|
||||
const std::string& key_set_id);
|
||||
|
||||
// Usage related methods for streaming licenses
|
||||
// Retrieve a random usage info from the list of all usage infos for this app
|
||||
// id.
|
||||
virtual CdmResponseType GetUsageInfo(const std::string& app_id,
|
||||
CdmUsageInfo* usage_info);
|
||||
|
||||
// Retrieve the usage info for the specified pst.
|
||||
// Returns UNKNOWN_ERROR if no usage info was found.
|
||||
virtual CdmResponseType GetUsageInfo(const std::string& app_id,
|
||||
const CdmSecureStopId& ssid,
|
||||
CdmUsageInfo* usage_info);
|
||||
|
||||
// Release all usage records for the current origin.
|
||||
virtual CdmResponseType ReleaseAllUsageInfo(const std::string& app_id,
|
||||
CdmSecurityLevel security_level);
|
||||
|
||||
// Release all usage records for the current origin. Span all
|
||||
// security levels.
|
||||
virtual CdmResponseType ReleaseAllUsageInfo(const std::string& app_id);
|
||||
|
||||
virtual CdmResponseType ReleaseUsageInfo(
|
||||
const CdmUsageInfoReleaseMessage& message);
|
||||
virtual CdmResponseType LoadUsageSession(const CdmKeySetId& key_set_id,
|
||||
@@ -215,7 +250,7 @@ class CdmEngine {
|
||||
CdmSigningAlgorithm algorithm,
|
||||
const std::string& signature);
|
||||
|
||||
virtual size_t SessionSize() const { return sessions_.size(); }
|
||||
virtual size_t SessionSize() const { return session_map_.Size(); }
|
||||
|
||||
// Is the key known to any session?
|
||||
virtual bool IsKeyLoaded(const KeyId& key_id);
|
||||
@@ -255,7 +290,7 @@ class CdmEngine {
|
||||
void CloseExpiredReleaseSessions();
|
||||
|
||||
// instance variables
|
||||
CdmSessionMap sessions_;
|
||||
CdmSessionMap session_map_;
|
||||
CdmReleaseKeySetMap release_key_sets_;
|
||||
scoped_ptr<CertificateProvisioning> cert_provisioning_;
|
||||
SecurityLevel cert_provisioning_requested_security_level_;
|
||||
@@ -276,14 +311,7 @@ class CdmEngine {
|
||||
scoped_ptr<UsagePropertySet> usage_property_set_;
|
||||
int64_t last_usage_information_update_time_;
|
||||
|
||||
// Locks the list of sessions, |sessions_|, for the event timer. It will be
|
||||
// locked in OpenSession, CloseSession. It is also locked in OnTimerEvent and
|
||||
// OnKeyReleaseEvent while the list of event listeners is being generated.
|
||||
// The layer above the CDM implementation is expected to handle thread
|
||||
// synchronization to make sure other functions that access sessions do not
|
||||
// occur simultaneously with OpenSession or CloseSession.
|
||||
Lock session_list_lock_;
|
||||
|
||||
// Protect release_key_sets_ from non-thread-safe operations.
|
||||
Lock release_key_sets_lock_;
|
||||
|
||||
CORE_DISALLOW_COPY_AND_ASSIGN(CdmEngine);
|
||||
|
||||
Reference in New Issue
Block a user