• 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 SOFTBUS_ADAPTER_HISYSEVENT_H
17 #define SOFTBUS_ADAPTER_HISYSEVENT_H
18 #include <stdint.h>
19 #include <stdbool.h>
20 #include <stdlib.h>
21 
22 #ifdef __cplusplus
23 #if __cplusplus
24 extern "C" {
25 #endif
26 #endif
27 
28 #define SOFTBUS_HISYSEVT_NAME_LEN  33
29 #define SOFTBUS_HISYSEVT_PARAM_LEN 33
30 
31 typedef enum {
32     SOFTBUS_EVT_PARAM_ZERO = 0,
33     SOFTBUS_EVT_PARAM_ONE = 1,
34     SOFTBUS_EVT_PARAM_TWO = 2,
35     SOFTBUS_EVT_PARAM_THREE = 3,
36     SOFTBUS_EVT_PARAM_FOUR = 4,
37     SOFTBUS_EVT_PARAM_FIVE = 5,
38     SOFTBUS_EVT_PARAM_SIX = 6,
39     SOFTBUS_EVT_PARAM_SEVEN = 7,
40 
41     SOFTBUS_EVT_PARAM_BUTT,
42 } SoftBusEvtParamNum;
43 
44 typedef enum {
45     SOFTBUS_EVT_TYPE_FAULT = 1,
46     SOFTBUS_EVT_TYPE_STATISTIC = 2,
47     SOFTBUS_EVT_TYPE_SECURITY = 3,
48     SOFTBUS_EVT_TYPE_BEHAVIOR = 4,
49 
50     SOFTBUS_EVT_TYPE_BUTT
51 } SoftBusEvtType;
52 
53 typedef enum {
54     SOFTBUS_EVT_LEVEL_CRITICAL,
55     SOFTBUS_EVT_LEVEL_MINOR,
56 } SoftBusEvtLevel;
57 
58 typedef enum {
59     SOFTBUS_EVT_PARAMTYPE_BOOL,
60     SOFTBUS_EVT_PARAMTYPE_UINT8,
61     SOFTBUS_EVT_PARAMTYPE_UINT16,
62     SOFTBUS_EVT_PARAMTYPE_INT32,
63     SOFTBUS_EVT_PARAMTYPE_UINT32,
64     SOFTBUS_EVT_PARAMTYPE_UINT64,
65     SOFTBUS_EVT_PARAMTYPE_FLOAT,
66     SOFTBUS_EVT_PARAMTYPE_DOUBLE,
67     SOFTBUS_EVT_PARAMTYPE_STRING,
68 
69     SOFTBUS_EVT_PARAMTYPE_BUTT
70 } SoftBusEvtParamType;
71 
72 typedef union {
73     bool b;
74     uint8_t u8v;
75     uint16_t u16v;
76     int32_t i32v;
77     uint32_t u32v;
78     uint64_t u64v;
79     float f;
80     double d;
81     char str[SOFTBUS_HISYSEVT_PARAM_LEN];
82 }SoftbusEvtParamValue;
83 
84 typedef struct {
85     SoftBusEvtParamType paramType;
86     char paramName[SOFTBUS_HISYSEVT_NAME_LEN];
87     SoftbusEvtParamValue paramValue;
88 } SoftBusEvtParam;
89 
90 typedef struct {
91     char evtName[SOFTBUS_HISYSEVT_NAME_LEN];
92     SoftBusEvtType evtType;
93     uint32_t paramNum;
94     SoftBusEvtParam *paramArray;
95 } SoftBusEvtReportMsg;
96 
97 int32_t SoftbusWriteHisEvt(SoftBusEvtReportMsg* reportMsg);
98 
99 SoftBusEvtReportMsg* SoftbusCreateEvtReportMsg(int32_t paramNum);
100 
101 void SoftbusFreeEvtReporMsg(SoftBusEvtReportMsg* msg);
102 
103 #ifdef __cplusplus
104 #if __cplusplus
105 }
106 #endif /* __cplusplus */
107 #endif /* __cplusplus */
108 
109 #endif /* SOFTBUS_ADAPTER_HISYSEVENT_H */