Make all the DnsTls headers private to libnetd_resolv

Test: m libnetd_resolv netd
Test: atest resolv_integration_test
Change-Id: Icae95641733abe7fe86b903dd3bcf69b08c83285
diff --git a/resolv/DnsProxyListener.cpp b/resolv/DnsProxyListener.cpp
index 18006f1..c582f2c 100644
--- a/resolv/DnsProxyListener.cpp
+++ b/resolv/DnsProxyListener.cpp
@@ -46,11 +46,11 @@
 #include <sysutils/SocketClient.h>
 
 // TODO: Considering moving ResponseCode.h Stopwatch.h thread_util.h to libnetdutils.
+#include "DnsProxyListener.h"
 #include "NetdClient.h"  // NETID_USE_LOCAL_NAMESERVERS
+#include "ResolverEventReporter.h"
 #include "ResponseCode.h"
 #include "Stopwatch.h"
-#include "netd_resolv/DnsProxyListener.h"
-#include "netd_resolv/ResolverEventReporter.h"
 #include "netd_resolv/stats.h"  // RCODE_TIMEOUT
 #include "netdutils/InternetAddresses.h"
 #include "thread_util.h"
diff --git a/resolv/include/netd_resolv/DnsProxyListener.h b/resolv/DnsProxyListener.h
similarity index 91%
rename from resolv/include/netd_resolv/DnsProxyListener.h
rename to resolv/DnsProxyListener.h
index ef9a3da..048744e 100644
--- a/resolv/include/netd_resolv/DnsProxyListener.h
+++ b/resolv/DnsProxyListener.h
@@ -17,11 +17,10 @@
 #ifndef _DNSPROXYLISTENER_H__
 #define _DNSPROXYLISTENER_H__
 
+#include <netd_resolv/resolv.h>  // android_net_context
 #include <sysutils/FrameworkCommand.h>
 #include <sysutils/FrameworkListener.h>
 
-#include "resolv.h"  // android_net_context
-
 namespace android {
 namespace net {
 
@@ -84,8 +83,8 @@
       private:
         void doDns64Synthesis(int32_t* rv, hostent** hpp);
 
-        SocketClient* mClient; //ref counted
-        char* mName;           // owned. TODO: convert to std::string.
+        SocketClient* mClient;  // ref counted
+        char* mName;            // owned. TODO: convert to std::string.
         int mAf;
         android_net_context mNetContext;
     };
@@ -110,9 +109,9 @@
         void doDns64ReverseLookup(hostent** hpp);
 
         SocketClient* mClient;  // ref counted
-        void* mAddress;    // address to lookup; owned
-        int mAddressLen; // length of address to look up
-        int mAddressFamily;  // address family
+        void* mAddress;         // address to lookup; owned
+        int mAddressLen;        // length of address to look up
+        int mAddressFamily;     // address family
         android_net_context mNetContext;
     };
 
diff --git a/resolv/DnsTlsDispatcher.cpp b/resolv/DnsTlsDispatcher.cpp
index 9d5d3d5..d9896ad 100644
--- a/resolv/DnsTlsDispatcher.cpp
+++ b/resolv/DnsTlsDispatcher.cpp
@@ -17,8 +17,8 @@
 #define LOG_TAG "DnsTlsDispatcher"
 //#define LOG_NDEBUG 0
 
-#include "netd_resolv/DnsTlsDispatcher.h"
-#include "netd_resolv/DnsTlsSocketFactory.h"
+#include "DnsTlsDispatcher.h"
+#include "DnsTlsSocketFactory.h"
 
 #include "log/log.h"
 
diff --git a/resolv/include/netd_resolv/DnsTlsDispatcher.h b/resolv/DnsTlsDispatcher.h
similarity index 84%
rename from resolv/include/netd_resolv/DnsTlsDispatcher.h
rename to resolv/DnsTlsDispatcher.h
index 45142b8..7a48089 100644
--- a/resolv/include/netd_resolv/DnsTlsDispatcher.h
+++ b/resolv/DnsTlsDispatcher.h
@@ -23,19 +23,15 @@
 #include <mutex>
 
 #include <android-base/thread_annotations.h>
-
 #include <netdutils/Slice.h>
 
 #include "DnsTlsServer.h"
 #include "DnsTlsTransport.h"
 #include "IDnsTlsSocketFactory.h"
-#include "params.h"
 
 namespace android {
 namespace net {
 
-using netdutils::Slice;
-
 // This is a singleton class that manages the collection of active DnsTlsTransports.
 // Queries made here are dispatched to an existing or newly constructed DnsTlsTransport.
 class DnsTlsDispatcher {
@@ -44,24 +40,26 @@
     DnsTlsDispatcher();
 
     // Constructor with dependency injection for testing.
-    explicit DnsTlsDispatcher(std::unique_ptr<IDnsTlsSocketFactory> factory) :
-            mFactory(std::move(factory)) {}
+    explicit DnsTlsDispatcher(std::unique_ptr<IDnsTlsSocketFactory> factory)
+        : mFactory(std::move(factory)) {}
 
     // Enqueues |query| for resolution via the given |tlsServers| on the
     // network indicated by |mark|; writes the response into |ans|, and stores
     // the count of bytes written in |resplen|. Returns a success or error code.
     // The order in which servers from |tlsServers| are queried may not be the
     // order passed in by the caller.
-    DnsTlsTransport::Response query(const std::list<DnsTlsServer> &tlsServers, unsigned mark,
-                                    const Slice query, const Slice ans, int * _Nonnull resplen);
+    DnsTlsTransport::Response query(const std::list<DnsTlsServer>& tlsServers, unsigned mark,
+                                    const netdutils::Slice query, const netdutils::Slice ans,
+                                    int* _Nonnull resplen);
 
     // Given a |query|, sends it to the server on the network indicated by |mark|,
     // and writes the response into |ans|,  and indicates
     // the number of bytes written in |resplen|.  Returns a success or error code.
     DnsTlsTransport::Response query(const DnsTlsServer& server, unsigned mark,
-                                    const Slice query, const Slice ans, int * _Nonnull resplen);
+                                    const netdutils::Slice query, const netdutils::Slice ans,
+                                    int* _Nonnull resplen);
 
-private:
+  private:
     // This lock is static so that it can be used to annotate the Transport struct.
     // DnsTlsDispatcher is a singleton in practice, so making this static does not change
     // the locking behavior.
@@ -73,9 +71,8 @@
     // Transport is a thin wrapper around DnsTlsTransport, adding reference counting and
     // usage monitoring so we can expire idle sessions from the cache.
     struct Transport {
-        Transport(const DnsTlsServer& server, unsigned mark,
-                  IDnsTlsSocketFactory* _Nonnull factory) :
-                transport(server, mark, factory) {}
+        Transport(const DnsTlsServer& server, unsigned mark, IDnsTlsSocketFactory* _Nonnull factory)
+            : transport(server, mark, factory) {}
         // DnsTlsTransport is thread-safe, so it doesn't need to be guarded.
         DnsTlsTransport transport;
         // This use counter and timestamp are used to ensure that only idle sessions are
@@ -99,8 +96,8 @@
     void cleanup(std::chrono::time_point<std::chrono::steady_clock> now) REQUIRES(sLock);
 
     // Return a sorted list of DnsTlsServers in preference order.
-    std::list<DnsTlsServer> getOrderedServerList(
-            const std::list<DnsTlsServer> &tlsServers, unsigned mark) const;
+    std::list<DnsTlsServer> getOrderedServerList(const std::list<DnsTlsServer>& tlsServers,
+                                                 unsigned mark) const;
 
     // Trivial factory for DnsTlsSockets.  Dependency injection is only used for testing.
     std::unique_ptr<IDnsTlsSocketFactory> mFactory;
diff --git a/resolv/DnsTlsQueryMap.cpp b/resolv/DnsTlsQueryMap.cpp
index 97f4eb6..6e6399c 100644
--- a/resolv/DnsTlsQueryMap.cpp
+++ b/resolv/DnsTlsQueryMap.cpp
@@ -17,14 +17,15 @@
 #define LOG_TAG "DnsTlsQueryMap"
 //#define LOG_NDEBUG 0
 
-#include "netd_resolv/DnsTlsQueryMap.h"
+#include "DnsTlsQueryMap.h"
 
 #include "log/log.h"
 
 namespace android {
 namespace net {
 
-std::unique_ptr<DnsTlsQueryMap::QueryFuture> DnsTlsQueryMap::recordQuery(const Slice query) {
+std::unique_ptr<DnsTlsQueryMap::QueryFuture> DnsTlsQueryMap::recordQuery(
+        const netdutils::Slice query) {
     std::lock_guard guard(mLock);
 
     // Store the query so it can be matched to the response or reissued.
diff --git a/resolv/include/netd_resolv/DnsTlsQueryMap.h b/resolv/DnsTlsQueryMap.h
similarity index 92%
rename from resolv/include/netd_resolv/DnsTlsQueryMap.h
rename to resolv/DnsTlsQueryMap.h
index f013e01..c5ab023 100644
--- a/resolv/include/netd_resolv/DnsTlsQueryMap.h
+++ b/resolv/DnsTlsQueryMap.h
@@ -26,13 +26,10 @@
 #include <netdutils/Slice.h>
 
 #include "DnsTlsServer.h"
-#include "params.h"
 
 namespace android {
 namespace net {
 
-using netdutils::Slice;
-
 // Keeps track of queries and responses.  This class matches responses with queries.
 // All methods are thread-safe and non-blocking.
 class DnsTlsQueryMap {
@@ -41,15 +38,15 @@
         // The new ID number assigned to this query.
         uint16_t newId;
         // A query that has been passed to recordQuery(), with its original ID number.
-        const Slice query;
+        const netdutils::Slice query;
     };
 
     typedef DnsTlsServer::Response Response;
     typedef DnsTlsServer::Result Result;
 
     struct QueryFuture {
-        QueryFuture(Query query, std::future<Result> result) :
-                query(query), result(std::move(result)) {}
+        QueryFuture(Query query, std::future<Result> result)
+            : query(query), result(std::move(result)) {}
         Query query;
         // A future which will resolve to the result of this query.
         std::future<Result> result;
@@ -57,7 +54,7 @@
 
     // Returns an object containing everything needed to complete processing of
     // this query, or null if the query could not be recorded.
-    std::unique_ptr<QueryFuture> recordQuery(const Slice query);
+    std::unique_ptr<QueryFuture> recordQuery(const netdutils::Slice query);
 
     // Process a response, including a new ID.  If the response
     // is not recognized as matching any query, it will be ignored.
@@ -77,7 +74,7 @@
     // Returns true if there are no pending queries.
     bool empty();
 
-private:
+  private:
     std::mutex mLock;
 
     struct QueryPromise {
diff --git a/resolv/DnsTlsServer.cpp b/resolv/DnsTlsServer.cpp
index b1ee481..a97c672 100644
--- a/resolv/DnsTlsServer.cpp
+++ b/resolv/DnsTlsServer.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include "netd_resolv/DnsTlsServer.h"
+#include "DnsTlsServer.h"
 
 #include <algorithm>
 
diff --git a/resolv/include/netd_resolv/DnsTlsServer.h b/resolv/DnsTlsServer.h
similarity index 91%
rename from resolv/include/netd_resolv/DnsTlsServer.h
rename to resolv/DnsTlsServer.h
index bb161f2..7fc4a35 100644
--- a/resolv/include/netd_resolv/DnsTlsServer.h
+++ b/resolv/DnsTlsServer.h
@@ -23,7 +23,7 @@
 
 #include <netinet/in.h>
 
-#include "params.h"
+#include <netd_resolv/params.h>
 
 namespace android {
 namespace net {
@@ -61,15 +61,15 @@
     int protocol = IPPROTO_TCP;
 
     // Exact comparison of DnsTlsServer objects
-    bool operator <(const DnsTlsServer& other) const;
-    bool operator ==(const DnsTlsServer& other) const;
+    bool operator<(const DnsTlsServer& other) const;
+    bool operator==(const DnsTlsServer& other) const;
 
     bool wasExplicitlyConfigured() const;
 };
 
 // This comparison only checks the IP address.  It ignores ports, names, and fingerprints.
 struct AddressComparator {
-    bool operator() (const DnsTlsServer& x, const DnsTlsServer& y) const;
+    bool operator()(const DnsTlsServer& x, const DnsTlsServer& y) const;
 };
 
 }  // namespace net
diff --git a/resolv/DnsTlsSessionCache.cpp b/resolv/DnsTlsSessionCache.cpp
index 54c1296..8d6dc6b 100644
--- a/resolv/DnsTlsSessionCache.cpp
+++ b/resolv/DnsTlsSessionCache.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include "netd_resolv/DnsTlsSessionCache.h"
+#include "DnsTlsSessionCache.h"
 
 #define LOG_TAG "DnsTlsSessionCache"
 //#define LOG_NDEBUG 0
diff --git a/resolv/include/netd_resolv/DnsTlsSessionCache.h b/resolv/DnsTlsSessionCache.h
similarity index 96%
rename from resolv/include/netd_resolv/DnsTlsSessionCache.h
rename to resolv/DnsTlsSessionCache.h
index 8d0fc1d..e1a88cf 100644
--- a/resolv/include/netd_resolv/DnsTlsSessionCache.h
+++ b/resolv/DnsTlsSessionCache.h
@@ -23,9 +23,6 @@
 #include <openssl/ssl.h>
 
 #include <android-base/thread_annotations.h>
-#include <android-base/unique_fd.h>
-
-#include "params.h"
 
 namespace android {
 namespace net {
@@ -33,7 +30,7 @@
 // Cache of recently seen SSL_SESSIONs.  This is used to support session tickets.
 // This class is thread-safe.
 class DnsTlsSessionCache {
-public:
+  public:
     // Prepare SSL objects to use this session cache.  These methods must be called
     // before making use of either object.
     void prepareSslContext(SSL_CTX* _Nonnull ssl_ctx);
@@ -46,7 +43,7 @@
     // pointer.)
     bssl::UniquePtr<SSL_SESSION> getSession() EXCLUDES(mLock);
 
-private:
+  private:
     static constexpr size_t kMaxSize = 5;
     static int newSessionCallback(SSL* _Nullable ssl, SSL_SESSION* _Nullable session);
 
diff --git a/resolv/DnsTlsSocket.cpp b/resolv/DnsTlsSocket.cpp
index d1455c1..b203731 100644
--- a/resolv/DnsTlsSocket.cpp
+++ b/resolv/DnsTlsSocket.cpp
@@ -17,7 +17,7 @@
 #define LOG_TAG "DnsTlsSocket"
 //#define LOG_NDEBUG 0
 
-#include "netd_resolv/DnsTlsSocket.h"
+#include "DnsTlsSocket.h"
 
 #include <arpa/inet.h>
 #include <arpa/nameser.h>
@@ -29,8 +29,8 @@
 #include <sys/poll.h>
 #include <algorithm>
 
-#include "netd_resolv/DnsTlsSessionCache.h"
-#include "netd_resolv/IDnsTlsSocketObserver.h"
+#include "DnsTlsSessionCache.h"
+#include "IDnsTlsSocketObserver.h"
 
 #include "log/log.h"
 #include "netdutils/SocketOption.h"
@@ -40,6 +40,7 @@
 using netdutils::enableSockopt;
 using netdutils::enableTcpKeepAlives;
 using netdutils::isOk;
+using netdutils::Slice;
 using netdutils::Status;
 
 namespace net {
diff --git a/resolv/include/netd_resolv/DnsTlsSocket.h b/resolv/DnsTlsSocket.h
similarity index 91%
rename from resolv/include/netd_resolv/DnsTlsSocket.h
rename to resolv/DnsTlsSocket.h
index 7a69ed1..22285f1 100644
--- a/resolv/include/netd_resolv/DnsTlsSocket.h
+++ b/resolv/DnsTlsSocket.h
@@ -17,9 +17,9 @@
 #ifndef _DNS_DNSTLSSOCKET_H
 #define _DNS_DNSTLSSOCKET_H
 
+#include <openssl/ssl.h>
 #include <future>
 #include <mutex>
-#include <openssl/ssl.h>
 
 #include <android-base/thread_annotations.h>
 #include <android-base/unique_fd.h>
@@ -29,7 +29,6 @@
 #include "DnsTlsServer.h"
 #include "IDnsTlsSocket.h"
 #include "LockedQueue.h"
-#include "params.h"
 
 namespace android {
 namespace net {
@@ -37,8 +36,6 @@
 class IDnsTlsSocketObserver;
 class DnsTlsSessionCache;
 
-using netdutils::Slice;
-
 // A class for managing a TLS socket that sends and receives messages in
 // [length][value] format, with a 2-byte length (i.e. DNS-over-TCP format).
 // This class is not aware of query-response pairing or anything else about DNS.
@@ -50,9 +47,8 @@
 class DnsTlsSocket : public IDnsTlsSocket {
   public:
     DnsTlsSocket(const DnsTlsServer& server, unsigned mark,
-                 IDnsTlsSocketObserver* _Nonnull observer,
-                 DnsTlsSessionCache* _Nonnull cache) :
-            mMark(mark), mServer(server), mObserver(observer), mCache(cache) {}
+                 IDnsTlsSocketObserver* _Nonnull observer, DnsTlsSessionCache* _Nonnull cache)
+        : mMark(mark), mServer(server), mObserver(observer), mCache(cache) {}
     ~DnsTlsSocket();
 
     // Creates the SSL context for this session and connect.  Returns false on failure.
@@ -66,9 +62,9 @@
     // notified that the socket is closed.
     // Note that success here indicates successful sending, not receipt of a response.
     // Thread-safe.
-    bool query(uint16_t id, const Slice query) override;
+    bool query(uint16_t id, const netdutils::Slice query) override;
 
-private:
+  private:
     // Lock to be held by the SSL event loop thread.  This is not normally in contention.
     std::mutex mLock;
 
@@ -89,13 +85,13 @@
     void sslDisconnect() REQUIRES(mLock);
 
     // Writes a buffer to the socket.
-    bool sslWrite(const Slice buffer) REQUIRES(mLock);
+    bool sslWrite(const netdutils::Slice buffer) REQUIRES(mLock);
 
     // Reads exactly the specified number of bytes from the socket, or fails.
     // Returns SSL_ERROR_NONE on success.
     // If |wait| is true, then this function always blocks.  Otherwise, it
     // will return SSL_ERROR_WANT_READ if there is no data from the server to read.
-    int sslRead(const Slice buffer, bool wait) REQUIRES(mLock);
+    int sslRead(const netdutils::Slice buffer, bool wait) REQUIRES(mLock);
 
     bool sendQuery(const std::vector<uint8_t>& buf) REQUIRES(mLock);
     bool readResponse() REQUIRES(mLock);
diff --git a/resolv/include/netd_resolv/DnsTlsSocketFactory.h b/resolv/DnsTlsSocketFactory.h
similarity index 87%
rename from resolv/include/netd_resolv/DnsTlsSocketFactory.h
rename to resolv/DnsTlsSocketFactory.h
index 1c58535..af4011d 100644
--- a/resolv/include/netd_resolv/DnsTlsSocketFactory.h
+++ b/resolv/DnsTlsSocketFactory.h
@@ -31,10 +31,10 @@
 
 // Trivial RAII factory for DnsTlsSocket.  This is owned by DnsTlsDispatcher.
 class DnsTlsSocketFactory : public IDnsTlsSocketFactory {
-public:
+  public:
     std::unique_ptr<IDnsTlsSocket> createDnsTlsSocket(const DnsTlsServer& server, unsigned mark,
-                                                     IDnsTlsSocketObserver* _Nonnull observer,
-                                                     DnsTlsSessionCache* _Nonnull cache) override {
+                                                      IDnsTlsSocketObserver* _Nonnull observer,
+                                                      DnsTlsSessionCache* _Nonnull cache) override {
         auto socket = std::make_unique<DnsTlsSocket>(server, mark, observer, cache);
         if (!socket->initialize()) {
             return nullptr;
diff --git a/resolv/DnsTlsTransport.cpp b/resolv/DnsTlsTransport.cpp
index b1e9205..0f9042e 100644
--- a/resolv/DnsTlsTransport.cpp
+++ b/resolv/DnsTlsTransport.cpp
@@ -17,13 +17,13 @@
 #define LOG_TAG "DnsTlsTransport"
 //#define LOG_NDEBUG 0
 
-#include "netd_resolv/DnsTlsTransport.h"
+#include "DnsTlsTransport.h"
 
 #include <arpa/inet.h>
 #include <arpa/nameser.h>
 
-#include "netd_resolv/DnsTlsSocketFactory.h"
-#include "netd_resolv/IDnsTlsSocketFactory.h"
+#include "DnsTlsSocketFactory.h"
+#include "IDnsTlsSocketFactory.h"
 
 #include "log/log.h"
 
@@ -178,7 +178,7 @@
     int replylen = 0;
     DnsTlsSocketFactory factory;
     DnsTlsTransport transport(server, mark, &factory);
-    auto r = transport.query(Slice(query, qlen)).get();
+    auto r = transport.query(netdutils::Slice(query, qlen)).get();
     if (r.code != Response::success) {
         ALOGV("query failed");
         return false;
diff --git a/resolv/include/netd_resolv/DnsTlsTransport.h b/resolv/DnsTlsTransport.h
similarity index 94%
rename from resolv/include/netd_resolv/DnsTlsTransport.h
rename to resolv/DnsTlsTransport.h
index 4590868..6c98fa6 100644
--- a/resolv/include/netd_resolv/DnsTlsTransport.h
+++ b/resolv/DnsTlsTransport.h
@@ -24,15 +24,13 @@
 
 #include <android-base/thread_annotations.h>
 #include <android-base/unique_fd.h>
+#include <netdutils/Slice.h>
 
 #include "DnsTlsQueryMap.h"
 #include "DnsTlsServer.h"
 #include "DnsTlsSessionCache.h"
 #include "IDnsTlsSocket.h"
 #include "IDnsTlsSocketObserver.h"
-#include "params.h"
-
-#include <netdutils/Slice.h>
 
 namespace android {
 namespace net {
@@ -44,8 +42,8 @@
 class DnsTlsTransport : public IDnsTlsSocketObserver {
   public:
     DnsTlsTransport(const DnsTlsServer& server, unsigned mark,
-                    IDnsTlsSocketFactory* _Nonnull factory) :
-            mMark(mark), mServer(server), mFactory(factory) {}
+                    IDnsTlsSocketFactory* _Nonnull factory)
+        : mMark(mark), mServer(server), mFactory(factory) {}
     ~DnsTlsTransport();
 
     typedef DnsTlsServer::Response Response;
@@ -63,7 +61,7 @@
     void onResponse(std::vector<uint8_t> response) override;
     void onClosed() override EXCLUDES(mLock);
 
-private:
+  private:
     std::mutex mLock;
 
     DnsTlsSessionCache mCache;
diff --git a/resolv/include/netd_resolv/IDnsTlsSocket.h b/resolv/IDnsTlsSocket.h
similarity index 97%
rename from resolv/include/netd_resolv/IDnsTlsSocket.h
rename to resolv/IDnsTlsSocket.h
index 4f21bbd..0f2800e 100644
--- a/resolv/include/netd_resolv/IDnsTlsSocket.h
+++ b/resolv/IDnsTlsSocket.h
@@ -32,8 +32,8 @@
 // [length][value] format, with a 2-byte length (i.e. DNS-over-TCP format).
 // This interface is not aware of query-response pairing or anything else about DNS.
 class IDnsTlsSocket {
-public:
-    virtual ~IDnsTlsSocket() {};
+  public:
+    virtual ~IDnsTlsSocket(){};
     // Send a query on the provided SSL socket.  |query| contains
     // the body of a query, not including the ID bytes.  This function will typically return before
     // the query is actually sent.  If this function fails, the observer will be
diff --git a/resolv/include/netd_resolv/IDnsTlsSocketFactory.h b/resolv/IDnsTlsSocketFactory.h
similarity index 87%
rename from resolv/include/netd_resolv/IDnsTlsSocketFactory.h
rename to resolv/IDnsTlsSocketFactory.h
index 52164b6..a391f59 100644
--- a/resolv/include/netd_resolv/IDnsTlsSocketFactory.h
+++ b/resolv/IDnsTlsSocketFactory.h
@@ -29,12 +29,10 @@
 // Dependency injection interface for DnsTlsSocketFactory.
 // This pattern allows mocking of DnsTlsSocket for tests.
 class IDnsTlsSocketFactory {
-public:
-    virtual ~IDnsTlsSocketFactory() {};
+  public:
+    virtual ~IDnsTlsSocketFactory(){};
     virtual std::unique_ptr<IDnsTlsSocket> createDnsTlsSocket(
-            const DnsTlsServer& server,
-            unsigned mark,
-            IDnsTlsSocketObserver* _Nonnull observer,
+            const DnsTlsServer& server, unsigned mark, IDnsTlsSocketObserver* _Nonnull observer,
             DnsTlsSessionCache* _Nonnull cache) = 0;
 };
 
diff --git a/resolv/include/netd_resolv/IDnsTlsSocketObserver.h b/resolv/IDnsTlsSocketObserver.h
similarity index 95%
rename from resolv/include/netd_resolv/IDnsTlsSocketObserver.h
rename to resolv/IDnsTlsSocketObserver.h
index 7ae364c..980f74a 100644
--- a/resolv/include/netd_resolv/IDnsTlsSocketObserver.h
+++ b/resolv/IDnsTlsSocketObserver.h
@@ -25,8 +25,8 @@
 // DnsTlsTransport, but it is a separate interface for clarity and to avoid a
 // circular dependency with DnsTlsSocket.
 class IDnsTlsSocketObserver {
-public:
-    virtual ~IDnsTlsSocketObserver() {};
+  public:
+    virtual ~IDnsTlsSocketObserver(){};
     virtual void onResponse(std::vector<uint8_t> response) = 0;
 
     virtual void onClosed() = 0;
diff --git a/resolv/PrivateDnsConfiguration.cpp b/resolv/PrivateDnsConfiguration.cpp
index 678589b..5309e36 100644
--- a/resolv/PrivateDnsConfiguration.cpp
+++ b/resolv/PrivateDnsConfiguration.cpp
@@ -21,8 +21,9 @@
 #include <netdb.h>
 #include <sys/socket.h>
 
-#include "netd_resolv/DnsTlsTransport.h"
-#include "netd_resolv/PrivateDnsConfiguration.h"
+#include "DnsTlsTransport.h"
+#include "PrivateDnsConfiguration.h"
+#include "netd_resolv/resolv.h"
 #include "netdutils/BackoffSequence.h"
 
 int resolv_set_private_dns_for_net(unsigned netid, uint32_t mark, const char** servers,
diff --git a/resolv/include/netd_resolv/PrivateDnsConfiguration.h b/resolv/PrivateDnsConfiguration.h
similarity index 96%
rename from resolv/include/netd_resolv/PrivateDnsConfiguration.h
rename to resolv/PrivateDnsConfiguration.h
index cee0205..eadbaee 100644
--- a/resolv/include/netd_resolv/PrivateDnsConfiguration.h
+++ b/resolv/PrivateDnsConfiguration.h
@@ -22,9 +22,11 @@
 #include <vector>
 
 #include <android-base/thread_annotations.h>
+#include <netd_resolv/resolv.h>
 
 #include "DnsTlsServer.h"
-#include "resolv.h"
+
+struct ExternalPrivateDnsStatus;  // Defined in netd_resolv/resolv.h
 
 namespace android {
 namespace net {
diff --git a/resolv/ResolverEventReporter.cpp b/resolv/ResolverEventReporter.cpp
index ad7250b..908cbce 100644
--- a/resolv/ResolverEventReporter.cpp
+++ b/resolv/ResolverEventReporter.cpp
@@ -16,7 +16,7 @@
 
 #include <android/binder_manager.h>
 
-#include "netd_resolv/ResolverEventReporter.h"
+#include "ResolverEventReporter.h"
 
 using aidl::android::net::metrics::INetdEventListener;
 
diff --git a/resolv/include/netd_resolv/ResolverEventReporter.h b/resolv/ResolverEventReporter.h
similarity index 100%
rename from resolv/include/netd_resolv/ResolverEventReporter.h
rename to resolv/ResolverEventReporter.h
diff --git a/resolv/dns_tls_test.cpp b/resolv/dns_tls_test.cpp
index 4597389..d8626f1 100644
--- a/resolv/dns_tls_test.cpp
+++ b/resolv/dns_tls_test.cpp
@@ -19,15 +19,15 @@
 
 #include <gtest/gtest.h>
 
-#include "netd_resolv/DnsTlsDispatcher.h"
-#include "netd_resolv/DnsTlsQueryMap.h"
-#include "netd_resolv/DnsTlsServer.h"
-#include "netd_resolv/DnsTlsSessionCache.h"
-#include "netd_resolv/DnsTlsSocket.h"
-#include "netd_resolv/DnsTlsTransport.h"
-#include "netd_resolv/IDnsTlsSocket.h"
-#include "netd_resolv/IDnsTlsSocketFactory.h"
-#include "netd_resolv/IDnsTlsSocketObserver.h"
+#include "DnsTlsDispatcher.h"
+#include "DnsTlsQueryMap.h"
+#include "DnsTlsServer.h"
+#include "DnsTlsSessionCache.h"
+#include "DnsTlsSocket.h"
+#include "DnsTlsTransport.h"
+#include "IDnsTlsSocket.h"
+#include "IDnsTlsSocketFactory.h"
+#include "IDnsTlsSocketObserver.h"
 
 #include <chrono>
 #include <arpa/inet.h>
diff --git a/resolv/res_send.cpp b/resolv/res_send.cpp
index 21017ac..906269f 100644
--- a/resolv/res_send.cpp
+++ b/resolv/res_send.cpp
@@ -101,9 +101,9 @@
 #include <android-base/logging.h>
 
 #include <netdutils/Slice.h>
-#include "netd_resolv/DnsTlsDispatcher.h"
-#include "netd_resolv/DnsTlsTransport.h"
-#include "netd_resolv/PrivateDnsConfiguration.h"
+#include "DnsTlsDispatcher.h"
+#include "DnsTlsTransport.h"
+#include "PrivateDnsConfiguration.h"
 #include "netd_resolv/resolv.h"
 #include "netd_resolv/stats.h"
 #include "private/android_filesystem_config.h"
@@ -113,6 +113,7 @@
 
 // TODO: use the namespace something like android::netd_resolv for libnetd_resolv
 using namespace android::net;
+using android::netdutils::Slice;
 
 #define VLOG if (!kVerboseLogging) {} else LOG(INFO)
 
@@ -1325,4 +1326,4 @@
     _resolv_populate_res_for_net(res);
     *rcode = NOERROR;
     return res_nsend(res, msg, msgLen, ans, ansLen, rcode, flags);
-}
\ No newline at end of file
+}