• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #define FAST_EXT_BYTE_SIZE (OVERHEAD_LEN + sizeof(PacketFastHead) + sizeof(SliceFastHead) + sizeof(SessionHead))
29 #define FAST_EXT_MSG_SIZE (OVERHEAD_LEN + sizeof(PacketFastHead) + sizeof(SliceFastHead))
30 
31 #define MIN(a, b) ((a) < (b) ? (a) : (b))
32 
33 int32_t TransProxyManagerInit(const IServerChannelCallBack *cb);
34 void TransProxyManagerDeinit(void);
35 
36 int32_t TransProxyGetNewChanSeq(int32_t channelId);
37 int32_t TransProxyOpenProxyChannel(AppInfo *appInfo, const ConnectOption *connInfo, int32_t *channelId);
38 int32_t TransProxyCloseProxyChannel(int32_t channelId);
39 
40 void TransProxyDelByConnId(uint32_t connId);
41 void TransProxyDelChanByReqId(int32_t reqId);
42 void TransProxyDelChanByChanId(int32_t chanlId);
43 int32_t TransProxyGetChanByChanId(int32_t chanId, ProxyChannelInfo *chan);
44 int32_t TransProxyGetChanByReqId(int32_t reqId, ProxyChannelInfo *chan);
45 
46 void TransProxyOpenProxyChannelSuccess(int32_t chanId);
47 void TransProxyOpenProxyChannelFail(int32_t channelId, const AppInfo *appInfo, int32_t errCode);
48 void TransProxyonMessageReceived(const ProxyMessage *msg);
49 
50 int32_t TransProxyGetSessionKeyByChanId(int32_t channelId, char *sessionKey, uint32_t sessionKeySize);
51 int32_t TransProxyGetSendMsgChanInfo(int32_t channelId, ProxyChannelInfo *chanInfo);
52 
53 int32_t TransProxyCreateChanInfo(ProxyChannelInfo *chan, int32_t channelId, const AppInfo *appInfo);
54 void TransProxyChanProcessByReqId(int32_t reqId, uint32_t connId);
55 
56 int64_t TransProxyGetAuthId(int32_t channelId);
57 int32_t TransProxyGetNameByChanId(int32_t chanId, char *pkgName, char *sessionName,
58     uint16_t pkgLen, uint16_t sessionLen);
59 
60 int32_t TransRefreshProxyTimesNative(int channelId);
61 
62 void TransProxyDeathCallback(const char *pkgName, int32_t pid);
63 
64 int32_t TransProxyGetAppInfoByChanId(int32_t chanId, AppInfo* appInfo);
65 int32_t TransProxyGetConnIdByChanId(int32_t channelId, int32_t *connId);
66 int32_t TransProxyGetConnOptionByChanId(int32_t channelId, ConnectOption *connOpt);
67 
68 int32_t TransProxyGetAppInfoType(int16_t myId, const char *identity);
69 
70 #ifdef __cplusplus
71 }
72 #endif
73 
74 #endif
75