Lines Matching defs:qid

97 	dns_qid_t			*qid;
112 * Locked by qid->lock if qid exists; otherwise, can be used without
250 dns_qid_t *qid;
272 (disp)->qid : (disp)->mgr->qid
278 * locking until qid is created. Technically, there is a possibility of race
279 * between the creation of qid and access to the port buffer; in practice,
280 * however, this should be safe because qid isn't created until the first
283 #define PORTBUFLOCK(mgr) if ((mgr)->qid != NULL) LOCK(&((mgr)->qid->lock))
284 #define PORTBUFUNLOCK(mgr) if ((mgr)->qid != NULL) UNLOCK((&(mgr)->qid->lock))
583 dns_hash(dns_qid_t *qid, isc_sockaddr_t *dest, dns_messageid_t id,
590 ret %= qid->qid_nbuckets;
592 INSIST(ret < qid->qid_nbuckets);
598 * Find the first entry in 'qid'. Returns NULL if there are no entries.
601 linear_first(dns_qid_t *qid) {
607 while (bucket < qid->qid_nbuckets) {
608 ret = ISC_LIST_HEAD(qid->qid_table[bucket]);
618 * Find the next entry after 'resp' in 'qid'. Return NULL if there are
622 linear_next(dns_qid_t *qid, dns_dispentry_t *resp) {
632 while (bucket < qid->qid_nbuckets) {
633 ret = ISC_LIST_HEAD(qid->qid_table[bucket]);
750 * The caller must not hold the qid->lock.
755 dns_qid_t *qid;
760 qid = DNS_QID(disp);
761 LOCK(&qid->lock);
771 UNLOCK(&qid->lock);
779 socket_search(dns_qid_t *qid, isc_sockaddr_t *dest, in_port_t port,
784 REQUIRE(bucket < qid->qid_nbuckets);
786 dispsock = ISC_LIST_HEAD(qid->sock_table[bucket]);
801 * The caller must hold the disp->lock and qid->lock.
805 isc_socketmgr_t *sockmgr, dns_qid_t *qid,
866 bucket = dns_hash(qid, dest, 0, port);
867 if (socket_search(qid, dest, port, bucket) != NULL)
899 ISC_LIST_APPEND(qid->sock_table[bucket], dispsock, blink);
922 dns_qid_t *qid;
939 qid = DNS_QID(disp);
940 LOCK(&qid->lock);
941 ISC_LIST_UNLINK(qid->sock_table[dispsock->bucket], dispsock,
943 UNLOCK(&qid->lock);
959 dns_qid_t *qid;
978 qid = DNS_QID(disp);
979 LOCK(&qid->lock);
980 ISC_LIST_UNLINK(qid->sock_table[dispsock->bucket], dispsock,
982 UNLOCK(&qid->lock);
1004 entry_search(dns_qid_t *qid, isc_sockaddr_t *dest, dns_messageid_t id,
1009 REQUIRE(bucket < qid->qid_nbuckets);
1011 res = ISC_LIST_HEAD(qid->qid_table[bucket]);
1135 dns_qid_t *qid;
1144 qid = mgr->qid;
1276 bucket = dns_hash(qid, &ev->address, id, disp->localport);
1277 LOCK(&qid->lock);
1279 resp = entry_search(qid, &ev->address, id, disp->localport,
1377 UNLOCK(&qid->lock);
1425 dns_qid_t *qid;
1433 qid = disp->qid;
1532 bucket = dns_hash(qid, &tcpmsg->address, id, disp->localport);
1533 LOCK(&qid->lock);
1534 resp = entry_search(qid, &tcpmsg->address, id, disp->localport, bucket);
1569 UNLOCK(&qid->lock);
1721 if (mgr->qid != NULL)
1722 qid_destroy(mctx, &mgr->qid);
1879 mgr->qid = NULL;
2102 result = qid_allocate(mgr, buckets, increment, &mgr->qid, ISC_TRUE);
2298 dns_qid_t *qid;
2307 qid = isc_mem_get(mgr->mctx, sizeof(*qid));
2308 if (qid == NULL)
2311 qid->qid_table = isc_mem_get(mgr->mctx,
2313 if (qid->qid_table == NULL) {
2314 isc_mem_put(mgr->mctx, qid, sizeof(*qid));
2318 qid->sock_table = NULL;
2320 qid->sock_table = isc_mem_get(mgr->mctx, buckets *
2322 if (qid->sock_table == NULL) {
2323 isc_mem_put(mgr->mctx, qid->qid_table,
2325 isc_mem_put(mgr->mctx, qid, sizeof(*qid));
2330 result = isc_mutex_init(&qid->lock);
2332 if (qid->sock_table != NULL) {
2333 isc_mem_put(mgr->mctx, qid->sock_table,
2336 isc_mem_put(mgr->mctx, qid->qid_table,
2338 isc_mem_put(mgr->mctx, qid, sizeof(*qid));
2343 ISC_LIST_INIT(qid->qid_table[i]);
2344 if (qid->sock_table != NULL)
2345 ISC_LIST_INIT(qid->sock_table[i]);
2348 qid->qid_nbuckets = buckets;
2349 qid->qid_increment = increment;
2350 qid->magic = QID_MAGIC;
2351 *qidp = qid;
2357 dns_qid_t *qid;
2360 qid = *qidp;
2362 REQUIRE(VALID_QID(qid));
2365 qid->magic = 0;
2366 isc_mem_put(mctx, qid->qid_table,
2367 qid->qid_nbuckets * sizeof(dns_displist_t));
2368 if (qid->sock_table != NULL) {
2369 isc_mem_put(mctx, qid->sock_table,
2370 qid->qid_nbuckets * sizeof(dispsocketlist_t));
2372 DESTROYLOCK(&qid->lock);
2373 isc_mem_put(mctx, qid, sizeof(*qid));
2414 disp->qid = NULL;
2480 if (disp->qid != NULL)
2481 qid_destroy(mgr->mctx, &disp->qid);
2533 result = qid_allocate(mgr, buckets, increment, &disp->qid, ISC_FALSE);
2968 dns_qid_t *qid;
3031 qid = DNS_QID(disp);
3032 LOCK(&qid->lock);
3038 result = get_dispsocket(disp, dest, sockmgr, qid, &dispsocket,
3041 UNLOCK(&qid->lock);
3054 bucket = dns_hash(qid, dest, id, localport);
3057 if (entry_search(qid, dest, id, localport, bucket) == NULL) {
3061 id += qid->qid_increment;
3063 bucket = dns_hash(qid, dest, id, localport);
3067 UNLOCK(&qid->lock);
3074 UNLOCK(&qid->lock);
3099 ISC_LIST_APPEND(qid->qid_table[bucket], res, link);
3100 UNLOCK(&qid->lock);
3109 LOCK(&qid->lock);
3110 ISC_LIST_UNLINK(qid->qid_table[bucket], res, link);
3111 UNLOCK(&qid->lock);
3178 dns_qid_t *qid;
3191 qid = DNS_QID(disp);
3222 LOCK(&qid->lock);
3223 ISC_LIST_UNLINK(qid->qid_table[bucket], res, link);
3224 UNLOCK(&qid->lock);
3286 dns_qid_t *qid;
3291 qid = DNS_QID(disp);
3297 LOCK(&qid->lock);
3298 for (resp = linear_first(qid);
3301 resp = linear_next(qid, resp);
3325 UNLOCK(&qid->lock);