3 * - useful general-purpose resolver client program, header file
6 * This file is part of adns, which is
7 * Copyright (C) 1997-2000,2003,2006 Ian Jackson
8 * Copyright (C) 1999-2000,2003,2006 Tony Finch
9 * Copyright (C) 1991 Massachusetts Institute of Technology
10 * (See the file INSTALL for full details.)
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2, or (at your option)
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software Foundation,
24 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 #ifndef ADNSHOST_H_INCLUDED
28 #define ADNSHOST_H_INCLUDED
40 #include <sys/types.h>
41 #include <sys/socket.h>
42 #include <netinet/in.h>
43 #include <arpa/inet.h>
45 #define ADNS_FEATURE_MANYAF
51 #ifdef ADNS_REGRESS_TEST
52 # include "hredirect.h"
55 /* declarations related to option processing */
58 typedef void optfunc(const struct optioninfo
*oi
, const char *arg
, const char *arg2
);
63 ot_flag
, ot_value
, ot_func
, ot_funcarg
, ot_funcarg2
66 const char *sopt
, *lopt
;
69 const char *argdesc
, *argdesc2
;
72 enum ttlmode
{ tm_none
, tm_rel
, tm_abs
};
73 enum outputformat
{ fmt_default
, fmt_simple
, fmt_inline
, fmt_asynch
};
75 struct perqueryflags_remember
{
76 int show_owner
, show_type
, show_cname
;
80 extern int ov_env
, ov_pipe
, ov_asynch
;
81 extern int ov_verbose
;
82 extern adns_rrtype ov_type
;
83 extern int ov_search
, ov_qc_query
, ov_qc_anshost
, ov_qc_cname
;
84 extern int ov_tcp
, ov_cname
, ov_afflags
, ov_v6map
, ov_format
;
86 extern struct perqueryflags_remember ov_pqfr
;
88 extern optfunc of_config
, of_version
, of_help
, of_type
, of_ptr
, of_reverse
;
89 extern optfunc of_asynch_id
, of_cancel_id
;
91 const struct optioninfo
*opt_findl(const char *opt
);
92 const struct optioninfo
*opt_finds(const char **optp
);
93 void opt_do(const struct optioninfo
*oip
, int invert
, const char *arg
, const char *arg2
);
95 /* declarations related to query processing */
98 struct query_node
*next
, *back
;
99 struct perqueryflags_remember pqfr
;
104 extern adns_state ads
;
105 extern struct outstanding_list
{ struct query_node
*head
, *tail
; } outstanding
;
107 void ensure_adns_init(void);
108 void query_do(const char *domain
);
109 void query_done(struct query_node
*qun
, adns_answer
*answer
);
111 void type_info(adns_rrtype type
, const char **typename_r
,
112 const void *datap
, char **data_r
);
113 /* wrapper for adns_rr_info which uses a static buffer to provide
114 * *typename_r for adns_r_unknown */
117 /* declarations related to main program and useful utility functions */
119 void sysfail(const char *what
, int errnoval
) NONRETURNING
;
120 void usageerr(const char *what
, ...) NONRETURNPRINTFFORMAT(1,2);
121 void outerr(void) NONRETURNING
;
123 void *xmalloc(size_t sz
);
124 char *xstrsave(const char *str
);
127 extern const char *config_text
; /* 0 => use defaults */