Limit C linkage to public symbols
Switched all internal functions to C++ linkage. This makes it harder to
accidentally call a function with a mismatched signature, and paves the
way to using C++ data structures internally.
This is the current list of symbols expoted by libnetd_resolv.so:
_resolv_delete_cache_for_net
_resolv_flush_cache_for_net
_resolv_set_nameservers_for_net
android_getaddrinfofornet
android_getaddrinfofornetcontext
android_gethostbyaddrfornet
android_gethostbyaddrfornetcontext
android_gethostbynamefornet
android_gethostbynamefornetcontext
android_net_res_stats_aggregate
android_net_res_stats_get_info_for_net
android_net_res_stats_get_usable_servers
A mass-renaming pass would improve consistency. Perhaps we could use
the prefix "netd_resolv_", or just "resolv_" for brevity. Once we begin
shipping netd binaries using this interface, we might have to live with
it for some time.
Test: atest netd_integration_test (after flashing with new netd binary)
Change-Id: I52f32add73fd908ad4a715ef8f8aff1f8d9733d0
diff --git a/res_mkquery.cpp b/res_mkquery.cpp
index bda6ad9..82c42d5 100644
--- a/res_mkquery.cpp
+++ b/res_mkquery.cpp
@@ -85,30 +85,26 @@
#define DEBUG
#endif
-#define UNUSED(a) (void) &a
-
extern const char* _res_opcodes[];
/*
* Form all types of queries.
* Returns the size of the result or -1.
*/
-int res_nmkquery(res_state statp, int op, /* opcode of query */
- const char* dname, /* domain name */
- int cl, int type, /* class and type of query */
- const u_char* data, /* resource record data */
- int datalen, /* length of data */
- const u_char* newrr_in, /* new rr for modify or append */
- u_char* buf, /* buffer to put query */
- int buflen) /* size of buffer */
+int res_nmkquery(res_state statp, int op, /* opcode of query */
+ const char* dname, /* domain name */
+ int cl, int type, /* class and type of query */
+ const u_char* data, /* resource record data */
+ int datalen, /* length of data */
+ const u_char* /*newrr_in*/, /* new rr for modify or append */
+ u_char* buf, /* buffer to put query */
+ int buflen) /* size of buffer */
{
HEADER* hp;
u_char *cp, *ep;
int n;
u_char *dnptrs[20], **dpp, **lastdnptr;
- UNUSED(newrr_in);
-
#ifdef DEBUG
if (statp->options & RES_DEBUG)
printf(";; res_nmkquery(%s, %s, %s, %s)\n", _res_opcodes[op], dname, p_class(cl),