• 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_TRANSCEIVER_H
17 #define SOFTBUS_PROXYCHANNEL_TRANSCEIVER_H
18 
19 #include "common_list.h"
20 #include "softbus_app_info.h"
21 #include "softbus_conn_interface.h"
22 #include "softbus_proxychannel_message.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 typedef struct {
29     ListNode node;
30     uint32_t requestId;
31     ConnectOption connInfo;
32     uint32_t connId;
33     int32_t ref;
34     uint32_t state;
35 } ProxyConnInfo;
36 
37 void TransProxyPostResetPeerMsgToLoop(const ProxyChannelInfo *chan);
38 void TransProxyPostHandshakeMsgToLoop(int32_t chanId);
39 void TransProxyPostDisConnectMsgToLoop(uint32_t connId);
40 void TransProxyPostOpenClosedMsgToLoop(const ProxyChannelInfo *chan);
41 void TransProxyPostOpenFailMsgToLoop(const ProxyChannelInfo *chan, int32_t errCode);
42 void TransProxyPostKeepAliveMsgToLoop(const ProxyChannelInfo *chan);
43 int32_t TransProxyTransInit(void);
44 int32_t TransProxyCloseConnChannel(uint32_t connectionId);
45 int32_t TransProxyCloseConnChannelReset(uint32_t connectionId, bool isDisconnect);
46 int32_t TransProxyOpenConnChannel(const AppInfo *appInfo, const ConnectOption *connInfo, int32_t *channelId);
47 int32_t TransProxyTransSendMsg(uint32_t connectionId, uint8_t *buf, uint32_t len, int32_t priority, int32_t pid);
48 void TransCreateConnByConnId(uint32_t connId);
49 int32_t TransDecConnRefByConnId(uint32_t connId);
50 int32_t TransAddConnRefByConnId(uint32_t connId);
51 int32_t TransProxyGetConnInfoByConnId(uint32_t connId, ConnectOption *connInfo);
52 
53 #ifdef __cplusplus
54 }
55 #endif
56 
57 #endif
58