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 LNN_TRANS_LANE_H
17 #define LNN_TRANS_LANE_H
18 
19 #include "lnn_lane_assign.h"
20 #include "lnn_lane_link.h"
21 #include "lnn_lane_listener.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 typedef struct {
28     TransOption info;
29     ILaneListener listener;
30     uint32_t actionAddr;
31     bool isSupportIpv6;
32 } ExtraReqInfo;
33 
34 typedef struct {
35     ListNode node;
36     uint32_t laneReqId;
37     uint64_t laneId;
38     LaneAllocInfo allocInfo;
39     LaneAllocListener listener;
40     bool isWithQos;
41     bool isCanceled;
42     bool isNotified;
43     bool notifyFree;
44     bool hasNotifiedFree;
45     ExtraReqInfo extraInfo;
46 } TransReqInfo;
47 
48 LaneInterface *TransLaneGetInstance(void);
49 int32_t GetTransReqInfoByLaneReqId(uint32_t laneReqId, TransReqInfo *reqInfo);
50 int32_t PostDelayDestroyMessage(uint32_t laneReqId, uint64_t laneId, uint64_t delayMillis);
51 int32_t PostDetectTimeoutMessage(uint32_t detectId, uint64_t delayMillis);
52 void RemoveDetectTimeoutMessage(uint32_t detectId);
53 int32_t PostLaneStateChangeMessage(LaneState state, const char *peerUdid, const LaneLinkInfo *laneLinkInfo);
54 void RemoveDelayDestroyMessage(uint64_t laneId);
55 void DelLogicAndLaneRelationship(uint64_t laneId);
56 int32_t UpdateReqListLaneId(uint64_t oldLaneId, uint64_t newLaneId);
57 void NotifyFreeLaneResult(uint32_t laneReqId, int32_t errCode);
58 int32_t HandleLaneQosChange(const LaneLinkInfo *laneLinkInfo);
59 
60 #ifdef __cplusplus
61 }
62 #endif
63 #endif // LNN_TRANS_LANE_H
64