]>
Commit | Line | Data |
---|---|---|
8cf45447 AC |
1 | /* authd/dns.h - header for authd DNS functions |
2 | * Copyright (c) 2016 William Pitcock <nenolod@dereferenced.org> | |
3 | * | |
4 | * Permission to use, copy, modify, and/or distribute this software for any | |
5 | * purpose with or without fee is hereby granted, provided that the above | |
6 | * copyright notice and this permission notice is present in all copies. | |
7 | * | |
8 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
9 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
10 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
11 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | |
12 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
13 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
14 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
15 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
16 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | |
17 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
18 | * POSSIBILITY OF SUCH DAMAGE. | |
19 | */ | |
20 | ||
21 | #ifndef _AUTHD_DNS_H | |
22 | #define _AUTHD_DNS_H | |
23 | ||
24 | #define DNS_REQ_IDLEN 10 | |
25 | ||
b3265d7a | 26 | #include "stdinc.h" |
8cf45447 AC |
27 | #include "res.h" |
28 | #include "reslib.h" | |
29 | ||
399c6333 EM |
30 | typedef enum |
31 | { | |
32 | QUERY_INVALID = 0, | |
33 | QUERY_A = '4', | |
34 | QUERY_AAAA = '6', | |
35 | QUERY_PTR_A = 'R', | |
36 | QUERY_PTR_AAAA = 'S', | |
37 | } query_type; | |
38 | ||
39 | /* Similar to that in ircd */ | |
40 | typedef void (*DNSCB)(const char *res, bool status, query_type type, void *data); | |
41 | ||
42 | struct dns_query | |
8cf45447 AC |
43 | { |
44 | struct DNSQuery query; | |
399c6333 | 45 | query_type type; |
8cf45447 | 46 | struct rb_sockaddr_storage addr; |
399c6333 EM |
47 | uint64_t id; |
48 | ||
49 | DNSCB callback; | |
50 | void *data; | |
8cf45447 AC |
51 | }; |
52 | ||
2b0cc3d3 | 53 | extern struct dns_query *lookup_hostname(const char *ip, DNSCB callback, void *data); |
399c6333 | 54 | extern struct dns_query *lookup_ip(const char *host, int aftype, DNSCB callback, void *data); |
540676fc | 55 | extern void cancel_query(struct dns_query *query); |
399c6333 | 56 | |
60374ac9 | 57 | extern void handle_resolve_dns(int parc, char *parv[]); |
394b8dde | 58 | extern void enumerate_nameservers(const char *rid, const char letter); |
6445c1cf | 59 | extern void reload_nameservers(const char letter); |
8cf45447 AC |
60 | |
61 | #endif |