1 /* Find public key in DNS
2 * Copyright (C) 2000-2002 D. Hugh Redelmeier.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * RCSID $Id: dnskey.h,v 1.18 2002/03/15 21:32:21 dhr Exp $
18 adns_qfd, /* file descriptor for sending queries to adns */
19 adns_afd; /* file descriptor for receiving answers from adns */
20 extern const char *pluto_adns_option; /* path from --pluto_adns */
21 extern void init_adns(void);
22 extern void stop_adns(void);
23 extern void handle_adns_answer(void);
25 /* (common prefix of) stuff remembered between async query and answer.
26 * Filled in by start_adns_query.
27 * Freed by call to release_adns_continuation.
30 typedef void (*cont_fn_t)(struct adns_continuation *cr, err_t ugh);
32 struct adns_continuation {
33 cont_fn_t cont_fn; /* function to carry on suspended work */
34 struct adns_query query;
35 struct id id; /* subject of query */
37 struct id sgw_id; /* peer, if constrained */
40 extern err_t start_adns_query(const struct id *id /* domain to query */
41 , const struct id *sgw_id /* if non-null, any accepted gw_info must match */
42 , int type /* T_TXT or T_KEY, selecting rr type of interest */
43 , cont_fn_t cont_fn /* continuation function */
44 , struct adns_continuation *cr);
46 extern void release_adns_continuation(struct adns_continuation *cr);
49 extern struct pubkeyrec *keys_from_dns; /* ephemeral! */
51 /* Gateway info gleaned from reverse DNS of client */
53 unsigned refcnt; /* reference counted! */
54 unsigned pref; /* preference: lower is better */
55 enum dns_auth_level dns_auth_level;
59 #define NO_TIME ((time_t) -2) /* time_t value meaning "not_yet" */
60 struct id client_id; /* id of client of peer */
61 struct id gw_id; /* id of peer (if id_is_ipaddr, .ip_addr is address) */
63 struct RSA_public_key gw_key;
67 extern struct gw_info *gateways_from_dns; /* ephemeral! */
69 extern void gw_addref(struct gw_info *gw)
70 , gw_delref(struct gw_info **gwp);