• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 NETMGR_EXT_INCLUDE_EVENT_REPORT_H
17 #define NETMGR_EXT_INCLUDE_EVENT_REPORT_H
18 
19 #include <string>
20 
21 #include "hisysevent.h"
22 
23 using HiSysEventType = OHOS::HiviewDFX::HiSysEvent::EventType;
24 using HiSysEvent = OHOS::HiviewDFX::HiSysEvent;
25 
26 namespace OHOS {
27 namespace NetManagerStandard {
28 struct EventInfo {
29     int32_t sharingType = 0;
30     int32_t operatorType = 0;
31     int32_t sharingCount = 0;
32 
33     int32_t errorType = 0;
34     std::string errorMsg;
35 };
36 
37 enum class NetworkShareEventOperator {
38     OPERATION_START_SA = 0,
39     OPERATION_ENABLE_IFACE,
40     OPERATION_TURNON_IP_FORWARD,
41     OPERATION_GET_UPSTREAM,
42     OPERATION_CONFIG_FORWARD,
43     OPERATION_CHECK_SA = 10,
44     OPERATION_DISABLE_IFACE,
45     OPERATION_TURNOFF_IP_FORWARD,
46     OPERATION_CANCEL_FORWARD,
47 };
48 
49 enum class NetworkShareEventErrorType {
50     ERROR_START_SA = -100,
51     ERROR_CHECK_SA = -101,
52     ERROR_ENABLE_IFACE = -110,
53     ERROR_DISABLE_IFACE = -111,
54     ERROR_TURNON_IP_FORWARD = -120,
55     ERROR_TURNOFF_IP_FORWARD = -121,
56     ERROR_CONFIG_FORWARD = -130,
57     ERROR_CANCEL_FORWARD = -131,
58     ERROR_GET_UPSTREAM = -140,
59 };
60 
61 enum class NetworkShareEventType {
62     SETUP_EVENT = 0,
63     CANCEL_EVENT = 1,
64     BEHAVIOR_EVENT = 2,
65 };
66 
67 class NetEventReport {
68 public:
69     static void SendSetupFaultEvent(const EventInfo &eventInfo);
70     static void SendCancleFaultEvent(const EventInfo &eventInfo);
71     static void SendTimeBehaviorEvent(const EventInfo &eventInfo);
72 };
73 } // namespace NetManagerStandard
74 } // namespace OHOS
75 #endif // NETMGR_EXT_INCLUDE_EVENT_REPORT_H
76