1b1b8bc3fSopenharmony_ci/*
2b1b8bc3fSopenharmony_ci * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
3b1b8bc3fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4b1b8bc3fSopenharmony_ci * you may not use this file except in compliance with the License.
5b1b8bc3fSopenharmony_ci * You may obtain a copy of the License at
6b1b8bc3fSopenharmony_ci *
7b1b8bc3fSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8b1b8bc3fSopenharmony_ci *
9b1b8bc3fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10b1b8bc3fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11b1b8bc3fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12b1b8bc3fSopenharmony_ci * See the License for the specific language governing permissions and
13b1b8bc3fSopenharmony_ci * limitations under the License.
14b1b8bc3fSopenharmony_ci */
15b1b8bc3fSopenharmony_ci
16b1b8bc3fSopenharmony_ci#ifndef NETSYS_NATIVE_CLIENT_H
17b1b8bc3fSopenharmony_ci#define NETSYS_NATIVE_CLIENT_H
18b1b8bc3fSopenharmony_ci
19b1b8bc3fSopenharmony_ci#include <linux/if.h>
20b1b8bc3fSopenharmony_ci#include <memory>
21b1b8bc3fSopenharmony_ci#include <netdb.h>
22b1b8bc3fSopenharmony_ci#include <string>
23b1b8bc3fSopenharmony_ci#include <vector>
24b1b8bc3fSopenharmony_ci
25b1b8bc3fSopenharmony_ci#include "i_netsys_service.h"
26b1b8bc3fSopenharmony_ci#include "i_net_diag_callback.h"
27b1b8bc3fSopenharmony_ci#include "i_net_dns_health_callback.h"
28b1b8bc3fSopenharmony_ci#include "net_dns_result_callback_stub.h"
29b1b8bc3fSopenharmony_ci#include "netsys_controller_callback.h"
30b1b8bc3fSopenharmony_ci#include "netsys_controller_define.h"
31b1b8bc3fSopenharmony_ci#include "network_sharing.h"
32b1b8bc3fSopenharmony_ci#include "notify_callback_stub.h"
33b1b8bc3fSopenharmony_ci#include "netsys_dns_report_callback.h"
34b1b8bc3fSopenharmony_ci
35b1b8bc3fSopenharmony_cinamespace OHOS {
36b1b8bc3fSopenharmony_cinamespace NetManagerStandard {
37b1b8bc3fSopenharmony_ciclass NetsysNativeClient {
38b1b8bc3fSopenharmony_ciprivate:
39b1b8bc3fSopenharmony_ci    class NativeNotifyCallback : public OHOS::NetsysNative::NotifyCallbackStub {
40b1b8bc3fSopenharmony_ci    public:
41b1b8bc3fSopenharmony_ci        NativeNotifyCallback(NetsysNativeClient &netsysNativeClient);
42b1b8bc3fSopenharmony_ci        ~NativeNotifyCallback() override = default;
43b1b8bc3fSopenharmony_ci        int32_t OnInterfaceAddressUpdated(const std::string &addr, const std::string &ifName, int flags,
44b1b8bc3fSopenharmony_ci                                          int scope) override;
45b1b8bc3fSopenharmony_ci        int32_t OnInterfaceAddressRemoved(const std::string &addr, const std::string &ifName, int flags,
46b1b8bc3fSopenharmony_ci                                          int scope) override;
47b1b8bc3fSopenharmony_ci        int32_t OnInterfaceAdded(const std::string &ifName) override;
48b1b8bc3fSopenharmony_ci        int32_t OnInterfaceRemoved(const std::string &ifName) override;
49b1b8bc3fSopenharmony_ci        int32_t OnInterfaceChanged(const std::string &ifName, bool up) override;
50b1b8bc3fSopenharmony_ci        int32_t OnInterfaceLinkStateChanged(const std::string &ifName, bool up) override;
51b1b8bc3fSopenharmony_ci        int32_t OnRouteChanged(bool updated, const std::string &route, const std::string &gateway,
52b1b8bc3fSopenharmony_ci                               const std::string &ifName) override;
53b1b8bc3fSopenharmony_ci        int32_t OnDhcpSuccess(sptr<OHOS::NetsysNative::DhcpResultParcel> &dhcpResult) override;
54b1b8bc3fSopenharmony_ci        int32_t OnBandwidthReachedLimit(const std::string &limitName, const std::string &iface) override;
55b1b8bc3fSopenharmony_ci
56b1b8bc3fSopenharmony_ci    private:
57b1b8bc3fSopenharmony_ci        NetsysNativeClient &netsysNativeClient_;
58b1b8bc3fSopenharmony_ci    };
59b1b8bc3fSopenharmony_ci
60b1b8bc3fSopenharmony_ci    class NativeNetDnsResultCallback : public OHOS::NetsysNative::NetDnsResultCallbackStub {
61b1b8bc3fSopenharmony_ci    public:
62b1b8bc3fSopenharmony_ci        NativeNetDnsResultCallback(NetsysNativeClient &netsysNativeClient);
63b1b8bc3fSopenharmony_ci        ~NativeNetDnsResultCallback() override = default;
64b1b8bc3fSopenharmony_ci        int32_t OnDnsResultReport(uint32_t size, std::list<OHOS::NetsysNative::NetDnsResultReport> res) override;
65b1b8bc3fSopenharmony_ci
66b1b8bc3fSopenharmony_ci    private:
67b1b8bc3fSopenharmony_ci        NetsysNativeClient &netsysNativeClient_;
68b1b8bc3fSopenharmony_ci    };
69b1b8bc3fSopenharmony_ci
70b1b8bc3fSopenharmony_cipublic:
71b1b8bc3fSopenharmony_ci    NetsysNativeClient();
72b1b8bc3fSopenharmony_ci    ~NetsysNativeClient() = default;
73b1b8bc3fSopenharmony_ci
74b1b8bc3fSopenharmony_ci    /**
75b1b8bc3fSopenharmony_ci     * Disallow or allow a app to create AF_INET or AF_INET6 socket
76b1b8bc3fSopenharmony_ci     *
77b1b8bc3fSopenharmony_ci     * @param uid App's uid which need to be disallowed ot allowed to create AF_INET or AF_INET6 socket
78b1b8bc3fSopenharmony_ci     * @param allow 0 means disallow, 1 means allow
79b1b8bc3fSopenharmony_ci     * @return return 0 if OK, return error number if not OK
80b1b8bc3fSopenharmony_ci     */
81b1b8bc3fSopenharmony_ci    int32_t SetInternetPermission(uint32_t uid, uint8_t allow);
82b1b8bc3fSopenharmony_ci
83b1b8bc3fSopenharmony_ci    /**
84b1b8bc3fSopenharmony_ci     * Create a physical network
85b1b8bc3fSopenharmony_ci     *
86b1b8bc3fSopenharmony_ci     * @param netId
87b1b8bc3fSopenharmony_ci     * @param permission Permission to create a physical network
88b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call
89b1b8bc3fSopenharmony_ci     */
90b1b8bc3fSopenharmony_ci    int32_t NetworkCreatePhysical(int32_t netId, int32_t permission);
91b1b8bc3fSopenharmony_ci
92b1b8bc3fSopenharmony_ci    int32_t NetworkCreateVirtual(int32_t netId, bool hasDns);
93b1b8bc3fSopenharmony_ci    int32_t NetworkAddUids(int32_t netId, const std::vector<UidRange> &uidRanges);
94b1b8bc3fSopenharmony_ci    int32_t NetworkDelUids(int32_t netId, const std::vector<UidRange> &uidRanges);
95b1b8bc3fSopenharmony_ci
96b1b8bc3fSopenharmony_ci    /**
97b1b8bc3fSopenharmony_ci     * Destroy the network
98b1b8bc3fSopenharmony_ci     *
99b1b8bc3fSopenharmony_ci     * @param netId
100b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call
101b1b8bc3fSopenharmony_ci     */
102b1b8bc3fSopenharmony_ci    int32_t NetworkDestroy(int32_t netId);
103b1b8bc3fSopenharmony_ci
104b1b8bc3fSopenharmony_ci    int32_t CreateVnic(uint16_t mtu, const std::string &tunAddr, int32_t prefix, const std::set<int32_t> &uids);
105b1b8bc3fSopenharmony_ci    int32_t DestroyVnic();
106b1b8bc3fSopenharmony_ci    int32_t EnableDistributedClientNet(const std::string &virnicAddr, const std::string &iif);
107b1b8bc3fSopenharmony_ci    int32_t EnableDistributedServerNet(const std::string &iif, const std::string &devIface, const std::string &dstAddr);
108b1b8bc3fSopenharmony_ci    int32_t DisableDistributedNet(bool isServer);
109b1b8bc3fSopenharmony_ci
110b1b8bc3fSopenharmony_ci    /**
111b1b8bc3fSopenharmony_ci     * Add network port device
112b1b8bc3fSopenharmony_ci     *
113b1b8bc3fSopenharmony_ci     * @param netId
114b1b8bc3fSopenharmony_ci     * @param iface Network port device name
115b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call
116b1b8bc3fSopenharmony_ci     */
117b1b8bc3fSopenharmony_ci    int32_t NetworkAddInterface(int32_t netId, const std::string &iface, NetBearType netBearerType);
118b1b8bc3fSopenharmony_ci
119b1b8bc3fSopenharmony_ci    /**
120b1b8bc3fSopenharmony_ci     * Delete network port device
121b1b8bc3fSopenharmony_ci     *
122b1b8bc3fSopenharmony_ci     * @param netId
123b1b8bc3fSopenharmony_ci     * @param iface Network port device name
124b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call
125b1b8bc3fSopenharmony_ci     */
126b1b8bc3fSopenharmony_ci    int32_t NetworkRemoveInterface(int32_t netId, const std::string &iface);
127b1b8bc3fSopenharmony_ci
128b1b8bc3fSopenharmony_ci    /**
129b1b8bc3fSopenharmony_ci     * Add route
130b1b8bc3fSopenharmony_ci     *
131b1b8bc3fSopenharmony_ci     * @param netId
132b1b8bc3fSopenharmony_ci     * @param ifName Network port device name
133b1b8bc3fSopenharmony_ci     * @param destination Target host ip
134b1b8bc3fSopenharmony_ci     * @param nextHop Next hop address
135b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call
136b1b8bc3fSopenharmony_ci     */
137b1b8bc3fSopenharmony_ci    int32_t NetworkAddRoute(int32_t netId, const std::string &ifName, const std::string &destination,
138b1b8bc3fSopenharmony_ci                            const std::string &nextHop);
139b1b8bc3fSopenharmony_ci
140b1b8bc3fSopenharmony_ci    /**
141b1b8bc3fSopenharmony_ci     * Remove route
142b1b8bc3fSopenharmony_ci     *
143b1b8bc3fSopenharmony_ci     * @param netId
144b1b8bc3fSopenharmony_ci     * @param ifName Network port device name
145b1b8bc3fSopenharmony_ci     * @param destination Target host ip
146b1b8bc3fSopenharmony_ci     * @param nextHop Next hop address
147b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call
148b1b8bc3fSopenharmony_ci     */
149b1b8bc3fSopenharmony_ci    int32_t NetworkRemoveRoute(int32_t netId, const std::string &ifName, const std::string &destination,
150b1b8bc3fSopenharmony_ci                               const std::string &nextHop);
151b1b8bc3fSopenharmony_ci
152b1b8bc3fSopenharmony_ci    /**
153b1b8bc3fSopenharmony_ci     * @brief Get interface config
154b1b8bc3fSopenharmony_ci     *
155b1b8bc3fSopenharmony_ci     * @param iface Network port device name
156b1b8bc3fSopenharmony_ci     * @return Return the result of this action, ERR_NONE is success.
157b1b8bc3fSopenharmony_ci     */
158b1b8bc3fSopenharmony_ci    int32_t GetInterfaceConfig(OHOS::nmd::InterfaceConfigurationParcel &cfg);
159b1b8bc3fSopenharmony_ci
160b1b8bc3fSopenharmony_ci    /**
161b1b8bc3fSopenharmony_ci     * @brief Set interface config
162b1b8bc3fSopenharmony_ci     *
163b1b8bc3fSopenharmony_ci     * @param cfg Network port info
164b1b8bc3fSopenharmony_ci     * @return Return the result of this action, ERR_NONE is success.
165b1b8bc3fSopenharmony_ci     */
166b1b8bc3fSopenharmony_ci    int32_t SetInterfaceConfig(const OHOS::nmd::InterfaceConfigurationParcel &cfg);
167b1b8bc3fSopenharmony_ci
168b1b8bc3fSopenharmony_ci    /**
169b1b8bc3fSopenharmony_ci     * Turn off the device
170b1b8bc3fSopenharmony_ci     *
171b1b8bc3fSopenharmony_ci     * @param iface Network port device name
172b1b8bc3fSopenharmony_ci     * @return Return the result of this action
173b1b8bc3fSopenharmony_ci     */
174b1b8bc3fSopenharmony_ci    int32_t SetInterfaceDown(const std::string &iface);
175b1b8bc3fSopenharmony_ci
176b1b8bc3fSopenharmony_ci    /**
177b1b8bc3fSopenharmony_ci     * Turn on the device
178b1b8bc3fSopenharmony_ci     *
179b1b8bc3fSopenharmony_ci     * @param iface Network port device name
180b1b8bc3fSopenharmony_ci     * @return Return the result of this action
181b1b8bc3fSopenharmony_ci     */
182b1b8bc3fSopenharmony_ci    int32_t SetInterfaceUp(const std::string &iface);
183b1b8bc3fSopenharmony_ci
184b1b8bc3fSopenharmony_ci    /**
185b1b8bc3fSopenharmony_ci     * Clear the network interface ip address
186b1b8bc3fSopenharmony_ci     *
187b1b8bc3fSopenharmony_ci     * @param ifName Network port device name
188b1b8bc3fSopenharmony_ci     */
189b1b8bc3fSopenharmony_ci    void ClearInterfaceAddrs(const std::string &ifName);
190b1b8bc3fSopenharmony_ci
191b1b8bc3fSopenharmony_ci    /**
192b1b8bc3fSopenharmony_ci     * Obtain mtu from the network interface device
193b1b8bc3fSopenharmony_ci     *
194b1b8bc3fSopenharmony_ci     * @param ifName Network port device name
195b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call
196b1b8bc3fSopenharmony_ci     */
197b1b8bc3fSopenharmony_ci    int32_t GetInterfaceMtu(const std::string &ifName);
198b1b8bc3fSopenharmony_ci
199b1b8bc3fSopenharmony_ci    /**
200b1b8bc3fSopenharmony_ci     * Set mtu to network interface device
201b1b8bc3fSopenharmony_ci     *
202b1b8bc3fSopenharmony_ci     * @param ifName Network port device name
203b1b8bc3fSopenharmony_ci     * @param mtu
204b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call
205b1b8bc3fSopenharmony_ci     */
206b1b8bc3fSopenharmony_ci    int32_t SetInterfaceMtu(const std::string &ifName, int32_t mtu);
207b1b8bc3fSopenharmony_ci
208b1b8bc3fSopenharmony_ci    /**
209b1b8bc3fSopenharmony_ci     * Set tcp buffer sizes
210b1b8bc3fSopenharmony_ci     *
211b1b8bc3fSopenharmony_ci     * @param tcpBufferSizes tcpBufferSizes
212b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call
213b1b8bc3fSopenharmony_ci     */
214b1b8bc3fSopenharmony_ci    int32_t SetTcpBufferSizes(const std::string &tcpBufferSizes);
215b1b8bc3fSopenharmony_ci
216b1b8bc3fSopenharmony_ci    /**
217b1b8bc3fSopenharmony_ci     * Add ip address
218b1b8bc3fSopenharmony_ci     *
219b1b8bc3fSopenharmony_ci     * @param ifName Network port device name
220b1b8bc3fSopenharmony_ci     * @param ipAddr    ip address
221b1b8bc3fSopenharmony_ci     * @param prefixLength  subnet mask
222b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call
223b1b8bc3fSopenharmony_ci     */
224b1b8bc3fSopenharmony_ci    int32_t AddInterfaceAddress(const std::string &ifName, const std::string &ipAddr, int32_t prefixLength);
225b1b8bc3fSopenharmony_ci
226b1b8bc3fSopenharmony_ci    /**
227b1b8bc3fSopenharmony_ci     * Delete ip address
228b1b8bc3fSopenharmony_ci     *
229b1b8bc3fSopenharmony_ci     * @param ifName Network port device name
230b1b8bc3fSopenharmony_ci     * @param ipAddr ip address
231b1b8bc3fSopenharmony_ci     * @param prefixLength subnet mask
232b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call
233b1b8bc3fSopenharmony_ci     */
234b1b8bc3fSopenharmony_ci    int32_t DelInterfaceAddress(const std::string &ifName, const std::string &ipAddr, int32_t prefixLength);
235b1b8bc3fSopenharmony_ci
236b1b8bc3fSopenharmony_ci    /**
237b1b8bc3fSopenharmony_ci     * Delete ip address
238b1b8bc3fSopenharmony_ci     *
239b1b8bc3fSopenharmony_ci     * @param ifName Network port device name
240b1b8bc3fSopenharmony_ci     * @param ipAddr ip address
241b1b8bc3fSopenharmony_ci     * @param prefixLength subnet mask
242b1b8bc3fSopenharmony_ci     * @param netCapabilities Net capabilities in string format
243b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call
244b1b8bc3fSopenharmony_ci     */
245b1b8bc3fSopenharmony_ci    int32_t DelInterfaceAddress(const std::string &ifName, const std::string &ipAddr, int32_t prefixLength,
246b1b8bc3fSopenharmony_ci                                const std::string &netCapabilities);
247b1b8bc3fSopenharmony_ci
248b1b8bc3fSopenharmony_ci    /**
249b1b8bc3fSopenharmony_ci     * Set iface ip address
250b1b8bc3fSopenharmony_ci     *
251b1b8bc3fSopenharmony_ci     * @param ifaceName Network port device name
252b1b8bc3fSopenharmony_ci     * @param ipAddress Ip address
253b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call
254b1b8bc3fSopenharmony_ci     */
255b1b8bc3fSopenharmony_ci    int32_t InterfaceSetIpAddress(const std::string &ifaceName, const std::string &ipAddress);
256b1b8bc3fSopenharmony_ci
257b1b8bc3fSopenharmony_ci    /**
258b1b8bc3fSopenharmony_ci     * Set iface up
259b1b8bc3fSopenharmony_ci     *
260b1b8bc3fSopenharmony_ci     * @param ifaceName Network port device name
261b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call
262b1b8bc3fSopenharmony_ci     */
263b1b8bc3fSopenharmony_ci    int32_t InterfaceSetIffUp(const std::string &ifaceName);
264b1b8bc3fSopenharmony_ci
265b1b8bc3fSopenharmony_ci    /**
266b1b8bc3fSopenharmony_ci     * Set dns
267b1b8bc3fSopenharmony_ci     *
268b1b8bc3fSopenharmony_ci     * @param netId
269b1b8bc3fSopenharmony_ci     * @param baseTimeoutMsec
270b1b8bc3fSopenharmony_ci     * @param retryCount
271b1b8bc3fSopenharmony_ci     * @param servers
272b1b8bc3fSopenharmony_ci     * @param domains
273b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call
274b1b8bc3fSopenharmony_ci     */
275b1b8bc3fSopenharmony_ci    int32_t SetResolverConfig(uint16_t netId, uint16_t baseTimeoutMsec, uint8_t retryCount,
276b1b8bc3fSopenharmony_ci                              const std::vector<std::string> &servers, const std::vector<std::string> &domains);
277b1b8bc3fSopenharmony_ci
278b1b8bc3fSopenharmony_ci    /**
279b1b8bc3fSopenharmony_ci     * Get dns server param info
280b1b8bc3fSopenharmony_ci     *
281b1b8bc3fSopenharmony_ci     * @param netId
282b1b8bc3fSopenharmony_ci     * @param servers
283b1b8bc3fSopenharmony_ci     * @param domains
284b1b8bc3fSopenharmony_ci     * @param baseTimeoutMsec
285b1b8bc3fSopenharmony_ci     * @param retryCount
286b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call
287b1b8bc3fSopenharmony_ci     */
288b1b8bc3fSopenharmony_ci    int32_t GetResolverConfig(uint16_t netId, std::vector<std::string> &servers, std::vector<std::string> &domains,
289b1b8bc3fSopenharmony_ci                              uint16_t &baseTimeoutMsec, uint8_t &retryCount);
290b1b8bc3fSopenharmony_ci
291b1b8bc3fSopenharmony_ci    /**
292b1b8bc3fSopenharmony_ci     * Create dns cache before set dns
293b1b8bc3fSopenharmony_ci     *
294b1b8bc3fSopenharmony_ci     * @param netId
295b1b8bc3fSopenharmony_ci     * @return Return the return value for status of call
296b1b8bc3fSopenharmony_ci     */
297b1b8bc3fSopenharmony_ci    int32_t CreateNetworkCache(uint16_t netId);
298b1b8bc3fSopenharmony_ci
299b1b8bc3fSopenharmony_ci    /**
300b1b8bc3fSopenharmony_ci     * Destroy dns cache
301b1b8bc3fSopenharmony_ci     *
302b1b8bc3fSopenharmony_ci     * @param netId
303b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call
304b1b8bc3fSopenharmony_ci     */
305b1b8bc3fSopenharmony_ci    int32_t DestroyNetworkCache(uint16_t netId);
306b1b8bc3fSopenharmony_ci
307b1b8bc3fSopenharmony_ci    /**
308b1b8bc3fSopenharmony_ci     * Domain name resolution Obtains the domain name address
309b1b8bc3fSopenharmony_ci     *
310b1b8bc3fSopenharmony_ci     * @param hostName Domain name to be resolved
311b1b8bc3fSopenharmony_ci     * @param serverName Server name used for query
312b1b8bc3fSopenharmony_ci     * @param hints Limit parameters when querying
313b1b8bc3fSopenharmony_ci     * @param netId Network id
314b1b8bc3fSopenharmony_ci     * @param res return addrinfo
315b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call
316b1b8bc3fSopenharmony_ci     */
317b1b8bc3fSopenharmony_ci    int32_t GetAddrInfo(const std::string &hostName, const std::string &serverName, const AddrInfo &hints,
318b1b8bc3fSopenharmony_ci                        uint16_t netId, std::vector<AddrInfo> &res);
319b1b8bc3fSopenharmony_ci
320b1b8bc3fSopenharmony_ci    /**
321b1b8bc3fSopenharmony_ci     * Obtains the bytes of the sharing network.
322b1b8bc3fSopenharmony_ci     *
323b1b8bc3fSopenharmony_ci     * @return Success return 0.
324b1b8bc3fSopenharmony_ci     */
325b1b8bc3fSopenharmony_ci    int32_t GetNetworkSharingTraffic(const std::string &downIface, const std::string &upIface,
326b1b8bc3fSopenharmony_ci                                     nmd::NetworkSharingTraffic &traffic);
327b1b8bc3fSopenharmony_ci
328b1b8bc3fSopenharmony_ci    /**
329b1b8bc3fSopenharmony_ci     * Obtains the bytes received over the cellular network.
330b1b8bc3fSopenharmony_ci     *
331b1b8bc3fSopenharmony_ci     * @return The number of received bytes.
332b1b8bc3fSopenharmony_ci     */
333b1b8bc3fSopenharmony_ci    int64_t GetCellularRxBytes();
334b1b8bc3fSopenharmony_ci
335b1b8bc3fSopenharmony_ci    /**
336b1b8bc3fSopenharmony_ci     * Obtains the bytes sent over the cellular network.
337b1b8bc3fSopenharmony_ci     *
338b1b8bc3fSopenharmony_ci     * @return The number of sent bytes.
339b1b8bc3fSopenharmony_ci     */
340b1b8bc3fSopenharmony_ci    int64_t GetCellularTxBytes();
341b1b8bc3fSopenharmony_ci
342b1b8bc3fSopenharmony_ci    /**
343b1b8bc3fSopenharmony_ci     * Obtains the bytes received through all NICs.
344b1b8bc3fSopenharmony_ci     *
345b1b8bc3fSopenharmony_ci     * @return The number of received bytes.
346b1b8bc3fSopenharmony_ci     */
347b1b8bc3fSopenharmony_ci    int64_t GetAllRxBytes();
348b1b8bc3fSopenharmony_ci
349b1b8bc3fSopenharmony_ci    /**
350b1b8bc3fSopenharmony_ci     * Obtains the bytes sent through all NICs.
351b1b8bc3fSopenharmony_ci     *
352b1b8bc3fSopenharmony_ci     * @return The number of sent bytes.
353b1b8bc3fSopenharmony_ci     */
354b1b8bc3fSopenharmony_ci    int64_t GetAllTxBytes();
355b1b8bc3fSopenharmony_ci
356b1b8bc3fSopenharmony_ci    /**
357b1b8bc3fSopenharmony_ci     * Obtains the bytes received through a specified UID.
358b1b8bc3fSopenharmony_ci     *
359b1b8bc3fSopenharmony_ci     * @param uid app id.
360b1b8bc3fSopenharmony_ci     * @return The number of received bytes.
361b1b8bc3fSopenharmony_ci     */
362b1b8bc3fSopenharmony_ci    int64_t GetUidRxBytes(uint32_t uid);
363b1b8bc3fSopenharmony_ci
364b1b8bc3fSopenharmony_ci    /**
365b1b8bc3fSopenharmony_ci     * Obtains the bytes sent through a specified UID.
366b1b8bc3fSopenharmony_ci     *
367b1b8bc3fSopenharmony_ci     * @param uid app id.
368b1b8bc3fSopenharmony_ci     * @return The number of sent bytes.
369b1b8bc3fSopenharmony_ci     */
370b1b8bc3fSopenharmony_ci    int64_t GetUidTxBytes(uint32_t uid);
371b1b8bc3fSopenharmony_ci
372b1b8bc3fSopenharmony_ci    /**
373b1b8bc3fSopenharmony_ci     * Obtains the bytes received through a specified UID on Iface.
374b1b8bc3fSopenharmony_ci     *
375b1b8bc3fSopenharmony_ci     * @param uid app id.
376b1b8bc3fSopenharmony_ci     * @param iface The name of the interface.
377b1b8bc3fSopenharmony_ci     * @return The number of received bytes.
378b1b8bc3fSopenharmony_ci     */
379b1b8bc3fSopenharmony_ci    int64_t GetUidOnIfaceRxBytes(uint32_t uid, const std::string &interfaceName);
380b1b8bc3fSopenharmony_ci
381b1b8bc3fSopenharmony_ci    /**
382b1b8bc3fSopenharmony_ci     * Obtains the bytes sent through a specified UID on Iface.
383b1b8bc3fSopenharmony_ci     *
384b1b8bc3fSopenharmony_ci     * @param uid app id.
385b1b8bc3fSopenharmony_ci     * @param iface The name of the interface.
386b1b8bc3fSopenharmony_ci     * @return The number of sent bytes.
387b1b8bc3fSopenharmony_ci     */
388b1b8bc3fSopenharmony_ci    int64_t GetUidOnIfaceTxBytes(uint32_t uid, const std::string &interfaceName);
389b1b8bc3fSopenharmony_ci
390b1b8bc3fSopenharmony_ci    /**
391b1b8bc3fSopenharmony_ci     * Obtains the bytes received through a specified NIC.
392b1b8bc3fSopenharmony_ci     *
393b1b8bc3fSopenharmony_ci     * @param iface The name of the interface.
394b1b8bc3fSopenharmony_ci     * @return The number of received bytes.
395b1b8bc3fSopenharmony_ci     */
396b1b8bc3fSopenharmony_ci    int64_t GetIfaceRxBytes(const std::string &interfaceName);
397b1b8bc3fSopenharmony_ci
398b1b8bc3fSopenharmony_ci    /**
399b1b8bc3fSopenharmony_ci     * Obtains the bytes sent through a specified NIC.
400b1b8bc3fSopenharmony_ci     *
401b1b8bc3fSopenharmony_ci     * @param iface The name of the interface.
402b1b8bc3fSopenharmony_ci     * @return The number of sent bytes.
403b1b8bc3fSopenharmony_ci     */
404b1b8bc3fSopenharmony_ci    int64_t GetIfaceTxBytes(const std::string &interfaceName);
405b1b8bc3fSopenharmony_ci
406b1b8bc3fSopenharmony_ci    /**
407b1b8bc3fSopenharmony_ci     * Obtains the NIC list.
408b1b8bc3fSopenharmony_ci     *
409b1b8bc3fSopenharmony_ci     * @return The list of interface.
410b1b8bc3fSopenharmony_ci     */
411b1b8bc3fSopenharmony_ci    std::vector<std::string> InterfaceGetList();
412b1b8bc3fSopenharmony_ci
413b1b8bc3fSopenharmony_ci    /**
414b1b8bc3fSopenharmony_ci     * Obtains the uid list.
415b1b8bc3fSopenharmony_ci     *
416b1b8bc3fSopenharmony_ci     * @return The list of uid.
417b1b8bc3fSopenharmony_ci     */
418b1b8bc3fSopenharmony_ci    std::vector<std::string> UidGetList();
419b1b8bc3fSopenharmony_ci
420b1b8bc3fSopenharmony_ci    /**
421b1b8bc3fSopenharmony_ci     * Obtains the packets received through a specified NIC.
422b1b8bc3fSopenharmony_ci     *
423b1b8bc3fSopenharmony_ci     * @param iface The name of the interface.
424b1b8bc3fSopenharmony_ci     * @return The number of received packets.
425b1b8bc3fSopenharmony_ci     */
426b1b8bc3fSopenharmony_ci    int64_t GetIfaceRxPackets(const std::string &interfaceName);
427b1b8bc3fSopenharmony_ci
428b1b8bc3fSopenharmony_ci    /**
429b1b8bc3fSopenharmony_ci     * Obtains the packets sent through a specified NIC.
430b1b8bc3fSopenharmony_ci     *
431b1b8bc3fSopenharmony_ci     * @param iface The name of the interface.
432b1b8bc3fSopenharmony_ci     * @return The number of sent packets.
433b1b8bc3fSopenharmony_ci     */
434b1b8bc3fSopenharmony_ci    int64_t GetIfaceTxPackets(const std::string &interfaceName);
435b1b8bc3fSopenharmony_ci
436b1b8bc3fSopenharmony_ci    /**
437b1b8bc3fSopenharmony_ci     *  set default network.
438b1b8bc3fSopenharmony_ci     *
439b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call
440b1b8bc3fSopenharmony_ci     */
441b1b8bc3fSopenharmony_ci    int32_t SetDefaultNetWork(int32_t netId);
442b1b8bc3fSopenharmony_ci
443b1b8bc3fSopenharmony_ci    /**
444b1b8bc3fSopenharmony_ci     * clear default network netId.
445b1b8bc3fSopenharmony_ci     *
446b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call
447b1b8bc3fSopenharmony_ci     */
448b1b8bc3fSopenharmony_ci    int32_t ClearDefaultNetWorkNetId();
449b1b8bc3fSopenharmony_ci
450b1b8bc3fSopenharmony_ci    /**
451b1b8bc3fSopenharmony_ci     * Obtains the NIC list.
452b1b8bc3fSopenharmony_ci     *
453b1b8bc3fSopenharmony_ci     * @param socketFd
454b1b8bc3fSopenharmony_ci     * @param netId
455b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call
456b1b8bc3fSopenharmony_ci     */
457b1b8bc3fSopenharmony_ci    int32_t BindSocket(int32_t socketFd, uint32_t netId);
458b1b8bc3fSopenharmony_ci
459b1b8bc3fSopenharmony_ci    /**
460b1b8bc3fSopenharmony_ci     * Enable ip forwarding.
461b1b8bc3fSopenharmony_ci     *
462b1b8bc3fSopenharmony_ci     * @param requestor the requestor of forwarding
463b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
464b1b8bc3fSopenharmony_ci     */
465b1b8bc3fSopenharmony_ci    int32_t IpEnableForwarding(const std::string &requestor);
466b1b8bc3fSopenharmony_ci
467b1b8bc3fSopenharmony_ci    /**
468b1b8bc3fSopenharmony_ci     * Disable ip forwarding.
469b1b8bc3fSopenharmony_ci     *
470b1b8bc3fSopenharmony_ci     * @param requestor the requestor of forwarding
471b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
472b1b8bc3fSopenharmony_ci     */
473b1b8bc3fSopenharmony_ci    int32_t IpDisableForwarding(const std::string &requestor);
474b1b8bc3fSopenharmony_ci
475b1b8bc3fSopenharmony_ci    /**
476b1b8bc3fSopenharmony_ci     * Enable Nat.
477b1b8bc3fSopenharmony_ci     *
478b1b8bc3fSopenharmony_ci     * @param downstreamIface the name of downstream interface
479b1b8bc3fSopenharmony_ci     * @param upstreamIface the name of upstream interface
480b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
481b1b8bc3fSopenharmony_ci     */
482b1b8bc3fSopenharmony_ci    int32_t EnableNat(const std::string &downstreamIface, const std::string &upstreamIface);
483b1b8bc3fSopenharmony_ci    /**
484b1b8bc3fSopenharmony_ci     * Disable Nat.
485b1b8bc3fSopenharmony_ci     *
486b1b8bc3fSopenharmony_ci     * @param downstreamIface the name of downstream interface
487b1b8bc3fSopenharmony_ci     * @param upstreamIface the name of upstream interface
488b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
489b1b8bc3fSopenharmony_ci     */
490b1b8bc3fSopenharmony_ci    int32_t DisableNat(const std::string &downstreamIface, const std::string &upstreamIface);
491b1b8bc3fSopenharmony_ci
492b1b8bc3fSopenharmony_ci    /**
493b1b8bc3fSopenharmony_ci     * Add interface forward.
494b1b8bc3fSopenharmony_ci     *
495b1b8bc3fSopenharmony_ci     * @param fromIface the name of incoming interface
496b1b8bc3fSopenharmony_ci     * @param toIface the name of outcoming interface
497b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
498b1b8bc3fSopenharmony_ci     */
499b1b8bc3fSopenharmony_ci    int32_t IpfwdAddInterfaceForward(const std::string &fromIface, const std::string &toIface);
500b1b8bc3fSopenharmony_ci
501b1b8bc3fSopenharmony_ci    /**
502b1b8bc3fSopenharmony_ci     * Remove interface forward.
503b1b8bc3fSopenharmony_ci     *
504b1b8bc3fSopenharmony_ci     * @param fromIface the name of incoming interface
505b1b8bc3fSopenharmony_ci     * @param toIface the name of outcoming interface
506b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
507b1b8bc3fSopenharmony_ci     */
508b1b8bc3fSopenharmony_ci    int32_t IpfwdRemoveInterfaceForward(const std::string &fromIface, const std::string &toIface);
509b1b8bc3fSopenharmony_ci
510b1b8bc3fSopenharmony_ci    /**
511b1b8bc3fSopenharmony_ci     * Set tether dns.
512b1b8bc3fSopenharmony_ci     *
513b1b8bc3fSopenharmony_ci     * @param netId network id
514b1b8bc3fSopenharmony_ci     * @param dnsAddr the list of dns address
515b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
516b1b8bc3fSopenharmony_ci     */
517b1b8bc3fSopenharmony_ci    int32_t ShareDnsSet(uint16_t netId);
518b1b8bc3fSopenharmony_ci
519b1b8bc3fSopenharmony_ci    /**
520b1b8bc3fSopenharmony_ci     * tart dns proxy listen
521b1b8bc3fSopenharmony_ci     *
522b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
523b1b8bc3fSopenharmony_ci     */
524b1b8bc3fSopenharmony_ci    virtual int32_t StartDnsProxyListen();
525b1b8bc3fSopenharmony_ci
526b1b8bc3fSopenharmony_ci    /**
527b1b8bc3fSopenharmony_ci     * stop dns proxy listen
528b1b8bc3fSopenharmony_ci     *
529b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
530b1b8bc3fSopenharmony_ci     */
531b1b8bc3fSopenharmony_ci    virtual int32_t StopDnsProxyListen();
532b1b8bc3fSopenharmony_ci
533b1b8bc3fSopenharmony_ci    /**
534b1b8bc3fSopenharmony_ci     * Set net callback function.
535b1b8bc3fSopenharmony_ci     *
536b1b8bc3fSopenharmony_ci     * @param callback callback function class
537b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
538b1b8bc3fSopenharmony_ci     */
539b1b8bc3fSopenharmony_ci    int32_t RegisterNetsysNotifyCallback(const NetsysNotifyCallback &callback);
540b1b8bc3fSopenharmony_ci
541b1b8bc3fSopenharmony_ci    /**
542b1b8bc3fSopenharmony_ci     * protect tradition network to connect VPN.
543b1b8bc3fSopenharmony_ci     *
544b1b8bc3fSopenharmony_ci     * @param socketFd socket file description
545b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
546b1b8bc3fSopenharmony_ci     */
547b1b8bc3fSopenharmony_ci    int32_t BindNetworkServiceVpn(int32_t socketFd);
548b1b8bc3fSopenharmony_ci
549b1b8bc3fSopenharmony_ci    /**
550b1b8bc3fSopenharmony_ci     * enable virtual network interface card.
551b1b8bc3fSopenharmony_ci     *
552b1b8bc3fSopenharmony_ci     * @param socketFd socket file description
553b1b8bc3fSopenharmony_ci     * @param ifRequest interface request
554b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
555b1b8bc3fSopenharmony_ci     */
556b1b8bc3fSopenharmony_ci    int32_t EnableVirtualNetIfaceCard(int32_t socketFd, struct ifreq &ifRequest, int32_t &ifaceFd);
557b1b8bc3fSopenharmony_ci
558b1b8bc3fSopenharmony_ci    /**
559b1b8bc3fSopenharmony_ci     * Set ip address.
560b1b8bc3fSopenharmony_ci     *
561b1b8bc3fSopenharmony_ci     * @param socketFd socket file description
562b1b8bc3fSopenharmony_ci     * @param ipAddress ip address
563b1b8bc3fSopenharmony_ci     * @param prefixLen the mask of ip address
564b1b8bc3fSopenharmony_ci     * @param ifRequest interface request
565b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
566b1b8bc3fSopenharmony_ci     */
567b1b8bc3fSopenharmony_ci    int32_t SetIpAddress(int32_t socketFd, const std::string &ipAddress, int32_t prefixLen, struct ifreq &ifRequest);
568b1b8bc3fSopenharmony_ci
569b1b8bc3fSopenharmony_ci    /**
570b1b8bc3fSopenharmony_ci     * Set network blocking.
571b1b8bc3fSopenharmony_ci     *
572b1b8bc3fSopenharmony_ci     * @param ifaceFd interface file description
573b1b8bc3fSopenharmony_ci     * @param isBlock network blocking
574b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
575b1b8bc3fSopenharmony_ci     */
576b1b8bc3fSopenharmony_ci    int32_t SetBlocking(int32_t ifaceFd, bool isBlock);
577b1b8bc3fSopenharmony_ci
578b1b8bc3fSopenharmony_ci    /**
579b1b8bc3fSopenharmony_ci     * Start Dhcp Client.
580b1b8bc3fSopenharmony_ci     *
581b1b8bc3fSopenharmony_ci     * @param iface interface file description
582b1b8bc3fSopenharmony_ci     * @param bIpv6 network blocking
583b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
584b1b8bc3fSopenharmony_ci     */
585b1b8bc3fSopenharmony_ci    int32_t StartDhcpClient(const std::string &iface, bool bIpv6);
586b1b8bc3fSopenharmony_ci
587b1b8bc3fSopenharmony_ci    /**
588b1b8bc3fSopenharmony_ci     * Stop Dhcp Client.
589b1b8bc3fSopenharmony_ci     *
590b1b8bc3fSopenharmony_ci     * @param iface interface file description
591b1b8bc3fSopenharmony_ci     * @param bIpv6 network blocking
592b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
593b1b8bc3fSopenharmony_ci     */
594b1b8bc3fSopenharmony_ci    int32_t StopDhcpClient(const std::string &iface, bool bIpv6);
595b1b8bc3fSopenharmony_ci
596b1b8bc3fSopenharmony_ci    /**
597b1b8bc3fSopenharmony_ci     * Register Notify Callback
598b1b8bc3fSopenharmony_ci     *
599b1b8bc3fSopenharmony_ci     * @param callback
600b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
601b1b8bc3fSopenharmony_ci     */
602b1b8bc3fSopenharmony_ci    int32_t RegisterCallback(const sptr<NetsysControllerCallback> &callback);
603b1b8bc3fSopenharmony_ci
604b1b8bc3fSopenharmony_ci    /**
605b1b8bc3fSopenharmony_ci     * start dhcpservice.
606b1b8bc3fSopenharmony_ci     *
607b1b8bc3fSopenharmony_ci     * @param iface interface name
608b1b8bc3fSopenharmony_ci     * @param ipv4addr ipv4 addr
609b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
610b1b8bc3fSopenharmony_ci     */
611b1b8bc3fSopenharmony_ci    int32_t StartDhcpService(const std::string &iface, const std::string &ipv4addr);
612b1b8bc3fSopenharmony_ci
613b1b8bc3fSopenharmony_ci    /**
614b1b8bc3fSopenharmony_ci     * stop dhcpservice.
615b1b8bc3fSopenharmony_ci     *
616b1b8bc3fSopenharmony_ci     * @param iface interface name
617b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
618b1b8bc3fSopenharmony_ci     */
619b1b8bc3fSopenharmony_ci    int32_t StopDhcpService(const std::string &iface);
620b1b8bc3fSopenharmony_ci
621b1b8bc3fSopenharmony_ci    /**
622b1b8bc3fSopenharmony_ci     * Turn on data saving mode.
623b1b8bc3fSopenharmony_ci     *
624b1b8bc3fSopenharmony_ci     * @param enable enable or disable
625b1b8bc3fSopenharmony_ci     * @return value the return value of the netsys interface call.
626b1b8bc3fSopenharmony_ci     */
627b1b8bc3fSopenharmony_ci    int32_t BandwidthEnableDataSaver(bool enable);
628b1b8bc3fSopenharmony_ci
629b1b8bc3fSopenharmony_ci    /**
630b1b8bc3fSopenharmony_ci     * Set quota.
631b1b8bc3fSopenharmony_ci     *
632b1b8bc3fSopenharmony_ci     * @param iface interface name
633b1b8bc3fSopenharmony_ci     * @param bytes
634b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
635b1b8bc3fSopenharmony_ci     */
636b1b8bc3fSopenharmony_ci    int32_t BandwidthSetIfaceQuota(const std::string &ifName, int64_t bytes);
637b1b8bc3fSopenharmony_ci
638b1b8bc3fSopenharmony_ci    /**
639b1b8bc3fSopenharmony_ci     * delete quota.
640b1b8bc3fSopenharmony_ci     *
641b1b8bc3fSopenharmony_ci     * @param iface interface name
642b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
643b1b8bc3fSopenharmony_ci     */
644b1b8bc3fSopenharmony_ci    int32_t BandwidthRemoveIfaceQuota(const std::string &ifName);
645b1b8bc3fSopenharmony_ci
646b1b8bc3fSopenharmony_ci    /**
647b1b8bc3fSopenharmony_ci     * Add DeniedList.
648b1b8bc3fSopenharmony_ci     *
649b1b8bc3fSopenharmony_ci     * @param uid
650b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
651b1b8bc3fSopenharmony_ci     */
652b1b8bc3fSopenharmony_ci    int32_t BandwidthAddDeniedList(uint32_t uid);
653b1b8bc3fSopenharmony_ci
654b1b8bc3fSopenharmony_ci    /**
655b1b8bc3fSopenharmony_ci     * Remove DeniedList.
656b1b8bc3fSopenharmony_ci     *
657b1b8bc3fSopenharmony_ci     * @param uid
658b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
659b1b8bc3fSopenharmony_ci     */
660b1b8bc3fSopenharmony_ci    int32_t BandwidthRemoveDeniedList(uint32_t uid);
661b1b8bc3fSopenharmony_ci
662b1b8bc3fSopenharmony_ci    /**
663b1b8bc3fSopenharmony_ci     * Add DeniedList.
664b1b8bc3fSopenharmony_ci     *
665b1b8bc3fSopenharmony_ci     * @param uid
666b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
667b1b8bc3fSopenharmony_ci     */
668b1b8bc3fSopenharmony_ci    int32_t BandwidthAddAllowedList(uint32_t uid);
669b1b8bc3fSopenharmony_ci
670b1b8bc3fSopenharmony_ci    /**
671b1b8bc3fSopenharmony_ci     * Remove DeniedList.
672b1b8bc3fSopenharmony_ci     *
673b1b8bc3fSopenharmony_ci     * @param uid
674b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
675b1b8bc3fSopenharmony_ci     */
676b1b8bc3fSopenharmony_ci    int32_t BandwidthRemoveAllowedList(uint32_t uid);
677b1b8bc3fSopenharmony_ci
678b1b8bc3fSopenharmony_ci    /**
679b1b8bc3fSopenharmony_ci     * Set firewall rules.
680b1b8bc3fSopenharmony_ci     *
681b1b8bc3fSopenharmony_ci     * @param chain chain type
682b1b8bc3fSopenharmony_ci     * @param isAllowedList is or not AllowedList
683b1b8bc3fSopenharmony_ci     * @param uids
684b1b8bc3fSopenharmony_ci     * @return value the return value of the netsys interface call.
685b1b8bc3fSopenharmony_ci     */
686b1b8bc3fSopenharmony_ci    int32_t FirewallSetUidsAllowedListChain(uint32_t chain, const std::vector<uint32_t> &uids);
687b1b8bc3fSopenharmony_ci
688b1b8bc3fSopenharmony_ci    /**
689b1b8bc3fSopenharmony_ci     * Set firewall rules.
690b1b8bc3fSopenharmony_ci     *
691b1b8bc3fSopenharmony_ci     * @param chain chain type
692b1b8bc3fSopenharmony_ci     * @param isAllowedList is or not AllowedList
693b1b8bc3fSopenharmony_ci     * @param uids
694b1b8bc3fSopenharmony_ci     * @return value the return value of the netsys interface call.
695b1b8bc3fSopenharmony_ci     */
696b1b8bc3fSopenharmony_ci    int32_t FirewallSetUidsDeniedListChain(uint32_t chain, const std::vector<uint32_t> &uids);
697b1b8bc3fSopenharmony_ci
698b1b8bc3fSopenharmony_ci    /**
699b1b8bc3fSopenharmony_ci     * Enable or disable the specified firewall chain.
700b1b8bc3fSopenharmony_ci     *
701b1b8bc3fSopenharmony_ci     * @param chain chain type
702b1b8bc3fSopenharmony_ci     * @param enable enable or disable
703b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
704b1b8bc3fSopenharmony_ci     */
705b1b8bc3fSopenharmony_ci    int32_t FirewallEnableChain(uint32_t chain, bool enable);
706b1b8bc3fSopenharmony_ci
707b1b8bc3fSopenharmony_ci    /**
708b1b8bc3fSopenharmony_ci     * Firewall set uid rule.
709b1b8bc3fSopenharmony_ci     *
710b1b8bc3fSopenharmony_ci     * @param chain chain type
711b1b8bc3fSopenharmony_ci     * @param uid uid
712b1b8bc3fSopenharmony_ci     * @param firewallRule firewall rule
713b1b8bc3fSopenharmony_ci     * @return Return the return value of the netsys interface call.
714b1b8bc3fSopenharmony_ci     */
715b1b8bc3fSopenharmony_ci    int32_t FirewallSetUidRule(uint32_t chain, const std::vector<uint32_t> &uids, uint32_t firewallRule);
716b1b8bc3fSopenharmony_ci
717b1b8bc3fSopenharmony_ci    /**
718b1b8bc3fSopenharmony_ci     * Get total traffic
719b1b8bc3fSopenharmony_ci     *
720b1b8bc3fSopenharmony_ci     * @param stats stats
721b1b8bc3fSopenharmony_ci     * @param type type
722b1b8bc3fSopenharmony_ci     * @return returns the total traffic of the specified type
723b1b8bc3fSopenharmony_ci     */
724b1b8bc3fSopenharmony_ci    int32_t GetTotalStats(uint64_t &stats, uint32_t type);
725b1b8bc3fSopenharmony_ci
726b1b8bc3fSopenharmony_ci    /**
727b1b8bc3fSopenharmony_ci     * Get uid traffic
728b1b8bc3fSopenharmony_ci     *
729b1b8bc3fSopenharmony_ci     * @param stats stats
730b1b8bc3fSopenharmony_ci     * @param type type
731b1b8bc3fSopenharmony_ci     * @param uid uid
732b1b8bc3fSopenharmony_ci     * @return returns the traffic of the uid
733b1b8bc3fSopenharmony_ci     */
734b1b8bc3fSopenharmony_ci    int32_t GetUidStats(uint64_t &stats, uint32_t type, uint32_t uid);
735b1b8bc3fSopenharmony_ci
736b1b8bc3fSopenharmony_ci    /**
737b1b8bc3fSopenharmony_ci     * Get Iface traffic
738b1b8bc3fSopenharmony_ci     *
739b1b8bc3fSopenharmony_ci     * @param stats stats
740b1b8bc3fSopenharmony_ci     * @param type type
741b1b8bc3fSopenharmony_ci     * @param interfaceName interfaceName
742b1b8bc3fSopenharmony_ci     * @return returns the traffic of the Iface
743b1b8bc3fSopenharmony_ci     */
744b1b8bc3fSopenharmony_ci    int32_t GetIfaceStats(uint64_t &stats, uint32_t type, const std::string &interfaceName);
745b1b8bc3fSopenharmony_ci
746b1b8bc3fSopenharmony_ci    /**
747b1b8bc3fSopenharmony_ci     * Get all Sim stats info
748b1b8bc3fSopenharmony_ci     * @param stats stats
749b1b8bc3fSopenharmony_ci     * @return returns the all info of the stats
750b1b8bc3fSopenharmony_ci     */
751b1b8bc3fSopenharmony_ci    int32_t GetAllSimStatsInfo(std::vector<OHOS::NetManagerStandard::NetStatsInfo> &stats);
752b1b8bc3fSopenharmony_ci
753b1b8bc3fSopenharmony_ci    /**
754b1b8bc3fSopenharmony_ci     * Delete the Sim Iface Stats with uid
755b1b8bc3fSopenharmony_ci     *
756b1b8bc3fSopenharmony_ci     * @param uid the uid of application
757b1b8bc3fSopenharmony_ci     * @return returns 0 for success other as failed.
758b1b8bc3fSopenharmony_ci     */
759b1b8bc3fSopenharmony_ci    int32_t DeleteSimStatsInfo(uint32_t uid);
760b1b8bc3fSopenharmony_ci
761b1b8bc3fSopenharmony_ci    /**
762b1b8bc3fSopenharmony_ci     * Get all stats info
763b1b8bc3fSopenharmony_ci     *
764b1b8bc3fSopenharmony_ci     * @param stats stats
765b1b8bc3fSopenharmony_ci     * @return returns the all info of the stats
766b1b8bc3fSopenharmony_ci     */
767b1b8bc3fSopenharmony_ci    int32_t GetAllStatsInfo(std::vector<OHOS::NetManagerStandard::NetStatsInfo> &stats);
768b1b8bc3fSopenharmony_ci
769b1b8bc3fSopenharmony_ci    /**
770b1b8bc3fSopenharmony_ci     * Delete the Iface Stats with uid
771b1b8bc3fSopenharmony_ci     *
772b1b8bc3fSopenharmony_ci     * @param uid the uid of application
773b1b8bc3fSopenharmony_ci     * @return returns 0 for success other as failed.
774b1b8bc3fSopenharmony_ci     */
775b1b8bc3fSopenharmony_ci    int32_t DeleteStatsInfo(uint32_t uid);
776b1b8bc3fSopenharmony_ci
777b1b8bc3fSopenharmony_ci    /**
778b1b8bc3fSopenharmony_ci     * Set iptables for result
779b1b8bc3fSopenharmony_ci     *
780b1b8bc3fSopenharmony_ci     * @param cmd Iptables command
781b1b8bc3fSopenharmony_ci     * @param respond The respond of execute iptables command
782b1b8bc3fSopenharmony_ci     * @param ipType The type of iptables command.
783b1b8bc3fSopenharmony_ci     * @return Value the return value of the netsys interface call
784b1b8bc3fSopenharmony_ci     */
785b1b8bc3fSopenharmony_ci    int32_t SetIptablesCommandForRes(const std::string &cmd, std::string &respond, NetsysNative::IptablesType ipType);
786b1b8bc3fSopenharmony_ci
787b1b8bc3fSopenharmony_ci    /**
788b1b8bc3fSopenharmony_ci     * Check network connectivity by sending packets to a host and reporting its response.
789b1b8bc3fSopenharmony_ci     *
790b1b8bc3fSopenharmony_ci     * @param pingOption Ping option
791b1b8bc3fSopenharmony_ci     * @param callback The respond of execute ping cmd.
792b1b8bc3fSopenharmony_ci     * @return Value the return value of the netsys interface call
793b1b8bc3fSopenharmony_ci     */
794b1b8bc3fSopenharmony_ci    int32_t NetDiagPingHost(const OHOS::NetsysNative::NetDiagPingOption &pingOption,
795b1b8bc3fSopenharmony_ci                            const sptr<OHOS::NetsysNative::INetDiagCallback> &callback);
796b1b8bc3fSopenharmony_ci
797b1b8bc3fSopenharmony_ci    /**
798b1b8bc3fSopenharmony_ci     * Get networking route table
799b1b8bc3fSopenharmony_ci     *
800b1b8bc3fSopenharmony_ci     * @param routeTables Network route table list.
801b1b8bc3fSopenharmony_ci     * @return Value the return value of the netsys interface call
802b1b8bc3fSopenharmony_ci     */
803b1b8bc3fSopenharmony_ci    int32_t NetDiagGetRouteTable(std::list<OHOS::NetsysNative::NetDiagRouteTable> &routeTables);
804b1b8bc3fSopenharmony_ci
805b1b8bc3fSopenharmony_ci    /**
806b1b8bc3fSopenharmony_ci     * Get networking sockets info.
807b1b8bc3fSopenharmony_ci     *
808b1b8bc3fSopenharmony_ci     * @param socketType Network protocol.
809b1b8bc3fSopenharmony_ci     * @param socketsInfo The result of network sockets info.
810b1b8bc3fSopenharmony_ci     * @return Value the return value of the netsys interface call
811b1b8bc3fSopenharmony_ci     */
812b1b8bc3fSopenharmony_ci    int32_t NetDiagGetSocketsInfo(OHOS::NetsysNative::NetDiagProtocolType socketType,
813b1b8bc3fSopenharmony_ci                                  OHOS::NetsysNative::NetDiagSocketsInfo &socketsInfo);
814b1b8bc3fSopenharmony_ci
815b1b8bc3fSopenharmony_ci    /**
816b1b8bc3fSopenharmony_ci     * Get network interface configuration.
817b1b8bc3fSopenharmony_ci     *
818b1b8bc3fSopenharmony_ci     * @param configs The result of network interface configuration.
819b1b8bc3fSopenharmony_ci     * @param ifaceName Get interface configuration information for the specified interface name.
820b1b8bc3fSopenharmony_ci     *                  If the interface name is empty, default to getting all interface configuration information.
821b1b8bc3fSopenharmony_ci     * @return Value the return value of the netsys interface call
822b1b8bc3fSopenharmony_ci     */
823b1b8bc3fSopenharmony_ci    int32_t NetDiagGetInterfaceConfig(std::list<OHOS::NetsysNative::NetDiagIfaceConfig> &configs,
824b1b8bc3fSopenharmony_ci                                      const std::string &ifaceName);
825b1b8bc3fSopenharmony_ci
826b1b8bc3fSopenharmony_ci    /**
827b1b8bc3fSopenharmony_ci     * Update network interface configuration.
828b1b8bc3fSopenharmony_ci     *
829b1b8bc3fSopenharmony_ci     * @param configs Network interface configuration.
830b1b8bc3fSopenharmony_ci     * @param ifaceName Interface name.
831b1b8bc3fSopenharmony_ci     * @param add Add or delete.
832b1b8bc3fSopenharmony_ci     * @return Value the return value of the netsys interface call
833b1b8bc3fSopenharmony_ci     */
834b1b8bc3fSopenharmony_ci    int32_t NetDiagUpdateInterfaceConfig(const OHOS::NetsysNative::NetDiagIfaceConfig &config,
835b1b8bc3fSopenharmony_ci                                         const std::string &ifaceName, bool add);
836b1b8bc3fSopenharmony_ci
837b1b8bc3fSopenharmony_ci    /**
838b1b8bc3fSopenharmony_ci     * Set network interface up/down state.
839b1b8bc3fSopenharmony_ci     *
840b1b8bc3fSopenharmony_ci     * @param ifaceName Interface name.
841b1b8bc3fSopenharmony_ci     * @param up Up or down.
842b1b8bc3fSopenharmony_ci     * @return Value the return value of the netsys interface call
843b1b8bc3fSopenharmony_ci     */
844b1b8bc3fSopenharmony_ci    int32_t NetDiagSetInterfaceActiveState(const std::string &ifaceName, bool up);
845b1b8bc3fSopenharmony_ci    int32_t AddStaticArp(const std::string &ipAddr, const std::string &macAddr,
846b1b8bc3fSopenharmony_ci                         const std::string &ifName);
847b1b8bc3fSopenharmony_ci    int32_t DelStaticArp(const std::string &ipAddr, const std::string &macAddr,
848b1b8bc3fSopenharmony_ci                         const std::string &ifName);
849b1b8bc3fSopenharmony_ci
850b1b8bc3fSopenharmony_ci        /**
851b1b8bc3fSopenharmony_ci     * Register Dns Result Callback Listener.
852b1b8bc3fSopenharmony_ci     *
853b1b8bc3fSopenharmony_ci     * @param callback Callback function
854b1b8bc3fSopenharmony_ci     * @param timestep Time gap between two callbacks
855b1b8bc3fSopenharmony_ci     * @return Value the return value of the netsys interface call
856b1b8bc3fSopenharmony_ci     */
857b1b8bc3fSopenharmony_ci    int32_t RegisterDnsResultCallback(const sptr<OHOS::NetManagerStandard::NetsysDnsReportCallback> &callback,
858b1b8bc3fSopenharmony_ci        uint32_t timeStep);
859b1b8bc3fSopenharmony_ci
860b1b8bc3fSopenharmony_ci    /**
861b1b8bc3fSopenharmony_ci     * Unregister Dns Result Callback Listener.
862b1b8bc3fSopenharmony_ci     *
863b1b8bc3fSopenharmony_ci     * @param callback Callback function
864b1b8bc3fSopenharmony_ci     * @return Value the return value of the netsys interface call
865b1b8bc3fSopenharmony_ci     */
866b1b8bc3fSopenharmony_ci    int32_t UnregisterDnsResultCallback(const sptr<OHOS::NetManagerStandard::NetsysDnsReportCallback> &callback);
867b1b8bc3fSopenharmony_ci
868b1b8bc3fSopenharmony_ci    /**
869b1b8bc3fSopenharmony_ci     * Register Dns Health Callback Listener.
870b1b8bc3fSopenharmony_ci     *
871b1b8bc3fSopenharmony_ci     * @param callback Callback function
872b1b8bc3fSopenharmony_ci     * @return Value the return value of the netsys interface call
873b1b8bc3fSopenharmony_ci     */
874b1b8bc3fSopenharmony_ci    int32_t RegisterDnsHealthCallback(const sptr<OHOS::NetsysNative::INetDnsHealthCallback> &callback);
875b1b8bc3fSopenharmony_ci
876b1b8bc3fSopenharmony_ci    /**
877b1b8bc3fSopenharmony_ci     * Unregister Dns Health Callback Listener.
878b1b8bc3fSopenharmony_ci     *
879b1b8bc3fSopenharmony_ci     * @param callback Callback function
880b1b8bc3fSopenharmony_ci     * @return Value the return value of the netsys interface call
881b1b8bc3fSopenharmony_ci     */
882b1b8bc3fSopenharmony_ci    int32_t UnregisterDnsHealthCallback(const sptr<OHOS::NetsysNative::INetDnsHealthCallback> &callback);
883b1b8bc3fSopenharmony_ci
884b1b8bc3fSopenharmony_ci    /**
885b1b8bc3fSopenharmony_ci     * Get Cookie Stats.
886b1b8bc3fSopenharmony_ci     *
887b1b8bc3fSopenharmony_ci     * @param stats stats
888b1b8bc3fSopenharmony_ci     * @param type type
889b1b8bc3fSopenharmony_ci     * @param cookie cookie
890b1b8bc3fSopenharmony_ci     * @return Value the return value of the netsys interface call
891b1b8bc3fSopenharmony_ci     */
892b1b8bc3fSopenharmony_ci    int32_t GetCookieStats(uint64_t &stats, uint32_t type, uint64_t cookie);
893b1b8bc3fSopenharmony_ci
894b1b8bc3fSopenharmony_ci    int32_t GetNetworkSharingType(std::set<uint32_t>& sharingTypeIsOn);
895b1b8bc3fSopenharmony_ci
896b1b8bc3fSopenharmony_ci    int32_t UpdateNetworkSharingType(uint32_t type, bool isOpen);
897b1b8bc3fSopenharmony_ci
898b1b8bc3fSopenharmony_ci#ifdef FEATURE_NET_FIREWALL_ENABLE
899b1b8bc3fSopenharmony_ci    /**
900b1b8bc3fSopenharmony_ci     * Set firewall rules to native
901b1b8bc3fSopenharmony_ci     *
902b1b8bc3fSopenharmony_ci     * @param type ip, dns, domain
903b1b8bc3fSopenharmony_ci     * @param ruleList list of NetFirewallIpRule
904b1b8bc3fSopenharmony_ci     * @param isFinish transmit finish or not
905b1b8bc3fSopenharmony_ci     * @return 0 if success or -1 if an error occurred
906b1b8bc3fSopenharmony_ci     */
907b1b8bc3fSopenharmony_ci    int32_t SetFirewallRules(NetFirewallRuleType type, const std::vector<sptr<NetFirewallBaseRule>> &ruleList,
908b1b8bc3fSopenharmony_ci                             bool isFinish);
909b1b8bc3fSopenharmony_ci
910b1b8bc3fSopenharmony_ci    /**
911b1b8bc3fSopenharmony_ci     * Set firewall default action
912b1b8bc3fSopenharmony_ci     *
913b1b8bc3fSopenharmony_ci     * @param inDefault  Default action of NetFirewallRuleDirection:RULE_IN
914b1b8bc3fSopenharmony_ci     * @param outDefault Default action of NetFirewallRuleDirection:RULE_OUT
915b1b8bc3fSopenharmony_ci     * @return 0 if success or -1 if an error occurred
916b1b8bc3fSopenharmony_ci     */
917b1b8bc3fSopenharmony_ci    int32_t SetFirewallDefaultAction(FirewallRuleAction inDefault, FirewallRuleAction outDefault);
918b1b8bc3fSopenharmony_ci
919b1b8bc3fSopenharmony_ci    /**
920b1b8bc3fSopenharmony_ci     * Set firewall current user id
921b1b8bc3fSopenharmony_ci     *
922b1b8bc3fSopenharmony_ci     * @param userId current user id
923b1b8bc3fSopenharmony_ci     * @return 0 if success or -1 if an error occurred
924b1b8bc3fSopenharmony_ci     */
925b1b8bc3fSopenharmony_ci    int32_t SetFirewallCurrentUserId(int32_t userId);
926b1b8bc3fSopenharmony_ci
927b1b8bc3fSopenharmony_ci    /**
928b1b8bc3fSopenharmony_ci     * Clear firewall rules by type
929b1b8bc3fSopenharmony_ci     *
930b1b8bc3fSopenharmony_ci     * @param type type
931b1b8bc3fSopenharmony_ci     * @return 0 if success or -1 if an error occurred
932b1b8bc3fSopenharmony_ci     */
933b1b8bc3fSopenharmony_ci    int32_t ClearFirewallRules(NetFirewallRuleType type);
934b1b8bc3fSopenharmony_ci
935b1b8bc3fSopenharmony_ci    /**
936b1b8bc3fSopenharmony_ci     * Register callback for recevie intercept event
937b1b8bc3fSopenharmony_ci     *
938b1b8bc3fSopenharmony_ci     * @param callback implement of INetFirewallCallback
939b1b8bc3fSopenharmony_ci     * @return 0 if success or -1 if an error occurred
940b1b8bc3fSopenharmony_ci     */
941b1b8bc3fSopenharmony_ci    int32_t RegisterNetFirewallCallback(const sptr<NetsysNative::INetFirewallCallback> &callback);
942b1b8bc3fSopenharmony_ci
943b1b8bc3fSopenharmony_ci    /**
944b1b8bc3fSopenharmony_ci     * Unregister callback for recevie intercept event
945b1b8bc3fSopenharmony_ci     *
946b1b8bc3fSopenharmony_ci     * @param callback register callback for recevie intercept event
947b1b8bc3fSopenharmony_ci     * @return 0 if success or -1 if an error occurred
948b1b8bc3fSopenharmony_ci     */
949b1b8bc3fSopenharmony_ci    int32_t UnRegisterNetFirewallCallback(const sptr<NetsysNative::INetFirewallCallback> &callback);
950b1b8bc3fSopenharmony_ci#endif
951b1b8bc3fSopenharmony_ci
952b1b8bc3fSopenharmony_ci#ifdef FEATURE_WEARABLE_DISTRIBUTED_NET_ENABLE
953b1b8bc3fSopenharmony_ci    int32_t EnableWearableDistributedNetForward(const int32_t tcpPortId, const int32_t udpPortId);
954b1b8bc3fSopenharmony_ci    int32_t DisableWearableDistributedNetForward();
955b1b8bc3fSopenharmony_ci#endif
956b1b8bc3fSopenharmony_ci
957b1b8bc3fSopenharmony_ci    int32_t SetIpv6PrivacyExtensions(const std::string &interfaceName, const uint32_t on);
958b1b8bc3fSopenharmony_ci
959b1b8bc3fSopenharmony_ci    int32_t SetEnableIpv6(const std::string &interfaceName, const uint32_t on);
960b1b8bc3fSopenharmony_ci
961b1b8bc3fSopenharmony_ci    /**
962b1b8bc3fSopenharmony_ci     * Set the policy to access the network of the specified application.
963b1b8bc3fSopenharmony_ci     *
964b1b8bc3fSopenharmony_ci     * @param uid - The specified UID of application.
965b1b8bc3fSopenharmony_ci     * @param policy - the network access policy of application. For details, see {@link NetworkAccessPolicy}.
966b1b8bc3fSopenharmony_ci     * @param reconfirmFlag true means a reconfirm diaglog trigger while policy deny network access.
967b1b8bc3fSopenharmony_ci     * @param isBroker true means the broker application.
968b1b8bc3fSopenharmony_ci     * @return return 0 if OK, return error number if not OK
969b1b8bc3fSopenharmony_ci     */
970b1b8bc3fSopenharmony_ci    int32_t SetNetworkAccessPolicy(uint32_t uid, NetworkAccessPolicy policy, bool reconfirmFlag, bool isBroker);
971b1b8bc3fSopenharmony_ci
972b1b8bc3fSopenharmony_ci    int32_t NotifyNetBearerTypeChange(std::set<NetBearType> bearerTypes);
973b1b8bc3fSopenharmony_ci    int32_t DeleteNetworkAccessPolicy(uint32_t uid);
974b1b8bc3fSopenharmony_ci
975b1b8bc3fSopenharmony_ci    int32_t StartClat(const std::string &interfaceName, int32_t netId, const std::string &nat64PrefixStr);
976b1b8bc3fSopenharmony_ci    int32_t StopClat(const std::string &interfaceName);
977b1b8bc3fSopenharmony_ci    int32_t ClearFirewallAllRules();
978b1b8bc3fSopenharmony_ci    int32_t CloseSocketsUid(const std::string &ipAddr, uint32_t uid);
979b1b8bc3fSopenharmony_ci
980b1b8bc3fSopenharmony_ci    /**
981b1b8bc3fSopenharmony_ci     * Set NIC Traffic allowed or disallowed
982b1b8bc3fSopenharmony_ci     *
983b1b8bc3fSopenharmony_ci     * @param ifaceNames ifaceNames
984b1b8bc3fSopenharmony_ci     * @param status true for allowed, false for disallowed
985b1b8bc3fSopenharmony_ci     * @return Returns 0 success. Otherwise fail, {@link NetPolicyResultCode}.
986b1b8bc3fSopenharmony_ci     */
987b1b8bc3fSopenharmony_ci    int32_t SetNicTrafficAllowed(const std::vector<std::string> &ifaceNames, bool status);
988b1b8bc3fSopenharmony_ci
989b1b8bc3fSopenharmony_ci#ifdef SUPPORT_SYSVPN
990b1b8bc3fSopenharmony_ci    /**
991b1b8bc3fSopenharmony_ci     * process the next vpn stage by SysVpnStageCode
992b1b8bc3fSopenharmony_ci     *
993b1b8bc3fSopenharmony_ci     * @param stage the next vpn stage code
994b1b8bc3fSopenharmony_ci     * @return Returns 0 success. Otherwise fail
995b1b8bc3fSopenharmony_ci     */
996b1b8bc3fSopenharmony_ci    int32_t ProcessVpnStage(NetsysNative::SysVpnStageCode stage);
997b1b8bc3fSopenharmony_ci#endif // SUPPORT_SYSVPN
998b1b8bc3fSopenharmony_ciprivate:
999b1b8bc3fSopenharmony_ci    void ProcessDhcpResult(sptr<OHOS::NetsysNative::DhcpResultParcel> &dhcpResult);
1000b1b8bc3fSopenharmony_ci    void ProcessBandwidthReachedLimit(const std::string &limitName, const std::string &iface);
1001b1b8bc3fSopenharmony_ci    sptr<OHOS::NetsysNative::INetsysService> GetProxy();
1002b1b8bc3fSopenharmony_ci    void OnRemoteDied(const wptr<IRemoteObject> &remote);
1003b1b8bc3fSopenharmony_ci
1004b1b8bc3fSopenharmony_ci    void RegisterNotifyCallback();
1005b1b8bc3fSopenharmony_ci
1006b1b8bc3fSopenharmony_ciprivate:
1007b1b8bc3fSopenharmony_ci    sptr<OHOS::NetsysNative::INotifyCallback> nativeNotifyCallback_ = nullptr;
1008b1b8bc3fSopenharmony_ci    sptr<OHOS::NetsysNative::INetDnsResultCallback> nativeDnsReportCallback_ = nullptr;
1009b1b8bc3fSopenharmony_ci    uint32_t dnsReportTimeStep = 500;
1010b1b8bc3fSopenharmony_ci    sptr<OHOS::NetsysNative::INetsysService> netsysNativeService_ = nullptr;
1011b1b8bc3fSopenharmony_ci    sptr<IRemoteObject::DeathRecipient> deathRecipient_ = nullptr;
1012b1b8bc3fSopenharmony_ci    std::list<sptr<NetsysControllerCallback>> cbObjects_;
1013b1b8bc3fSopenharmony_ci    std::list<sptr<NetsysDnsReportCallback>> cbDnsReportObjects_;
1014b1b8bc3fSopenharmony_ci    std::mutex mutex_;
1015b1b8bc3fSopenharmony_ci    std::mutex cbObjMutex_;
1016b1b8bc3fSopenharmony_ci    std::mutex cbDnsReportObjMutex_;
1017b1b8bc3fSopenharmony_ci
1018b1b8bc3fSopenharmony_ciprivate:
1019b1b8bc3fSopenharmony_ci    class NetNativeConnDeathRecipient : public IRemoteObject::DeathRecipient {
1020b1b8bc3fSopenharmony_ci    public:
1021b1b8bc3fSopenharmony_ci        explicit NetNativeConnDeathRecipient(NetsysNativeClient &client) : client_(client) {}
1022b1b8bc3fSopenharmony_ci        ~NetNativeConnDeathRecipient() override = default;
1023b1b8bc3fSopenharmony_ci        void OnRemoteDied(const wptr<IRemoteObject> &remote) override
1024b1b8bc3fSopenharmony_ci        {
1025b1b8bc3fSopenharmony_ci            client_.OnRemoteDied(remote);
1026b1b8bc3fSopenharmony_ci        }
1027b1b8bc3fSopenharmony_ci
1028b1b8bc3fSopenharmony_ci    private:
1029b1b8bc3fSopenharmony_ci        NetsysNativeClient &client_;
1030b1b8bc3fSopenharmony_ci    };
1031b1b8bc3fSopenharmony_ci};
1032b1b8bc3fSopenharmony_ci} // namespace NetManagerStandard
1033b1b8bc3fSopenharmony_ci} // namespace OHOS
1034b1b8bc3fSopenharmony_ci#endif // NETSYS_NATIVE_CLIENT_H
1035