int ReflexAgent(int percept1, int percept2){ //interpret input //rulematch //return action; int rule, action; rule = interpretInput (percept1, percept2); action = ruleMatch(rule); return action; }
/* Evaluates the rule -- indirect interface, this will be * called from the SpecialPurpose detection plugin as * CheckRule (void *, void *); */ static int CheckRule(void *p, void *r) { Rule *rule = (Rule *)r; if (!rule->initialized) { _ded.errMsg("Dynamic Rule [%d:%d] was not initialized properly.\n", rule->info.genID, rule->info.sigID); return RULE_NOMATCH; } ContentSetup(); /* If there is an eval func, use it, this is a 'hand-coded' rule */ if (rule->evalFunc) return rule->evalFunc((SFSnortPacket *)p); else return ruleMatch(p, rule); }