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 CONN_EVENT_FORM_H 17 #define CONN_EVENT_FORM_H 18 19 #include <stdint.h> 20 21 #include "event_form_enum.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 typedef enum { 28 EVENT_SCENE_CONNECT = 1, 29 EVENT_SCENE_START_BASE_LISTENER = 2, 30 EVENT_SCENE_STOP_BASE_LISTENER = 3, 31 EVENT_SCENE_SOCKET_CREATE = 4, 32 EVENT_SCENE_SOCKET_LISTEN = 5, 33 EVENT_SCENE_SOCKET_ACCEPT = 6, 34 EVENT_SCENE_SOCKET_CONNECT = 7, 35 EVENT_SCENE_SOCKET_SHUTDOWN = 8, 36 EVENT_SCENE_SOCKET_CLOSE = 9, 37 EVENT_SCENE_LEGACY_CONNECT = 10, 38 EVENT_SCENE_PASSIVE_CONNECT = 11, 39 EVENT_SCENE_PAGING = 12, 40 EVENT_SCENE_PAGING_PASSIVE_BROADCAST_RESPONSE = 13, 41 } ConnEventScene; 42 43 typedef enum { 44 EVENT_STAGE_CONNECT_START = 1, 45 EVENT_STAGE_CONNECT_INVOKE_PROTOCOL = 2, 46 EVENT_STAGE_CONNECT_END = 3, 47 EVENT_STAGE_CONNECT_SEND_MESSAGE = 10, 48 EVENT_STAGE_CONNECT_CHECK_HML = 11, 49 EVENT_STAGE_CONNECT_CREATE_GROUP = 12, 50 EVENT_STAGE_CONNECT_CONNECT_NOTIFY = 13, 51 EVENT_STAGE_CONNECT_POST_RENEGOTIATE_REQ = 14, 52 EVENT_STAGE_CONNECT_RENEGOTIATE_CONNECT = 15, 53 EVENT_STAGE_CONNECT_SWITCH_NOTIFY = 16, 54 EVENT_STAGE_CONNECT_POST_RENEGOTIATE_RESP = 17, 55 EVENT_STAGE_CONNECT_CONNECT_GROUP = 18, 56 EVENT_STAGE_CONNECT_CONFIG_INFO = 19, 57 EVENT_STAGE_CONNECT_START_LISTENING = 20, 58 59 EVENT_STAGE_PAGING_START = 21, 60 EVENT_STAGE_PAGING_DISCOVERY_REPORT = 22, 61 EVENT_STAGE_PAGING_CONNECT_START = 23, 62 EVENT_STAGE_PAGING_CONNECT_REPORT = 24, 63 EVENT_STAGE_PAGING_END = 25, 64 EVENT_STAGE_PAGING_PASSIVE_BROADCAST_RESPONSE = 26, 65 66 EVENT_STAGE_CONNECT_DEVICE = 2101, 67 EVENT_STAGE_CONNECT_DEVICE_DIRECTLY = 2102, 68 EVENT_STAGE_CONNECT_UPDATE_CONNECTION_RC = 2103, 69 EVENT_STAGE_CONNECT_SERVER_ACCEPTED = 2104, 70 EVENT_STAGE_CONNECT_SEND_BASIC_INFO = 2105, 71 EVENT_STAGE_CONNECT_PARSE_BASIC_INFO = 2106, 72 } ConnEventConnectStage; 73 74 typedef enum { 75 EVENT_STAGE_TCP_COMMON_ONE = 1, 76 } ConnEventTcpCommonStage; 77 78 typedef struct { 79 int32_t result; // STAGE_RES 80 int32_t errcode; // ERROR_CODE 81 int32_t connectionId; // CONN_ID 82 int32_t requestId; // CONN_REQ_ID 83 int32_t linkType; // LINK_TYPE 84 int32_t authType; // AUTH_TYPE 85 int32_t authId; // AUTH_ID 86 const char *lnnType; // LNN_TYPE 87 int32_t expectRole; // EXPECT_ROLE 88 int32_t costTime; // TIME_CONSUMING 89 int32_t rssi; // RSSI 90 int32_t load; // CHLOAD 91 int32_t frequency; // FREQ 92 int32_t connProtocol; // CONN_PROTOCOL 93 int32_t connRole; // CONN_ROLE 94 int32_t connRcDelta; // CONN_RC_DELTA 95 int32_t connRc; // CONN_RC 96 int32_t supportFeature; // SUPT_FEATURE 97 int32_t moduleId; // MODULE_ID 98 uint32_t proType; // PROTOCOL_TYPE 99 int32_t fd; // FD 100 int32_t cfd; // CFD 101 const char *challengeCode; // CHALLENGE_CODE 102 const char *peerIp; // PEER_IP 103 const char *peerBrMac; // PEER_BR_MAC 104 const char *peerBleMac; // PEER_BLE_MAC 105 const char *peerWifiMac; // PEER_WIFI_MAC 106 const char *peerSleMac; // PEER_SLE_MAC 107 const char *peerPort; // PEER_PORT 108 const char *peerNetworkId; // PEER_NET_ID 109 const char *peerUdid; // PEER_UDID 110 const char *peerDeviceType; // PEER_DEV_TYPE 111 const char *localNetworkId; // LOCAL_NET_ID 112 const char *callerPkg; // HOST_PKG 113 const char *calleePkg; // TO_CALL_PKG 114 const char *srcAccountIdHash; // SRC_ACCOUNT_ID_HASH 115 const char *dstAccountIdHash; // DST_ACCOUNT_ID_HASH 116 int32_t bootLinkType; // BOOT_LINK_TYPE 117 int32_t isRenegotiate; // IS_RENEGOTIATE 118 int32_t isReuse; // IS_REUSE 119 uint64_t negotiateTime; // NEGOTIATE_TIME_COSUMING 120 uint64_t linkTime; // LINK_TIME_COSUMING 121 int32_t osType; // OS_TYPE 122 const char *localDeviceType; // LOCAL_DEVICE_TYPE 123 const char *remoteDeviceType; // REMOTE_DEVICE_TYPE 124 int32_t p2pChannel; // P2P_CHAN 125 int32_t hmlChannel; // HML_CHAN 126 int32_t staChannel; // STA_CHAN 127 int32_t apChannel; // HOTSPOT_CHAN 128 const char *peerDevVer; // REMOTE_OS_VERSION 129 int32_t remoteScreenStatus; // REMOTE_SCREEN_STATUS 130 int32_t localScreenStatus; // LOCAL_SCREEN_STATUS 131 int32_t businessType; // BUSINESS_TYPE 132 int32_t businessId; // BUSINESS_ID 133 int32_t timeout; // TIME_OUT 134 int32_t fastestConnectEnable; // FASTEST_CONNECT_ENABLE 135 int32_t coapDataChannel; // COAP_DATA_CHANNEL 136 int32_t enableWideBandwidth; // ENABLE_WIDE_BANDWIDTH 137 int32_t p2pRole; // P2P_ROLE 138 int32_t needHmlConnect; // NEED_HML_CONNECT 139 const char *businessTag; // BUSINESS_TAG 140 int32_t staChload; // STA_CHLOAD 141 int32_t sameAccount; // SAME_ACCOUNT 142 int32_t discoveryCnt; // DISCOVERY_CNT 143 int32_t connectingCnt; // CONNECTING_CNT 144 int32_t connectSuccessCnt; // CONNECT_SUCCESS_CNT 145 int32_t connectFailCnt; // CONNECT_FAIL_CNT 146 } ConnEventExtra; 147 148 typedef enum { 149 ALARM_SCENE_CONN_RESERVED = 1, 150 } ConnAlarmScene; 151 152 typedef struct { 153 int32_t errcode; 154 int32_t result; 155 int32_t linkType; 156 int32_t duration; 157 int32_t netType; 158 } ConnAlarmExtra; 159 160 typedef enum { 161 STATS_SCENE_CONN_RESERVED = 1, 162 STATS_SCENE_CONN_BT_POST_FAILED, 163 STATS_SCENE_CONN_BT_RECV_FAILED, 164 STATS_SCENE_CONN_WIFI_CONN_FAILED, 165 STATS_SCENE_CONN_WIFI_SEND_FAILED, 166 STATS_SCENE_CONN_WIFI_POST_FAILED, 167 STATS_SCENE_CONN_WIFI_RECV_FAILED, 168 } ConnStatsScene; 169 170 typedef enum { 171 CONN_RESULT_OK = 0, 172 CONN_RESULT_DISCONNECTED, 173 CONN_RESULT_REFUSED, 174 } ConnResult; 175 176 typedef struct { 177 int32_t reserved; 178 } ConnStatsExtra; 179 180 typedef enum { 181 AUDIT_SCENE_CONN_HML_GROUP_TIMEOUT = 1, 182 } ConnAuditScene; 183 184 typedef struct { 185 int32_t errcode; // ERROR_CODE 186 SoftbusAuditType auditType; // AUDIT_TYPE 187 int32_t connectionId; // CONN_ID 188 int32_t requestId; // REQ_ID 189 int32_t linkType; // LINK_TYPE 190 int32_t expectRole; // EXPECT_ROLE 191 int32_t costTime; // COST_TIME 192 int32_t connectTimes; // CONN_TIMES 193 const char *frequency; // FREQ 194 const char *challengeCode; // CHALLENGE_CODE 195 const char *peerBrMac; // PEER_BR_MAC 196 const char *localBrMac; // LOCAL_BR_MAC 197 const char *peerBleMac; // PEER_BLE_MAC 198 const char *localBleMac; // LOCAL_BLE_MAC 199 const char *peerWifiMac; // PEER_WIFI_MAC 200 const char *peerDeviceType; // PEER_DEV_TYPE 201 const char *peerUdid; // PEER_UDID 202 const char *localUdid; // LOCAL_UDID 203 const char *connPayload; // CONN_PAYLOAD 204 const char *localDeviceName; // LOCAL_DEV_NAME 205 const char *peerIp; // PEER_IP 206 const char *localIp; // LOCAL_IP 207 const char *callerPkg; // HOST_PKG 208 const char *calleePkg; // TO_CALL_PKG 209 const char *peerPort; // PEER_PORT 210 const char *localPort; // LOCAL_PORT 211 } ConnAuditExtra; 212 213 #ifdef __cplusplus 214 } 215 #endif /* __cplusplus */ 216 #endif // CONN_EVENT_FORM_H 217