blob: 214fedae184faf2a57bfe4cdff04dbec5792eccc [file] [log] [blame]
Daniel Normand2533c32019-08-02 15:13:50 -07001/*
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
27namespace android {
28namespace init {
29
30using InterfaceInheritanceHierarchyMap = std::map<android::FQName, std::set<android::FQName>>;
31
Daniel Normand2533c32019-08-02 15:13:50 -070032// 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.
35Result<void> CheckInterfaceInheritanceHierarchy(const std::set<std::string>& instances,
36 const InterfaceInheritanceHierarchyMap& hierarchy);
Daniel Normand2533c32019-08-02 15:13:50 -070037
38// Saves the set of known interfaces using the provided HIDL interface
39// inheritance hierarchy.
40void 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.
44Result<void> IsKnownInterface(const std::string& instance);
45Result<void> IsKnownInterface(const FQName& intf);
46
47} // namespace init
48} // namespace android