]> git.ipfire.org Git - thirdparty/strongswan.git/blob - programs/pluto/adns.h
- import of strongswan-2.7.0
[thirdparty/strongswan.git] / programs / pluto / adns.h
1 /* Pluto Asynchronous DNS Helper Program's Header
2 * Copyright (C) 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: adns.h,v 1.1 2004/03/15 20:35:28 as Exp $
15 */
16
17 #ifndef USE_LWRES /* whole file! */
18
19 /* The interface in RHL6.x and BIND distribution 8.2.2 are different,
20 * so we build some of our own :-(
21 */
22
23 # ifndef NS_MAXDNAME
24 # define NS_MAXDNAME MAXDNAME /* I hope this is long enough for IPv6 */
25 # endif
26
27 # ifndef NS_PACKETSZ
28 # define NS_PACKETSZ PACKETSZ
29 # endif
30
31 /* protocol version */
32
33 #define ADNS_Q_MAGIC (((((('d' << 8) + 'n') << 8) + 's') << 8) + 4)
34 #define ADNS_A_MAGIC (((((('d' << 8) + 'n') << 8) + 's') << 8) + 128 + 4)
35
36 /* note: both struct adns_query and struct adns_answer must start with
37 * size_t len;
38 */
39
40 struct adns_query {
41 size_t len;
42 unsigned int qmagic;
43 unsigned long serial;
44 lset_t debugging; /* only used #ifdef DEBUG, but don't want layout to change */
45 u_char name_buf[NS_MAXDNAME + 2];
46 int type; /* T_KEY or T_TXT */
47 };
48
49 struct adns_answer {
50 size_t len;
51 unsigned int amagic;
52 unsigned long serial;
53 struct adns_continuation *continuation;
54 int result;
55 int h_errno_val;
56 u_char ans[NS_PACKETSZ * 10]; /* very probably bigger than necessary */
57 };
58
59 enum helper_exit_status {
60 HES_CONTINUE = -1, /* not an exit */
61 HES_OK = 0, /* all's well that ends well (perhaps EOF) */
62 HES_INVOCATION, /* improper invocation */
63 HES_IO_ERROR_SELECT, /* IO error in select() */
64 HES_MALLOC, /* malloc failed */
65 HES_IO_ERROR_IN, /* error reading pipe */
66 HES_IO_ERROR_OUT, /* error reading pipe */
67 HES_PIPE, /* pipe(2) failed */
68 HES_SYNC, /* answer from worker doesn't match query */
69 HES_FORK, /* fork(2) failed */
70 HES_RES_INIT, /* resolver initialization failed */
71 HES_BAD_LEN, /* implausible .len field */
72 HES_BAD_MAGIC, /* .magic field wrong */
73 };
74
75 #endif /* !USE_LWRES */