resolved-dns-transaction.h revision 019036a47fcd10fcf0286800d144c706f3773e2f
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye This file is part of systemd.
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye Copyright 2014 Lennart Poettering
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye systemd is free software; you can redistribute it and/or modify it
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye under the terms of the GNU Lesser General Public License as published by
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye the Free Software Foundation; either version 2.1 of the License, or
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye (at your option) any later version.
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye systemd is distributed in the hope that it will be useful, but
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye WITHOUT ANY WARRANTY; without even the implied warranty of
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye Lesser General Public License for more details.
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye You should have received a copy of the GNU Lesser General Public License
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye along with systemd; If not, see <http://www.gnu.org/licenses/>.
cf1f7b5e81583dfca30972cfef322266a6928e7fKnut Anders Hatlentypedef enum DnsTransactionState DnsTransactionState;
64b763950bf11e9357facbd2b5666631a895c085Trond Norbyetypedef enum DnsTransactionSource DnsTransactionSource;
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye#define DNS_TRANSACTION_IS_LIVE(state) IN_SET((state), DNS_TRANSACTION_NULL, DNS_TRANSACTION_PENDING, DNS_TRANSACTION_VALIDATING)
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye /* Indicates whether the primary answer is authenticated,
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye * i.e. whether the RRs from answer which directly match the
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye * question are authenticated, or, if there are none, whether
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye * the NODATA or NXDOMAIN case is. It says nothing about
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye * additional RRs listed in the answer, however they have
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye * their own DNS_ANSWER_AUTHORIZED FLAGS. Note that this bit
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye * is defined different than the AD bit in DNS packets, as
64b763950bf11e9357facbd2b5666631a895c085Trond Norbye * that covers more than just the actual primary answer. */
5e6c91d7e77062129cd0b6ac8aaa546dff216419Lubos Kosco /* Contains DNSKEY, DS, SOA RRs we already verified and need
a07b2874263e3c5f0cd2e83441719415d53059c2Knut Anders Hatlen * to authenticate this reply */
780cc7d1b57609ff15fb283201e93cb501ebe9e6Jorgen Austvik /* The active server */
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco /* The features of the DNS server at time of transaction start */
0466de7c67573e1ce5e0733325c1e5383270f5d5Knut Anders Hatlen /* TCP connection logic, if we need it */
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco /* Query candidates this transaction is referenced by and that
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco * shall be notified about this specific transaction
1ed6b730409d4740e941142599767d5eac7e7d92Lubos Kosco * completing. */
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik /* Zone items this transaction is referenced by and that shall
b34561d2c3d92fac37dbced05ba6a8738e3d20e9Lubos Kosco * be notified about completion. */
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik /* Other transactions that this transactions is referenced by
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik * and that shall be notified about completion. This is used
c7eb123c8b2081a261deff3c401fbf92ddba1b58Jorgen Austvik * when transactions want to validate their RRsets, but need
5a0c5ad4116f5a4dd0dd5a0a4e6d02973cd5eef9Lubos Kosco * another DNSKEY or DS RR to do so. */
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvik /* The opposite direction: the transactions this transaction
49f592091468eac515dde6139fbc8efa26056b0aJorgen Austvik * created in order to request DNSKEY or DS RRs. */
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvik LIST_FIELDS(DnsTransaction, transactions_by_scope);
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen Austvikint dns_transaction_new(DnsTransaction **ret, DnsScope *s, DnsResourceKey *key);
945f4c3c36a15447913781dfb1894b34f2941c57Jorgen AustvikDnsTransaction* dns_transaction_free(DnsTransaction *t);
7ecd52b03dc1f0b03ff8f522b4891c8531896c3dJorgen Austvikvoid dns_transaction_process_reply(DnsTransaction *t, DnsPacket *p);
1ed6b730409d4740e941142599767d5eac7e7d92Lubos Koscovoid dns_transaction_complete(DnsTransaction *t, DnsTransactionState state);
64b763950bf11e9357facbd2b5666631a895c085Trond Norbyevoid dns_transaction_notify(DnsTransaction *t, DnsTransaction *source);
b34561d2c3d92fac37dbced05ba6a8738e3d20e9Lubos Koscoint dns_transaction_validate_dnssec(DnsTransaction *t);
b34561d2c3d92fac37dbced05ba6a8738e3d20e9Lubos Koscoint dns_transaction_request_dnssec_keys(DnsTransaction *t);
b34561d2c3d92fac37dbced05ba6a8738e3d20e9Lubos Koscoconst char *dns_transaction_key_string(DnsTransaction *t);
b34561d2c3d92fac37dbced05ba6a8738e3d20e9Lubos Koscoconst char* dns_transaction_state_to_string(DnsTransactionState p) _const_;
b34561d2c3d92fac37dbced05ba6a8738e3d20e9Lubos KoscoDnsTransactionState dns_transaction_state_from_string(const char *s) _pure_;
b34561d2c3d92fac37dbced05ba6a8738e3d20e9Lubos Koscoconst char* dns_transaction_source_to_string(DnsTransactionSource p) _const_;
b34561d2c3d92fac37dbced05ba6a8738e3d20e9Lubos KoscoDnsTransactionSource dns_transaction_source_from_string(const char *s) _pure_;
b34561d2c3d92fac37dbced05ba6a8738e3d20e9Lubos Kosco/* LLMNR Jitter interval, see RFC 4795 Section 7 */
b34561d2c3d92fac37dbced05ba6a8738e3d20e9Lubos Kosco#define LLMNR_JITTER_INTERVAL_USEC (100 * USEC_PER_MSEC)
b34561d2c3d92fac37dbced05ba6a8738e3d20e9Lubos Kosco/* mDNS Jitter interval, see RFC 6762 Section 5.2 */
b34561d2c3d92fac37dbced05ba6a8738e3d20e9Lubos Kosco#define MDNS_JITTER_MIN_USEC (20 * USEC_PER_MSEC)
b34561d2c3d92fac37dbced05ba6a8738e3d20e9Lubos Kosco#define MDNS_JITTER_RANGE_USEC (100 * USEC_PER_MSEC)
b34561d2c3d92fac37dbced05ba6a8738e3d20e9Lubos Kosco/* Maximum attempts to send DNS requests, across all DNS servers */
b34561d2c3d92fac37dbced05ba6a8738e3d20e9Lubos Kosco/* Maximum attempts to send LLMNR requests, see RFC 4795 Section 2.7 */