OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / freeswan / pluto / dnskey.h
1 /* Find public key in DNS
2  * Copyright (C) 2000-2002  D. Hugh Redelmeier.
3  *
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>.
8  *
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
12  * for more details.
13  *
14  * RCSID $Id: dnskey.h,v 1.18 2002/03/15 21:32:21 dhr Exp $
15  */
16
17 extern int
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);
24
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.
28  */
29
30 typedef void (*cont_fn_t)(struct adns_continuation *cr, err_t ugh);
31
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 */
36     bool sgw_specified;
37     struct id sgw_id;   /* peer, if constrained */
38 };
39
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);
45
46 extern void release_adns_continuation(struct adns_continuation *cr);
47
48
49 extern struct pubkeyrec *keys_from_dns; /* ephemeral! */
50
51 /* Gateway info gleaned from reverse DNS of client */
52 struct gw_info {
53     unsigned refcnt;    /* reference counted! */
54     unsigned pref;      /* preference: lower is better */
55     enum dns_auth_level dns_auth_level;
56     time_t created_time
57         , last_tried_time
58         , last_worked_time;
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) */
62     bool gw_key_present;
63     struct RSA_public_key gw_key;
64     struct gw_info *next;
65 };
66
67 extern struct gw_info *gateways_from_dns;       /* ephemeral! */
68
69 extern void gw_addref(struct gw_info *gw)
70     , gw_delref(struct gw_info **gwp);