passing of control between modules.

git-svn-id: file:///svn/unbound/trunk@479 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2007-08-02 12:13:08 +00:00
parent 947bd1ab91
commit 6849c1030b
6 changed files with 27 additions and 3 deletions

View file

@ -4,6 +4,8 @@
- fixup delegation point duplicates. - fixup delegation point duplicates.
- fixup iterator scrubber; lame NS set is let through the scrubber - fixup iterator scrubber; lame NS set is let through the scrubber
so that the classification is lame. so that the classification is lame.
- validator module exists, and does nothing but pass through,
with calling of next module and return.
1 August 2007: Wouter 1 August 2007: Wouter
- set version to 0.5 - set version to 0.5

View file

@ -1502,6 +1502,8 @@ process_response(struct module_qstate* qstate, struct iter_qstate* iq,
/* edns is not examined, but removed from message to help cache */ /* edns is not examined, but removed from message to help cache */
if(parse_extract_edns(prs, &edns) != LDNS_RCODE_NOERROR) if(parse_extract_edns(prs, &edns) != LDNS_RCODE_NOERROR)
goto handle_it; goto handle_it;
/* remove CD-bit, we asked for in case we handle validation ourself */
prs->flags &= ~BIT_CD;
/* normalize and sanitize: easy to delete items from linked lists */ /* normalize and sanitize: easy to delete items from linked lists */
if(!scrub_message(pkt, prs, &iq->qchase, iq->dp->name, if(!scrub_message(pkt, prs, &iq->qchase, iq->dp->name,

View file

@ -484,7 +484,7 @@ void mesh_walk_supers(struct module_qstate* qstate, int id)
(void)rbtree_insert(&mesh->run, &ref->s->run_node); (void)rbtree_insert(&mesh->run, &ref->s->run_node);
/* callback the function to inform super of result */ /* callback the function to inform super of result */
(*mesh->modfunc[ref->s->s.curmod]->inform_super)(qstate, (*mesh->modfunc[ref->s->s.curmod]->inform_super)(qstate,
id, &ref->s->s); ref->s->s.curmod, &ref->s->s);
} }
} }
@ -570,7 +570,7 @@ mesh_continue(struct mesh_area* mesh, struct mesh_state* mstate,
} }
/* pass along the locus of control */ /* pass along the locus of control */
mstate->s.curmod --; mstate->s.curmod --;
*ev = module_event_pass; *ev = module_event_moddone;
return 1; return 1;
} }
return 0; return 0;

View file

@ -62,6 +62,7 @@ strmodulevent(enum module_ev e)
case module_event_pass: return "module_event_pass"; case module_event_pass: return "module_event_pass";
case module_event_reply: return "module_event_reply"; case module_event_reply: return "module_event_reply";
case module_event_noreply: return "module_event_noreply"; case module_event_noreply: return "module_event_noreply";
case module_event_moddone: return "module_event_moddone";
case module_event_error: return "module_event_error"; case module_event_error: return "module_event_error";
} }
return "bad_event_value"; return "bad_event_value";

View file

@ -225,6 +225,8 @@ enum module_ev {
module_event_reply, module_event_reply,
/** no reply, timeout or other error */ /** no reply, timeout or other error */
module_event_noreply, module_event_noreply,
/** next module is done, and its reply is awaiting you */
module_event_moddone,
/** error */ /** error */
module_event_error module_event_error
}; };

View file

@ -83,10 +83,24 @@ val_operate(struct module_qstate* qstate, enum module_ev event, int id,
verbose(VERB_DETAIL, "validator[module %d] operate: extstate:%s " verbose(VERB_DETAIL, "validator[module %d] operate: extstate:%s "
"event:%s", id, strextstate(qstate->ext_state[id]), "event:%s", id, strextstate(qstate->ext_state[id]),
strmodulevent(event)); strmodulevent(event));
if(vq) log_query_info(VERB_DETAIL, "iterator operate: query", if(vq) log_query_info(VERB_DETAIL, "validator operate: query",
&qstate->qinfo); &qstate->qinfo);
(void)ve; (void)ve;
(void)outbound; (void)outbound;
if(event == module_event_new || event == module_event_pass) {
/* pass request to next module, to get it */
verbose(VERB_ALGO, "validator: pass to next module");
qstate->ext_state[id] = module_wait_module;
return;
}
if(event == module_event_moddone) {
/* we're done */
verbose(VERB_ALGO, "validator: nextmodule returned");
qstate->ext_state[id] = module_finished;
return;
}
qstate->ext_state[id] = module_error;
return;
} }
/** /**
@ -100,6 +114,9 @@ static void
val_inform_super(struct module_qstate* qstate, int id, val_inform_super(struct module_qstate* qstate, int id,
struct module_qstate* super) struct module_qstate* super)
{ {
log_query_info(VERB_ALGO, "validator: inform_super, sub=",
&qstate->qinfo);
log_query_info(VERB_ALGO, "super=", &super->qinfo);
} }