config-filter.h revision 08e7163a8d12979119fa56c92676af4ba6304f1a
#ifndef CONFIG_FILTER_H
#define CONFIG_FILTER_H
#include "network.h"
struct config_filter {
const char *service;
const char *local_host, *remote_host;
struct ip_addr local_net, remote_net;
unsigned int local_bits, remote_bits;
};
struct config_filter_parser {
struct config_filter filter;
const char *file_and_line;
/* NULL-terminated array of parsers */
struct config_module_parser *parsers;
};
ARRAY_DEFINE_TYPE(config_filter_parsers, struct config_filter_parser *);
struct config_filter_context *config_filter_init(pool_t pool);
void config_filter_deinit(struct config_filter_context **ctx);
/* Replace filter's parsers with given parser list. */
void config_filter_add_all(struct config_filter_context *ctx,
struct config_filter_parser *const *parsers);
/* Build new parsers from all existing ones matching the given filter. */
int config_filter_parsers_get(struct config_filter_context *ctx, pool_t pool,
const struct config_filter *filter,
struct config_module_parser **parsers_r,
const char **error_r);
void config_filter_parsers_free(struct config_module_parser *parsers);
/* Returns TRUE if filter matches mask. */
bool config_filter_match(const struct config_filter *mask,
const struct config_filter *filter);
/* Returns TRUE if two filters are fully equal. */
bool config_filters_equal(const struct config_filter *f1,
const struct config_filter *f2);
#endif