• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 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 HIDL_GEN_HASH_HASH_H_
18 #define HIDL_GEN_HASH_HASH_H_
19 
20 #include <string>
21 #include <vector>
22 
23 namespace android {
24 
25 struct Hash {
26     // path to .hal file
27     static const Hash &getHash(const std::string &path);
28 
29     // returns matching hashes of interfaceName in path
30     // path is something like hardware/interfaces/current.txt
31     // interfaceName is something like android.hardware.foo@1.0::IFoo
32     static std::vector<std::string> lookupHash(const std::string &path,
33                                                const std::string &interfaceName,
34                                                std::string *err);
35 
36     static std::string hexString(const std::vector<uint8_t> &hash);
37     std::string hexString() const;
38 
39     const std::vector<uint8_t> &raw() const;
40     const std::string &getPath() const;
41 
42 private:
43     Hash(const std::string &path);
44 
45     const std::string mPath;
46     const std::vector<uint8_t> mHash;
47 };
48 
49 }  // namespace android
50 
51 #endif  // HIDL_GEN_HASH_HASH_H_
52 
53