X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=adns.git;a=blobdiff_plain;f=src%2Fadns.h;h=400ba9f466b68a26bc303475be1c1d738cf6392d;hp=6a9e1b385afbba5f87098a0485d55f23ca5c1b07;hb=eec1d9c837c2b0f0c64d74a3dbf25732c7c475f2;hpb=ea1e31e326a99219a0a6edf28a75845b79b74893 diff --git a/src/adns.h b/src/adns.h index 6a9e1b3..400ba9f 100644 --- a/src/adns.h +++ b/src/adns.h @@ -1,11 +1,9 @@ /* - * Copyright (C)1998 Ian Jackson. - * This version provided for review and comment only. - * - * $Id$ + * adns.h + * - adns user-visible API (single-threaded, without any locking) */ /* - * This file is part of adns, which is Copyright (C) 1997, 1998 Ian Jackson + * This file is part of adns, which is Copyright (C) 1997-1999 Ian Jackson * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,7 +17,9 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ */ #ifndef ADNS_H_INCLUDED @@ -30,6 +30,8 @@ #include #include +/* All struct in_addr anywhere in adns are in NETWORK byte order. */ + typedef struct adns__state *adns_state; typedef struct adns__query *adns_query; @@ -40,11 +42,13 @@ typedef enum { adns_if_debug= 0x0008, /* enable all output to stderr plus debug msgs */ adns_if_noautosys= 0x0010, /* do not make syscalls at every opportunity */ adns_if_eintr= 0x0020, /* allow _wait and _synchronous to return EINTR */ + adns_if_nosigpipe= 0x0040, /* applic has SIGPIPE set to SIG_IGN, do not protect */ } adns_initflags; typedef enum { adns_qf_search= 0x000001, /* use the searchlist */ adns_qf_usevc= 0x000002, /* use a virtual circuit (TCP connection) */ + adns_qf_owner= 0x000004, /* fill in the owner field in the answer */ adns_qf_quoteok_query= 0x000010, /* allow quote-requiring chars in query domain */ adns_qf_quoteok_cname= 0x000020, /* allow ... in CNAME we go via */ adns_qf_quoteok_anshost= 0x000040, /* allow ... in answers expected to be hostnames */ @@ -87,7 +91,7 @@ typedef enum { } adns_rrtype; -/* In queries without qtf_anyquote, all domains must have standard +/* In queries without qtf_quoteok_*, all domains must have standard * legal syntax. In queries _with_ qtf_anyquote, domains in the query * or response may contain any characters, quoted according to * RFC1035 5.1. On input to adns, the char* is a pointer to the @@ -133,8 +137,6 @@ typedef enum { adns_s_max_misconfig= 199, - /* fixme: implement _s_cname */ - /* permanent problems with the query */ adns_s_querydomainwrong, adns_s_querydomaininvalid, @@ -194,7 +196,9 @@ typedef struct { typedef struct { adns_status status; char *cname; /* always NULL if query was for CNAME records */ + char *owner; /* only set if requested in query flags */ adns_rrtype type; /* guaranteed to be same as in query */ + time_t expires; /* expiry time, defined only if _s_ok, nxdomain or nodata. NOT TTL! */ int nrrs, rrsz; union { void *untyped; @@ -235,8 +239,11 @@ typedef struct { * If no (appropriate) requests are outstanding adns_query and adns_wait return ESRCH; */ -/* fixme: separate parsing from instantiation */ -int adns_init(adns_state *newstate_r, adns_initflags flags, FILE *diagfile/*0=>stderr*/); +int adns_init(adns_state *newstate_r, adns_initflags flags, + FILE *diagfile /*0=>stderr*/); + +int adns_init_strcfg(adns_state *newstate_r, adns_initflags flags, + FILE *diagfile /*0=>discard*/, const char *configtext); int adns_synchronous(adns_state ads, const char *owner,