Lines Matching defs:qid

77 	dns_qid_t			*qid;
96 * Locked by qid->lock if qid exists; otherwise, can be used without
239 dns_qid_t *qid;
261 (disp)->qid : (disp)->mgr->qid
267 * locking until qid is created. Technically, there is a possibility of race
268 * between the creation of qid and access to the port buffer; in practice,
269 * however, this should be safe because qid isn't created until the first
272 #define PORTBUFLOCK(mgr) if ((mgr)->qid != NULL) LOCK(&((mgr)->qid->lock))
273 #define PORTBUFUNLOCK(mgr) if ((mgr)->qid != NULL) UNLOCK((&(mgr)->qid->lock))
420 dns_hash(dns_qid_t *qid, isc_sockaddr_t *dest, dns_messageid_t id,
427 ret %= qid->qid_nbuckets;
429 INSIST(ret < qid->qid_nbuckets);
435 * Find the first entry in 'qid'. Returns NULL if there are no entries.
438 linear_first(dns_qid_t *qid) {
444 while (bucket < qid->qid_nbuckets) {
445 ret = ISC_LIST_HEAD(qid->qid_table[bucket]);
455 * Find the next entry after 'resp' in 'qid'. Return NULL if there are
459 linear_next(dns_qid_t *qid, dns_dispentry_t *resp) {
469 while (bucket < qid->qid_nbuckets) {
470 ret = ISC_LIST_HEAD(qid->qid_table[bucket]);
575 dns_qid_t *qid;
586 qid = DNS_QID(disp);
587 LOCK(&qid->lock);
590 UNLOCK(&qid->lock);
596 * The caller must not hold the qid->lock.
601 dns_qid_t *qid;
606 qid = DNS_QID(disp);
607 LOCK(&qid->lock);
623 UNLOCK(&qid->lock);
628 * Return NULL if no such entry exists. Requires qid->lock to be held.
631 socket_search(dns_qid_t *qid, isc_sockaddr_t *dest, in_port_t port,
636 REQUIRE(VALID_QID(qid));
637 REQUIRE(bucket < qid->qid_nbuckets);
639 dispsock = ISC_LIST_HEAD(qid->sock_table[bucket]);
674 dns_qid_t *qid;
715 qid = DNS_QID(disp);
721 LOCK(&qid->lock);
722 bucket = dns_hash(qid, dest, 0, port);
723 if (socket_search(qid, dest, port, bucket) != NULL) {
724 UNLOCK(&qid->lock);
727 UNLOCK(&qid->lock);
743 LOCK(&qid->lock);
745 UNLOCK(&qid->lock);
763 LOCK(&qid->lock);
764 ISC_LIST_APPEND(qid->sock_table[bucket], dispsock, blink);
765 UNLOCK(&qid->lock);
788 dns_qid_t *qid;
805 qid = DNS_QID(disp);
806 LOCK(&qid->lock);
807 ISC_LIST_UNLINK(qid->sock_table[dispsock->bucket], dispsock,
809 UNLOCK(&qid->lock);
825 dns_qid_t *qid;
844 qid = DNS_QID(disp);
845 LOCK(&qid->lock);
846 ISC_LIST_UNLINK(qid->sock_table[dispsock->bucket], dispsock,
848 UNLOCK(&qid->lock);
870 entry_search(dns_qid_t *qid, isc_sockaddr_t *dest, dns_messageid_t id,
875 REQUIRE(VALID_QID(qid));
876 REQUIRE(bucket < qid->qid_nbuckets);
878 res = ISC_LIST_HEAD(qid->qid_table[bucket]);
1044 dns_qid_t *qid;
1053 qid = mgr->qid;
1185 bucket = dns_hash(qid, &ev->address, id, disp->localport);
1186 LOCK(&qid->lock);
1188 resp = entry_search(qid, &ev->address, id, disp->localport,
1287 UNLOCK(&qid->lock);
1334 dns_qid_t *qid;
1342 qid = disp->qid;
1441 bucket = dns_hash(qid, &tcpmsg->address, id, disp->localport);
1442 LOCK(&qid->lock);
1443 resp = entry_search(qid, &tcpmsg->address, id, disp->localport, bucket);
1478 UNLOCK(&qid->lock);
1654 if (mgr->qid != NULL)
1655 qid_destroy(mctx, &mgr->qid);
1846 mgr->qid = NULL;
2088 result = qid_allocate(mgr, buckets, increment, &mgr->qid, ISC_TRUE);
2283 dns_qid_t *qid;
2292 qid = isc_mem_get(mgr->mctx, sizeof(*qid));
2293 if (qid == NULL)
2296 qid->qid_table = isc_mem_get(mgr->mctx,
2298 if (qid->qid_table == NULL) {
2299 isc_mem_put(mgr->mctx, qid, sizeof(*qid));
2303 qid->sock_table = NULL;
2305 qid->sock_table = isc_mem_get(mgr->mctx, buckets *
2307 if (qid->sock_table == NULL) {
2308 isc_mem_put(mgr->mctx, qid->qid_table,
2310 isc_mem_put(mgr->mctx, qid, sizeof(*qid));
2315 result = isc_mutex_init(&qid->lock);
2317 if (qid->sock_table != NULL) {
2318 isc_mem_put(mgr->mctx, qid->sock_table,
2321 isc_mem_put(mgr->mctx, qid->qid_table,
2323 isc_mem_put(mgr->mctx, qid, sizeof(*qid));
2328 ISC_LIST_INIT(qid->qid_table[i]);
2329 if (qid->sock_table != NULL)
2330 ISC_LIST_INIT(qid->sock_table[i]);
2333 qid->qid_nbuckets = buckets;
2334 qid->qid_increment = increment;
2335 qid->magic = QID_MAGIC;
2336 *qidp = qid;
2342 dns_qid_t *qid;
2345 qid = *qidp;
2347 REQUIRE(VALID_QID(qid));
2350 qid->magic = 0;
2351 isc_mem_put(mctx, qid->qid_table,
2352 qid->qid_nbuckets * sizeof(dns_displist_t));
2353 if (qid->sock_table != NULL) {
2354 isc_mem_put(mctx, qid->sock_table,
2355 qid->qid_nbuckets * sizeof(dispsocketlist_t));
2357 DESTROYLOCK(&qid->lock);
2358 isc_mem_put(mctx, qid, sizeof(*qid));
2400 disp->qid = NULL;
2469 if (disp->qid != NULL)
2470 qid_destroy(mgr->mctx, &disp->qid);
2543 result = qid_allocate(mgr, buckets, increment, &disp->qid, ISC_FALSE);
3195 dns_qid_t *qid;
3258 qid = DNS_QID(disp);
3279 LOCK(&qid->lock);
3287 bucket = dns_hash(qid, dest, id, localport);
3288 if (entry_search(qid, dest, id, localport, bucket) == NULL) {
3294 id += qid->qid_increment;
3297 UNLOCK(&qid->lock);
3331 LOCK(&qid->lock);
3332 ISC_LIST_APPEND(qid->qid_table[bucket], res, link);
3333 UNLOCK(&qid->lock);
3335 inc_stats(disp->mgr, (qid == disp->mgr->qid) ?
3346 LOCK(&qid->lock);
3347 ISC_LIST_UNLINK(qid->qid_table[bucket], res, link);
3348 UNLOCK(&qid->lock);
3356 dec_stats(disp->mgr, (qid == disp->mgr->qid) ?
3463 dns_qid_t *qid;
3476 qid = DNS_QID(disp);
3490 dec_stats(disp->mgr, (qid == disp->mgr->qid) ?
3510 LOCK(&qid->lock);
3511 ISC_LIST_UNLINK(qid->qid_table[bucket], res, link);
3512 UNLOCK(&qid->lock);
3574 dns_qid_t *qid;
3579 qid = DNS_QID(disp);
3585 LOCK(&qid->lock);
3586 for (resp = linear_first(qid);
3589 resp = linear_next(qid, resp);
3613 UNLOCK(&qid->lock);