Move the legacy stats function declarations out of resolv_private.h

No functionality changes.

Bug: 137169582
Test: cd packages/modules/DnsResolver && mm
Change-Id: I2aa236f8f3de1582cae820d761295d388b6baee7
diff --git a/res_send.cpp b/res_send.cpp
index b496065..1bbcfbc 100644
--- a/res_send.cpp
+++ b/res_send.cpp
@@ -542,7 +542,7 @@
             // SERVFAIL or times out) do not unduly affect the stats.
             if (shouldRecordStats) {
                 res_sample sample;
-                _res_stats_set_sample(&sample, now, *rcode, delay);
+                res_stats_set_sample(&sample, now, *rcode, delay);
                 resolv_cache_add_resolver_stats_sample(statp->netid, revision_id, serverSockAddr,
                                                        sample, params.max_samples);
                 resolv_stats_add(statp->netid, serverSockAddr, dnsQueryEvent);
@@ -803,7 +803,7 @@
      */
     if (resplen > 0) {
         struct timespec done = evNowTime();
-        *delay = _res_stats_calculate_rtt(&done, &now);
+        *delay = res_stats_calculate_rtt(&done, &now);
         *rcode = anhp->rcode;
     }
     return (resplen);
@@ -1012,7 +1012,7 @@
         }
 
         timespec done = evNowTime();
-        *delay = _res_stats_calculate_rtt(&done, &now);
+        *delay = res_stats_calculate_rtt(&done, &now);
         if (anhp->rcode == SERVFAIL || anhp->rcode == NOTIMP || anhp->rcode == REFUSED) {
             LOG(DEBUG) << __func__ << ": server rejected query:";
             res_pquery(ans, (resplen > anssiz) ? anssiz : resplen);
diff --git a/res_stats.cpp b/res_stats.cpp
index f3b79bb..a9e2f69 100644
--- a/res_stats.cpp
+++ b/res_stats.cpp
@@ -24,7 +24,7 @@
 #include "stats.h"
 
 // Calculate the round-trip-time from start time t0 and end time t1.
-int _res_stats_calculate_rtt(const timespec* t1, const timespec* t0) {
+int res_stats_calculate_rtt(const timespec* t1, const timespec* t0) {
     // Divide ns by one million to get ms, multiply s by thousand to get ms (obvious)
     long ms0 = t0->tv_sec * 1000 + t0->tv_nsec / 1000000;
     long ms1 = t1->tv_sec * 1000 + t1->tv_nsec / 1000000;
@@ -32,7 +32,7 @@
 }
 
 // Create a sample for calculating server reachability statistics.
-void _res_stats_set_sample(res_sample* sample, time_t now, int rcode, int rtt) {
+void res_stats_set_sample(res_sample* sample, time_t now, int rcode, int rtt) {
     LOG(INFO) << __func__ << ": rcode = " << rcode << ", sec = " << rtt;
     sample->at = now;
     sample->rcode = rcode;
diff --git a/resolv_cache.h b/resolv_cache.h
index d34ae95..dd7ede1 100644
--- a/resolv_cache.h
+++ b/resolv_cache.h
@@ -40,6 +40,7 @@
 
 #include "ResolverStats.h"
 #include "params.h"
+#include "stats.h"
 
 // Sets the name server addresses to the provided ResState.
 // The name servers are retrieved from the cache which is associated
@@ -115,3 +116,17 @@
 void resolv_oem_options_dump(android::netdutils::DumpWriter& dw, unsigned netid);
 
 const char* tc_mode_to_str(const int mode);
+
+/* Retrieve a local copy of the stats for the given netid. The buffer must have space for
+ * MAXNS __resolver_stats. Returns the revision id of the resolvers used.
+ */
+int resolv_cache_get_resolver_stats(
+        unsigned netid, res_params* params, res_stats stats[MAXNS],
+        const std::vector<android::netdutils::IPSockAddr>& serverSockAddrs);
+
+/* Add a sample to the shared struct for the given netid and server, provided that the
+ * revision_id of the stored servers has not changed.
+ */
+void resolv_cache_add_resolver_stats_sample(unsigned netid, int revision_id,
+                                            const android::netdutils::IPSockAddr& serverSockAddr,
+                                            const res_sample& sample, int max_samples);
diff --git a/resolv_private.h b/resolv_private.h
index f01760c..f6a1706 100644
--- a/resolv_private.h
+++ b/resolv_private.h
@@ -55,12 +55,9 @@
 #include <string>
 #include <vector>
 
-#include <netdutils/InternetAddresses.h>
-
 #include "DnsResolver.h"
 #include "netd_resolv/resolv.h"
 #include "params.h"
-#include "stats.h"
 #include "stats.pb.h"
 
 // Linux defines MAXHOSTNAMELEN as 64, while the domain name limit in
@@ -119,26 +116,6 @@
 // TODO: remove these legacy aliases
 typedef ResState* res_state;
 
-/* Retrieve a local copy of the stats for the given netid. The buffer must have space for
- * MAXNS res_stats. Returns the revision id of the resolvers used or -1 on failure.
- */
-int resolv_cache_get_resolver_stats(
-        unsigned netid, res_params* params, res_stats stats[MAXNS],
-        const std::vector<android::netdutils::IPSockAddr>& serverSockAddrs);
-
-/* Add a sample to the shared struct for the given netid and server, provided that the
- * revision_id of the stored servers has not changed.
- */
-void resolv_cache_add_resolver_stats_sample(unsigned netid, int revision_id,
-                                            const android::netdutils::IPSockAddr& serverSockAddr,
-                                            const res_sample& sample, int max_samples);
-
-// Calculate the round-trip-time from start time t0 and end time t1.
-int _res_stats_calculate_rtt(const timespec* t1, const timespec* t0);
-
-// Create a sample for calculating server reachability statistics.
-void _res_stats_set_sample(res_sample* sample, time_t now, int rcode, int rtt);
-
 /* End of stats related definitions */
 
 /*
diff --git a/stats.h b/stats.h
index cc7de9f..698c8c2 100644
--- a/stats.h
+++ b/stats.h
@@ -55,3 +55,9 @@
 // Returns an array of bools indicating which servers are considered good
 int android_net_res_stats_get_usable_servers(const res_params* params, res_stats stats[],
                                              int nscount, bool valid_servers[]);
+
+// Calculate the round-trip-time from start time t0 and end time t1.
+int res_stats_calculate_rtt(const timespec* t1, const timespec* t0);
+
+// Create a sample for calculating server reachability statistics.
+void res_stats_set_sample(res_sample* sample, time_t now, int rcode, int rtt);