]>
Commit | Line | Data |
---|---|---|
db9ecf05 | 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
b30bf55d LP |
2 | #pragma once |
3 | ||
ae8f0ec3 LP |
4 | #include "hash-funcs.h" |
5 | ||
6 | typedef struct DnsStubListenerExtra DnsStubListenerExtra; | |
7 | ||
8 | typedef enum DnsStubListenerMode { | |
9 | DNS_STUB_LISTENER_NO, | |
10 | DNS_STUB_LISTENER_UDP = 1 << 0, | |
11 | DNS_STUB_LISTENER_TCP = 1 << 1, | |
12 | DNS_STUB_LISTENER_YES = DNS_STUB_LISTENER_UDP | DNS_STUB_LISTENER_TCP, | |
13 | _DNS_STUB_LISTENER_MODE_MAX, | |
2d93c20e | 14 | _DNS_STUB_LISTENER_MODE_INVALID = -EINVAL, |
ae8f0ec3 LP |
15 | } DnsStubListenerMode; |
16 | ||
b30bf55d LP |
17 | #include "resolved-manager.h" |
18 | ||
ae8f0ec3 | 19 | struct DnsStubListenerExtra { |
0354029b LP |
20 | Manager *manager; |
21 | ||
ae8f0ec3 LP |
22 | DnsStubListenerMode mode; |
23 | ||
24 | int family; | |
25 | union in_addr_union address; | |
26 | uint16_t port; | |
27 | ||
28 | sd_event_source *udp_event_source; | |
29 | sd_event_source *tcp_event_source; | |
bde69bbd LP |
30 | |
31 | Hashmap *queries_by_packet; | |
ae8f0ec3 LP |
32 | }; |
33 | ||
34 | extern const struct hash_ops dns_stub_listener_extra_hash_ops; | |
35 | ||
0354029b | 36 | int dns_stub_listener_extra_new(Manager *m, DnsStubListenerExtra **ret); |
36aaabc3 | 37 | DnsStubListenerExtra *dns_stub_listener_extra_free(DnsStubListenerExtra *p); |
06cd8363 ZJS |
38 | static inline uint16_t dns_stub_listener_extra_port(DnsStubListenerExtra *p) { |
39 | assert(p); | |
40 | ||
41 | return p->port > 0 ? p->port : 53; | |
42 | } | |
1f05101f | 43 | |
b30bf55d LP |
44 | void manager_dns_stub_stop(Manager *m); |
45 | int manager_dns_stub_start(Manager *m); | |
ae8f0ec3 LP |
46 | |
47 | const char* dns_stub_listener_mode_to_string(DnsStubListenerMode p) _const_; | |
48 | DnsStubListenerMode dns_stub_listener_mode_from_string(const char *s) _pure_; |