• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 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_MOCK_AUTH_CENTER_H
17 #define OHOS_MOCK_AUTH_CENTER_H
18 
19 #include "wifi_event_handler.h"
20 #include "wifi_errcode.h"
21 #include "network_selection.h"
22 #include "network_selector_factory.h"
23 #include "wifi_internal_msg.h"
24 #include "wifi_log.h"
25 #include "i_net_conn_service.h"
26 #include "net_all_capabilities.h"
27 #include "net_supplier_callback_base.h"
28 #include <any>
29 
30 namespace OHOS {
31 namespace Wifi {
32 class WifiAuthCenter {
33 public:
34     static WifiAuthCenter &GetInstance();
35 
36     int Init();
37 
38     static bool IsSystemAccess();
39 
40     static bool IsNativeProcess();
41 
42     int VerifySetWifiInfoPermission(const int &pid, const int &uid);
43 
44     int VerifyGetWifiInfoPermission(const int &pid, const int &uid);
45 
46     int VerifyManageEdmPolicyPermission(const int &pid, const int &uid);
47 
48     int VerifyGetScanInfosPermission(const int &pid, const int &uid);
49 
50     int VerifyGetWifiLocalMacPermission(const int &pid, const int &uid);
51 
52     int VerifyWifiConnectionPermission(const int &pid, const int &uid);
53 
54     int VerifySetWifiConfigPermission(const int &pid, const int &uid);
55 
56     int VerifyGetWifiDirectDevicePermission(const int &pid, const int &uid);
57 
58     int VerifyManageWifiHotspotPermission(const int &pid, const int &uid);
59 
60     int VerifyGetWifiPeersMacPermission(const int &pid, const int &uid);
61 
62     int VerifyGetWifiPeersMacPermissionEx(const int &pid, const int &uid, const int &tokenId);
63 
64     int VerifyGetWifiInfoInternalPermission(const int &pid, const int &uid);
65 
66     int VerifyManageWifiHotspotExtPermission(const int &pid, const int &uid);
67 
68     int VerifyGetWifiConfigPermission(const int &pid, const int &uid);
69 
70     int VerifyEnterpriseWifiConnectionPermission(const int &pid, const int &uid);
71 
72     int VerifySameProcessPermission(const int &pid, const int &uid);
73 };
74 
75 class WifiNetAgent {
76 public:
77     static WifiNetAgent &GetInstance();
78 
79     explicit WifiNetAgent();
80     ~WifiNetAgent();
81     void OnStaMachineUpdateNetLinkInfo(IpInfo &wifiIpInfo, IpV6Info &wifiIpV6Info, WifiProxyConfig &wifiProxyConfig,
82         int instId = 0);
83     void OnStaMachineUpdateNetSupplierInfo(const sptr<NetManagerStandard::NetSupplierInfo> netSupplierInfo,
84         int instId = 0);
85     void OnStaMachineNetManagerRestart(const sptr<NetManagerStandard::NetSupplierInfo> &netSupplierInfo,
86         int instId = 0);
87     void OnStaMachineWifiStart(int instId = 0);
88     bool DelInterfaceAddress(const std::string &interface, const std::string &ipAddress, int prefixLength);
89     void UnregisterNetSupplier(int instId = 0);
90 };
91 
92 struct NetworkSelectionResult {
93     InterScanInfo interScanInfo;
94     WifiDeviceConfig wifiDeviceConfig;
95 };
96 
97 class NetworkSelectionManager {
98 public:
99     std::unique_ptr<NetworkSelectorFactory> pNetworkSelectorFactory = nullptr;
100 };
101 
102 } // namespace Wifi
103 } // namespace OHOS
104 #endif