1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef SERVICES_EDM_PLUGIN_INCLUDE_IPTABLES_EXECUTER_UTILS_H
17 #define SERVICES_EDM_PLUGIN_INCLUDE_IPTABLES_EXECUTER_UTILS_H
18 
19 #include <memory>
20 #include <mutex>
21 #include <string>
22 
23 #include "edm_errors.h"
24 
25 namespace OHOS {
26 namespace EDM {
27 namespace IPTABLES {
28 
29 class ExecuterUtils {
30 public:
31     ExecuterUtils() = default;
32     ExecuterUtils(const ExecuterUtils&) = delete;
33     ExecuterUtils& operator=(const ExecuterUtils&) = delete;
34     ExecuterUtils(ExecuterUtils&&) = delete;
35     ExecuterUtils& operator=(ExecuterUtils&&) = delete;
36     virtual ~ExecuterUtils() = default;
37 
38     virtual ErrCode Execute(const std::string& rule, std::string& result);
39 
40     static std::shared_ptr<ExecuterUtils> GetInstance();
41 
42 private:
43     static std::shared_ptr<ExecuterUtils> instance_;
44     static std::mutex mutexLock_;
45 };
46 } // namespace IPTABLES
47 } // namespace EDM
48 } // namespace OHOS
49 #endif // SERVICES_EDM_PLUGIN_INCLUDE_IPTABLES_EXECUTER_UTILS_H
50