Lines Matching refs:msg

291 	struct dns_msg* msg, time_t now)  in addr_to_additional()  argument
293 if((msg->rep->rrsets[msg->rep->rrset_count] = in addr_to_additional()
295 msg->rep->ar_numrrsets++; in addr_to_additional()
296 msg->rep->rrset_count++; in addr_to_additional()
329 struct dns_msg** msg) in find_add_addrs() argument
342 if(msg) in find_add_addrs()
343 addr_to_additional(akey, region, *msg, now); in find_add_addrs()
362 if(msg) in find_add_addrs()
363 addr_to_additional(akey, region, *msg, now); in find_add_addrs()
441 struct dns_msg* msg, struct delegpt* dp, time_t now) in find_add_ds() argument
446 msg->qinfo.qclass, 0, now, 0); in find_add_ds()
451 dp->namelen, LDNS_RR_TYPE_NSEC, msg->qinfo.qclass, in find_add_ds()
463 if((msg->rep->rrsets[msg->rep->rrset_count] = in find_add_ds()
465 msg->rep->ns_numrrsets++; in find_add_ds()
466 msg->rep->rrset_count++; in find_add_ds()
476 struct dns_msg* msg = (struct dns_msg*)regional_alloc(region, in dns_msg_create() local
478 if(!msg) in dns_msg_create()
480 msg->qinfo.qname = regional_alloc_init(region, qname, qnamelen); in dns_msg_create()
481 if(!msg->qinfo.qname) in dns_msg_create()
483 msg->qinfo.qname_len = qnamelen; in dns_msg_create()
484 msg->qinfo.qtype = qtype; in dns_msg_create()
485 msg->qinfo.qclass = qclass; in dns_msg_create()
486 msg->qinfo.local_alias = NULL; in dns_msg_create()
488 msg->rep = (struct reply_info*)regional_alloc_zero(region, in dns_msg_create()
490 if(!msg->rep) in dns_msg_create()
494 msg->rep->flags = BIT_QR; /* with QR, no AA */ in dns_msg_create()
495 msg->rep->qdcount = 1; in dns_msg_create()
496 msg->rep->reason_bogus = LDNS_EDE_NONE; in dns_msg_create()
497 msg->rep->rrsets = (struct ub_packed_rrset_key**) in dns_msg_create()
500 if(!msg->rep->rrsets) in dns_msg_create()
502 return msg; in dns_msg_create()
506 dns_msg_authadd(struct dns_msg* msg, struct regional* region, in dns_msg_authadd() argument
509 if(!(msg->rep->rrsets[msg->rep->rrset_count++] = in dns_msg_authadd()
512 msg->rep->ns_numrrsets++; in dns_msg_authadd()
517 dns_msg_ansadd(struct dns_msg* msg, struct regional* region, in dns_msg_ansadd() argument
520 if(!(msg->rep->rrsets[msg->rep->rrset_count++] = in dns_msg_ansadd()
523 msg->rep->an_numrrsets++; in dns_msg_ansadd()
530 struct regional* region, struct dns_msg** msg, time_t now, in dns_cache_find_delegation() argument
551 if(msg) { in dns_cache_find_delegation()
557 *msg = dns_msg_create(qname, qnamelen, qtype, qclass, region, in dns_cache_find_delegation()
559 if(!*msg || !dns_msg_authadd(*msg, region, nskey, now)) { in dns_cache_find_delegation()
569 if(msg) in dns_cache_find_delegation()
570 find_add_ds(env, region, *msg, dp, now); in dns_cache_find_delegation()
572 if(!find_add_addrs(env, qclass, region, dp, now, msg)) in dns_cache_find_delegation()
581 struct dns_msg* msg = (struct dns_msg*)regional_alloc(region, in gen_dns_msg() local
583 if(!msg) in gen_dns_msg()
585 memcpy(&msg->qinfo, q, sizeof(struct query_info)); in gen_dns_msg()
586 msg->qinfo.qname = regional_alloc_init(region, q->qname, q->qname_len); in gen_dns_msg()
587 if(!msg->qinfo.qname) in gen_dns_msg()
590 msg->rep = (struct reply_info*)regional_alloc(region, in gen_dns_msg()
592 if(!msg->rep) in gen_dns_msg()
594 msg->rep->reason_bogus = LDNS_EDE_NONE; in gen_dns_msg()
595 msg->rep->reason_bogus_str = NULL; in gen_dns_msg()
598 msg->rep->rrsets = (struct ub_packed_rrset_key**) in gen_dns_msg()
601 if(!msg->rep->rrsets) in gen_dns_msg()
603 return msg; in gen_dns_msg()
611 struct dns_msg* msg; in tomsg() local
639 msg = gen_dns_msg(region, q, r->rrset_count); in tomsg()
640 if(!msg) return NULL; in tomsg()
641 msg->rep->flags = r->flags; in tomsg()
642 msg->rep->qdcount = r->qdcount; in tomsg()
643 msg->rep->ttl = is_expired in tomsg()
647 msg->rep->prefetch_ttl = r->prefetch_ttl - now; in tomsg()
649 msg->rep->prefetch_ttl = PREFETCH_TTL_CALC(msg->rep->ttl); in tomsg()
650 msg->rep->serve_expired_ttl = msg->rep->ttl + SERVE_EXPIRED_TTL; in tomsg()
651 msg->rep->security = r->security; in tomsg()
652 msg->rep->an_numrrsets = r->an_numrrsets; in tomsg()
653 msg->rep->ns_numrrsets = r->ns_numrrsets; in tomsg()
654 msg->rep->ar_numrrsets = r->ar_numrrsets; in tomsg()
655 msg->rep->rrset_count = r->rrset_count; in tomsg()
656 msg->rep->authoritative = r->authoritative; in tomsg()
657 msg->rep->reason_bogus = r->reason_bogus; in tomsg()
659 msg->rep->reason_bogus_str = regional_strdup(region, r->reason_bogus_str); in tomsg()
677 for(i=0; i<msg->rep->rrset_count; i++) { in tomsg()
678 msg->rep->rrsets[i] = packed_rrset_copy_region(r->rrsets[i], in tomsg()
680 if(!msg->rep->rrsets[i]) { in tomsg()
690 return msg; in tomsg()
720 struct dns_msg* msg; in rrset_msg() local
725 msg = gen_dns_msg(region, q, 1); /* only the CNAME (or other) RRset */ in rrset_msg()
726 if(!msg) in rrset_msg()
728 msg->rep->flags = BIT_QR; /* reply, no AA, no error */ in rrset_msg()
729 msg->rep->authoritative = 0; /* reply stored in cache can't be authoritative */ in rrset_msg()
730 msg->rep->qdcount = 1; in rrset_msg()
731 msg->rep->ttl = d->ttl - now; in rrset_msg()
732 msg->rep->prefetch_ttl = PREFETCH_TTL_CALC(msg->rep->ttl); in rrset_msg()
733 msg->rep->serve_expired_ttl = msg->rep->ttl + SERVE_EXPIRED_TTL; in rrset_msg()
734 msg->rep->security = sec_status_unchecked; in rrset_msg()
735 msg->rep->an_numrrsets = 1; in rrset_msg()
736 msg->rep->ns_numrrsets = 0; in rrset_msg()
737 msg->rep->ar_numrrsets = 0; in rrset_msg()
738 msg->rep->rrset_count = 1; in rrset_msg()
739 msg->rep->reason_bogus = LDNS_EDE_NONE; in rrset_msg()
740 msg->rep->rrsets[0] = packed_rrset_copy_region(rrset, region, now); in rrset_msg()
741 if(!msg->rep->rrsets[0]) /* copy CNAME */ in rrset_msg()
743 return msg; in rrset_msg()
751 struct dns_msg* msg; in synth_dname_msg() local
764 msg = gen_dns_msg(region, q, 2); /* DNAME + CNAME RRset */ in synth_dname_msg()
765 if(!msg) in synth_dname_msg()
767 msg->rep->flags = BIT_QR; /* reply, no AA, no error */ in synth_dname_msg()
768 msg->rep->authoritative = 0; /* reply stored in cache can't be authoritative */ in synth_dname_msg()
769 msg->rep->qdcount = 1; in synth_dname_msg()
770 msg->rep->ttl = d->ttl - now; in synth_dname_msg()
771 msg->rep->prefetch_ttl = PREFETCH_TTL_CALC(msg->rep->ttl); in synth_dname_msg()
772 msg->rep->serve_expired_ttl = msg->rep->ttl + SERVE_EXPIRED_TTL; in synth_dname_msg()
773 msg->rep->security = sec_status_unchecked; in synth_dname_msg()
774 msg->rep->an_numrrsets = 1; in synth_dname_msg()
775 msg->rep->ns_numrrsets = 0; in synth_dname_msg()
776 msg->rep->ar_numrrsets = 0; in synth_dname_msg()
777 msg->rep->rrset_count = 1; in synth_dname_msg()
778 msg->rep->reason_bogus = LDNS_EDE_NONE; in synth_dname_msg()
779 msg->rep->rrsets[0] = packed_rrset_copy_region(rrset, region, now); in synth_dname_msg()
780 if(!msg->rep->rrsets[0]) /* copy DNAME */ in synth_dname_msg()
788 msg->rep->flags |= LDNS_RCODE_YXDOMAIN; in synth_dname_msg()
789 return msg; in synth_dname_msg()
804 msg->rep->rrsets[1] = ck; in synth_dname_msg()
830 msg->rep->ttl = newd->ttl; in synth_dname_msg()
831 msg->rep->prefetch_ttl = PREFETCH_TTL_CALC(newd->ttl); in synth_dname_msg()
832 msg->rep->serve_expired_ttl = newd->ttl + SERVE_EXPIRED_TTL; in synth_dname_msg()
835 msg->rep->an_numrrsets ++; in synth_dname_msg()
836 msg->rep->rrset_count ++; in synth_dname_msg()
837 return msg; in synth_dname_msg()
847 struct dns_msg* msg = NULL; in fill_any() local
856 msg = dns_msg_create(qname, qnamelen, qtype, qclass, in fill_any()
858 if(!msg) { in fill_any()
862 msg->rep->flags |= LDNS_RCODE_NOTIMPL; in fill_any()
863 msg->rep->security = sec_status_indeterminate; in fill_any()
864 return msg; in fill_any()
887 if(!msg) { in fill_any()
888 msg = dns_msg_create(qname, qnamelen, qtype, qclass, in fill_any()
890 if(!msg) { in fill_any()
897 if(!dns_msg_ansadd(msg, region, rrset, now)) { in fill_any()
903 return msg; in fill_any()
929 struct dns_msg* msg = tomsg(env, &key->key, data, region, now, 0, in dns_cache_lookup() local
931 if(msg) { in dns_cache_lookup()
933 return msg; in dns_cache_lookup()
947 struct dns_msg* msg = synth_dname_msg(rrset, region, now, &k, in dns_cache_lookup() local
949 if(msg) { in dns_cache_lookup()
958 return msg; in dns_cache_lookup()
972 return msg; in dns_cache_lookup()
990 struct dns_msg* msg = rrset_msg(rrset, region, now, &k); in dns_cache_lookup() local
991 if(msg) { in dns_cache_lookup()
993 return msg; in dns_cache_lookup()
1017 struct dns_msg* msg = rrset_msg(rrset, region, now, &k); in dns_cache_lookup() local
1018 if(msg) { in dns_cache_lookup()
1020 return msg; in dns_cache_lookup()
1046 struct dns_msg* msg; in dns_cache_lookup() local
1051 && (msg=tomsg(env, &k, data, region, now, 0, scratch))) { in dns_cache_lookup()
1053 msg->qinfo.qname=qname; in dns_cache_lookup()
1054 msg->qinfo.qname_len=qnamelen; in dns_cache_lookup()
1056 msg->rep->security = sec_status_unchecked; in dns_cache_lookup()
1057 iter_scrub_nxdomain(msg); in dns_cache_lookup()
1058 return msg; in dns_cache_lookup()
1135 struct msgreply_entry* msg; in dns_cache_prefetch_adjust() local
1136 msg = msg_cache_lookup(env, qinfo->qname, qinfo->qname_len, in dns_cache_prefetch_adjust()
1138 if(msg) { in dns_cache_prefetch_adjust()
1139 struct reply_info* rep = (struct reply_info*)msg->entry.data; in dns_cache_prefetch_adjust()
1142 lock_rw_unlock(&msg->entry.lock); in dns_cache_prefetch_adjust()
1145 lock_rw_unlock(&msg->entry.lock); in dns_cache_prefetch_adjust()