]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/resolve/resolved-dns-stream.h
resolved: implement LLMNR uniqueness verification
[thirdparty/systemd.git] / src / resolve / resolved-dns-stream.h
CommitLineData
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
26typedef struct DnsStream DnsStream;
27
28#include "resolved.h"
ec2c5e43
LP
29#include "resolved-dns-packet.h"
30#include "resolved-dns-transaction.h"
623a4c97
LP
31
32struct DnsStream {
33 Manager *manager;
34
35 DnsProtocol protocol;
36
37 int fd;
38 union sockaddr_union peer;
39 socklen_t peer_salen;
40 union sockaddr_union local;
41 socklen_t local_salen;
42 int ifindex;
43 uint32_t ttl;
b914e211 44 bool identified;
623a4c97
LP
45
46 sd_event_source *io_event_source;
47 sd_event_source *timeout_event_source;
48
49 be16_t write_size, read_size;
50 DnsPacket *write_packet, *read_packet;
51 size_t n_written, n_read;
52
53 int (*on_packet)(DnsStream *s);
54 int (*complete)(DnsStream *s, int error);
55
ec2c5e43 56 DnsTransaction *transaction;
623a4c97
LP
57
58 LIST_FIELDS(DnsStream, streams);
59};
60
61int dns_stream_new(Manager *m, DnsStream **s, DnsProtocol protocol, int fd);
62DnsStream *dns_stream_free(DnsStream *s);
63
64int dns_stream_write_packet(DnsStream *s, DnsPacket *p);