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