1 /* 2 * Copyright (c) 2021-2022 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 TRANS_CHANNEL_MANAGER_H 17 #define TRANS_CHANNEL_MANAGER_H 18 19 #include <stdint.h> 20 21 #include "softbus_conn_interface.h" 22 #include "softbus_trans_def.h" 23 #include "softbus_app_info.h" 24 25 #ifdef __cplusplus 26 extern "C" { 27 #endif /* __cplusplus */ 28 29 int32_t GenerateChannelId(bool isTdcChannel); 30 31 int32_t TransChannelInit(void); 32 33 void TransChannelDeinit(void); 34 35 int32_t TransOpenChannel(const SessionParam *param, TransInfo *transInfo); 36 37 int32_t TransOpenAuthChannel(const char *sessionName, const ConnectOption *connOpt, const char *reqId); 38 39 int32_t TransStreamStats(int32_t channelId, int32_t channelType, const StreamSendStats *data); 40 41 int32_t TransRippleStats(int32_t channelId, int32_t channelType, const TrafficStats *data); 42 43 int32_t TransRequestQos(int32_t channelId, int32_t chanType, int32_t appType, int32_t quality); 44 45 int32_t TransNotifyAuthSuccess(int32_t channelId, int32_t channelType); 46 47 int32_t TransReleaseUdpResources(int32_t channelId); 48 49 int32_t TransCloseChannel(const char *sessionName, int32_t channelId, int32_t channelType); 50 51 int32_t TransCloseChannelWithStatistics(int32_t channelId, int32_t channelType, uint64_t laneId, 52 const void *dataInfo, uint32_t len); 53 54 int32_t TransSendMsg(int32_t channelId, int32_t channelType, const void *data, uint32_t len, int32_t msgType); 55 56 void TransChannelDeathCallback(const char *pkgName, int32_t pid); 57 58 int32_t TransGetNameByChanId(const TransInfo *info, char *pkgName, char *sessionName, 59 uint16_t pkgLen, uint16_t sessionNameLen); 60 61 int32_t TransGetAndComparePid(pid_t pid, int32_t channelId, int32_t channelType); 62 63 int32_t TransGetAndComparePidBySession(pid_t pid, const char *sessionName, int32_t sessionId); 64 65 int32_t TransGetAppInfoByChanId(int32_t channelId, int32_t channelType, AppInfo* appInfo); 66 67 int32_t TransGetConnByChanId(int32_t channelId, int32_t channelType, int32_t* connId); 68 69 void ReleaseProxyChannelId(int32_t channelId); 70 71 int32_t CheckAuthChannelIsExit(ConnectOption *connInfo); 72 #ifdef __cplusplus 73 } 74 #endif /* __cplusplus */ 75 #endif 76