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_TCP_CONNECT_MANAGER_H 17 #define SOFTBUS_TCP_CONNECT_MANAGER_H 18 19 #include "softbus_conn_manager.h" 20 21 #ifdef __cplusplus 22 #if __cplusplus 23 extern "C" { 24 #endif 25 #endif 26 27 uint32_t CalTcpConnectionId(int32_t fd); 28 29 uint32_t TcpGetConnNum(void); 30 31 int32_t TcpConnectDevice(const ConnectOption *option, uint32_t requestId, const ConnectResult *result); 32 33 int32_t TcpDisconnectDevice(uint32_t connectionId); 34 35 int32_t TcpDisconnectDeviceNow(const ConnectOption *option); 36 37 int32_t TcpPostBytes( 38 uint32_t connectionId, uint8_t *data, uint32_t len, int32_t pid, int32_t flag, int32_t module, int64_t seq); 39 40 int32_t TcpGetConnectionInfo(uint32_t connectionId, ConnectionInfo *Info); 41 42 int32_t TcpStartListening(const LocalListenerInfo *info); 43 44 int32_t TcpStopListening(const LocalListenerInfo *info); 45 46 ConnectFuncInterface *ConnInitTcp(const ConnectCallback *callback); 47 48 int32_t ConnGetSocketError(int32_t fd); 49 50 int32_t TcpConnSetKeepalive(int32_t fd, bool needKeepalive); 51 52 #ifdef __cplusplus 53 #if __cplusplus 54 } 55 #endif /* __cplusplus */ 56 #endif /* __cplusplus */ 57 58 #endif