From d2318c50cd0c15e8eaef0a4511267f8bad2bbee5 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Tue, 29 May 2007 12:31:02 +0000 Subject: [PATCH] Name change to make naming more uniform. git-svn-id: file:///svn/unbound/trunk@345 be551aaa-1e26-0410-a405-d3ace91eadb9 --- daemon/worker.c | 2 +- doc/Changelog | 1 + iterator/iterator.c | 4 ++-- services/cache/dns.c | 4 ++-- util/data/msgreply.c | 20 ++++++++++---------- util/data/msgreply.h | 2 +- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/daemon/worker.c b/daemon/worker.c index d6c4c69d3..f0e4f3c62 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -137,7 +137,7 @@ replyerror_fillbuf(int r, struct comm_reply* repinfo, uint16_t id, ldns_buffer_write(buf, &flags, sizeof(uint16_t)); ldns_buffer_write(buf, &flags, sizeof(uint16_t)); ldns_buffer_write(buf, &flags, sizeof(uint16_t)); - ldns_buffer_write(buf, qinfo->qname, qinfo->qnamesize); + ldns_buffer_write(buf, qinfo->qname, qinfo->qname_len); ldns_buffer_write_u16(buf, qinfo->qtype); ldns_buffer_write_u16(buf, qinfo->qclass); ldns_buffer_flip(buf); diff --git a/doc/Changelog b/doc/Changelog index 9bb17f4a8..cba15afc9 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -3,6 +3,7 @@ - lookup message from msg cache (and copy to region). - fixed cast error in dns msg lookup. - message with duplicate rrset does not increase its TTLs twice. + - 'qnamesize' changed to 'qname_len' for similar naming scheme. 25 May 2007: Wouter - Acknowledge use of unbound-java code in iterator. Nicer readme. diff --git a/iterator/iterator.c b/iterator/iterator.c index d70860ce5..3b1253a83 100644 --- a/iterator/iterator.c +++ b/iterator/iterator.c @@ -125,7 +125,7 @@ fwd_new(struct module_qstate* qstate, int id) outbound_list_init(&iq->outlist); if(qstate->qinfo.has_cd) flags |= BIT_CD; - e = (*env->send_query)(qstate->qinfo.qname, qstate->qinfo.qnamesize, + e = (*env->send_query)(qstate->qinfo.qname, qstate->qinfo.qname_len, qstate->qinfo.qtype, qstate->qinfo.qclass, flags, dnssec, &ie->fwd_addr, ie->fwd_addrlen, qstate); if(!e) @@ -327,7 +327,7 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq, * we just look for the closest set of server to the parent of qname. */ delname = qstate->qinfo.qname; - delnamelen = qstate->qinfo.qnamesize; + delnamelen = qstate->qinfo.qname_len; if(qstate->qinfo.qtype == LDNS_RR_TYPE_DS && delname[0] != 0) { /* do not adjust root label */ size_t lablen = delname[0] + 1; diff --git a/services/cache/dns.c b/services/cache/dns.c index addf7e94d..e028487bb 100644 --- a/services/cache/dns.c +++ b/services/cache/dns.c @@ -286,7 +286,7 @@ tomsg(struct module_env* env, struct msgreply_entry* e, struct reply_info* r, return NULL; memcpy(&msg->qinfo, &e->key, sizeof(struct query_info)); msg->qinfo.qname = region_alloc_init(region, e->key.qname, - e->key.qnamesize); + e->key.qname_len); if(!msg->qinfo.qname) return NULL; /* allocate replyinfo struct and rrset key array separately */ @@ -326,7 +326,7 @@ dns_cache_lookup(struct module_env* env, /* lookup first, this has both NXdomains and ANSWER responses */ k.qname = qname; - k.qnamesize = qnamelen; + k.qname_len = qnamelen; k.qtype = qtype; k.qclass = qclass; k.has_cd = has_cd; diff --git a/util/data/msgreply.c b/util/data/msgreply.c index f48b221b2..15be1b9a6 100644 --- a/util/data/msgreply.c +++ b/util/data/msgreply.c @@ -68,7 +68,7 @@ parse_create_qinfo(ldns_buffer* pkt, struct msg_parse* msg, if(!qinf->qname) return 0; dname_pkt_copy(pkt, qinf->qname, msg->qname); } else qinf->qname = 0; - qinf->qnamesize = msg->qname_len; + qinf->qname_len = msg->qname_len; qinf->qtype = msg->qtype; qinf->qclass = msg->qclass; qinf->has_cd = 0; @@ -430,7 +430,7 @@ query_info_parse(struct query_info* m, ldns_buffer* query) m->has_cd = LDNS_CD_WIRE(q)?1:0; ldns_buffer_skip(query, LDNS_HEADER_SIZE); m->qname = ldns_buffer_current(query); - if((m->qnamesize = query_dname_len(query)) == 0) + if((m->qname_len = query_dname_len(query)) == 0) return 0; /* parse error */ if(ldns_buffer_remaining(query) < 4) return 0; /* need qtype, qclass */ @@ -443,11 +443,11 @@ int query_info_allocqname(struct query_info* m) { uint8_t* q = m->qname; - if(!(m->qname = (uint8_t*)malloc(m->qnamesize))) { + if(!(m->qname = (uint8_t*)malloc(m->qname_len))) { log_err("query_info_allocqname: out of memory"); return 0; /* out of memory */ } - memcpy(m->qname, q, m->qnamesize); + memcpy(m->qname, q, m->qname_len); return 1; } @@ -467,7 +467,7 @@ query_info_compare(void* m1, void* m2) COMPARE_IT(msg1->qtype, msg2->qtype); if((mc = query_dname_compare(msg1->qname, msg2->qname)) != 0) return mc; - log_assert(msg1->qnamesize == msg2->qnamesize); + log_assert(msg1->qname_len == msg2->qname_len); COMPARE_IT(msg1->has_cd, msg2->has_cd); COMPARE_IT(msg1->qclass, msg2->qclass); return 0; @@ -487,7 +487,7 @@ msgreply_sizefunc(void* k, void* d) struct query_info* q = (struct query_info*)k; struct reply_info* r = (struct reply_info*)d; size_t s = sizeof(struct msgreply_entry) + sizeof(struct reply_info) - + q->qnamesize; + + q->qname_len; s += (r->rrset_count-1) * sizeof(struct rrset_ref); s += r->rrset_count * sizeof(struct ub_packed_rrset_key*); return s; @@ -1021,13 +1021,13 @@ int reply_info_encode(struct query_info* qinfo, struct reply_info* rep, /* insert query section */ if(rep->qdcount) { if(ldns_buffer_remaining(buffer) < - qinfo->qnamesize+sizeof(uint16_t)*2) + qinfo->qname_len+sizeof(uint16_t)*2) return 0; /* buffer too small */ if(!compress_tree_store(&tree, qinfo->qname, dname_count_labels(qinfo->qname), ldns_buffer_position(buffer), region, NULL)) return 0; - ldns_buffer_write(buffer, qinfo->qname, qinfo->qnamesize); + ldns_buffer_write(buffer, qinfo->qname, qinfo->qname_len); ldns_buffer_write_u16(buffer, qinfo->qtype); ldns_buffer_write_u16(buffer, qinfo->qclass); } @@ -1152,7 +1152,7 @@ query_info_entrysetup(struct query_info* q, struct reply_info* r, lock_protect(&e->entry.lock, &e->key, sizeof(e->key)); lock_protect(&e->entry.lock, &e->entry.hash, sizeof(e->entry.hash) + sizeof(e->entry.key) + sizeof(e->entry.data)); - lock_protect(&e->entry.lock, e->key.qname, e->key.qnamesize); + lock_protect(&e->entry.lock, e->key.qname, e->key.qname_len); q->qname = NULL; return e; } @@ -1169,7 +1169,7 @@ qinfo_query_encode(ldns_buffer* pkt, struct query_info* qinfo) ldns_buffer_write_u16(pkt, flags); ldns_buffer_write_u16(pkt, 1); /* query count */ ldns_buffer_write(pkt, "\000\000\000\000\000\000", 6); /* counts */ - ldns_buffer_write(pkt, qinfo->qname, qinfo->qnamesize); + ldns_buffer_write(pkt, qinfo->qname, qinfo->qname_len); ldns_buffer_write_u16(pkt, qinfo->qtype); ldns_buffer_write_u16(pkt, qinfo->qclass); ldns_buffer_flip(pkt); diff --git a/util/data/msgreply.h b/util/data/msgreply.h index 8bf99dbc5..5533dd23f 100644 --- a/util/data/msgreply.h +++ b/util/data/msgreply.h @@ -61,7 +61,7 @@ struct query_info { */ uint8_t* qname; /** length of qname (including last 0 octet) */ - size_t qnamesize; + size_t qname_len; /** qtype, host byte order */ uint16_t qtype; /** qclass, host byte order */ -- 2.47.2