blob: 68f2d0511f04fe9c09fe665bf2bed009cc6ce895 [file] [log] [blame]
Xiaohan Wang379a1802017-01-13 13:14:10 -08001// Copyright 2017 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CDM_CONTENT_DECRYPTION_MODULE_EXT_H_
6#define CDM_CONTENT_DECRYPTION_MODULE_EXT_H_
7
8#if defined(WIN32)
9#include <windows.h>
10#endif
11
12#include "content_decryption_module_export.h"
13
14#if defined(_MSC_VER)
15typedef unsigned int uint32_t;
16#else
17#include <stdint.h>
18#endif
19
20namespace cdm {
21
22#if defined(WIN32)
23typedef wchar_t FilePathCharType;
24typedef HANDLE PlatformFile;
25const PlatformFile kInvalidPlatformFile = INVALID_HANDLE_VALUE;
26#elif defined(OS_POSIX)
27typedef char FilePathCharType;
28typedef int PlatformFile;
29const PlatformFile kInvalidPlatformFile = -1;
30#else // !defined(WIN32) && !defined(OS_POSIX)
31#error Unsupported platform.
32#endif // defined(WIN32)
33
34struct HostFile {
35 HostFile(const FilePathCharType* file_path,
36 PlatformFile file,
37 PlatformFile sig_file)
38 : file_path(file_path), file(file), sig_file(sig_file) {}
39
40 // File that is part of the host of the CDM.
41 const FilePathCharType* file_path = nullptr;
42 PlatformFile file = kInvalidPlatformFile;
43
44 // Signature file for |file|.
45 PlatformFile sig_file = kInvalidPlatformFile;
46};
47
48} // namespace cdm
49
50extern "C" {
51
Xiaohan Wangf45b8d92017-01-19 11:50:46 -080052// Functions in this file are dynamically retrieved by their versioned function
53// names. Increment the version number for any backward incompatible API
54// changes.
55
56// Verifies CDM host. All files in |host_files| are opened in read-only mode.
57//
58// Returns false and closes all files if there is an immediate failure.
59// Otherwise returns true as soon as possible and processes the files
Xiaohan Wang379a1802017-01-13 13:14:10 -080060// asynchronously. All files MUST be closed by the CDM after this one-time
61// processing is finished.
Xiaohan Wangf45b8d92017-01-19 11:50:46 -080062CDM_API bool VerifyHost_0(const cdm::HostFile* host_files, uint32_t num_files);
Xiaohan Wang379a1802017-01-13 13:14:10 -080063}
64
65#endif // CDM_CONTENT_DECRYPTION_MODULE_EXT_H_