1 /*
2  * Copyright (c) 2022 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 SECURITY_GUARD_MODEL_CFG_MARSHALLING_H
17 #define SECURITY_GUARD_MODEL_CFG_MARSHALLING_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include "nlohmann/json.hpp"
23 
24 namespace OHOS::Security::SecurityGuard {
25 using Field = struct {
26     std::string fieldName;
27     std::string fieldType;
28     std::string value;
29 };
30 
31 using Rule = struct {
32     int64_t eventId;
33     std::vector<Field> fields;
34     std::string fieldsRelation;
35 };
36 
37 using BuildInDetectionCfg = struct {
38     std::vector<Rule> rules;
39     std::string rulesRelation;
40     std::string trueResult;
41     std::string falseResult;
42 };
43 
44 using AppDetectionCfg = struct {
45     std::string detectionCategory;
46     std::string configFileName;
47     std::string trueResult;
48     std::string falseResult;
49 };
50 
51 constexpr const char *AUDIT_TABLE = "audit_event";
52 constexpr const char *RISK_TABLE = "risk_event";
53 
from_json(const nlohmann::json & jsonObj,Field & field)54 void from_json(const nlohmann::json &jsonObj, Field &field) {};
from_json(const nlohmann::json & jsonObj,Rule & rule)55 void from_json(const nlohmann::json &jsonObj, Rule &rule) {};
from_json(const nlohmann::json & jsonObj,BuildInDetectionCfg & config)56 void from_json(const nlohmann::json &jsonObj, BuildInDetectionCfg &config) {};
to_json(nlohmann::json & jsonObj,const ModelCfg & modelCfg)57 void to_json(nlohmann::json &jsonObj, const ModelCfg &modelCfg) {};
from_json(const nlohmann::json & jsonObj,ModelCfg & modelCfg)58 void from_json(const nlohmann::json &jsonObj, ModelCfg &modelCfg) {};
to_json(nlohmann::json & jsonObj,const EventCfg & eventCfg)59 void to_json(nlohmann::json &jsonObj, const EventCfg &eventCfg) {};
from_json(const nlohmann::json & jsonObj,EventCfg & eventCfg)60 void from_json(const nlohmann::json &jsonObj, EventCfg &eventCfg) {};
to_json(nlohmann::json & jsonObj,const DataMgrCfgSt & dataMgrCfg)61 void to_json(nlohmann::json &jsonObj, const DataMgrCfgSt &dataMgrCfg) {};
from_json(const nlohmann::json & jsonObj,DataMgrCfgSt & dataMgrCfg)62 void from_json(const nlohmann::json &jsonObj, DataMgrCfgSt &dataMgrCfg) {};
to_json(nlohmann::json & jsonObj,const SecEvent & eventDataSt)63 void to_json(nlohmann::json &jsonObj, const SecEvent &eventDataSt) {};
to_json(nlohmann::json & jsonObj,const EventContentSt & eventContentSt)64 void to_json(nlohmann::json &jsonObj, const EventContentSt &eventContentSt) {};
from_json(const nlohmann::json & jsonObj,EventContentSt & eventContentSt)65 void from_json(const nlohmann::json &jsonObj, EventContentSt &eventContentSt) {};
66 } // namespace OHOS::Security::SecurityGuard
67 
68 #endif // SECURITY_GUARD_MODEL_CFG_MARSHALLING_H
69