]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/resolve/resolved-dns-stub.h
io.systemd.Unit.List fix context/runtime split (#38172)
[thirdparty/systemd.git] / src / resolve / resolved-dns-stub.h
CommitLineData
db9ecf05 1/* SPDX-License-Identifier: LGPL-2.1-or-later */
b30bf55d
LP
2#pragma once
3
68527d30 4#include "in-addr-util.h"
284d7641 5#include "resolved-forward.h"
ae8f0ec3
LP
6
7typedef enum DnsStubListenerMode {
8 DNS_STUB_LISTENER_NO,
9 DNS_STUB_LISTENER_UDP = 1 << 0,
10 DNS_STUB_LISTENER_TCP = 1 << 1,
11 DNS_STUB_LISTENER_YES = DNS_STUB_LISTENER_UDP | DNS_STUB_LISTENER_TCP,
12 _DNS_STUB_LISTENER_MODE_MAX,
2d93c20e 13 _DNS_STUB_LISTENER_MODE_INVALID = -EINVAL,
ae8f0ec3
LP
14} DnsStubListenerMode;
15
284d7641 16typedef struct DnsStubListenerExtra {
0354029b
LP
17 Manager *manager;
18
ae8f0ec3
LP
19 DnsStubListenerMode mode;
20
21 int family;
22 union in_addr_union address;
23 uint16_t port;
24
25 sd_event_source *udp_event_source;
26 sd_event_source *tcp_event_source;
bde69bbd
LP
27
28 Hashmap *queries_by_packet;
284d7641 29} DnsStubListenerExtra;
ae8f0ec3
LP
30
31extern const struct hash_ops dns_stub_listener_extra_hash_ops;
32
0354029b 33int dns_stub_listener_extra_new(Manager *m, DnsStubListenerExtra **ret);
36aaabc3 34DnsStubListenerExtra *dns_stub_listener_extra_free(DnsStubListenerExtra *p);
06cd8363
ZJS
35static inline uint16_t dns_stub_listener_extra_port(DnsStubListenerExtra *p) {
36 assert(p);
37
38 return p->port > 0 ? p->port : 53;
39}
1f05101f 40
b30bf55d
LP
41void manager_dns_stub_stop(Manager *m);
42int manager_dns_stub_start(Manager *m);
ae8f0ec3
LP
43
44const char* dns_stub_listener_mode_to_string(DnsStubListenerMode p) _const_;
45DnsStubListenerMode dns_stub_listener_mode_from_string(const char *s) _pure_;