xref: /minix/external/bsd/bind/dist/lib/lwres/context_p.h (revision bb9622b5)
1 /*	$NetBSD: context_p.h,v 1.4 2014/12/10 04:38:02 christos Exp $	*/
2 
3 /*
4  * Copyright (C) 2004, 2005, 2007, 2008  Internet Systems Consortium, Inc. ("ISC")
5  * Copyright (C) 2000, 2001  Internet Software Consortium.
6  *
7  * Permission to use, copy, modify, and/or distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /* Id: context_p.h,v 1.19 2008/12/17 23:47:58 tbox Exp  */
21 
22 #ifndef LWRES_CONTEXT_P_H
23 #define LWRES_CONTEXT_P_H 1
24 
25 /*! \file */
26 
27 /*@{*/
28 /**
29  * Helper functions, assuming the context is always called "ctx" in
30  * the scope these functions are called from.
31  */
32 #define CTXMALLOC(len)		ctx->malloc(ctx->arg, (len))
33 #define CTXFREE(addr, len)	ctx->free(ctx->arg, (addr), (len))
34 /*@}*/
35 
36 #define LWRES_DEFAULT_TIMEOUT	120	/* 120 seconds for a reply */
37 
38 /**
39  * Not all the attributes here are actually settable by the application at
40  * this time.
41  */
42 struct lwres_context {
43 	unsigned int		timeout;	/*%< time to wait for reply */
44 	lwres_uint32_t		serial;		/*%< serial number state */
45 
46 	/*
47 	 * For network I/O.
48 	 */
49 	int			sock;		/*%< socket to send on */
50 	lwres_addr_t		address;	/*%< address to send to */
51 	int			use_ipv4;	/*%< use IPv4 transaction */
52 	int			use_ipv6;	/*%< use IPv6 transaction */
53 
54 	/*@{*/
55 	/*
56 	 * Function pointers for allocating memory.
57 	 */
58 	lwres_malloc_t		malloc;
59 	lwres_free_t		free;
60 	void		       *arg;
61 	/*@}*/
62 
63 	/*%
64 	 * resolv.conf-like data
65 	 */
66 	lwres_conf_t		confdata;
67 };
68 
69 #endif /* LWRES_CONTEXT_P_H */
70