2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

callback structure changes

This commit is contained in:
Bob Halley
1999-07-30 23:33:15 +00:00
parent 7d44d8aacd
commit a01f52a731
4 changed files with 19 additions and 19 deletions

View File

@@ -38,22 +38,21 @@
#define BUFLEN 255 #define BUFLEN 255
#define BIGBUFLEN (64 * 1024) #define BIGBUFLEN (64 * 1024)
static dns_result_t t1_commit_callback(dns_rdatacallbacks_t *callbacks, static dns_result_t t1_add_callback(void *arg, dns_name_t *owner,
dns_name_t *owner, dns_rdataset_t *dataset); dns_rdataset_t *dataset);
static void t1(void); static void t1(void);
isc_mem_t *T1_mctx; isc_mem_t *T1_mctx;
char *Tokens[T_MAXTOKS + 1]; char *Tokens[T_MAXTOKS + 1];
static dns_result_t static dns_result_t
t1_commit_callback(dns_rdatacallbacks_t *callbacks, dns_name_t *owner, t1_add_callback(void *arg, dns_name_t *owner, dns_rdataset_t *dataset) {
dns_rdataset_t *dataset) {
char buf[BIGBUFLEN]; char buf[BIGBUFLEN];
isc_buffer_t target; isc_buffer_t target;
dns_result_t result; dns_result_t result;
callbacks = callbacks; /*unused*/ arg = arg; /*unused*/
isc_buffer_init(&target, buf, BIGBUFLEN, ISC_BUFFERTYPE_TEXT); isc_buffer_init(&target, buf, BIGBUFLEN, ISC_BUFFERTYPE_TEXT);
result = dns_rdataset_totext(dataset, owner, ISC_FALSE, ISC_FALSE, result = dns_rdataset_totext(dataset, owner, ISC_FALSE, ISC_FALSE,
@@ -106,7 +105,7 @@ test_master(char *testfile, char *origin, char *class, dns_result_t exp_result)
} }
dns_rdatacallbacks_init(&callbacks); dns_rdatacallbacks_init(&callbacks);
callbacks.commit = t1_commit_callback; callbacks.add = t1_add_callback;
textregion.base = class; textregion.base = class;
textregion.length = strlen(class); textregion.length = strlen(class);

View File

@@ -30,19 +30,18 @@
#include <dns/result.h> #include <dns/result.h>
#include <dns/types.h> #include <dns/types.h>
dns_result_t print_dataset(dns_rdatacallbacks_t *callbacks, dns_result_t print_dataset(void *arg, dns_name_t *owner,
dns_name_t *owner, dns_rdataset_t *dataset); dns_rdataset_t *dataset);
isc_mem_t *mctx; isc_mem_t *mctx;
dns_result_t dns_result_t
print_dataset(dns_rdatacallbacks_t *callbacks, dns_name_t *owner, print_dataset(void *arg, dns_name_t *owner, dns_rdataset_t *dataset) {
dns_rdataset_t *dataset) {
char buf[64*1024]; char buf[64*1024];
isc_buffer_t target; isc_buffer_t target;
dns_result_t result; dns_result_t result;
callbacks = callbacks; /*unused*/ arg = arg; /*unused*/
isc_buffer_init(&target, buf, 64*1024, ISC_BUFFERTYPE_TEXT); isc_buffer_init(&target, buf, 64*1024, ISC_BUFFERTYPE_TEXT);
result = dns_rdataset_totext(dataset, owner, ISC_FALSE, ISC_FALSE, result = dns_rdataset_totext(dataset, owner, ISC_FALSE, ISC_FALSE,
@@ -88,9 +87,10 @@ main(int argc, char *argv[]) {
} }
dns_rdatacallbacks_init(&callbacks); dns_rdatacallbacks_init(&callbacks);
callbacks.commit = print_dataset; callbacks.add = print_dataset;
result = dns_master_load(argv[1], &origin, &origin, 1, ISC_FALSE, result = dns_master_load(argv[1], &origin, &origin, 1,
ISC_FALSE,
&soacount, &nscount, &soacount, &nscount,
&callbacks, mctx); &callbacks, mctx);
fprintf(stdout, "dns_master_load: %s\n", fprintf(stdout, "dns_master_load: %s\n",

View File

@@ -15,7 +15,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
/* $Id: callbacks.c,v 1.2 1999/03/06 04:08:29 halley Exp $ */ /* $Id: callbacks.c,v 1.3 1999/07/30 23:32:51 halley Exp $ */
#include <config.h> #include <config.h>
@@ -35,10 +35,10 @@ dns_rdatacallbacks_init(dns_rdatacallbacks_t *callbacks) {
REQUIRE(callbacks != NULL); REQUIRE(callbacks != NULL);
callbacks->commit = NULL; callbacks->add = NULL;
callbacks->error = default_error_warn_callback; callbacks->error = default_error_warn_callback;
callbacks->warn = default_error_warn_callback; callbacks->warn = default_error_warn_callback;
callbacks->commit_private = NULL; callbacks->add_private = NULL;
callbacks->error_private = NULL; callbacks->error_private = NULL;
callbacks->warn_private = NULL; callbacks->warn_private = NULL;
} }

View File

@@ -15,7 +15,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
/* $Id: master.c,v 1.20 1999/06/24 17:55:38 halley Exp $ */ /* $Id: master.c,v 1.21 1999/07/30 23:32:51 halley Exp $ */
#include <config.h> #include <config.h>
@@ -195,7 +195,7 @@ dns_master_load(char *master_file, dns_name_t *top, dns_name_t *origin,
REQUIRE(dns_name_isabsolute(top)); REQUIRE(dns_name_isabsolute(top));
REQUIRE(dns_name_isabsolute(origin)); REQUIRE(dns_name_isabsolute(origin));
REQUIRE(callbacks != NULL); REQUIRE(callbacks != NULL);
REQUIRE(callbacks->commit != NULL); REQUIRE(callbacks->add != NULL);
REQUIRE(callbacks->error != NULL); REQUIRE(callbacks->error != NULL);
REQUIRE(callbacks->warn != NULL); REQUIRE(callbacks->warn != NULL);
REQUIRE(nscount != NULL); REQUIRE(nscount != NULL);
@@ -934,7 +934,8 @@ commit(dns_rdatacallbacks_t *callbacks, rdatalist_head_t *head,
while ((this = ISC_LIST_HEAD(*head)) != NULL) { while ((this = ISC_LIST_HEAD(*head)) != NULL) {
dns_rdataset_init(&dataset); dns_rdataset_init(&dataset);
dns_rdatalist_tordataset(this, &dataset); dns_rdatalist_tordataset(this, &dataset);
result = ((*callbacks->commit)(callbacks, owner, &dataset)); result = ((*callbacks->add)(callbacks->add_private, owner,
&dataset));
if (result != DNS_R_SUCCESS) if (result != DNS_R_SUCCESS)
return (result); return (result);
ISC_LIST_UNLINK(*head, this, link); ISC_LIST_UNLINK(*head, this, link);