resolved-dns-scope.h revision dc477e7385e8ab29efb8fadb72ec994077a105c6
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen#pragma once
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen/***
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen This file is part of systemd.
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen Copyright 2014 Lennart Poettering
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen systemd is free software; you can redistribute it and/or modify it
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen under the terms of the GNU Lesser General Public License as published by
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen the Free Software Foundation; either version 2.1 of the License, or
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen (at your option) any later version.
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen systemd is distributed in the hope that it will be useful, but
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen WITHOUT ANY WARRANTY; without even the implied warranty of
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen Lesser General Public License for more details.
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen You should have received a copy of the GNU Lesser General Public License
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen along with systemd; If not, see <http://www.gnu.org/licenses/>.
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen***/
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
0a6f50c0afdfc434b492493bd9efab20cbee8623Thomas Hindoe Paaboel Andersen#include "list.h"
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersentypedef struct DnsScope DnsScope;
1c4baffc1895809bae9ac36b670af90a4cb9cd7dTom Gundersen
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen#include "resolved-dns-cache.h"
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering#include "resolved-dns-packet.h"
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poettering#include "resolved-dns-server.h"
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering#include "resolved-dns-zone.h"
a5a807e63a50314e190e9166d8a453cd8dd258e3Zbigniew Jędrzejewski-Szmek#include "resolved-link.h"
822db23cfa98a9fbc48f41e11caafb6f1017e052Lennart Poettering
3df3e884ae1237ef0d4d23b0e80f4ffda95ac135Ronny Chevaliertypedef enum DnsScopeMatch {
958b66ea16deddd794b3a52643bd44633e165eadLennart Poettering DNS_SCOPE_NO,
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering DNS_SCOPE_MAYBE,
4ad7f2761da661853dcc29d542efb4727abb1101Nick Owens DNS_SCOPE_YES,
39d8db043b599a7382f94bfc904d5e108af438bdLennart Poettering _DNS_SCOPE_MATCH_MAX,
39d8db043b599a7382f94bfc904d5e108af438bdLennart Poettering _DNS_SCOPE_INVALID = -1
39d8db043b599a7382f94bfc904d5e108af438bdLennart Poettering} DnsScopeMatch;
5f402ae84bbc08fe8de5682e371b3f66c387da52Daniel Mack
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringstruct DnsScope {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Manager *manager;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
1c4baffc1895809bae9ac36b670af90a4cb9cd7dTom Gundersen DnsProtocol protocol;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering int family;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Link *link;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering DnsCache cache;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering DnsZone zone;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering OrderedHashmap *conflict_queue;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering sd_event_source *conflict_event_source;
1c4baffc1895809bae9ac36b670af90a4cb9cd7dTom Gundersen
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering RateLimit ratelimit;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering usec_t resend_timeout;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering usec_t max_rtt;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Hashmap *transactions;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering LIST_HEAD(DnsQueryCandidate, query_candidates);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering LIST_FIELDS(DnsScope, scopes);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering};
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poetteringint dns_scope_new(Manager *m, DnsScope **ret, Link *l, DnsProtocol p, int family);
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart PoetteringDnsScope* dns_scope_free(DnsScope *s);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poetteringvoid dns_scope_packet_received(DnsScope *s, usec_t rtt);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringvoid dns_scope_packet_lost(DnsScope *s, usec_t usec);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint dns_scope_emit(DnsScope *s, int fd, DnsPacket *p);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint dns_scope_tcp_socket(DnsScope *s, int family, const union in_addr_union *address, uint16_t port, DnsServer **server);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint dns_scope_udp_dns_socket(DnsScope *s, DnsServer **server);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart PoetteringDnsScopeMatch dns_scope_good_domain(DnsScope *s, int ifindex, uint64_t flags, const char *domain);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint dns_scope_good_key(DnsScope *s, DnsResourceKey *key);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
21d73c87b09ec2b8642424bc714ce9af3da4fc40Lennart PoetteringDnsServer *dns_scope_get_dns_server(DnsScope *s);
21d73c87b09ec2b8642424bc714ce9af3da4fc40Lennart Poetteringvoid dns_scope_next_dns_server(DnsScope *s);
21d73c87b09ec2b8642424bc714ce9af3da4fc40Lennart Poettering
21d73c87b09ec2b8642424bc714ce9af3da4fc40Lennart Poetteringint dns_scope_llmnr_membership(DnsScope *s, bool b);
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poettering
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poetteringvoid dns_scope_process_query(DnsScope *s, DnsStream *stream, DnsPacket *p);
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart PoetteringDnsTransaction *dns_scope_find_transaction(DnsScope *scope, DnsResourceKey *key, bool cache_ok);
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint dns_scope_notify_conflict(DnsScope *scope, DnsResourceRecord *rr);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringvoid dns_scope_check_conflicts(DnsScope *scope, DnsPacket *p);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poetteringvoid dns_scope_dump(DnsScope *s, FILE *f);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart PoetteringDnsSearchDomain *dns_scope_get_search_domains(DnsScope *s);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringbool dns_scope_has_search_domains(DnsScope *s);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringbool dns_scope_name_needs_search_domain(DnsScope *s, const char *name);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering