#ifndef DNS_RESPONDER_CLIENT_H #define DNS_RESPONDER_CLIENT_H #include "SockDiag.h" #include #include #include #include "android/net/INetd.h" #include "binder/IServiceManager.h" #include "NetdClient.h" #include "dns_responder.h" #include "resolv_params.h" class DnsResponderClient { public: struct Mapping { std::string host; std::string entry; std::string ip4; std::string ip6; }; virtual ~DnsResponderClient() = default; void SetupMappings(unsigned num_hosts, const std::vector& domains, std::vector* mappings); bool SetResolversForNetwork(const std::vector& servers, const std::vector& domains, const std::vector& params); bool SetResolversForNetwork(const std::vector& searchDomains, const std::vector& servers, const std::string& params); static void SetupDNSServers(unsigned num_servers, const std::vector& mappings, std::vector>* dns, std::vector* servers); static void ShutdownDNSServers(std::vector>* dns); static int SetupOemNetwork(); static void TearDownOemNetwork(int oemNetId); virtual void SetUp(); virtual void TearDown(); public: android::sp mNetdSrv = nullptr; int mOemNetId = -1; }; #endif // DNS_RESPONDER_CLIENT_H