| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
#pragma once |
| 3 |
|
| 4 |
#include <sys/uio.h> |
| 5 |
|
| 6 |
#include "in-addr-util.h" |
| 7 |
#include "shared-forward.h" |
| 8 |
|
| 9 |
typedef struct DNSServer { |
| 10 |
struct iovec addr; |
| 11 |
int family; |
| 12 |
uint16_t port; |
| 13 |
int ifindex; |
| 14 |
char *server_name; |
| 15 |
bool accessible; |
| 16 |
union in_addr_union in_addr; |
| 17 |
} DNSServer; |
| 18 |
|
| 19 |
DNSServer* dns_server_free(DNSServer *s); |
| 20 |
DEFINE_TRIVIAL_CLEANUP_FUNC(DNSServer*, dns_server_free); |
| 21 |
|
| 22 |
typedef struct SearchDomain { |
| 23 |
char *name; |
| 24 |
bool route_only; |
| 25 |
int ifindex; |
| 26 |
} SearchDomain; |
| 27 |
|
| 28 |
typedef struct DNSScope { |
| 29 |
char *ifname; |
| 30 |
int ifindex; |
| 31 |
char *protocol; |
| 32 |
int family; |
| 33 |
char *dnssec_mode_str; |
| 34 |
char *dns_over_tls_mode_str; |
| 35 |
} DNSScope; |
| 36 |
|
| 37 |
DNSScope* dns_scope_free(DNSScope *s); |
| 38 |
DEFINE_TRIVIAL_CLEANUP_FUNC(DNSScope*, dns_scope_free); |
| 39 |
|
| 40 |
SearchDomain* search_domain_free(SearchDomain *d); |
| 41 |
DEFINE_TRIVIAL_CLEANUP_FUNC(SearchDomain*, search_domain_free); |
| 42 |
|
| 43 |
typedef struct DNSConfiguration { |
| 44 |
char *ifname; |
| 45 |
int ifindex; |
| 46 |
bool default_route; |
| 47 |
DNSServer *current_dns_server; |
| 48 |
OrderedSet *dns_servers; |
| 49 |
OrderedSet *search_domains; |
| 50 |
OrderedSet *fallback_dns_servers; |
| 51 |
Set *dns_scopes; |
| 52 |
char *dnssec_mode_str; |
| 53 |
char *dns_over_tls_mode_str; |
| 54 |
char *llmnr_mode_str; |
| 55 |
char *mdns_mode_str; |
| 56 |
char **negative_trust_anchors; |
| 57 |
char *resolv_conf_mode_str; |
| 58 |
char *delegate; |
| 59 |
bool dnssec_supported; |
| 60 |
} DNSConfiguration; |
| 61 |
|
| 62 |
DNSConfiguration* dns_configuration_free(DNSConfiguration *c); |
| 63 |
DEFINE_TRIVIAL_CLEANUP_FUNC(DNSConfiguration*, dns_configuration_free); |
| 64 |
|
| 65 |
int dns_configuration_from_json(sd_json_variant *variant, DNSConfiguration **ret); |
| 66 |
bool dns_is_accessible(DNSConfiguration *c); |
| 67 |
bool dns_configuration_contains_search_domain(DNSConfiguration *c, const char *domain); |
| 68 |
|
| 69 |
extern const struct hash_ops dns_configuration_hash_ops; |