}
return NULL;
}
+
+static void
+tcls_delete_matches(struct tcls *cls,
+ const struct cls_rule *target,
+ int include)
+{
+ size_t i;
+
+ for (i = 0; i < cls->n_rules; ) {
+ struct test_rule *pos = cls->rules[i];
+ uint32_t wildcards = pos->cls_rule.wc.wildcards;
+ if (include & (wildcards ? CLS_INC_WILD : CLS_INC_EXACT)
+ && match(target, &pos->cls_rule.flow)) {
+ tcls_remove(cls, pos);
+ } else {
+ i++;
+ }
+ }
+}
\f
#ifdef WORDS_BIGENDIAN
#define HTONL(VALUE) ((uint32_t) (VALUE))
compare_classifiers(&cls, &tcls);
}
+ while (!classifier_is_empty(&cls)) {
+ struct test_rule *rule = xmemdup(tcls.rules[rand() % tcls.n_rules],
+ sizeof(struct test_rule));
+ int include = rand() % 2 ? CLS_INC_WILD : CLS_INC_EXACT;
+ include |= (rule->cls_rule.wc.wildcards
+ ? CLS_INC_WILD : CLS_INC_EXACT);
+ classifier_for_each_match(&cls, &rule->cls_rule, include,
+ free_rule, &cls);
+ tcls_delete_matches(&tcls, &rule->cls_rule, include);
+ compare_classifiers(&cls, &tcls);
+ free(rule);
+ }
+ putchar('.');
+ fflush(stdout);
+
destroy_classifier(&cls);
tcls_destroy(&tcls);
}