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_SELECT_RULE_H 17 #define LNN_SELECT_RULE_H 18 19 #include "lnn_lane_interface.h" 20 #include "lnn_lane_select.h" 21 #include "softbus_common.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 #define UNACCEPT_SCORE 20 28 29 typedef enum { 30 HIGH_BAND_WIDTH = 0, 31 MIDDLE_HIGH_BAND_WIDTH, 32 MIDDLE_LOW_BAND_WIDTH, 33 LOW_BAND_WIDTH, 34 BW_TYPE_BUTT, 35 } BandWidthType; 36 37 typedef enum { 38 CUSTOM_QOS_MESH = 0, 39 CUSTOM_QOS_DB, 40 CUSTOM_QOS_RTT, 41 CUSTOM_QOS_BUTT, 42 } CustomQos; 43 44 typedef struct { 45 bool available; 46 int32_t (*linkFeatureCheck)(const char *networkId); 47 int32_t (*getLinkScore)(const char *networkId, uint32_t expectedBw); 48 } LinkAttribute; 49 50 int32_t UpdateP2pAvailability(const char *peerUdid, bool isSupportP2p); 51 int32_t GetWlanLinkedFrequency(void); 52 LinkAttribute *GetLinkAttrByLinkType(LaneLinkType linkType); 53 int32_t DecideAvailableLane(const char *networkId, const LaneSelectParam *request, 54 LanePreferredLinkList *recommendList); 55 int32_t DecideDefaultLink(const char *networkId, LaneTransType transType, LaneLinkType *resList, uint32_t *resNum); 56 int32_t DecideCustomLink(const char *networkId, CustomQos customQos, LaneLinkType *resList, uint32_t *resNum); 57 int32_t FinalDecideLinkType(const char *networkId, LaneLinkType *linkList, 58 uint32_t listNum, LanePreferredLinkList *recommendList); 59 int32_t LaneCheckLinkValid(const char *networkId, LaneLinkType linkType, LaneTransType transType); 60 int32_t DecideReuseLane(const char *networkId, const LaneSelectParam *request, 61 LanePreferredLinkList *recommendList); 62 bool IsSupportWifiDirectEnhance(const char *networkId); 63 int32_t InitLaneSelectRule(void); 64 void DeinitLaneSelectRule(void); 65 int32_t GetAllSupportReuseBandWidth(const char *peerNetworkId, LaneTransType transType, 66 uint32_t **supportBw, uint8_t *bwCnt); 67 int32_t GetSupportBandWidth(const char *peerNetworkId, LaneTransType transType, uint32_t *supportBw); 68 69 #ifdef __cplusplus 70 } 71 #endif 72 #endif // LNN_SELECT_RULE_H