// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary // source code may only be used and distributed under the Widevine Master // License Agreement. #ifndef CAS_STATUS_H #define CAS_STATUS_H #include namespace wvcas { // TODO(jfore): Add more detailed error status codes. enum class CasStatusCode : int32_t { kUnknownError = 0, kNoError = 1, kCryptoInterfaceError = 2, kCryptoSessionError = 3, kCasLicenseError = 4, kIndividualizationError = 5, kInvalidParameter = 6, kDecryptionError = 7, kKeyNotFound = 8, kSessionNotFound = 9, kUnknownLicenseType = 10, kLicenseFileParseError = 11, kInvalidLicenseFile = 12, kInvalidPesData = 13, kDeferedEcmProcessing = 14, kAccessDeniedByParentalControl = 15, kUnknownEvent = 16, kOEMCryptoVersionMismatch = 17, kDeviceCertificateError = 18, kClientIdEncryptionError = 19, kProvisioningError = 20, }; class CasStatus { public: CasStatus(CasStatusCode status = CasStatusCode::kNoError, const std::string& err_string = std::string()) : status_(status), err_string_(err_string) {} static CasStatus OkStatus() { return CasStatus(); } virtual ~CasStatus() {} virtual CasStatusCode status_code() const { return status_; } virtual const std::string& error_string() const { return err_string_; } virtual bool ok() const { return status_ == CasStatusCode::kNoError; } private: CasStatusCode status_; std::string err_string_; }; } // namespace wvcas #endif // CAS_STATUS_H