Daniel Norman | d2533c3 | 2019-08-02 15:13:50 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2019 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 | #pragma once |
| 18 | |
| 19 | #include <map> |
| 20 | #include <set> |
| 21 | #include <string> |
| 22 | |
| 23 | #include <hidl-util/FQName.h> |
| 24 | |
| 25 | #include "result.h" |
| 26 | |
| 27 | namespace android { |
| 28 | namespace init { |
| 29 | |
| 30 | using InterfaceInheritanceHierarchyMap = std::map<android::FQName, std::set<android::FQName>>; |
| 31 | |
Daniel Norman | d2533c3 | 2019-08-02 15:13:50 -0700 | [diff] [blame] | 32 | // For the given set of interfaces / interface instances, checks that each |
| 33 | // interface's hierarchy of inherited interfaces is also included in the given |
| 34 | // interface set. Uses the provided hierarchy data. |
| 35 | Result<void> CheckInterfaceInheritanceHierarchy(const std::set<std::string>& instances, |
| 36 | const InterfaceInheritanceHierarchyMap& hierarchy); |
Daniel Norman | d2533c3 | 2019-08-02 15:13:50 -0700 | [diff] [blame] | 37 | |
| 38 | // Saves the set of known interfaces using the provided HIDL interface |
| 39 | // inheritance hierarchy. |
| 40 | void SetKnownInterfaces(const InterfaceInheritanceHierarchyMap& hierarchy); |
| 41 | |
| 42 | // Checks if the provided interface is in the set of known interfaces. Returns |
| 43 | // an empty Result if present, otherwise an Error. |
| 44 | Result<void> IsKnownInterface(const std::string& instance); |
| 45 | Result<void> IsKnownInterface(const FQName& intf); |
| 46 | |
| 47 | } // namespace init |
| 48 | } // namespace android |