blob: 5df8344e60a23988cd33d7b7c4ffabec2852502c [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
Xiaohan Wang56e73fc2017-04-03 16:06:12 -07008#if defined(_WIN32)
Xiaohan Wang379a1802017-01-13 13:14:10 -08009#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
Xiaohan Wang56e73fc2017-04-03 16:06:12 -070022#if defined(_WIN32)
Xiaohan Wang379a1802017-01-13 13:14:10 -080023typedef wchar_t FilePathCharType;
24typedef HANDLE PlatformFile;
25const PlatformFile kInvalidPlatformFile = INVALID_HANDLE_VALUE;
Xiaohan Wang56e73fc2017-04-03 16:06:12 -070026#else
Xiaohan Wang379a1802017-01-13 13:14:10 -080027typedef char FilePathCharType;
28typedef int PlatformFile;
29const PlatformFile kInvalidPlatformFile = -1;
Xiaohan Wang56e73fc2017-04-03 16:06:12 -070030#endif // defined(_WIN32)
Xiaohan Wang379a1802017-01-13 13:14:10 -080031
32struct HostFile {
33 HostFile(const FilePathCharType* file_path,
34 PlatformFile file,
35 PlatformFile sig_file)
36 : file_path(file_path), file(file), sig_file(sig_file) {}
37
38 // File that is part of the host of the CDM.
39 const FilePathCharType* file_path = nullptr;
40 PlatformFile file = kInvalidPlatformFile;
41
42 // Signature file for |file|.
43 PlatformFile sig_file = kInvalidPlatformFile;
44};
45
46} // namespace cdm
47
48extern "C" {
49
Xiaohan Wangf45b8d92017-01-19 11:50:46 -080050// Functions in this file are dynamically retrieved by their versioned function
51// names. Increment the version number for any backward incompatible API
52// changes.
53
54// Verifies CDM host. All files in |host_files| are opened in read-only mode.
55//
56// Returns false and closes all files if there is an immediate failure.
57// Otherwise returns true as soon as possible and processes the files
Xiaohan Wang379a1802017-01-13 13:14:10 -080058// asynchronously. All files MUST be closed by the CDM after this one-time
59// processing is finished.
Xiaohan Wang46eebfa2017-01-19 13:36:24 -080060CDM_API bool VerifyCdmHost_0(const cdm::HostFile* host_files,
61 uint32_t num_files);
Xiaohan Wang379a1802017-01-13 13:14:10 -080062}
63
64#endif // CDM_CONTENT_DECRYPTION_MODULE_EXT_H_