1 | /*
|
---|
2 | * Copyright (C) 2010 Andrew Tridgell
|
---|
3 | *
|
---|
4 | * Permission to use, copy, modify, and distribute this software for any
|
---|
5 | * purpose with or without fee is hereby granted, provided that the
|
---|
6 | * above copyright notice and this permission notice appear in all
|
---|
7 | * copies.
|
---|
8 | *
|
---|
9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR
|
---|
10 | * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
|
---|
11 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
|
---|
12 | * THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
|
---|
13 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
---|
14 | * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
---|
15 | * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
|
---|
16 | * USE OR PERFORMANCE OF THIS SOFTWARE.
|
---|
17 | */
|
---|
18 |
|
---|
19 | /*
|
---|
20 | This header provides a minimal set of defines and typedefs needed
|
---|
21 | for building an external DLZ module for bind9. When creating a new
|
---|
22 | external DLZ driver, please copy this header into your own source
|
---|
23 | tree.
|
---|
24 | */
|
---|
25 | typedef unsigned int isc_result_t;
|
---|
26 | typedef bool isc_boolean_t;
|
---|
27 | typedef uint32_t dns_ttl_t;
|
---|
28 |
|
---|
29 | #define DLZ_DLOPEN_VERSION 1
|
---|
30 |
|
---|
31 | /* return this in flags to dlz_version() if thread safe */
|
---|
32 | #define DNS_SDLZFLAG_THREADSAFE 0x00000001U
|
---|
33 |
|
---|
34 | /* result codes */
|
---|
35 | #define ISC_R_SUCCESS 0
|
---|
36 | #define ISC_R_NOMEMORY 1
|
---|
37 | #define ISC_R_NOTFOUND 23
|
---|
38 | #define ISC_R_FAILURE 25
|
---|
39 |
|
---|
40 | /* log levels */
|
---|
41 | #define ISC_LOG_INFO (-1)
|
---|
42 | #define ISC_LOG_NOTICE (-2)
|
---|
43 | #define ISC_LOG_WARNING (-3)
|
---|
44 | #define ISC_LOG_ERROR (-4)
|
---|
45 | #define ISC_LOG_CRITICAL (-5)
|
---|
46 |
|
---|
47 | /* some opaque structures */
|
---|
48 | typedef void *dns_sdlzlookup_t;
|
---|
49 | typedef void *dns_sdlzallnodes_t;
|
---|
50 | typedef void *dns_view_t;
|
---|
51 |
|
---|
52 | /*
|
---|
53 | * prototypes for the functions you can include in your driver
|
---|
54 | */
|
---|
55 |
|
---|
56 |
|
---|
57 | /*
|
---|
58 | * dlz_version() is required for all DLZ external drivers. It should
|
---|
59 | * return DLZ_DLOPEN_VERSION
|
---|
60 | */
|
---|
61 | int dlz_version(unsigned int *flags);
|
---|
62 |
|
---|
63 | /*
|
---|
64 | * dlz_create() is required for all DLZ external drivers.
|
---|
65 | */
|
---|
66 | isc_result_t dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata, ...);
|
---|
67 |
|
---|
68 | /*
|
---|
69 | * dlz_destroy() is optional, and will be called when the driver is
|
---|
70 | * unloaded if supplied
|
---|
71 | */
|
---|
72 | void dlz_destroy(void *dbdata);
|
---|
73 |
|
---|
74 | /*
|
---|
75 | dlz_findzonedb is required for all DLZ external drivers
|
---|
76 | */
|
---|
77 | isc_result_t dlz_findzonedb(void *dbdata, const char *name);
|
---|
78 |
|
---|
79 | /*
|
---|
80 | dlz_lookup is required for all DLZ external drivers
|
---|
81 | */
|
---|
82 | isc_result_t dlz_lookup(const char *zone, const char *name,
|
---|
83 | void *dbdata, dns_sdlzlookup_t *lookup);
|
---|
84 |
|
---|
85 | /*
|
---|
86 | dlz_allowzonexfr() is optional, and should be supplied if you want
|
---|
87 | to support zone transfers
|
---|
88 | */
|
---|
89 | isc_result_t dlz_allowzonexfr(void *dbdata, const char *name, const char *client);
|
---|
90 |
|
---|
91 |
|
---|
92 | /*
|
---|
93 | dlz_allnodes() is optional, but must be supplied if supply a
|
---|
94 | dlz_allowzonexfr() function
|
---|
95 | */
|
---|
96 | isc_result_t dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes);
|
---|
97 |
|
---|
98 | /*
|
---|
99 | dlz_newversion() is optional. It should be supplied if you want to
|
---|
100 | support dynamic updates.
|
---|
101 | */
|
---|
102 | isc_result_t dlz_newversion(const char *zone, void *dbdata, void **versionp);
|
---|
103 |
|
---|
104 | /*
|
---|
105 | dlz_closeversion() is optional, but must be supplied if you supply
|
---|
106 | a dlz_newversion() function
|
---|
107 | */
|
---|
108 | void dlz_closeversion(const char *zone, isc_boolean_t commit, void *dbdata, void **versionp);
|
---|
109 |
|
---|
110 | /*
|
---|
111 | dlz_configure() is optional, but must be supplied if you want to
|
---|
112 | support dynamic updates
|
---|
113 | */
|
---|
114 | isc_result_t dlz_configure(dns_view_t *view, void *dbdata);
|
---|
115 |
|
---|
116 | /*
|
---|
117 | dlz_ssumatch() is optional, but must be supplied if you want to
|
---|
118 | support dynamic updates
|
---|
119 | */
|
---|
120 | isc_boolean_t dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
|
---|
121 | const char *type, const char *key, uint32_t keydatalen, uint8_t *keydata,
|
---|
122 | void *dbdata);
|
---|
123 |
|
---|
124 | /*
|
---|
125 | dlz_addrdataset() is optional, but must be supplied if you want to
|
---|
126 | support dynamic updates
|
---|
127 | */
|
---|
128 | isc_result_t dlz_addrdataset(const char *name, const char *rdatastr, void *dbdata, void *version);
|
---|
129 |
|
---|
130 | /*
|
---|
131 | dlz_subrdataset() is optional, but must be supplied if you want to
|
---|
132 | support dynamic updates
|
---|
133 | */
|
---|
134 | isc_result_t dlz_subrdataset(const char *name, const char *rdatastr, void *dbdata, void *version);
|
---|
135 |
|
---|
136 | /*
|
---|
137 | dlz_delrdataset() is optional, but must be supplied if you want to
|
---|
138 | support dynamic updates
|
---|
139 | */
|
---|
140 | isc_result_t dlz_delrdataset(const char *name, const char *type, void *dbdata, void *version);
|
---|