Move ExternalPrivateDnsStatus away from libnetd_resolv's public headers
This is a first pass at sanitizing the public headers of libnetd_resolv
by moving out things that are only used internally.
The main motivation is reducing noise in ABI dumps generated for the ABI
checker. It's also a nice opportunity to cut off the C wrappers that we
no longer need.
Test: cd system/netd && atest
Change-Id: I08689c263c4fd96363666a108ba08d768ad327df
diff --git a/PrivateDnsConfiguration.h b/PrivateDnsConfiguration.h
index ed0885d..50fb54d 100644
--- a/PrivateDnsConfiguration.h
+++ b/PrivateDnsConfiguration.h
@@ -23,20 +23,34 @@
#include <vector>
#include <android-base/thread_annotations.h>
-#include <netd_resolv/resolv.h>
#include "DnsTlsServer.h"
-struct ExternalPrivateDnsStatus; // Defined in netd_resolv/resolv.h
-
namespace android {
namespace net {
+// The DNS over TLS mode on a specific netId.
+enum class PrivateDnsMode : uint8_t { OFF, OPPORTUNISTIC, STRICT };
+
+// Validation status of a DNS over TLS server (on a specific netId).
+enum class Validation : uint8_t { in_process, success, fail, unknown_server, unknown_netid };
+
struct PrivateDnsStatus {
PrivateDnsMode mode;
std::list<DnsTlsServer> validatedServers;
};
+// TODO: remove this C-style struct and use PrivateDnsStatus everywhere.
+struct ExternalPrivateDnsStatus {
+ PrivateDnsMode mode;
+ int numServers;
+ struct PrivateDnsInfo {
+ sockaddr_storage ss;
+ const char* hostname;
+ Validation validation;
+ } serverStatus[MAXNS];
+};
+
class PrivateDnsConfiguration {
public:
int set(int32_t netId, uint32_t mark, const std::vector<std::string>& servers,
@@ -44,7 +58,7 @@
PrivateDnsStatus getStatus(unsigned netId);
- // Externally used for netd.
+ // DEPRECATED, use getStatus() above.
void getStatus(unsigned netId, ExternalPrivateDnsStatus* status);
void clear(unsigned netId);