Lines Matching defs:ntatable
38 dns_ntatable_t *ntatable;
104 dns_ntatable_t *ntatable;
109 ntatable = isc_mem_get(view->mctx, sizeof(*ntatable));
110 if (ntatable == NULL)
113 ntatable->task = NULL;
114 result = isc_task_create(taskmgr, 0, &ntatable->task);
117 isc_task_setname(ntatable->task, "ntatable", ntatable);
119 ntatable->table = NULL;
121 &ntatable->table);
125 result = isc_rwlock_init(&ntatable->rwlock, 0, 0);
129 ntatable->timermgr = timermgr;
130 ntatable->taskmgr = taskmgr;
132 ntatable->view = view;
133 ntatable->references = 1;
135 ntatable->magic = NTATABLE_MAGIC;
136 *ntatablep = ntatable;
141 dns_rbt_destroy(&ntatable->table);
144 isc_task_detach(&ntatable->task);
147 isc_mem_put(ntatable->view->mctx, ntatable, sizeof(*ntatable));
171 dns_ntatable_t *ntatable;
175 ntatable = *ntatablep;
178 RWLOCK(&ntatable->rwlock, isc_rwlocktype_write);
179 INSIST(ntatable->references > 0);
180 ntatable->references--;
181 if (ntatable->references == 0)
183 RWUNLOCK(&ntatable->rwlock, isc_rwlocktype_write);
186 dns_rbt_destroy(&ntatable->table);
187 isc_rwlock_destroy(&ntatable->rwlock);
188 if (ntatable->task != NULL)
189 isc_task_detach(&ntatable->task);
190 ntatable->timermgr = NULL;
191 ntatable->taskmgr = NULL;
192 ntatable->magic = 0;
193 isc_mem_put(ntatable->view->mctx, ntatable, sizeof(*ntatable));
202 dns_ntatable_t *ntatable = nta->ntatable;
203 dns_view_t *view = ntatable->view;
250 dns_ntatable_t *ntatable = nta->ntatable;
251 dns_view_t *view = ntatable->view;
279 settimer(dns_ntatable_t *ntatable, dns_nta_t *nta, isc_uint32_t lifetime) {
284 REQUIRE(VALID_NTATABLE(ntatable));
287 if (ntatable->timermgr == NULL)
290 view = ntatable->view;
295 result = isc_timer_create(ntatable->timermgr, isc_timertype_ticker,
296 NULL, &interval, ntatable->task,
302 nta_create(dns_ntatable_t *ntatable, dns_name_t *name, dns_nta_t **target) {
307 REQUIRE(VALID_NTATABLE(ntatable));
310 view = ntatable->view;
316 nta->ntatable = ntatable;
340 dns_ntatable_add(dns_ntatable_t *ntatable, dns_name_t *name,
349 REQUIRE(VALID_NTATABLE(ntatable));
351 view = ntatable->view;
353 result = nta_create(ntatable, name, &nta);
360 RWLOCK(&ntatable->rwlock, isc_rwlocktype_write);
363 result = dns_rbt_addnode(ntatable->table, name, &node);
366 (void)settimer(ntatable, nta, lifetime);
373 (void)settimer(ntatable, nta, lifetime);
383 RWUNLOCK(&ntatable->rwlock, isc_rwlocktype_write);
395 deletenode(dns_ntatable_t *ntatable, const dns_name_t *name) {
399 REQUIRE(VALID_NTATABLE(ntatable));
402 result = dns_rbt_findnode(ntatable->table, name, NULL, &node, NULL,
406 result = dns_rbt_deletenode(ntatable->table,
417 dns_ntatable_delete(dns_ntatable_t *ntatable, dns_name_t *name) {
420 RWLOCK(&ntatable->rwlock, isc_rwlocktype_write);
421 result = deletenode(ntatable, name);
422 RWUNLOCK(&ntatable->rwlock, isc_rwlocktype_write);
428 dns_ntatable_covered(dns_ntatable_t *ntatable, isc_stdtime_t now,
439 REQUIRE(ntatable == NULL || VALID_NTATABLE(ntatable));
442 if (ntatable == NULL)
449 RWLOCK(&ntatable->rwlock, locktype);
452 result = dns_rbt_findnode(ntatable->table, name, foundname, &node, NULL,
468 RWUNLOCK(&ntatable->rwlock, locktype);
485 result = deletenode(ntatable, foundname);
494 RWUNLOCK(&ntatable->rwlock, locktype);
512 dns_ntatable_totext(dns_ntatable_t *ntatable, isc_buffer_t **buf) {
519 REQUIRE(VALID_NTATABLE(ntatable));
523 RWLOCK(&ntatable->rwlock, isc_rwlocktype_read);
524 dns_rbtnodechain_init(&chain, ntatable->view->mctx);
525 result = dns_rbtnodechain_first(&chain, ntatable->table, NULL, NULL);
570 RWUNLOCK(&ntatable->rwlock, isc_rwlocktype_read);
576 dns_ntatable_dump(dns_ntatable_t *ntatable, FILE *fp) {
582 REQUIRE(VALID_NTATABLE(ntatable));
586 RWLOCK(&ntatable->rwlock, isc_rwlocktype_read);
587 dns_rbtnodechain_init(&chain, ntatable->view->mctx);
588 result = dns_rbtnodechain_first(&chain, ntatable->table, NULL, NULL);
620 RWUNLOCK(&ntatable->rwlock, isc_rwlocktype_read);
626 dns_ntatable_dump(dns_ntatable_t *ntatable, FILE *fp) {
631 result = isc_buffer_allocate(ntatable->view->mctx, &text, len);
635 result = dns_ntatable_totext(ntatable, &text);
653 dns_ntatable_save(dns_ntatable_t *ntatable, FILE *fp) {
660 REQUIRE(VALID_NTATABLE(ntatable));
664 RWLOCK(&ntatable->rwlock, isc_rwlocktype_read);
665 dns_rbtnodechain_init(&chain, ntatable->view->mctx);
666 result = dns_rbtnodechain_first(&chain, ntatable->table, NULL, NULL);
715 RWUNLOCK(&ntatable->rwlock, isc_rwlocktype_read);