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