resolved-dns-transaction.h revision 105e151299dc1208855380be2b22d0db2d66ebc6
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
#pragma once
/***
This file is part of systemd.
Copyright 2014 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
typedef struct DnsTransaction DnsTransaction;
typedef enum DnsTransactionState DnsTransactionState;
typedef enum DnsTransactionSource DnsTransactionSource;
enum DnsTransactionState {
};
#define DNS_TRANSACTION_IS_LIVE(state) IN_SET((state), DNS_TRANSACTION_NULL, DNS_TRANSACTION_PENDING, DNS_TRANSACTION_VALIDATING)
enum DnsTransactionSource {
};
#include "resolved-dns-answer.h"
#include "resolved-dns-packet.h"
#include "resolved-dns-question.h"
#include "resolved-dns-scope.h"
struct DnsTransaction {
char *key_string;
bool initial_jitter_scheduled:1;
bool initial_jitter_elapsed:1;
int answer_rcode;
/* Indicates whether the primary answer is authenticated,
* i.e. whether the RRs from answer which directly match the
* question are authenticated, or, if there are none, whether
* the NODATA or NXDOMAIN case is. It says nothing about
* additional RRs listed in the answer, however they have
* their own DNS_ANSWER_AUTHORIZED FLAGS. Note that this bit
* is defined different than the AD bit in DNS packets, as
* that covers more than just the actual primary answer. */
bool answer_authenticated;
/* Contains DNSKEY, DS, SOA RRs we already verified and need
* to authenticate this reply */
unsigned n_attempts;
int dns_udp_fd;
/* The active server */
/* The features of the DNS server at time of transaction start */
/* TCP connection logic, if we need it */
/* Query candidates this transaction is referenced by and that
* shall be notified about this specific transaction
* completing. */
/* Zone items this transaction is referenced by and that shall
* be notified about completion. */
/* Other transactions that this transactions is referenced by
* and that shall be notified about completion. This is used
* when transactions want to validate their RRsets, but need
* another DNSKEY or DS RR to do so. */
/* The opposite direction: the transactions this transaction
* created in order to request DNSKEY or DS RRs. */
unsigned block_gc;
};
void dns_transaction_gc(DnsTransaction *t);
int dns_transaction_go(DnsTransaction *t);
const char *dns_transaction_key_string(DnsTransaction *t);
/* LLMNR Jitter interval, see RFC 4795 Section 7 */
/* mDNS Jitter interval, see RFC 6762 Section 5.2 */
/* Maximum attempts to send DNS requests, across all DNS servers */
#define DNS_TRANSACTION_ATTEMPTS_MAX 16
/* Maximum attempts to send LLMNR requests, see RFC 4795 Section 2.7 */
#define LLMNR_TRANSACTION_ATTEMPTS_MAX 3
#define TRANSACTION_ATTEMPTS_MAX(p) ((p) == DNS_PROTOCOL_LLMNR ? LLMNR_TRANSACTION_ATTEMPTS_MAX : DNS_TRANSACTION_ATTEMPTS_MAX)