Lines Matching refs:tkey

182 remove_fromring(dns_tsigkey_t *tkey) {
183 if (tkey->generated) {
184 ISC_LIST_UNLINK(tkey->ring->lru, tkey, link);
185 tkey->ring->generated--;
187 (void)dns_rbt_deletename(tkey->ring->keys, &tkey->name, false);
191 adjust_lru(dns_tsigkey_t *tkey) {
192 if (tkey->generated) {
193 RWLOCK(&tkey->ring->lock, isc_rwlocktype_write);
198 if (ISC_LINK_LINKED(tkey, link) && tkey->ring->lru.tail != tkey)
200 ISC_LIST_UNLINK(tkey->ring->lru, tkey, link);
201 ISC_LIST_APPEND(tkey->ring->lru, tkey, link);
203 RWUNLOCK(&tkey->ring->lock, isc_rwlocktype_write);
216 dns_tsigkey_t *tkey) {
231 result = dns_rbt_addname(ring->keys, name, tkey);
232 if (result == ISC_R_SUCCESS && tkey->generated) {
237 ISC_LIST_APPEND(ring->lru, tkey, link);
253 dns_tsigkey_t *tkey;
264 tkey = isc_mem_get(mctx, sizeof(dns_tsigkey_t));
266 dns_name_init(&tkey->name, NULL);
267 dns_name_dup(name, mctx, &tkey->name);
268 (void)dns_name_downcase(&tkey->name, &tkey->name, NULL);
277 tkey->algorithm = dns__tsig_algnamefromname(algorithm);
292 tkey->algorithm = tmpname;
296 tkey->creator = isc_mem_get(mctx, sizeof(dns_name_t));
297 dns_name_init(tkey->creator, NULL);
298 dns_name_dup(creator, mctx, tkey->creator);
300 tkey->creator = NULL;
303 tkey->key = NULL;
305 dst_key_attach(dstkey, &tkey->key);
307 tkey->ring = ring;
316 isc_refcount_init(&tkey->refs, refs);
318 tkey->generated = generated;
319 tkey->inception = inception;
320 tkey->expire = expire;
321 tkey->mctx = NULL;
322 isc_mem_attach(mctx, &tkey->mctx);
323 ISC_LINK_INIT(tkey, link);
325 tkey->magic = TSIG_MAGIC;
328 ret = keyring_add(ring, name, tkey);
349 *key = tkey;
355 tkey->magic = 0;
357 isc_refcount_decrement0(&tkey->refs);
359 isc_refcount_destroy(&tkey->refs);
361 if (tkey->key != NULL) {
362 dst_key_free(&tkey->key);
364 if (tkey->creator != NULL) {
365 dns_name_free(tkey->creator, mctx);
366 isc_mem_put(mctx, tkey->creator, sizeof(dns_name_t));
368 if (dns__tsig_algallocated(tkey->algorithm)) {
370 DE_CONST(tkey->algorithm, tmpname);
377 dns_name_free(&tkey->name, mctx);
378 isc_mem_put(mctx, tkey, sizeof(dns_tsigkey_t));
395 dns_tsigkey_t *tkey;
415 tkey = node->data;
416 if (tkey != NULL) {
417 if (tkey->generated &&
418 isc_refcount_current(&tkey->refs) == 1 &&
419 tkey->inception != tkey->expire &&
420 tkey->expire < now)
422 tsig_log(tkey, 2, "tsig expire: deleting");
425 remove_fromring(tkey);
573 dump_key(dns_tsigkey_t *tkey, FILE *fp) {
581 REQUIRE(tkey != NULL);
584 dns_name_format(&tkey->name, namestr, sizeof(namestr));
585 dns_name_format(tkey->creator, creatorstr, sizeof(creatorstr));
586 dns_name_format(tkey->algorithm, algorithmstr, sizeof(algorithmstr));
587 result = dst_key_dump(tkey->key, tkey->mctx, &buffer, &length);
590 tkey->inception, tkey->expire, algorithmstr, length,
594 isc_mem_put(tkey->mctx, buffer, length);
607 dns_tsigkey_t *tkey;
632 tkey = node->data;
633 if (tkey != NULL && tkey->generated && tkey->expire >= now) {
634 dump_key(tkey, fp);
791 if (msg->tkey != 1) {
1852 dns_tsigkey_t *tkey) {
1855 result = keyring_add(ring, name, tkey);
1857 isc_refcount_increment(&tkey->refs);