LCOV - code coverage report
Current view: top level - resolve - resolved-dns-query.h (source / functions) Hit Total Coverage
Test: systemd_full.info Lines: 0 1 0.0 %
Date: 2019-08-23 13:36:53 Functions: 0 1 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 2 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: LGPL-2.1+ */
       2                 :            : #pragma once
       3                 :            : 
       4                 :            : #include "sd-bus.h"
       5                 :            : 
       6                 :            : #include "set.h"
       7                 :            : 
       8                 :            : typedef struct DnsQueryCandidate DnsQueryCandidate;
       9                 :            : typedef struct DnsQuery DnsQuery;
      10                 :            : 
      11                 :            : #include "resolved-dns-answer.h"
      12                 :            : #include "resolved-dns-question.h"
      13                 :            : #include "resolved-dns-stream.h"
      14                 :            : #include "resolved-dns-search-domain.h"
      15                 :            : 
      16                 :            : struct DnsQueryCandidate {
      17                 :            :         DnsQuery *query;
      18                 :            :         DnsScope *scope;
      19                 :            : 
      20                 :            :         DnsSearchDomain *search_domain;
      21                 :            : 
      22                 :            :         int error_code;
      23                 :            :         Set *transactions;
      24                 :            : 
      25                 :            :         LIST_FIELDS(DnsQueryCandidate, candidates_by_query);
      26                 :            :         LIST_FIELDS(DnsQueryCandidate, candidates_by_scope);
      27                 :            : };
      28                 :            : 
      29                 :            : struct DnsQuery {
      30                 :            :         Manager *manager;
      31                 :            : 
      32                 :            :         /* When resolving a service, we first create a TXT+SRV query,
      33                 :            :          * and then for the hostnames we discover auxiliary A+AAAA
      34                 :            :          * queries. This pointer always points from the auxiliary
      35                 :            :          * queries back to the TXT+SRV query. */
      36                 :            :         DnsQuery *auxiliary_for;
      37                 :            :         LIST_HEAD(DnsQuery, auxiliary_queries);
      38                 :            :         unsigned n_auxiliary_queries;
      39                 :            :         int auxiliary_result;
      40                 :            : 
      41                 :            :         /* The question, formatted in IDNA for use on classic DNS, and as UTF8 for use in LLMNR or mDNS. Note that even
      42                 :            :          * on classic DNS some labels might use UTF8 encoding. Specifically, DNS-SD service names (in contrast to their
      43                 :            :          * domain suffixes) use UTF-8 encoding even on DNS. Thus, the difference between these two fields is mostly
      44                 :            :          * relevant only for explicit *hostname* lookups as well as the domain suffixes of service lookups. */
      45                 :            :         DnsQuestion *question_idna;
      46                 :            :         DnsQuestion *question_utf8;
      47                 :            : 
      48                 :            :         uint64_t flags;
      49                 :            :         int ifindex;
      50                 :            : 
      51                 :            :         /* If true, A or AAAA RR lookups will be suppressed on links with no routable address of the matching address
      52                 :            :          * family */
      53                 :            :         bool suppress_unroutable_family;
      54                 :            : 
      55                 :            :         /* If true, the RR TTLs of the answer will be clamped by their current left validity in the cache */
      56                 :            :         bool clamp_ttl;
      57                 :            : 
      58                 :            :         DnsTransactionState state;
      59                 :            :         unsigned n_cname_redirects;
      60                 :            : 
      61                 :            :         LIST_HEAD(DnsQueryCandidate, candidates);
      62                 :            :         sd_event_source *timeout_event_source;
      63                 :            : 
      64                 :            :         /* Discovered data */
      65                 :            :         DnsAnswer *answer;
      66                 :            :         int answer_rcode;
      67                 :            :         DnssecResult answer_dnssec_result;
      68                 :            :         bool answer_authenticated;
      69                 :            :         DnsProtocol answer_protocol;
      70                 :            :         int answer_family;
      71                 :            :         DnsSearchDomain *answer_search_domain;
      72                 :            :         int answer_errno; /* if state is DNS_TRANSACTION_ERRNO */
      73                 :            :         bool previous_redirect_unauthenticated;
      74                 :            : 
      75                 :            :         /* Bus client information */
      76                 :            :         sd_bus_message *request;
      77                 :            :         int request_family;
      78                 :            :         bool request_address_valid;
      79                 :            :         union in_addr_union request_address;
      80                 :            :         unsigned block_all_complete;
      81                 :            :         char *request_address_string;
      82                 :            : 
      83                 :            :         /* DNS stub information */
      84                 :            :         DnsPacket *request_dns_packet;
      85                 :            :         DnsStream *request_dns_stream;
      86                 :            :         DnsPacket *reply_dns_packet;
      87                 :            : 
      88                 :            :         /* Completion callback */
      89                 :            :         void (*complete)(DnsQuery* q);
      90                 :            :         unsigned block_ready;
      91                 :            : 
      92                 :            :         sd_bus_track *bus_track;
      93                 :            : 
      94                 :            :         LIST_FIELDS(DnsQuery, queries);
      95                 :            :         LIST_FIELDS(DnsQuery, auxiliary_queries);
      96                 :            : };
      97                 :            : 
      98                 :            : enum {
      99                 :            :         DNS_QUERY_MATCH,
     100                 :            :         DNS_QUERY_NOMATCH,
     101                 :            :         DNS_QUERY_RESTARTED,
     102                 :            : };
     103                 :            : 
     104                 :            : DnsQueryCandidate* dns_query_candidate_free(DnsQueryCandidate *c);
     105                 :            : void dns_query_candidate_notify(DnsQueryCandidate *c);
     106                 :            : 
     107                 :            : int dns_query_new(Manager *m, DnsQuery **q, DnsQuestion *question_utf8, DnsQuestion *question_idna, int family, uint64_t flags);
     108                 :            : DnsQuery *dns_query_free(DnsQuery *q);
     109                 :            : 
     110                 :            : int dns_query_make_auxiliary(DnsQuery *q, DnsQuery *auxiliary_for);
     111                 :            : 
     112                 :            : int dns_query_go(DnsQuery *q);
     113                 :            : void dns_query_ready(DnsQuery *q);
     114                 :            : 
     115                 :            : int dns_query_process_cname(DnsQuery *q);
     116                 :            : 
     117                 :            : int dns_query_bus_track(DnsQuery *q, sd_bus_message *m);
     118                 :            : 
     119                 :            : DnsQuestion* dns_query_question_for_protocol(DnsQuery *q, DnsProtocol protocol);
     120                 :            : 
     121                 :            : const char *dns_query_string(DnsQuery *q);
     122                 :            : 
     123         [ #  # ]:          0 : DEFINE_TRIVIAL_CLEANUP_FUNC(DnsQuery*, dns_query_free);
     124                 :            : 
     125                 :            : bool dns_query_fully_authenticated(DnsQuery *q);

Generated by: LCOV version 1.14