1 /* Pluto Asynchronous DNS Helper Program's Header
2 * Copyright (C) 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: adns.h,v 1.2 2002/03/09 01:26:19 dhr Exp $
17 /* The interface in RHL6.x and BIND distribution 8.2.2 are different,
18 * so we build some of our own :-(
22 # define NS_MAXDNAME MAXDNAME /* I hope this is long enough for IPv6 */
26 # define NS_PACKETSZ PACKETSZ
29 /* protocol version */
31 #define ADNS_Q_MAGIC (((((('d' << 8) + 'n') << 8) + 's') << 8) + 1)
32 #define ADNS_A_MAGIC (((((('d' << 8) + 'n') << 8) + 's') << 8) + 128 + 1)
34 /* note: both struct adns_query and struct adns_answer must start with
41 struct adns_continuation *continuation;
42 u_char name_buf[NS_MAXDNAME + 2];
43 int type; /* T_KEY or T_TXT */
49 struct adns_continuation *continuation;
52 u_char ans[NS_PACKETSZ * 10]; /* very probably bigger than necessary */
55 enum helper_exit_status {
56 HES_CONTINUE = -1, /* not an exit */
57 HES_OK = 0, /* all's well that ends well (perhaps EOF) */
58 HES_INVOCATION, /* improper invocation */
59 HES_IO_ERROR_SELECT, /* IO error in select() */
60 HES_MALLOC, /* malloc failed */
61 HES_IO_ERROR_IN, /* error reading pipe */
62 HES_IO_ERROR_OUT, /* error reading pipe */
63 HES_PIPE, /* pipe(2) failed */
64 HES_SYNC, /* answer from worker doesn't match query */
65 HES_FORK, /* fork(2) failed */
66 HES_RES_INIT, /* resolver initialization failed */
67 HES_BAD_LEN, /* implausible .len field */
68 HES_BAD_MAGIC, /* .magic field wrong */