]>
Commit | Line | Data |
---|---|---|
623a4c97 LP |
1 | /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ |
2 | ||
3 | #pragma once | |
4 | ||
5 | /*** | |
6 | This file is part of systemd. | |
7 | ||
8 | Copyright 2014 Lennart Poettering | |
9 | ||
10 | systemd is free software; you can redistribute it and/or modify it | |
11 | under the terms of the GNU Lesser General Public License as published by | |
12 | the Free Software Foundation; either version 2.1 of the License, or | |
13 | (at your option) any later version. | |
14 | ||
15 | systemd is distributed in the hope that it will be useful, but | |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | Lesser General Public License for more details. | |
19 | ||
20 | You should have received a copy of the GNU Lesser General Public License | |
21 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
22 | ***/ | |
23 | ||
24 | #include "socket-util.h" | |
25 | ||
26 | typedef struct DnsStream DnsStream; | |
27 | ||
28 | #include "resolved.h" | |
29 | ||
30 | struct DnsStream { | |
31 | Manager *manager; | |
32 | ||
33 | DnsProtocol protocol; | |
34 | ||
35 | int fd; | |
36 | union sockaddr_union peer; | |
37 | socklen_t peer_salen; | |
38 | union sockaddr_union local; | |
39 | socklen_t local_salen; | |
40 | int ifindex; | |
41 | uint32_t ttl; | |
b914e211 | 42 | bool identified; |
623a4c97 LP |
43 | |
44 | sd_event_source *io_event_source; | |
45 | sd_event_source *timeout_event_source; | |
46 | ||
47 | be16_t write_size, read_size; | |
48 | DnsPacket *write_packet, *read_packet; | |
49 | size_t n_written, n_read; | |
50 | ||
51 | int (*on_packet)(DnsStream *s); | |
52 | int (*complete)(DnsStream *s, int error); | |
53 | ||
54 | DnsQueryTransaction *transaction; | |
55 | ||
56 | LIST_FIELDS(DnsStream, streams); | |
57 | }; | |
58 | ||
59 | int dns_stream_new(Manager *m, DnsStream **s, DnsProtocol protocol, int fd); | |
60 | DnsStream *dns_stream_free(DnsStream *s); | |
61 | ||
62 | int dns_stream_write_packet(DnsStream *s, DnsPacket *p); |