[ Merge from Widevine CDM repo of https://widevine-internal-review.googlesource.com/#/c/10171/ and https://widevine-internal-review.googlesource.com/#/c/10172/ ] Updated license_protocol.proto from constituent protos in google3 These changes make use of OEMCrypto v9 changes to support usage reporting. Usage reporting may be enabled for streaming (by means of secure stops) and offline playback by a provider session token specified in the license. Changes include periodically updating usage information for relevant sessions and reporting and releasing usage information as needed. The CDM has removed all references to Secure Stops. This change updates the Android API implementation to comply. b/11987015 Change-Id: Ibb6f2ced4ef20ee349ca1ae6412ce686b2b5d085
89 lines
3.2 KiB
C++
89 lines
3.2 KiB
C++
// Copyright 2013 Google Inc. All Rights Reserved.
|
|
//
|
|
#ifndef WVCDM_CORE_DEVICE_FILES_H_
|
|
#define WVCDM_CORE_DEVICE_FILES_H_
|
|
|
|
#include "wv_cdm_types.h"
|
|
|
|
namespace wvcdm {
|
|
|
|
class File;
|
|
|
|
class DeviceFiles {
|
|
public:
|
|
typedef enum {
|
|
kLicenseStateActive,
|
|
kLicenseStateReleasing,
|
|
kLicenseStateUnknown,
|
|
} LicenseState;
|
|
|
|
DeviceFiles(): file_(NULL), security_level_(kSecurityLevelUninitialized),
|
|
initialized_(false), test_file_(false) {}
|
|
virtual ~DeviceFiles();
|
|
|
|
virtual bool Init(CdmSecurityLevel security_level);
|
|
|
|
virtual bool StoreCertificate(const std::string& certificate,
|
|
const std::string& wrapped_private_key);
|
|
virtual bool RetrieveCertificate(std::string* certificate,
|
|
std::string* wrapped_private_key);
|
|
|
|
virtual bool StoreLicense(const std::string& key_set_id,
|
|
const LicenseState state,
|
|
const CdmInitData& pssh_data,
|
|
const CdmKeyMessage& key_request,
|
|
const CdmKeyResponse& key_response,
|
|
const CdmKeyMessage& key_renewal_request,
|
|
const CdmKeyResponse& key_renewal_response,
|
|
const std::string& release_server_url);
|
|
virtual bool RetrieveLicense(const std::string& key_set_id,
|
|
LicenseState* state,
|
|
CdmInitData* pssh_data,
|
|
CdmKeyMessage* key_request,
|
|
CdmKeyResponse* key_response,
|
|
CdmKeyMessage* key_renewal_request,
|
|
CdmKeyResponse* key_renewal_response,
|
|
std::string* release_server_url);
|
|
virtual bool DeleteLicense(const std::string& key_set_id);
|
|
virtual bool DeleteAllFiles();
|
|
virtual bool DeleteAllLicenses();
|
|
virtual bool LicenseExists(const std::string& key_set_id);
|
|
|
|
virtual bool StoreUsageInfo(const std::string& provider_session_token,
|
|
const CdmKeyMessage& key_request,
|
|
const CdmKeyResponse& key_response);
|
|
virtual bool DeleteUsageInfo(const std::string& provider_session_token);
|
|
virtual bool DeleteUsageInfo();
|
|
virtual bool RetrieveUsageInfo(
|
|
std::vector<std::pair<CdmKeyMessage, CdmKeyResponse> >* usage_info);
|
|
|
|
// For testing only
|
|
static std::string GetCertificateFileName();
|
|
static std::string GetLicenseFileNameExtension();
|
|
static std::string GetUsageInfoFileName();
|
|
void SetTestFile(File* file);
|
|
|
|
protected:
|
|
bool Hash(const std::string& data, std::string* hash);
|
|
bool StoreFile(const char* name, const std::string& serialized_file);
|
|
bool RetrieveFile(const char* name, std::string* serialized_file);
|
|
|
|
private:
|
|
// Certificate and offline licenses are now stored in security
|
|
// level specific directories. In an earlier version they were
|
|
// stored in a common directory and need to be copied over.
|
|
virtual void SecurityLevelPathBackwardCompatibility();
|
|
|
|
File* file_;
|
|
CdmSecurityLevel security_level_;
|
|
bool initialized_;
|
|
|
|
bool test_file_;
|
|
|
|
CORE_DISALLOW_COPY_AND_ASSIGN(DeviceFiles);
|
|
};
|
|
|
|
} // namespace wvcdm
|
|
|
|
#endif // WVCDM_CORE_DEVICE_FILES_H_
|