Lines Matching refs:rep
60 * @param rep: contains list of rrsets to store.
78 store_rrsets(struct module_env* env, struct reply_info* rep, time_t now,
83 time_t ttl, min_ttl = rep->ttl;
85 for(i=0; i<rep->rrset_count; i++) {
86 rep->ref[i].key = rep->rrsets[i];
87 rep->ref[i].id = rep->rrsets[i]->id;
89 switch(rrset_cache_update(env->rrset_cache, &rep->ref[i],
90 env->alloc, ((ntohs(rep->ref[i].key->rk.type)==
97 lock_rw_rdlock(&rep->ref[i].key->entry.lock);
99 if(rep->ref[i].key->id == 0 ||
100 rep->ref[i].id != rep->ref[i].key->id)
103 rep->ref[i].key, region, now);
104 lock_rw_unlock(&rep->ref[i].key->entry.lock);
116 rep->rrsets[i] = rep->ref[i].key;
119 lock_rw_rdlock(&rep->ref[i].key->entry.lock);
121 if(rep->ref[i].key->id != 0 &&
122 rep->ref[i].id == rep->ref[i].key->id) {
124 rep->rrsets[i]->entry.data)->ttl;
127 lock_rw_unlock(&rep->ref[i].key->entry.lock);
130 if(min_ttl < rep->ttl) {
131 rep->ttl = min_ttl;
132 rep->prefetch_ttl = PREFETCH_TTL_CALC(rep->ttl);
133 rep->serve_expired_ttl = rep->ttl + SERVE_EXPIRED_TTL;
156 hashvalue_type hash, struct reply_info* rep, time_t leeway, int pside,
161 time_t ttl = rep->ttl;
165 for(i=0; i<rep->rrset_count; i++) {
166 rep->ref[i].key = rep->rrsets[i];
167 rep->ref[i].id = rep->rrsets[i]->id;
170 /* there was a reply_info_sortref(rep) here but it seems to be
172 reply_info_set_ttls(rep, *env->now);
173 store_rrsets(env, rep, *env->now, leeway, pside, qrep, region,
179 reply_info_delete(rep, NULL);
197 reply_info_sortref(rep);
198 if(!(e = query_info_entrysetup(qinfo, rep, hash))) {
200 reply_info_delete(rep, NULL);
203 slabhash_insert(env->msg_cache, hash, &e->entry, rep, env->alloc);
273 if((msg->rep->rrsets[msg->rep->rrset_count] =
275 msg->rep->ar_numrrsets++;
276 msg->rep->rrset_count++;
457 if((msg->rep->rrsets[msg->rep->rrset_count] =
459 msg->rep->ns_numrrsets++;
460 msg->rep->rrset_count++;
482 msg->rep = (struct reply_info*)regional_alloc_zero(region,
484 if(!msg->rep)
488 msg->rep->flags = BIT_QR; /* with QR, no AA */
489 msg->rep->qdcount = 1;
490 msg->rep->reason_bogus = LDNS_EDE_NONE;
491 msg->rep->rrsets = (struct ub_packed_rrset_key**)
494 if(!msg->rep->rrsets)
503 if(!(msg->rep->rrsets[msg->rep->rrset_count++] =
506 msg->rep->ns_numrrsets++;
514 if(!(msg->rep->rrsets[msg->rep->rrset_count++] =
517 msg->rep->an_numrrsets++;
584 msg->rep = (struct reply_info*)regional_alloc(region,
586 if(!msg->rep)
588 msg->rep->reason_bogus = LDNS_EDE_NONE;
589 msg->rep->reason_bogus_str = NULL;
592 msg->rep->rrsets = (struct ub_packed_rrset_key**)
595 if(!msg->rep->rrsets)
621 msg->rep->flags = r->flags;
622 msg->rep->qdcount = r->qdcount;
623 msg->rep->ttl = is_expired
627 msg->rep->prefetch_ttl = r->prefetch_ttl - now;
629 msg->rep->prefetch_ttl = PREFETCH_TTL_CALC(msg->rep->ttl);
630 msg->rep->serve_expired_ttl = msg->rep->ttl + SERVE_EXPIRED_TTL;
631 msg->rep->serve_expired_norec_ttl = 0;
632 msg->rep->security = r->security;
633 msg->rep->an_numrrsets = r->an_numrrsets;
634 msg->rep->ns_numrrsets = r->ns_numrrsets;
635 msg->rep->ar_numrrsets = r->ar_numrrsets;
636 msg->rep->rrset_count = r->rrset_count;
637 msg->rep->authoritative = r->authoritative;
638 msg->rep->reason_bogus = r->reason_bogus;
640 msg->rep->reason_bogus_str = regional_strdup(region, r->reason_bogus_str);
658 for(i=0; i<msg->rep->rrset_count; i++) {
659 msg->rep->rrsets[i] = packed_rrset_copy_region(r->rrsets[i],
661 if(!msg->rep->rrsets[i]) {
679 res = gen_dns_msg(region, &origin->qinfo, origin->rep->rrset_count);
681 *res->rep = *origin->rep;
682 if(origin->rep->reason_bogus_str) {
683 res->rep->reason_bogus_str = regional_strdup(region,
684 origin->rep->reason_bogus_str);
686 for(i=0; i<res->rep->rrset_count; i++) {
687 res->rep->rrsets[i] = packed_rrset_copy_region(
688 origin->rep->rrsets[i], region, 0);
689 if(!res->rep->rrsets[i]) {
709 msg->rep->flags = BIT_QR; /* reply, no AA, no error */
710 msg->rep->authoritative = 0; /* reply stored in cache can't be authoritative */
711 msg->rep->qdcount = 1;
712 msg->rep->ttl = d->ttl - now;
713 msg->rep->prefetch_ttl = PREFETCH_TTL_CALC(msg->rep->ttl);
714 msg->rep->serve_expired_ttl = msg->rep->ttl + SERVE_EXPIRED_TTL;
715 msg->rep->serve_expired_norec_ttl = 0;
716 msg->rep->security = sec_status_unchecked;
717 msg->rep->an_numrrsets = 1;
718 msg->rep->ns_numrrsets = 0;
719 msg->rep->ar_numrrsets = 0;
720 msg->rep->rrset_count = 1;
721 msg->rep->reason_bogus = LDNS_EDE_NONE;
722 msg->rep->rrsets[0] = packed_rrset_copy_region(rrset, region, now);
723 if(!msg->rep->rrsets[0]) /* copy CNAME */
749 msg->rep->flags = BIT_QR; /* reply, no AA, no error */
750 msg->rep->authoritative = 0; /* reply stored in cache can't be authoritative */
751 msg->rep->qdcount = 1;
752 msg->rep->ttl = d->ttl - now;
753 msg->rep->prefetch_ttl = PREFETCH_TTL_CALC(msg->rep->ttl);
754 msg->rep->serve_expired_ttl = msg->rep->ttl + SERVE_EXPIRED_TTL;
755 msg->rep->serve_expired_norec_ttl = 0;
756 msg->rep->security = sec_status_unchecked;
757 msg->rep->an_numrrsets = 1;
758 msg->rep->ns_numrrsets = 0;
759 msg->rep->ar_numrrsets = 0;
760 msg->rep->rrset_count = 1;
761 msg->rep->reason_bogus = LDNS_EDE_NONE;
762 msg->rep->rrsets[0] = packed_rrset_copy_region(rrset, region, now);
763 if(!msg->rep->rrsets[0]) /* copy DNAME */
771 msg->rep->flags |= LDNS_RCODE_YXDOMAIN;
787 msg->rep->rrsets[1] = ck;
813 msg->rep->ttl = newd->ttl;
814 msg->rep->prefetch_ttl = PREFETCH_TTL_CALC(newd->ttl);
815 msg->rep->serve_expired_ttl = newd->ttl + SERVE_EXPIRED_TTL;
818 msg->rep->an_numrrsets ++;
819 msg->rep->rrset_count ++;
845 msg->rep->flags |= LDNS_RCODE_NOTIMPL;
846 msg->rep->security = sec_status_indeterminate;
1039 msg->rep->security = sec_status_unchecked;
1063 struct reply_info* rep = NULL;
1130 rep = reply_info_copy(msgrep, env->alloc, NULL);
1131 if(!rep)
1140 for(i=0; i<rep->rrset_count; i++) {
1142 rep->rrsets[i]->entry.data, *env->now);
1143 ref.key = rep->rrsets[i];
1144 ref.id = rep->rrsets[i]->id;
1152 reply_info_delete(rep, NULL);
1162 reply_info_parsedelete(rep, env->alloc);
1168 rep->flags |= (BIT_RA | BIT_QR);
1169 rep->flags &= ~(BIT_AA | BIT_CD);
1171 dns_cache_store_msg(env, &qinf, h, rep, leeway, pside, msgrep,
1188 struct reply_info* rep = (struct reply_info*)msg->entry.data;
1189 if(rep) {
1190 rep->prefetch_ttl += adjust;