From ec4878be7578bd3de6df15408d74374a798567c2 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Wed, 1 Aug 2007 11:29:12 +0000 Subject: [PATCH] query flags for detect cycle. git-svn-id: file:///svn/unbound/trunk@469 be551aaa-1e26-0410-a405-d3ace91eadb9 --- doc/Changelog | 1 + iterator/iter_utils.c | 2 +- services/mesh.c | 5 +++-- services/mesh.h | 5 ++++- util/module.h | 7 ++++--- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index 280d8bc4d..652ce057c 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -2,6 +2,7 @@ - set version to 0.5 - module work for module to module interconnections. - config of modules. + - detect cycle takes flags. 31 July 2007: Wouter - updated plan diff --git a/iterator/iter_utils.c b/iterator/iter_utils.c index a6accbe45..73d4b7269 100644 --- a/iterator/iter_utils.c +++ b/iterator/iter_utils.c @@ -365,7 +365,7 @@ causes_cycle(struct module_qstate* qstate, uint8_t* name, size_t namelen, qinf.qname_len = namelen; qinf.qtype = t; qinf.qclass = c; - return (*qstate->env->detect_cycle)(qstate, &qinf); + return (*qstate->env->detect_cycle)(qstate, &qinf, BIT_RD, 0); } void diff --git a/services/mesh.c b/services/mesh.c index 4abd77c9a..df0d4372b 100644 --- a/services/mesh.c +++ b/services/mesh.c @@ -607,11 +607,12 @@ find_in_subsub(struct mesh_state* m, struct mesh_state* tofind) } int -mesh_detect_cycle(struct module_qstate* qstate, struct query_info* qinfo) +mesh_detect_cycle(struct module_qstate* qstate, struct query_info* qinfo, + uint16_t flags, int prime) { struct mesh_area* mesh = qstate->env->mesh; struct mesh_state* cyc_m = qstate->mesh_info; - struct mesh_state* dep_m = mesh_area_find(mesh, qinfo, BIT_RD, 0); + struct mesh_state* dep_m = mesh_area_find(mesh, qinfo, flags, prime); if(!dep_m) return 0; if(dep_m == cyc_m || find_in_subsub(dep_m, cyc_m)) diff --git a/services/mesh.h b/services/mesh.h index 82e1a92e4..abb7083b2 100644 --- a/services/mesh.h +++ b/services/mesh.h @@ -362,10 +362,13 @@ size_t mesh_get_mem(struct mesh_area* mesh); * trees. * @param qstate: given mesh querystate. * @param qinfo: query info for dependency. + * @param flags: query flags of dependency. + * @param prime: if dependency is a priming query or not. * @return true if the name,type,class exists and the given qstate mesh exists * as a dependency of that name. Thus if qstate becomes dependent on * name,type,class then a cycle is created. */ -int mesh_detect_cycle(struct module_qstate* qstate, struct query_info* qinfo); +int mesh_detect_cycle(struct module_qstate* qstate, struct query_info* qinfo, + uint16_t flags, int prime); #endif /* SERVICES_MESH_H */ diff --git a/util/module.h b/util/module.h index f6d7f058f..b19e19768 100644 --- a/util/module.h +++ b/util/module.h @@ -202,15 +202,16 @@ struct module_env { * Detect if adding a dependency for qstate on name,type,class will * create a dependency cycle. * @param qstate: given mesh querystate. - * @param qinfo: query info for dependency. Assumed RDflag and not - * priming. + * @param qinfo: query info for dependency. + * @param flags: query flags of dependency, RD/CD flags. + * @param prime: if dependency is a priming query or not. * @return true if the name,type,class exists and the given * qstate mesh exists as a dependency of that name. Thus * if qstate becomes dependent on name,type,class then a * cycle is created. */ int (*detect_cycle)(struct module_qstate* qstate, - struct query_info* qinfo); + struct query_info* qinfo, uint16_t flags, int prime); /** region for temporary usage. May be cleared after operate() call. */ struct region* scratch; -- 2.47.2