2 * collectd - src/filter_chain.h
3 * Copyright (C) 2008,2009 Florian octo Forster
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; only version 2 of the License is applicable.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 * Florian octo Forster <octo at verplant.org>
22 #ifndef FILTER_CHAIN_H
23 #define FILTER_CHAIN_H 1
28 #define FC_MATCH_NO_MATCH 0
29 #define FC_MATCH_MATCHES 1
31 #define FC_TARGET_CONTINUE 0
32 #define FC_TARGET_STOP 1
33 #define FC_TARGET_RETURN 2
40 int (*create) (const oconfig_item_t *ci, void **user_data);
41 int (*destroy) (void **user_data);
42 int (*match) (const data_set_t *ds, const value_list_t *vl,
43 notification_meta_t **meta, void **user_data);
45 typedef struct match_proc_s match_proc_t;
47 int fc_register_match (const char *name, match_proc_t proc);
54 int (*create) (const oconfig_item_t *ci, void **user_data);
55 int (*destroy) (void **user_data);
56 int (*invoke) (const data_set_t *ds, value_list_t *vl,
57 notification_meta_t **meta, void **user_data);
59 typedef struct target_proc_s target_proc_t;
62 typedef struct fc_chain_s fc_chain_t;
64 int fc_register_target (const char *name, target_proc_t proc);
67 * TODO: Chain management
70 int fc_chain_add (const char *chain_name,
71 const char *target_name, int target_argc, char **target_argv);
72 int fc_chain_delete (const char *chain_name);
76 * TODO: Rule management
79 int fc_rule_add (const char *chain_name, int position,
80 int match_num, const char **match_name, int *match_argc, char ***match_argv,
81 const char *target_name, int target_argc, char **target_argv);
82 int fc_rule_delete (const char *chain_name, int position);
88 fc_chain_t *fc_chain_get_by_name (const char *chain_name);
90 int fc_process_chain (const data_set_t *ds, value_list_t *vl,
93 int fc_default_action (const data_set_t *ds, value_list_t *vl);
96 * Shortcut for global configuration
98 int fc_configure (const oconfig_item_t *ci);
100 #endif /* FILTER_CHAIN_H */
101 /* vim: set sw=2 sts=2 et : */