| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
#pragma once |
| 3 |
|
| 4 |
#include "list.h" |
| 5 |
#include "resolved-forward.h" |
| 6 |
|
| 7 |
#define DELEGATE_SEARCH_DOMAINS_MAX 1024 |
| 8 |
#define DELEGATE_DNS_SERVERS_MAX 256 |
| 9 |
|
| 10 |
/* A DnsDelegate object is used to manage additional, explicitly configured unicast DNS lookup scopes, |
| 11 |
* independent from any network link and from the global scope. */ |
| 12 |
|
| 13 |
typedef struct DnsDelegate { |
| 14 |
Manager *manager; |
| 15 |
char *id; |
| 16 |
|
| 17 |
LIST_HEAD(DnsServer, dns_servers); |
| 18 |
unsigned n_dns_servers; |
| 19 |
DnsServer *current_dns_server; |
| 20 |
|
| 21 |
LIST_HEAD(DnsSearchDomain, search_domains); |
| 22 |
unsigned n_search_domains; |
| 23 |
|
| 24 |
int default_route; |
| 25 |
|
| 26 |
uint32_t fwmark; |
| 27 |
|
| 28 |
DnsScope *scope; |
| 29 |
|
| 30 |
LIST_FIELDS(DnsDelegate, delegates); |
| 31 |
} DnsDelegate; |
| 32 |
|
| 33 |
int dns_delegate_new(Manager *m, const char *id, DnsDelegate **ret); |
| 34 |
DnsDelegate *dns_delegate_free(DnsDelegate *d); |
| 35 |
|
| 36 |
DEFINE_TRIVIAL_CLEANUP_FUNC(DnsDelegate*, dns_delegate_free); |
| 37 |
|
| 38 |
DnsServer* dns_delegate_set_dns_server(DnsDelegate *d, DnsServer *s); |
| 39 |
DnsServer *dns_delegate_get_dns_server(DnsDelegate *d); |
| 40 |
void dns_delegate_next_dns_server(DnsDelegate *d, DnsServer *if_current); |
| 41 |
|
| 42 |
int manager_load_delegates(Manager *m); |
| 43 |
|
| 44 |
const struct ConfigPerfItem* resolved_dns_delegate_gperf_lookup(const char *str, GPERF_LEN_TYPE length); |
| 45 |
|
| 46 |
CONFIG_PARSER_PROTOTYPE(config_parse_delegate_dns_servers); |
| 47 |
CONFIG_PARSER_PROTOTYPE(config_parse_delegate_domains); |