1 /*
2  * Copyright (c) 2022 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_PENDING_CTL_H
17 #define TRANS_LANE_PENDING_CTL_H
18 
19 #include <stdint.h>
20 
21 #include "lnn_lane_interface.h"
22 #include "session.h"
23 #include "softbus_conn_interface.h"
24 #include "softbus_trans_def.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif /* __cplusplus */
29 
30 typedef enum {
31     PARA_ACTION = 1,
32     PARA_BUTT,
33 } ParaType;
34 
35 typedef struct {
36     uint32_t actionId;
37 } ActionAddr;
38 
39 typedef struct {
40     ParaType type;
41     union {
42         ActionAddr action;
43     };
44     bool enable160M;
45 } LinkPara;
46 typedef struct {
47     ListNode node;
48     int32_t errCode;
49     uint32_t laneReqId;
50     int32_t channelId;
51     char *sessionName;
52     LinkPara linkPara;
53     LaneConnInfo connInfo;
54     bool bSucc;
55     bool isFinished;
56 } TransAuthWithParaNode;
57 
58 int32_t TransReqLanePendingInit(void);
59 void TransReqLanePendingDeinit(void);
60 int32_t TransAsyncReqLanePendingInit(void);
61 void TransAsyncReqLanePendingDeinit(void);
62 int32_t TransFreeLanePendingInit(void);
63 void TransFreeLanePendingDeinit(void);
64 
65 int32_t TransGetConnectOptByConnInfo(const LaneConnInfo *info, ConnectOption *connOpt);
66 int32_t TransGetLaneInfo(const SessionParam *param, LaneConnInfo *connInfo, uint32_t *laneHandle);
67 int32_t TransAsyncGetLaneInfo(
68     const SessionParam *param, uint32_t *laneHandle, uint32_t callingTokenId, int64_t timeStart);
69 int32_t TransGetLaneInfoByOption(const LaneRequestOption *requestOption, LaneConnInfo *connInfo, uint32_t *laneHandle);
70 int32_t TransGetLaneInfoByQos(const LaneAllocInfo *allocInfo, LaneConnInfo *connInfo, uint32_t *laneHandle);
71 bool TransGetAuthTypeByNetWorkId(const char *peerNetWorkId);
72 int32_t TransCancelLaneItemCondByLaneHandle(uint32_t laneHandle, bool bSucc, bool isAsync, int32_t errCode);
73 int32_t TransDeleteLaneReqItemByLaneHandle(uint32_t laneHandle, bool isAsync);
74 int32_t TransAuthWithParaReqLanePendingInit(void);
75 void TransAuthWithParaReqLanePendingDeinit(void);
76 int32_t TransAuthWithParaAddLaneReqToList(uint32_t laneReqId, const char *sessionName,
77     const LinkPara *linkPara, int32_t channelId);
78 int32_t TransAuthWithParaDelLaneReqById(uint32_t laneReqId);
79 int32_t TransAuthWithParaGetLaneReqByLaneReqId(uint32_t laneReqId, TransAuthWithParaNode *paraNode);
80 int32_t TransUpdateAuthWithParaLaneConnInfo(uint32_t laneHandle, bool bSucc, const LaneConnInfo *connInfo,
81     int32_t errCode);
82 
83 int32_t TransFreeLaneByLaneHandle(uint32_t laneHandle, bool isAsync);
84 #ifdef __cplusplus
85 }
86 #endif /* __cplusplus */
87 #endif
88