1 /* $NetBSD: dlz_dbi.h,v 1.1.1.3 2014/12/10 03:34:31 christos Exp $ */
4 * Copyright (C) 2002 Stichting NLnet, Netherlands, stichting@nlnet.nl.
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the
8 * above copyright notice and this permission notice appear in all
11 * THE SOFTWARE IS PROVIDED "AS IS" AND STICHTING NLNET
12 * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
13 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
14 * STICHTING NLNET BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
15 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
16 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
17 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
18 * USE OR PERFORMANCE OF THIS SOFTWARE.
20 * The development of Dynamically Loadable Zones (DLZ) for Bind 9 was
21 * conceived and contributed by Rob Butler.
23 * Permission to use, copy, modify, and distribute this software for any
24 * purpose with or without fee is hereby granted, provided that the
25 * above copyright notice and this permission notice appear in all
28 * THE SOFTWARE IS PROVIDED "AS IS" AND ROB BUTLER
29 * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
31 * ROB BUTLER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
32 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
33 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
34 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
35 * USE OR PERFORMANCE OF THIS SOFTWARE.
38 #include <dlz_minimal.h>
40 #include <dlz_pthread.h>
48 #define REQUIRE_CLIENT 0x01
49 #define REQUIRE_QUERY 0x02
50 #define REQUIRE_RECORD 0x04
51 #define REQUIRE_ZONE 0x08
53 typedef struct query_segment query_segment_t
;
54 typedef DLZ_LIST(query_segment_t
) query_list_t
;
55 typedef struct dbinstance dbinstance_t
;
56 typedef DLZ_LIST(dbinstance_t
) db_list_t
;
57 typedef struct driverinstance driverinstance_t
;
60 * a query segment is all the text between our special tokens
61 * special tokens are %zone%, %record%, %client%
63 struct query_segment
{
67 DLZ_LINK(query_segment_t
) link
;
71 * a database instance contains everything we need for running
72 * a query against the database. Using it each separate thread
73 * can dynamically construct a query and execute it against the
74 * database. The "instance_lock" and locking code in the driver's
75 * make sure no two threads try to use the same DBI at a time.
79 query_list_t
*allnodes_q
;
80 query_list_t
*allowxfr_q
;
81 query_list_t
*authority_q
;
82 query_list_t
*findzone_q
;
83 query_list_t
*lookup_q
;
84 query_list_t
*countzone_q
;
90 DLZ_LINK(dbinstance_t
) link
;
98 destroy_querylist(query_list_t
**querylist
);
101 build_querylist(const char *query_str
, char **zone
, char **record
,
102 char **client
, query_list_t
**querylist
, unsigned int flags
,
106 build_querystring(query_list_t
*querylist
);
109 build_dbinstance(const char *allnodes_str
, const char *allowxfr_str
,
110 const char *authority_str
, const char *findzone_str
,
111 const char *lookup_str
, const char *countzone_str
,
112 dbinstance_t
**dbi
, log_t log
);
115 destroy_dbinstance(dbinstance_t
*dbi
);
118 get_parameter_value(const char *input
, const char* key
);
120 #endif /* DLZ_DBI_H */