1 /*
2  * Copyright (c) 2021-2024 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 HI_APP_EVENT_VERIFY_H
17 #define HI_APP_EVENT_VERIFY_H
18 
19 #include <memory>
20 #include <string>
21 
22 #include "base_type.h"
23 
24 namespace OHOS {
25 namespace HiviewDFX {
26 class AppEventPack;
27 using HiAppEvent::ReportConfig;
28 using HiAppEvent::EventConfig;
29 
30 int VerifyAppEvent(std::shared_ptr<AppEventPack> event);
31 int VerifyCustomEventParams(std::shared_ptr<AppEventPack> event);
32 int VerifyReportConfig(ReportConfig& config);
33 
34 bool IsValidDomain(const std::string& domain);
35 bool IsValidEventName(const std::string& eventName);
36 bool IsValidWatcherName(const std::string& watcherName);
37 bool IsValidEventType(int eventType);
38 bool IsValidProcessorName(const std::string& name);
39 bool IsValidRouteInfo(const std::string& name);
40 bool IsValidAppId(const std::string& name);
41 bool IsValidPeriodReport(int timeout);
42 bool IsValidBatchReport(int count);
43 bool IsValidUserIdName(const std::string& name);
44 bool IsValidUserIdValue(const std::string& value);
45 bool IsValidUserPropName(const std::string& name);
46 bool IsValidUserPropValue(const std::string& value);
47 bool IsValidEventConfig(const EventConfig& eventCfg);
48 bool IsValidConfigId(int configId);
49 bool IsValidCustomConfigsNum(size_t num);
50 bool IsValidCustomConfig(const std::string& name, const std::string& value);
51 bool IsApp();
52 } // namespace HiviewDFX
53 } // namespace OHOS
54 #endif // HI_APP_EVENT_VERIFY_H
55