1 /* 2 * Copyright (c) 2025 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 AUTH_CONNECTION_STRUCT_H 17 #define AUTH_CONNECTION_STRUCT_H 18 19 #include <stdbool.h> 20 #include <stdint.h> 21 22 #include "auth_common_struct.h" 23 #include "auth_interface_struct.h" 24 #include "softbus_conn_interface_struct.h" 25 26 #ifdef __cplusplus 27 #if __cplusplus 28 extern "C" { 29 #endif 30 #endif 31 32 typedef struct { 33 uint64_t connId; 34 AuthConnInfo connInfo; 35 bool fromServer; 36 AuthDataHead head; 37 uint32_t len; 38 uint8_t data[0]; 39 } RepeatDeviceIdData; 40 41 typedef struct { 42 void (*onConnectResult)(uint32_t requestId, uint64_t connId, int32_t result, const AuthConnInfo *connInfo); 43 void (*onDisconnected)(uint64_t connId, const AuthConnInfo *connInfo); 44 void (*onDataReceived)( 45 uint64_t connId, const AuthConnInfo *connInfo, bool fromServer, const AuthDataHead *head, const uint8_t *data); 46 } AuthConnListener; 47 48 typedef struct { 49 int32_t fd; 50 int32_t ret; 51 } AuthConnectResult; 52 53 #define CONN_INFO "conn=%{public}s:%{public}u" 54 #define CONN_DATA(connId) GetConnTypeStr(connId), GetConnId(connId) 55 56 #ifdef __cplusplus 57 #if __cplusplus 58 } 59 #endif 60 #endif 61 #endif /* AUTH_CONNECTION_STRUCT_H */