/* * Check all rules if they match n and apply. */ void rule_apply_all(notification * n) { for (GSList * iter = rules; iter; iter = iter->next) { rule_t *r = iter->data; if (rule_matches_notification(r, n)) { rule_apply(r, n); } } }
struct list_res tf_apply (const struct tf *tf, const struct res *in, bool append) { assert (in->hs.len == data_arrs_len); uint32_t app[MAX_APP]; int napp = 0; struct list_res res = {0}; const struct port_map_elem *rules = rule_get (tf, in->port); if (!rules) return res; if (rules->start != UINT32_MAX) { for (uint32_t cur = rules->start; cur < tf->nrules; cur++) { const struct rule *r = &tf->rules[cur]; assert (r->in > 0); if (r->in != in->port) break; struct list_res tmp; tmp = rule_apply (r, tf, in, append, app, &napp); list_concat (&res, &tmp); } } /* Check all rules with multiple ports. */ for (int i = 0; i < tf->nrules; i++) { const struct rule *r = &tf->rules[i]; if (r->in >= 0) break; if (!port_match (in->port, r->in, tf)) continue; struct list_res tmp; tmp = rule_apply (r, tf, in, append, app, &napp); list_concat (&res, &tmp); } return res; }