1 /*
2  * Copyright (C) 2024-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 OHOS_WIFI_NETWORK_BLACK_LIST_MANAGER_H
17 #define OHOS_WIFI_NETWORK_BLACK_LIST_MANAGER_H
18 
19 #include <map>
20 #include <set>
21 #include "wifi_log.h"
22 
23 namespace OHOS {
24 namespace Wifi {
25 class NetworkBlockListManager {
26 public:
27     NetworkBlockListManager();
28     ~NetworkBlockListManager();
29     static NetworkBlockListManager &GetInstance();
30     void AddWifiBlocklist(const std::string &bssid);
31     bool IsInWifiBlocklist(const std::string &bssid);
32     void AddAbnormalWifiBlocklist(const std::string &bssid);
33     void CleanAbnormalWifiBlocklist();
34     void CleanTempWifiBlockList();
35     bool IsInAbnormalWifiBlocklist(const std::string &bssid);
36     bool IsInTempWifiBlockList(const std::string &bssid);
37     bool IsFailedMultiTimes(const std::string &bssid);
38     void RemoveWifiBlocklist(const std::string &bssid);
39 
40 private:
41     std::mutex mutex_;
42     std::set<std::string> wifiBlockSet_;
43     std::set<std::string> abnormalWifiBlockSet_;
44     std::map<std::string, int32_t> tempWifiBlockMap_;
45 };
46 
47 } // namespace Wifi
48 } // namespace OHOS
49 #endif