• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2023 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 NETSYS_CONTROLLER_H
17 #define NETSYS_CONTROLLER_H
18 
19 #include "i_net_diag_callback.h"
20 #include "i_net_dns_health_callback.h"
21 #include "i_net_dns_result_callback.h"
22 #include "i_netsys_controller_service.h"
23 #include "refbase.h"
24 namespace OHOS {
25 namespace NetManagerStandard {
26 class NetsysController {
27 public:
28     ~NetsysController() = default;
29     void Init();
30 
31     static NetsysController &GetInstance();
32 
33     /**
34      * Disallow or allow a app to create AF_INET or AF_INET6 socket
35      *
36      * @param uid App's uid which need to be disallowed ot allowed to create AF_INET or AF_INET6 socket
37      * @param allow 0 means disallow, 1 means allow
38      * @return return 0 if OK, return error number if not OK
39      */
40     int32_t SetInternetPermission(uint32_t uid, uint8_t allow);
41 
42     /**
43      * Create a physical network
44      *
45      * @param netId
46      * @param permission Permission to create a physical network
47      * @return Return the return value of the netsys interface call
48      */
49     int32_t NetworkCreatePhysical(int32_t netId, int32_t permission);
50 
51     /**
52      * Create a virtual network
53      *
54      * @param netId
55      * @param hasDns
56      * @return Return the return value of the netsys interface call
57      */
58     int32_t NetworkCreateVirtual(int32_t netId, bool hasDns);
59 
60     /**
61      * Destroy the network
62      *
63      * @param netId
64      * @return Return the return value of the netsys interface call
65      */
66     int32_t NetworkDestroy(int32_t netId);
67 
68     int32_t NetworkAddUids(int32_t netId, const std::vector<int32_t> &beginUids, const std::vector<int32_t> &endUids);
69     int32_t NetworkDelUids(int32_t netId, const std::vector<int32_t> &beginUids, const std::vector<int32_t> &endUids);
70 
71     /**
72      * Add network port device
73      *
74      * @param netId
75      * @param iface Network port device name
76      * @return Return the return value of the netsys interface call
77      */
78     int32_t NetworkAddInterface(int32_t netId, const std::string &iface);
79 
80     /**
81      * Delete network port device
82      *
83      * @param netId
84      * @param iface Network port device name
85      * @return Return the return value of the netsys interface call
86      */
87     int32_t NetworkRemoveInterface(int32_t netId, const std::string &iface);
88 
89     /**
90      * Add route
91      *
92      * @param netId
93      * @param ifName Network port device name
94      * @param destination Target host ip
95      * @param nextHop Next hop address
96      * @return Return the return value of the netsys interface call
97      */
98     int32_t NetworkAddRoute(int32_t netId, const std::string &ifName, const std::string &destination,
99                             const std::string &nextHop);
100 
101     /**
102      * Remove route
103      *
104      * @param netId
105      * @param ifName Network port device name
106      * @param destination Target host ip
107      * @param nextHop Next hop address
108      * @return Return the return value of the netsys interface call
109      */
110     int32_t NetworkRemoveRoute(int32_t netId, const std::string &ifName, const std::string &destination,
111                                const std::string &nextHop);
112 
113     /**
114      * @brief Get interface config
115      *
116      * @param iface Network port device name
117      * @return Return the result of this action, ERR_NONE is success
118      */
119     int32_t GetInterfaceConfig(OHOS::nmd::InterfaceConfigurationParcel &cfg);
120 
121     /**
122      * @brief Set interface config
123      *
124      * @param cfg Network port info
125      * @return Return the result of this action, ERR_NONE is success
126      */
127     int32_t SetInterfaceConfig(const OHOS::nmd::InterfaceConfigurationParcel &cfg);
128 
129     /**
130      * Turn off the device
131      *
132      * @param iface Network port device name
133      * @return Return the result of this action
134      */
135     int32_t SetInterfaceDown(const std::string &iface);
136 
137     /**
138      * Turn on the device
139      *
140      * @param iface Network port device name
141      * @return Return the result of this action
142      */
143     int32_t SetInterfaceUp(const std::string &iface);
144 
145     /**
146      * Clear the network interface ip address
147      *
148      * @param ifName Network port device name
149      */
150     void ClearInterfaceAddrs(const std::string &ifName);
151 
152     /**
153      * Obtain mtu from the network interface device
154      *
155      * @param ifName Network port device name
156      * @return Return the return value of the netsys interface call
157      */
158     int32_t GetInterfaceMtu(const std::string &ifName);
159 
160     /**
161      * Set mtu to network interface device
162      *
163      * @param ifName Network port device name
164      * @param mtu
165      * @return Return the return value of the netsys interface call
166      */
167     int32_t SetInterfaceMtu(const std::string &ifName, int32_t mtu);
168 
169     /**
170      * @brief Set tcp buffer sizes
171      *
172      * @param tcpBufferSizes tcpBufferSizes
173      * @return Return the return value of the netsys interface call
174      */
175     int32_t SetTcpBufferSizes(const std::string &tcpBufferSizes);
176 
177     /**
178      * Add ip address
179      *
180      * @param ifName Network port device name
181      * @param ipAddr    ip address
182      * @param prefixLength  subnet mask
183      * @return Return the return value of the netsys interface call
184      */
185     int32_t AddInterfaceAddress(const std::string &ifName, const std::string &ipAddr, int32_t prefixLength);
186 
187     /**
188      * Delete ip address
189      *
190      * @param ifName Network port device name
191      * @param ipAddr ip address
192      * @param prefixLength subnet mask
193      * @return Return the return value of the netsys interface call
194      */
195     int32_t DelInterfaceAddress(const std::string &ifName, const std::string &ipAddr, int32_t prefixLength);
196 
197     /**
198      * Set iface ip address
199      *
200      * @param ifaceName Network port device name
201      * @param ipAddress Ip address
202      * @return Return the return value of the netsys interface call
203      */
204     int32_t InterfaceSetIpAddress(const std::string &ifaceName, const std::string &ipAddress);
205 
206     /**
207      * Set iface up
208      *
209      * @param ifaceName Network port device name
210      * @return Return the return value of the netsys interface call
211      */
212     int32_t InterfaceSetIffUp(const std::string &ifaceName);
213 
214     /**
215      * Set dns
216      *
217      * @param netId
218      * @param baseTimeoutMsec
219      * @param retryCount
220      * @param servers
221      * @param domains
222      * @return Return the return value of the netsys interface call
223      */
224     int32_t SetResolverConfig(uint16_t netId, uint16_t baseTimeoutMsec, uint8_t retryCount,
225                               const std::vector<std::string> &servers, const std::vector<std::string> &domains);
226     /**
227      * Get dns server param info
228      *
229      * @param netId
230      * @param servers
231      * @param domains
232      * @param baseTimeoutMsec
233      * @param retryCount
234      * @return Return the return value of the netsys interface call
235      */
236     int32_t GetResolverConfig(uint16_t netId, std::vector<std::string> &servers, std::vector<std::string> &domains,
237                               uint16_t &baseTimeoutMsec, uint8_t &retryCount);
238 
239     /**
240      * Create dns cache before set dns
241      *
242      * @param netId
243      * @return Return the return value for status of call
244      */
245     int32_t CreateNetworkCache(uint16_t netId);
246 
247     /**
248      * Destroy dns cache
249      *
250      * @param netId
251      * @return Return the return value of the netsys interface call
252      */
253     int32_t DestroyNetworkCache(uint16_t netId);
254 
255     /**
256      * Domain name resolution Obtains the domain name address
257      *
258      * @param hostName Domain name to be resolved
259      * @param serverName Server name used for query
260      * @param hints Limit parameters when querying
261      * @param netId Network id
262      * @param res return addrinfo
263      * @return Return the return value of the netsys interface call
264      */
265     int32_t GetAddrInfo(const std::string &hostName, const std::string &serverName, const AddrInfo &hints,
266                         uint16_t netId, std::vector<AddrInfo> &res);
267 
268     /**
269      * free addrinfo
270      *
271      * @param aihead struct is addrinfo's variable
272      */
273     void FreeAddrInfo(addrinfo *aihead);
274 
275     /**
276      * Obtains the bytes of the sharing network.
277      *
278      * @return Success return 0.
279      */
280     int32_t GetNetworkSharingTraffic(const std::string &downIface, const std::string &upIface,
281                                      nmd::NetworkSharingTraffic &traffic);
282 
283     /**
284      * Obtains the bytes received over the cellular network.
285      *
286      * @return The number of received bytes.
287      */
288     int64_t GetCellularRxBytes();
289 
290     /**
291      * Obtains the bytes sent over the cellular network.
292      *
293      * @return The number of sent bytes.
294      */
295     int64_t GetCellularTxBytes();
296 
297     /**
298      * Obtains the bytes received through all NICs.
299      *
300      * @return The number of received bytes.
301      */
302     int64_t GetAllRxBytes();
303 
304     /**
305      * Obtains the bytes sent through all NICs.
306      *
307      * @return The number of sent bytes.
308      */
309     int64_t GetAllTxBytes();
310 
311     /**
312      * Obtains the bytes received through a specified UID.
313      *
314      * @param uid app id.
315      * @return The number of received bytes.
316      */
317     int64_t GetUidRxBytes(uint32_t uid);
318 
319     /**
320      * Obtains the bytes sent through a specified UID.
321      *
322      * @param uid app id.
323      * @return The number of sent bytes.
324      */
325     int64_t GetUidTxBytes(uint32_t uid);
326 
327     /**
328      * Obtains the bytes received through a specified UID on Iface.
329      *
330      * @param uid app id.
331      * @param iface The name of the interface.
332      * @return The number of received bytes.
333      */
334     int64_t GetUidOnIfaceRxBytes(uint32_t uid, const std::string &interfaceName);
335 
336     /**
337      * Obtains the bytes sent through a specified UID on Iface.
338      *
339      * @param uid app id.
340      * @param iface The name of the interface.
341      * @return The number of sent bytes.
342      */
343     int64_t GetUidOnIfaceTxBytes(uint32_t uid, const std::string &interfaceName);
344 
345     /**
346      * Obtains the bytes received through a specified NIC.
347      *
348      * @param iface The name of the interface.
349      * @return The number of received bytes.
350      */
351     int64_t GetIfaceRxBytes(const std::string &interfaceName);
352 
353     /**
354      * Obtains the bytes sent through a specified NIC.
355      *
356      * @param iface The name of the interface.
357      * @return The number of sent bytes.
358      */
359     int64_t GetIfaceTxBytes(const std::string &interfaceName);
360 
361     /**
362      * Obtains the NIC list.
363      *
364      * @return The list of interface.
365      */
366     std::vector<std::string> InterfaceGetList();
367 
368     /**
369      * Obtains the uid list.
370      *
371      * @return The list of uid.
372      */
373     std::vector<std::string> UidGetList();
374 
375     /**
376      * Obtains the packets received through a specified NIC.
377      *
378      * @param iface The name of the interface.
379      * @return The number of received packets.
380      */
381     int64_t GetIfaceRxPackets(const std::string &interfaceName);
382 
383     /**
384      * Obtains the packets sent through a specified NIC.
385      *
386      * @param iface The name of the interface.
387      * @return The number of sent packets.
388      */
389     int64_t GetIfaceTxPackets(const std::string &interfaceName);
390 
391     /**
392      *  set default network.
393      *
394      * @return Return the return value of the netsys interface call
395      */
396     int32_t SetDefaultNetWork(int32_t netId);
397 
398     /**
399      * clear default network netId.
400      *
401      * @return Return the return value of the netsys interface call
402      */
403     int32_t ClearDefaultNetWorkNetId();
404 
405     /**
406      * Obtains the NIC list.
407      *
408      * @param socketFd
409      * @param netId
410      * @return Return the return value of the netsys interface call
411      */
412     int32_t BindSocket(int32_t socketFd, uint32_t netId);
413 
414     /**
415      * Enable ip forwarding.
416      *
417      * @param requestor the requestor of forwarding
418      * @return Return the return value of the netsys interface call.
419      */
420     int32_t IpEnableForwarding(const std::string &requestor);
421 
422     /**
423      * Disable ip forwarding.
424      *
425      * @param requestor the requestor of forwarding
426      * @return Return the return value of the netsys interface call.
427      */
428     int32_t IpDisableForwarding(const std::string &requestor);
429 
430     /**
431      * Enable Nat.
432      *
433      * @param downstreamIface the name of downstream interface
434      * @param upstreamIface the name of upstream interface
435      * @return Return the return value of the netsys interface call.
436      */
437     int32_t EnableNat(const std::string &downstreamIface, const std::string &upstreamIface);
438     /**
439      * Disable Nat.
440      *
441      * @param downstreamIface the name of downstream interface
442      * @param upstreamIface the name of upstream interface
443      * @return Return the return value of the netsys interface call.
444      */
445     int32_t DisableNat(const std::string &downstreamIface, const std::string &upstreamIface);
446 
447     /**
448      * Add interface forward.
449      *
450      * @param fromIface the name of incoming interface
451      * @param toIface the name of outcoming interface
452      * @return Return the return value of the netsys interface call.
453      */
454     int32_t IpfwdAddInterfaceForward(const std::string &fromIface, const std::string &toIface);
455 
456     /**
457      * Remove interface forward.
458      *
459      * @param fromIface the name of incoming interface
460      * @param toIface the name of outcoming interface
461      * @return Return the return value of the netsys interface call.
462      */
463     int32_t IpfwdRemoveInterfaceForward(const std::string &fromIface, const std::string &toIface);
464 
465     /**
466      * Set tether dns.
467      *
468      * @param netId network id
469      * @param dnsAddr the list of dns address
470      * @return Return the return value of the netsys interface call.
471      */
472     int32_t ShareDnsSet(uint16_t netId);
473 
474     /**
475      * start dns proxy listen
476      *
477      * @return success or failed
478      */
479     int32_t StartDnsProxyListen();
480 
481     /**
482      * stop dns proxy listen
483      *
484      * @return success or failed
485      */
486     int32_t StopDnsProxyListen();
487 
488     /**
489      * Set net callbackfuction.
490      *
491      * @param callback callback function class
492      * @return Return the return value of the netsys interface call.
493      */
494     int32_t RegisterNetsysNotifyCallback(const NetsysNotifyCallback &callback);
495 
496     /**
497      * Protect tradition network to connect VPN.
498      *
499      * @param socketFd socket file description
500      * @return Return the return value of the netsys interface call.
501      */
502     int32_t BindNetworkServiceVpn(int32_t socketFd);
503 
504     /**
505      * Enable virtual network interface card.
506      *
507      * @param socketFd socket file description
508      * @param ifRequest interface request
509      * @param ifaceFd interface file description at output parameter
510      * @return Return the return value of the netsys interface call.
511      */
512     int32_t EnableVirtualNetIfaceCard(int32_t socketFd, struct ifreq &ifRequest, int32_t &ifaceFd);
513 
514     /**
515      * Set ip address.
516      *
517      * @param socketFd socket file description
518      * @param ipAddress ip address
519      * @param prefixLen the mask of ip address
520      * @param ifRequest interface request
521      * @return Return the return value of the netsys interface call.
522      */
523     int32_t SetIpAddress(int32_t socketFd, const std::string &ipAddress, int32_t prefixLen, struct ifreq &ifRequest);
524 
525     /**
526      * Set network blocking.
527      *
528      * @param ifaceFd interface file description
529      * @param isBlock network blocking
530      * @return Return the return value of the netsys interface call.
531      */
532     int32_t SetBlocking(int32_t ifaceFd, bool isBlock);
533     /**
534      * Start Dhcp Client.
535      *
536      * @param iface interface file description
537      * @param bIpv6 network blocking
538      * @return success or failed
539      */
540     int32_t StartDhcpClient(const std::string &iface, bool bIpv6);
541     /**
542      * Stop Dhcp Client.
543      *
544      * @param iface interface file description
545      * @param bIpv6 network blocking
546      * @return success or failed
547      */
548     int32_t StopDhcpClient(const std::string &iface, bool bIpv6);
549     /**
550      * Register Notify Callback
551      *
552      * @param callback
553      * @return success or failed
554      */
555     int32_t RegisterCallback(sptr<NetsysControllerCallback> callback);
556 
557     /**
558      * start dhcpservice.
559      *
560      * @param iface interface name
561      * @param ipv4addr ipv4 addr
562      * @return Return the return value of the netsys interface call.
563      */
564     int32_t StartDhcpService(const std::string &iface, const std::string &ipv4addr);
565 
566     /**
567      * stop dhcpservice.
568      *
569      * @param iface interface name
570      * @return Return the return value of the netsys interface call.
571      */
572     int32_t StopDhcpService(const std::string &iface);
573 
574     /**
575      * Turn on data saving mode.
576      *
577      * @param enable enable or disable
578      * @return value the return value of the netsys interface call.
579      */
580     int32_t BandwidthEnableDataSaver(bool enable);
581 
582     /**
583      * Set quota.
584      *
585      * @param iface interface name
586      * @param bytes
587      * @return success or failed
588      */
589     int32_t BandwidthSetIfaceQuota(const std::string &ifName, int64_t bytes);
590 
591     /**
592      * Delete quota.
593      *
594      * @param iface interface name
595      * @return success or failed
596      */
597     int32_t BandwidthRemoveIfaceQuota(const std::string &ifName);
598 
599     /**
600      * Add DeniedList.
601      *
602      * @param uid
603      * @return success or failed
604      */
605     int32_t BandwidthAddDeniedList(uint32_t uid);
606 
607     /**
608      * Remove DeniedList.
609      *
610      * @param uid
611      * @return success or failed
612      */
613     int32_t BandwidthRemoveDeniedList(uint32_t uid);
614 
615     /**
616      * Add DeniedList.
617      *
618      * @param uid
619      * @return success or failed
620      */
621     int32_t BandwidthAddAllowedList(uint32_t uid);
622 
623     /**
624      * remove DeniedList.
625      *
626      * @param uid
627      * @return success or failed
628      */
629     int32_t BandwidthRemoveAllowedList(uint32_t uid);
630 
631     /**
632      * Set firewall rules.
633      *
634      * @param chain chain type
635      * @param isAllowedList is or not AllowedList
636      * @param uids
637      * @return Return the return value of the netsys interface call.
638      */
639     int32_t FirewallSetUidsAllowedListChain(uint32_t chain, const std::vector<uint32_t> &uids);
640 
641     /**
642      * Set firewall rules.
643      *
644      * @param chain chain type
645      * @param isAllowedList is or not AllowedList
646      * @param uids
647      * @return Return the return value of the netsys interface call.
648      */
649     int32_t FirewallSetUidsDeniedListChain(uint32_t chain, const std::vector<uint32_t> &uids);
650 
651     /**
652      * Enable or disable the specified firewall chain.
653      *
654      * @param chain chain type
655      * @param enable enable or disable
656      * @return success or failed
657      */
658     int32_t FirewallEnableChain(uint32_t chain, bool enable);
659 
660     /**
661      * Firewall set uid rule.
662      *
663      * @param chain chain type
664      * @param uid uid
665      * @param firewallRule firewall rule
666      * @return success or failed
667      */
668     int32_t FirewallSetUidRule(uint32_t chain, const std::vector<uint32_t> &uids, uint32_t firewallRule);
669 
670     /**
671      * Get total traffic
672      *
673      * @param stats stats
674      * @param type type
675      * @return returns the total traffic of the specified type
676      */
677     int32_t GetTotalStats(uint64_t &stats, uint32_t type);
678 
679     /**
680      * Get uid traffic
681      *
682      * @param stats stats
683      * @param type type
684      * @param uid uid
685      * @return returns the traffic of the uid
686      */
687     int32_t GetUidStats(uint64_t &stats, uint32_t type, uint32_t uid);
688 
689     /**
690      * Get Iface traffic
691      *
692      * @param stats stats
693      * @param type type
694      * @param interfaceName interfaceName
695      * @return returns the traffic of the Iface
696      */
697     int32_t GetIfaceStats(uint64_t &stats, uint32_t type, const std::string &interfaceName);
698 
699     /**
700      * Get all stats info
701      *
702      * @param stats stats
703      * @return returns the all info of the stats
704      */
705     int32_t GetAllStatsInfo(std::vector<OHOS::NetManagerStandard::NetStatsInfo> &stats);
706 
707     /**
708      * Set iptables for result
709      *
710      * @param cmd Iptables command
711      * @param respond The respond of execute iptables command
712      * @return Value the return value of the netsys interface call
713      */
714     int32_t SetIptablesCommandForRes(const std::string &cmd, std::string &respond);
715 
716     /**
717      * Check network connectivity by sending packets to a host and reporting its response.
718      *
719      * @param pingOption Ping option
720      * @param callback The respond of execute ping cmd.
721      * @return Value the return value of the netsys interface call
722      */
723     int32_t NetDiagPingHost(const OHOS::NetsysNative::NetDiagPingOption &pingOption,
724                             const sptr<OHOS::NetsysNative::INetDiagCallback> &callback);
725 
726     /**
727      * Get networking route table
728      *
729      * @param routeTables Network route table list.
730      * @return Value the return value of the netsys interface call
731      */
732     int32_t NetDiagGetRouteTable(std::list<OHOS::NetsysNative::NetDiagRouteTable> &routeTables);
733 
734     /**
735      * Get networking sockets info.
736      *
737      * @param socketType Network protocol.
738      * @param socketsInfo The result of network sockets info.
739      * @return Value the return value of the netsys interface call
740      */
741     int32_t NetDiagGetSocketsInfo(OHOS::NetsysNative::NetDiagProtocolType socketType,
742                                   OHOS::NetsysNative::NetDiagSocketsInfo &socketsInfo);
743 
744     /**
745      * Get network interface configuration.
746      *
747      * @param configs The result of network interface configuration.
748      * @param ifaceName Get interface configuration information for the specified interface name.
749      *                  If the interface name is empty, default to getting all interface configuration information.
750      * @return Value the return value of the netsys interface call
751      */
752     int32_t NetDiagGetInterfaceConfig(std::list<OHOS::NetsysNative::NetDiagIfaceConfig> &configs,
753                                       const std::string &ifaceName);
754 
755     /**
756      * Update network interface configuration.
757      *
758      * @param configs Network interface configuration.
759      * @param ifaceName Interface name.
760      * @param add Add or delete.
761      * @return Value the return value of the netsys interface call
762      */
763     int32_t NetDiagUpdateInterfaceConfig(const OHOS::NetsysNative::NetDiagIfaceConfig &config,
764                                          const std::string &ifaceName, bool add);
765 
766     /**
767      * Set network interface up/down state.
768      *
769      * @param ifaceName Interface name.
770      * @param up Up or down.
771      * @return Value the return value of the netsys interface call
772      */
773     int32_t NetDiagSetInterfaceActiveState(const std::string &ifaceName, bool up);
774     int32_t AddStaticArp(const std::string &ipAddr, const std::string &macAddr, const std::string &ifName);
775     int32_t DelStaticArp(const std::string &ipAddr, const std::string &macAddr, const std::string &ifName);
776 
777     /**
778      * Register Dns Result Callback Listener.
779      *
780      * @param callback Callback function
781      * @param timestep Time gap between two callbacks
782      * @return Value the return value of the netsys interface call
783      */
784     int32_t RegisterDnsResultCallback(const sptr<OHOS::NetManagerStandard::NetsysDnsReportCallback> &callback,
785         uint32_t timeStep);
786 
787     /**
788      * Unregister Dns Result Callback Listener.
789      *
790      * @param callback Callback function
791      * @return Value the return value of the netsys interface call
792      */
793     int32_t UnregisterDnsResultCallback(const sptr<OHOS::NetManagerStandard::NetsysDnsReportCallback> &callback);
794 
795     /**
796      * Register Dns Health Callback Listener.
797      *
798      * @param callback Callback function
799      * @return Value the return value of the netsys interface call
800      */
801     int32_t RegisterDnsHealthCallback(const sptr<OHOS::NetsysNative::INetDnsHealthCallback> &callback);
802 
803     /**
804      * Unregister Dns Health Callback Listener.
805      *
806      * @param callback Callback function
807      * @return Value the return value of the netsys interface call
808      */
809     int32_t UnregisterDnsHealthCallback(const sptr<OHOS::NetsysNative::INetDnsHealthCallback> &callback);
810 
811     /**
812      * Get Cookie Stats
813      *
814      * @param stats stats
815      * @param type type
816      * @param cookie cookie
817      * @return returns the stats of the cookie
818      */
819     int32_t GetCookieStats(uint64_t &stats, uint32_t type, uint64_t cookie);
820 private:
821     NetsysController() = default;
822 
823 private:
824     bool initFlag_ = false;
825     sptr<INetsysControllerService> netsysService_;
826 };
827 } // namespace NetManagerStandard
828 } // namespace OHOS
829 #endif // NETSYS_CONTROLLER_H
830