Lines Matching defs:ring
135 cleanup_ring(dns_tsig_keyring_t *ring);
178 ISC_LIST_UNLINK(tkey->ring->lru, tkey, link);
179 tkey->ring->generated--;
181 (void)dns_rbt_deletename(tkey->ring->keys, &tkey->name, ISC_FALSE);
187 RWLOCK(&tkey->ring->lock, isc_rwlocktype_write);
193 tkey->ring->lru.tail != tkey)
195 ISC_LIST_UNLINK(tkey->ring->lru, tkey, link);
196 ISC_LIST_APPEND(tkey->ring->lru, tkey, link);
198 RWUNLOCK(&tkey->ring->lock, isc_rwlocktype_write);
203 * A supplemental routine just to add a key to ring. Note that reference
210 keyring_add(dns_tsig_keyring_t *ring, dns_name_t *name,
215 RWLOCK(&ring->lock, isc_rwlocktype_write);
216 ring->writecount++;
222 if (ring->writecount > 10) {
223 cleanup_ring(ring);
224 ring->writecount = 0;
227 result = dns_rbt_addname(ring->keys, name, tkey);
233 ISC_LIST_APPEND(ring->lru, tkey, link);
234 if (ring->generated++ > ring->maxgenerated)
235 remove_fromring(ISC_LIST_HEAD(ring->lru));
237 RWUNLOCK(&ring->lock, isc_rwlocktype_write);
247 dns_tsig_keyring_t *ring, dns_tsigkey_t **key)
257 REQUIRE(key != NULL || ring != NULL);
360 tkey->ring = ring;
364 if (ring != NULL)
379 if (ring != NULL) {
380 ret = keyring_add(ring, name, tkey);
434 cleanup_ring(dns_tsig_keyring_t *ring)
454 dns_rbtnodechain_init(&chain, ring->mctx);
455 result = dns_rbtnodechain_first(&chain, ring->keys, &foundname,
488 destroyring(dns_tsig_keyring_t *ring) {
489 dns_rbt_destroy(&ring->keys);
490 isc_rwlock_destroy(&ring->lock);
491 isc_mem_putanddetach(&ring->mctx, ring, sizeof(dns_tsig_keyring_t));
520 restore_key(dns_tsig_keyring_t *ring, isc_stdtime_t now, FILE *fp) {
574 ring->mctx, keystr, &dstkey);
580 expire, ring->mctx, ring, NULL);
620 dns_tsig_keyring_t *ring;
625 ring = *ringp;
628 RWLOCK(&ring->lock, isc_rwlocktype_write);
629 INSIST(ring->references > 0);
630 ring->references--;
631 references = ring->references;
632 RWUNLOCK(&ring->lock, isc_rwlocktype_write);
641 dns_rbtnodechain_init(&chain, ring->mctx);
642 result = dns_rbtnodechain_first(&chain, ring->keys, &foundname,
666 destroyring(ring);
675 dns_tsig_keyring_t *ring, dns_tsigkey_t **key)
776 inception, expire, mctx, ring, key);
831 REQUIRE(key->ring != NULL);
833 RWLOCK(&key->ring->lock, isc_rwlocktype_write);
835 RWUNLOCK(&key->ring->lock, isc_rwlocktype_write);
1847 dns_name_t *algorithm, dns_tsig_keyring_t *ring)
1856 REQUIRE(ring != NULL);
1858 RWLOCK(&ring->lock, isc_rwlocktype_write);
1859 cleanup_ring(ring);
1860 RWUNLOCK(&ring->lock, isc_rwlocktype_write);
1863 RWLOCK(&ring->lock, isc_rwlocktype_read);
1865 result = dns_rbt_findname(ring->keys, name, 0, NULL, (void *)&key);
1867 RWUNLOCK(&ring->lock, isc_rwlocktype_read);
1871 RWUNLOCK(&ring->lock, isc_rwlocktype_read);
1878 RWUNLOCK(&ring->lock, isc_rwlocktype_read);
1879 RWLOCK(&ring->lock, isc_rwlocktype_write);
1881 RWUNLOCK(&ring->lock, isc_rwlocktype_write);
1890 RWUNLOCK(&ring->lock, isc_rwlocktype_read);
1896 RWUNLOCK(&ring->lock, isc_rwlocktype_read);
1913 ISC_LIST_UNLINK(key->ring->lru, key, link);
1921 dns_tsig_keyring_t *ring;
1927 ring = isc_mem_get(mctx, sizeof(dns_tsig_keyring_t));
1928 if (ring == NULL)
1931 result = isc_rwlock_init(&ring->lock, 0, 0);
1933 isc_mem_put(mctx, ring, sizeof(dns_tsig_keyring_t));
1937 ring->keys = NULL;
1938 result = dns_rbt_create(mctx, free_tsignode, NULL, &ring->keys);
1940 isc_rwlock_destroy(&ring->lock);
1941 isc_mem_put(mctx, ring, sizeof(dns_tsig_keyring_t));
1945 ring->writecount = 0;
1946 ring->mctx = NULL;
1947 ring->generated = 0;
1948 ring->maxgenerated = DNS_TSIG_MAXGENERATEDKEYS;
1949 ISC_LIST_INIT(ring->lru);
1950 isc_mem_attach(mctx, &ring->mctx);
1951 ring->references = 1;
1953 *ringp = ring;
1958 dns_tsigkeyring_add(dns_tsig_keyring_t *ring, dns_name_t *name,
1963 result = keyring_add(ring, name, tkey);
1986 dns_tsig_keyring_t *ring;
1992 ring = *ringp;
1995 RWLOCK(&ring->lock, isc_rwlocktype_write);
1996 INSIST(ring->references > 0);
1997 ring->references--;
1998 references = ring->references;
1999 RWUNLOCK(&ring->lock, isc_rwlocktype_write);
2002 destroyring(ring);
2006 dns_keyring_restore(dns_tsig_keyring_t *ring, FILE *fp) {
2012 result = restore_key(ring, now, fp);