• 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 TRANS_LANE_MANAGER_H
17 #define TRANS_LANE_MANAGER_H
18 
19 #include <stdint.h>
20 #include "lnn_lane_interface.h"
21 #include "softbus_app_info.h"
22 #include "softbus_conn_interface.h"
23 #include "softbus_trans_def.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
28 
29 typedef enum {
30     CORE_SESSION_STATE_INIT,
31     CORE_SESSION_STATE_WAIT_LANE,
32     CORE_SESSION_STATE_LAN_COMPLETE,
33     CORE_SESSION_STATE_CHANNEL_OPENED,
34     CORE_SESSION_STATE_CANCELLING,
35     CORE_SESSION_STATE_BUTT,
36 } CoreSessionState;
37 
38 int32_t TransLaneMgrInit(void);
39 
40 int32_t TransSocketLaneMgrInit(void);
41 
42 void TransLaneMgrDeinit(void);
43 
44 void TransSocketLaneMgrDeinit(void);
45 
46 int32_t TransLaneMgrAddLane(
47     const TransInfo *transInfo, const LaneConnInfo *connInfo, uint32_t laneHandle, bool isQosLane, AppInfoData *myData);
48 
49 int32_t TransLaneMgrDelLane(int32_t channelId, int32_t channelType, bool isAsync);
50 
51 void TransLaneMgrDeathCallback(const char *pkgName, int32_t pid);
52 
53 int32_t TransGetLaneHandleByChannelId(int32_t channelId, uint32_t *laneHandle);
54 
55 int32_t TransGetLaneIdByChannelId(int32_t channelId, uint64_t *laneId);
56 
57 int32_t TransGetChannelInfoByLaneHandle(uint32_t laneHandle, int32_t *channelId, int32_t *channelType);
58 
59 int32_t TransAddSocketChannelInfo(
60     const char *sessionName, int32_t sessionId, int32_t channelId, int32_t channelType, CoreSessionState state);
61 
62 int32_t TransUpdateSocketChannelInfoBySession(
63     const char *sessionName, int32_t sessionId, int32_t channelId, int32_t channelType);
64 
65 int32_t TransUpdateSocketChannelLaneInfoBySession(
66     const char *sessionName, int32_t sessionId, uint32_t laneHandle, bool isQosLane, bool isAsync);
67 
68 int32_t TransDeleteSocketChannelInfoBySession(const char *sessionName, int32_t sessionId);
69 
70 int32_t TransDeleteSocketChannelInfoByChannel(int32_t channelId, int32_t channelType);
71 
72 int32_t TransDeleteSocketChannelInfoByPid(int32_t pid);
73 
74 int32_t TransSetSocketChannelStateBySession(const char *sessionName, int32_t sessionId, CoreSessionState state);
75 
76 int32_t TransSetSocketChannelStateByChannel(int32_t channelId, int32_t channelType, CoreSessionState state);
77 
78 int32_t TransGetSocketChannelStateBySession(const char *sessionName, int32_t sessionId, CoreSessionState *state);
79 
80 int32_t TransGetSocketChannelStateByChannel(int32_t channelId, int32_t channelType, CoreSessionState *state);
81 
82 int32_t TransGetSocketChannelLaneInfoBySession(
83     const char *sessionName, int32_t sessionId, uint32_t *laneHandle, bool *isQosLane, bool *isAsync);
84 
85 int32_t TransGetPidFromSocketChannelInfoBySession(const char *sessionName, int32_t sessionId, int32_t *pid);
86 
87 int32_t TransGetConnectTypeByChannelId(int32_t channelId, ConnectType *connectType);
88 
89 #ifdef __cplusplus
90 }
91 #endif /* __cplusplus */
92 #endif
93