blob: 990eb14811116feab94e48b940d8f1a735fe2bab [file] [log] [blame]
James Feist3cb5fec2018-01-23 14:41:51 -08001/*
2// Copyright (c) 2017 Intel Corporation
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
Ed Tanous072e25d2018-12-16 21:45:20 -080018#include "filesystem.hpp"
James Feista465ccc2019-02-08 12:51:01 -080019
James Feistb4383f42018-08-06 16:54:10 -070020#include <nlohmann/json.hpp>
James Feist68500ff2018-08-08 15:40:42 -070021#include <sdbusplus/exception.hpp>
James Feist3cb5fec2018-01-23 14:41:51 -080022
James Feista465ccc2019-02-08 12:51:01 -080023bool findFiles(const std::filesystem::path& dirPath,
24 const std::string& matchString,
25 std::vector<std::filesystem::path>& foundPaths);
James Feistb4383f42018-08-06 16:54:10 -070026
James Feista465ccc2019-02-08 12:51:01 -080027bool validateJson(const nlohmann::json& schemaFile,
28 const nlohmann::json& input);
James Feist68500ff2018-08-08 15:40:42 -070029struct DBusInternalError final : public sdbusplus::exception_t
30{
James Feista465ccc2019-02-08 12:51:01 -080031 const char* name() const noexcept override
James Feist68500ff2018-08-08 15:40:42 -070032 {
33 return "org.freedesktop.DBus.Error.Failed";
34 };
James Feista465ccc2019-02-08 12:51:01 -080035 const char* description() const noexcept override
James Feist68500ff2018-08-08 15:40:42 -070036 {
37 return "internal error";
38 };
James Feista465ccc2019-02-08 12:51:01 -080039 const char* what() const noexcept override
James Feist68500ff2018-08-08 15:40:42 -070040 {
41 return "org.freedesktop.DBus.Error.Failed: "
42 "internal error";
43 };
44};