• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2024 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_TRANSCEIVER_H
17 #define SOFTBUS_PROXYCHANNEL_TRANSCEIVER_H
18 
19 #include "softbus_proxychannel_message.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 typedef struct {
26     ListNode node;
27     uint32_t requestId;
28     uint32_t connId;
29     int32_t ref;
30     uint32_t state;
31     bool isServerSide;
32     ConnectOption connInfo;
33 } ProxyConnInfo;
34 
35 void TransProxyPostResetPeerMsgToLoop(const ProxyChannelInfo *chan);
36 void TransProxyPostHandshakeMsgToLoop(int32_t channelId);
37 void TransProxyPostDisConnectMsgToLoop(uint32_t connId, bool isServer, const ProxyChannelInfo *chan);
38 void TransProxyPostOpenClosedMsgToLoop(const ProxyChannelInfo *chan);
39 void TransProxyPostOpenFailMsgToLoop(const ProxyChannelInfo *chan, int32_t errCode);
40 void TransProxyPostKeepAliveMsgToLoop(const ProxyChannelInfo *chan);
41 void TransProxyPostAuthNegoMsgToLooperDelay(uint32_t authRequestId, int32_t channelId, uint32_t delayTime);
42 int32_t TransProxyTransInit(void);
43 int32_t TransProxyCloseConnChannel(uint32_t connectionId, bool isServer);
44 int32_t TransProxyCloseConnChannelReset(uint32_t connectionId, bool isDisconnect, bool isServer, bool deviceType);
45 int32_t TransProxyOpenConnChannel(const AppInfo *appInfo, const ConnectOption *connInfo, int32_t *channelId);
46 int32_t TransProxyTransSendMsg(uint32_t connectionId, uint8_t *buf, uint32_t len, int32_t priority, int32_t pid);
47 void TransCreateConnByConnId(uint32_t connId, bool isServer);
48 int32_t TransDecConnRefByConnId(uint32_t connId, bool isServer);
49 int32_t TransAddConnRefByConnId(uint32_t connId, bool isServer);
50 int32_t TransProxyGetConnInfoByConnId(uint32_t connId, ConnectOption *connInfo);
51 int32_t TransDelConnByReqId(uint32_t requestId);
52 int32_t CheckIsProxyAuthChannel(ConnectOption *connInfo);
53 void TransProxyNegoSessionKeySucc(int32_t channelId);
54 void TransProxyNegoSessionKeyFail(int32_t channelId, int32_t errCode);
55 int32_t TransProxyGetConnOptionByChanId(int32_t channelId, ConnectOption *connOpt);
56 
57 #ifdef __cplusplus
58 }
59 #endif
60 
61 #endif
62