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/resolv/gethnamaddr.cpp b/resolv/gethnamaddr.cpp
index 5c4874d..3fd6324 100644
--- a/resolv/gethnamaddr.cpp
+++ b/resolv/gethnamaddr.cpp
@@ -272,11 +272,11 @@
}
cp += n; /* name */
BOUNDS_CHECK(cp, 3 * INT16SZ + INT32SZ);
- int type = _getshort(cp);
+ int type = ns_get16(cp);
cp += INT16SZ; /* type */
- int cl = _getshort(cp);
+ int cl = ns_get16(cp);
cp += INT16SZ + INT32SZ; /* class, TTL */
- n = _getshort(cp);
+ n = ns_get16(cp);
cp += INT16SZ; /* len */
BOUNDS_CHECK(cp, n);
erdata = cp + n;