Move resolv_init out and make callbacks of libnetd_resolv global
1. Revise init flow of libnetd_resolv
- A better and generic design for it
2. Rename and make callbacks from netd global
- libnetd_resolv has multiple components need to use it
- res* component could use it easily
Bug: 126141549
Test: built, flashed, booted
system/netd/tests/runtests.sh pass
Change-Id: Iacb4fd708a26fd9c9139a606f0320fc12b4fc7e1
diff --git a/resolv/include/netd_resolv/resolv.h b/resolv/include/netd_resolv/resolv.h
index 2e65370..b5518e4 100644
--- a/resolv/include/netd_resolv/resolv.h
+++ b/resolv/include/netd_resolv/resolv.h
@@ -110,7 +110,7 @@
// TODO: Remove the callback after moving NAT64 prefix discovery out of netd to libnetd_resolv.
typedef bool (*get_dns64_prefix_callback)(unsigned netid, in6_addr* prefix, uint8_t* prefix_len);
-struct dnsproxylistener_callbacks {
+struct ResolverNetdCallbacks {
check_calling_permission_callback check_calling_permission;
get_network_context_callback get_network_context;
get_dns64_prefix_callback get_dns64_prefix;
@@ -150,7 +150,7 @@
// Delete the cache associated with a certain network
LIBNETD_RESOLV_PUBLIC void resolv_delete_cache_for_net(unsigned netid);
-// Set callbacks to DnsProxyListener, and bring it up.
-LIBNETD_RESOLV_PUBLIC bool resolv_init(const dnsproxylistener_callbacks& callbacks);
+// Set callbacks and bring DnsResolver up.
+LIBNETD_RESOLV_PUBLIC bool resolv_init(const ResolverNetdCallbacks& callbacks);
#endif // NETD_RESOLV_RESOLV_H
diff --git a/resolv/include/netd_resolv/resolv_stub.h b/resolv/include/netd_resolv/resolv_stub.h
index 9168ab2..5f78908 100644
--- a/resolv/include/netd_resolv/resolv_stub.h
+++ b/resolv/include/netd_resolv/resolv_stub.h
@@ -58,7 +58,7 @@
bool (*resolv_has_nameservers)(unsigned netid);
- bool (*resolv_init)(const dnsproxylistener_callbacks& callbacks);
+ bool (*resolv_init)(const ResolverNetdCallbacks& callbacks);
int (*resolv_set_nameservers_for_net)(unsigned netid, const char** servers, unsigned numservers,
const char* domains, const res_params* params);