Add two Netd binder calls to set/get resolver config.
setResolverConfiguration() sets the name servers, search domains,
and resolver parameters.
getResolverInfo() returns the configured information and also the
statistics for each server.
Also includes tests for the new functionality.
BUG: 25731675
Change-Id: Idde486f36bb731f9edd240d62dc1795f8e621fe6
diff --git a/server/ResolverController.h b/server/ResolverController.h
index 048ff3f..a3810d4 100644
--- a/server/ResolverController.h
+++ b/server/ResolverController.h
@@ -17,20 +17,44 @@
#ifndef _RESOLVER_CONTROLLER_H_
#define _RESOLVER_CONTROLLER_H_
+#include <vector>
#include <netinet/in.h>
#include <linux/in.h>
struct __res_params;
+namespace android {
+namespace net {
+struct ResolverStats;
+} // namespace net
+} // namespace android
+
class ResolverController {
public:
ResolverController() {};
+
virtual ~ResolverController() {};
+
+ // TODO: delete this function
int setDnsServers(unsigned netId, const char* searchDomains, const char** servers,
int numservers, const __res_params* params);
+
int clearDnsServers(unsigned netid);
+
int flushDnsCache(unsigned netid);
- // TODO: Add deleteDnsCache(unsigned netId)
+
+ int getDnsInfo(unsigned netId, std::vector<std::string>* servers,
+ std::vector<std::string>* domains, __res_params* params,
+ std::vector<android::net::ResolverStats>* stats);
+
+ // Binder specific functions, which convert between the binder int/string arrays and the
+ // actual data structures, and call setDnsServer() / getDnsInfo() for the actual processing.
+ int setResolverConfiguration(int32_t netId, const std::vector<std::string>& servers,
+ const std::vector<std::string>& domains, const std::vector<int32_t>& params);
+
+ int getResolverInfo(int32_t netId, std::vector<std::string>* servers,
+ std::vector<std::string>* domains, std::vector<int32_t>* params,
+ std::vector<int32_t>* stats);
};
#endif /* _RESOLVER_CONTROLLER_H_ */