Lines Matching defs:state

89 add_name(struct dlz_example_data *state, struct record *list,
112 if (state->log != NULL)
113 state->log(ISC_LOG_ERROR,
141 del_name(struct dlz_example_data *state, struct record *list,
147 UNUSED(state);
205 b9_add_helper(struct dlz_example_data *state,
209 state->log = (log_t *)ptr;
211 state->putrr = (dns_sdlz_putrr_t *)ptr;
213 state->putnamedrr = (dns_sdlz_putnamedrr_t *)ptr;
215 state->writeable_zone = (dns_dlz_writeablezone_t *)ptr;
225 struct dlz_example_data *state;
235 state = calloc(1, sizeof(struct dlz_example_data));
236 if (state == NULL)
242 b9_add_helper(state, helper_name, va_arg(ap, void *));
247 if (state->log != NULL)
248 state->log(ISC_LOG_ERROR,
250 dlz_destroy(state);
255 state->zone_name = malloc(strlen(argv[1]) + 2);
256 if (state->zone_name == NULL) {
257 free(state);
261 strcpy(state->zone_name, argv[1]);
263 sprintf(state->zone_name, "%s.", argv[1]);
265 if (strcmp(state->zone_name, ".") == 0)
271 state->zone_name, extra, state->zone_name);
278 add_name(state, &state->current[0], state->zone_name,
280 add_name(state, &state->current[0], state->zone_name,
281 "ns", 3600, state->zone_name);
282 add_name(state, &state->current[0], state->zone_name,
285 if (state->log != NULL)
286 state->log(ISC_LOG_INFO, "dlz_example: started for zone %s",
287 state->zone_name);
289 *dbdata = state;
293 free(state);
303 struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
305 if (state->log != NULL)
306 state->log(ISC_LOG_INFO,
308 state->zone_name);
309 free(state->zone_name);
310 free(state);
321 struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
335 state->log(ISC_LOG_INFO,
338 state->log(ISC_LOG_INFO,
340 "in zone DB '%s'", name, state->zone_name);
360 if (strcasecmp(state->zone_name, name) == 0)
364 if (strcasecmp(state->zone_name, absolute) == 0)
386 struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
396 if (state->putrr == NULL)
400 strncpy(full_name, state->zone_name, 255);
403 snprintf(full_name, 255, "%s.%s", name, state->zone_name);
424 state->log(ISC_LOG_INFO,
441 state->log(ISC_LOG_INFO,
445 result = state->putrr(lookup, "TXT", 0, buf);
455 result = state->putrr(lookup, "TXT", 0, buf);
461 if (strcasecmp(state->current[i].name, full_name) == 0) {
463 result = state->putrr(lookup, state->current[i].type,
464 state->current[i].ttl,
465 state->current[i].data);
494 struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
499 if (state->putnamedrr == NULL)
504 if (strlen(state->current[i].name) == 0U) {
507 result = state->putnamedrr(allnodes, state->current[i].name,
508 state->current[i].type,
509 state->current[i].ttl,
510 state->current[i].data);
524 struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
526 if (state->transaction_started) {
527 if (state->log != NULL)
528 state->log(ISC_LOG_INFO,
534 state->transaction_started = ISC_TRUE;
535 *versionp = (void *) &state->transaction_started;
547 struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
549 if (!state->transaction_started) {
550 if (state->log != NULL)
551 state->log(ISC_LOG_INFO, "dlz_example: transaction not "
557 state->transaction_started = ISC_FALSE;
563 if (state->log != NULL)
564 state->log(ISC_LOG_INFO, "dlz_example: committing "
567 if (strlen(state->deletes[i].name) > 0U) {
568 (void)del_name(state, &state->current[0],
569 state->deletes[i].name,
570 state->deletes[i].type,
571 state->deletes[i].ttl,
572 state->deletes[i].data);
576 if (strlen(state->adds[i].name) > 0U) {
577 (void)add_name(state, &state->current[0],
578 state->adds[i].name,
579 state->adds[i].type,
580 state->adds[i].ttl,
581 state->adds[i].data);
585 if (state->log != NULL)
586 state->log(ISC_LOG_INFO, "dlz_example: cancelling "
589 memset(state->adds, 0, sizeof(state->adds));
590 memset(state->deletes, 0, sizeof(state->deletes));
599 struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
602 if (state->log != NULL)
603 state->log(ISC_LOG_INFO, "dlz_example: starting configure");
605 if (state->writeable_zone == NULL) {
606 if (state->log != NULL)
607 state->log(ISC_LOG_INFO, "dlz_example: no "
612 result = state->writeable_zone(view, dlzdb, state->zone_name);
614 if (state->log != NULL)
615 state->log(ISC_LOG_ERROR, "dlz_example: failed to "
616 "configure zone %s", state->zone_name);
620 if (state->log != NULL)
621 state->log(ISC_LOG_INFO, "dlz_example: configured writeable "
622 "zone %s", state->zone_name);
634 struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
643 if (state->log != NULL)
644 state->log(ISC_LOG_INFO, "dlz_example: denying update "
648 if (state->log != NULL)
649 state->log(ISC_LOG_INFO, "dlz_example: allowing update of "
656 modrdataset(struct dlz_example_data *state, const char *name,
703 result = add_name(state, list, name, type,
718 struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
720 if (version != (void *) &state->transaction_started)
723 if (state->log != NULL)
724 state->log(ISC_LOG_INFO, "dlz_example: adding rdataset %s '%s'",
727 return (modrdataset(state, name, rdatastr, &state->adds[0]));
734 struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
736 if (version != (void *) &state->transaction_started)
739 if (state->log != NULL)
740 state->log(ISC_LOG_INFO, "dlz_example: subtracting rdataset "
743 return (modrdataset(state, name, rdatastr, &state->deletes[0]));
750 struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
752 if (version != (void *) &state->transaction_started)
755 if (state->log != NULL)
756 state->log(ISC_LOG_INFO, "dlz_example: deleting rdataset %s "