Add a netcontext variant of gethostbyaddr
Bug: 34953048
Test: Integration tests pass
Change-Id: Id04830345be56cd7a077981c6e2acfb5568e7a88
diff --git a/libc/dns/include/resolv_netid.h b/libc/dns/include/resolv_netid.h
index 37c1891..711792b 100644
--- a/libc/dns/include/resolv_netid.h
+++ b/libc/dns/include/resolv_netid.h
@@ -34,6 +34,7 @@
*/
#include <sys/cdefs.h>
#include <netinet/in.h>
+#include "resolv_params.h"
#include <stdio.h>
/*
@@ -71,6 +72,7 @@
unsigned dns_netid;
unsigned dns_mark;
uid_t uid;
+ res_send_qhook qhook;
};
#define NET_CONTEXT_INVALID_UID ((uid_t)-1)
@@ -83,6 +85,7 @@
* TODO: consider refactoring android_getaddrinfo_proxy() to serve as an
* explore_fqdn() dispatch table method, with the below function only making DNS calls.
*/
+struct hostent *android_gethostbyaddrfornetcontext(const void *, socklen_t, int, const struct android_net_context *) __used_in_netd;
int android_getaddrinfofornetcontext(const char *, const char *, const struct addrinfo *,
const struct android_net_context *, struct addrinfo **) __used_in_netd;
@@ -97,7 +100,7 @@
extern void _resolv_delete_cache_for_net(unsigned netid) __used_in_netd;
/* Internal use only. */
-struct hostent *android_gethostbyaddrfornet_proxy(const void *, socklen_t, int , unsigned, unsigned) __LIBC_HIDDEN__;
+struct hostent *android_gethostbyaddrfornetcontext_proxy(const void *, socklen_t, int , const struct android_net_context *) __LIBC_HIDDEN__;
int android_getnameinfofornet(const struct sockaddr *, socklen_t, char *, size_t, char *, size_t, int, unsigned, unsigned) __LIBC_HIDDEN__;
FILE* android_open_proxy(void) __LIBC_HIDDEN__;
diff --git a/libc/dns/include/resolv_params.h b/libc/dns/include/resolv_params.h
index 49ae691..1b9d433 100644
--- a/libc/dns/include/resolv_params.h
+++ b/libc/dns/include/resolv_params.h
@@ -43,4 +43,15 @@
uint8_t max_samples; // max # samples taken into account for statistics
};
+typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error }
+ res_sendhookact;
+
+typedef res_sendhookact (*res_send_qhook)(struct sockaddr * const *,
+ const u_char **, int *,
+ u_char *, int, int *);
+
+typedef res_sendhookact (*res_send_rhook)(const struct sockaddr *,
+ const u_char *, int, u_char *,
+ int, int *);
+
#endif // _RESOLV_PARAMS_H
diff --git a/libc/dns/include/resolv_private.h b/libc/dns/include/resolv_private.h
index 54b9626..284270c 100644
--- a/libc/dns/include/resolv_private.h
+++ b/libc/dns/include/resolv_private.h
@@ -116,17 +116,6 @@
#endif
#endif
-typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error }
- res_sendhookact;
-
-typedef res_sendhookact (*res_send_qhook)(struct sockaddr * const *,
- const u_char **, int *,
- u_char *, int, int *);
-
-typedef res_sendhookact (*res_send_rhook)(const struct sockaddr *,
- const u_char *, int, u_char *,
- int, int *);
-
struct res_sym {
int number; /* Identifying number, like T_MX */
const char * name; /* Its symbolic name, like "MX" */