1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef LICENSE_FETCHER_H_
18 #define LICENSE_FETCHER_H_
19 
20 #include "protos/license_protos.pb.h"
21 #include <media/stagefright/foundation/ABase.h>
22 
23 namespace android {
24 namespace clearkeycas {
25 
26 // Interface for classes which request a license.
27 class LicenseFetcher {
28 public:
LicenseFetcher()29     LicenseFetcher() {}
~LicenseFetcher()30     virtual ~LicenseFetcher() {}
31 
32     // Initializes resources set in subclass-specific calls. This must be called
33     // before threads are started.
34     virtual status_t Init(const char *input) = 0;
35 
36     // Fetches license based on |asset_id|.  On return, |asset| contains the
37     // decrypted asset_key needed to decrypt content keys.
38     // |asset| must be non-null.
39     virtual status_t FetchLicense(
40             uint64_t asset_id, clearkeycas::Asset* asset) = 0;
41 
42 private:
43     DISALLOW_EVIL_CONSTRUCTORS(LicenseFetcher);
44 };
45 
46 }  // namespace clearkeycas
47 }  // namespace android
48 
49 #endif  // LICENSE_FETCHER_H_
50