3 * - useful general-purpose resolver client program, header file
7 * Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk>
9 * It is part of adns, which is
10 * Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk>
11 * Copyright (C) 1999 Tony Finch <dot@dotat.at>
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2, or (at your option)
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software Foundation,
25 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 #ifndef ADNSHOST_H_INCLUDED
29 #define ADNSHOST_H_INCLUDED
40 #include <sys/types.h>
41 #include <sys/socket.h>
42 #include <netinet/in.h>
43 #include <arpa/inet.h>
49 #ifdef ADNS_REGRESS_TEST
50 # include "hredirect.h"
53 /* declarations related to option processing */
56 typedef void optfunc(const struct optioninfo *oi, const char *arg, const char *arg2);
61 ot_flag, ot_value, ot_func, ot_funcarg, ot_funcarg2
64 const char *sopt, *lopt;
67 const char *argdesc, *argdesc2;
70 enum ttlmode { tm_none, tm_rel, tm_abs };
71 enum outputformat { fmt_default, fmt_simple, fmt_inline, fmt_asynch };
73 struct perqueryflags_remember {
74 int show_owner, show_type, show_cname;
78 extern int ov_env, ov_pipe, ov_asynch;
79 extern int ov_verbose;
80 extern adns_rrtype ov_type;
81 extern int ov_search, ov_qc_query, ov_qc_anshost, ov_qc_cname;
82 extern int ov_tcp, ov_cname, ov_format;
84 extern struct perqueryflags_remember ov_pqfr;
86 extern optfunc of_config, of_help, of_type, of_ptr, of_reverse;
87 extern optfunc of_asynch_id, of_cancel_id;
89 const struct optioninfo *opt_findl(const char *opt);
90 const struct optioninfo *opt_finds(const char **optp);
91 void opt_do(const struct optioninfo *oip, int invert, const char *arg, const char *arg2);
93 /* declarations related to query processing */
96 struct query_node *next, *back;
97 struct perqueryflags_remember pqfr;
102 extern adns_state ads;
103 extern struct outstanding_list { struct query_node *head, *tail; } outstanding;
105 void ensure_adns_init(void);
106 void query_do(const char *domain);
107 void query_done(struct query_node *qun, adns_answer *answer);
109 /* declarations related to main program and useful utility functions */
111 void sysfail(const char *what, int errnoval) NONRETURNING;
112 void usageerr(const char *what, ...) NONRETURNPRINTFFORMAT(1,2);
113 void outerr(void) NONRETURNING;
115 void *xmalloc(size_t sz);
116 char *xstrsave(const char *str);
118 void quitnow(int rc) NONRETURNING;
121 extern const char *config_text; /* 0 => use defaults */