1 /* 2 * Copyright (c) 2021 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_CONN_MANAGER_H 17 #define SOFTBUS_CONN_MANAGER_H 18 19 #include "softbus_conn_interface.h" 20 21 #define CONNECT_TYPE_SHIFT 16 22 23 #ifdef __cplusplus 24 #if __cplusplus 25 extern "C" { 26 #endif 27 #endif 28 29 typedef struct { 30 int32_t (*ConnectDevice)(const ConnectOption *option, uint32_t requestId, const ConnectResult *result); 31 int32_t (*PostBytes)(uint32_t connectionId, const char *data, int32_t len, int32_t pid, int32_t flag); 32 int32_t (*DisconnectDevice)(uint32_t connectionId); 33 int32_t (*DisconnectDeviceNow)(const ConnectOption *option); 34 int32_t (*GetConnectionInfo)(uint32_t connectionId, ConnectionInfo *info); 35 int32_t (*StartLocalListening)(const LocalListenerInfo *info); 36 int32_t (*StopLocalListening)(const LocalListenerInfo *info); 37 bool (*CheckActiveConnection)(const ConnectOption *info); 38 } ConnectFuncInterface; 39 40 #define MAGIC_NUMBER 0xBABEFACE 41 typedef struct { 42 int32_t magic; 43 int32_t module; 44 int64_t seq; 45 int32_t flag; 46 uint32_t len; 47 } ConnPktHead; 48 49 #ifdef __cplusplus 50 #if __cplusplus 51 } 52 #endif /* __cplusplus */ 53 #endif /* __cplusplus */ 54 55 #endif 56