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_PROXYCHANNEL_MANAGER_H 17 #define SOFTBUS_PROXYCHANNEL_MANAGER_H 18 19 #include "stdint.h" 20 #include "softbus_app_info.h" 21 #include "softbus_conn_interface.h" 22 #include "softbus_proxychannel_message.h" 23 #include "trans_channel_callback.h" 24 25 #ifdef __cplusplus 26 extern "C" { 27 #endif 28 29 30 int32_t TransProxyManagerInit(const IServerChannelCallBack *cb); 31 void TransProxyManagerDeinit(void); 32 33 int32_t TransProxyAuthSessionDataLenCheck(uint32_t dataLen, int32_t type); 34 35 int32_t TransProxyGetNewChanSeq(int32_t channelId); 36 int32_t TransProxyOpenProxyChannel(const AppInfo *appInfo, const ConnectOption *connInfo, int32_t *channelId); 37 int32_t TransProxyCloseProxyChannel(int32_t channelId); 38 int32_t TransProxySendMsg(int32_t channelId, const char *data, uint32_t dataLen, int32_t priority); 39 40 void TransProxyDelByConnId(uint32_t connId); 41 void TransProxyDelChanByReqId(int32_t reqId); 42 void TransProxyDelChanByChanId(int32_t chanlId); 43 44 void TransProxyOpenProxyChannelSuccess(int32_t chanId); 45 void TransProxyOpenProxyChannelFail(int32_t channelId, const AppInfo *appInfo, int32_t errCode); 46 void TransProxyonMessageReceived(const ProxyMessage *msg); 47 48 int32_t TransProxyGetSessionKeyByChanId(int32_t channelId, char *sessionKey, uint32_t sessionKeySize); 49 int16_t TransProxyGetNewMyId(void); 50 int32_t TransProxyGetSendMsgChanInfo(int32_t channelId, ProxyChannelInfo *chanInfo); 51 52 int32_t TransProxyCreateChanInfo(ProxyChannelInfo *chan, int32_t channelId, const AppInfo *appInfo); 53 void TransProxyChanProcessByReqId(int32_t reqId, uint32_t connId); 54 55 int64_t TransProxyGetAuthId(int32_t channelId); 56 int32_t TransProxyGetNameByChanId(int32_t chanId, char *pkgName, char *sessionName, 57 uint16_t pkgLen, uint16_t sessionLen); 58 59 void TransProxyDeathCallback(const char *pkgName); 60 61 int32_t TransProxyGetAppInfoByChanId(int32_t chanId, AppInfo* appInfo); 62 int32_t TransProxyGetConnIdByChanId(int32_t channelId, int32_t *connId); 63 int32_t TransProxyGetConnOptionByChanId(int32_t channelId, ConnectOption *connOpt); 64 65 int32_t TransProxyGetAppInfoType(int16_t myId, const char *identity); 66 67 #ifdef __cplusplus 68 } 69 #endif 70 71 #endif 72