#include <u.h>
#include <libc.h>
#include <String.h>
#include "common.h"
#include "debug.h"
#include "rule.h"
#include "allrule.h"
enum { DEBUG_ALLRULE = false };
typedef struct AllRule
{
Rule;
} AllRule;
static RuleOperations allruleops =
{
.free = rule_free_self,
.issatisfy = rule_issatisfy_true,
.contains = rule_contains_true
};
Rule *allrule_new(char *root)
{
AllRule *result;
assert_valid(root);
result = (AllRule *)emalloc_fs(sizeof(*result));
result->ops = &allruleops;
result->root = estrdup_fs(root);
result->name = "all";
return (Rule *)result;
}
Rule *allrule_parse(char *rule, char *setting, char *path)
{
assert_valid(rule);
assert_valid(setting);
assert_valid(path);
if(strcmp(rule, "all") != 0)
{
return nil;
}
INFO(DEBUG_ALLRULE, "parsed all rule with path: %s", path);
return allrule_new(path);
}
|