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 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); 37 Result<void> CheckInterfaceInheritanceHierarchy(const std::set<android::FQName>& interfaces, 38 const InterfaceInheritanceHierarchyMap& hierarchy); 39 40 // Saves the set of known interfaces using the provided HIDL interface 41 // inheritance hierarchy. 42 void SetKnownInterfaces(const InterfaceInheritanceHierarchyMap& hierarchy); 43 44 // Checks if the provided interface is in the set of known interfaces. Returns 45 // an empty Result if present, otherwise an Error. 46 Result<void> IsKnownInterface(const std::string& instance); 47 Result<void> IsKnownInterface(const FQName& intf); 48 49 } // namespace init 50 } // namespace android 51