2 * collectd - src/filter_chain.h
3 * Copyright (C) 2008,2009 Florian octo Forster
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
24 * Florian octo Forster <octo at collectd.org>
27 #ifndef FILTER_CHAIN_H
28 #define FILTER_CHAIN_H 1
34 #define FC_MATCH_NO_MATCH 0
35 #define FC_MATCH_MATCHES 1
37 #define FC_TARGET_CONTINUE 0
38 #define FC_TARGET_STOP 1
39 #define FC_TARGET_RETURN 2
45 int (*create)(const oconfig_item_t *ci, void **user_data);
46 int (*destroy)(void **user_data);
47 int (*match)(const data_set_t *ds, const value_list_t *vl,
48 notification_meta_t **meta, void **user_data);
50 typedef struct match_proc_s match_proc_t;
52 int fc_register_match(const char *name, match_proc_t proc);
57 struct target_proc_s {
58 int (*create)(const oconfig_item_t *ci, void **user_data);
59 int (*destroy)(void **user_data);
60 int (*invoke)(const data_set_t *ds, value_list_t *vl,
61 notification_meta_t **meta, void **user_data);
63 typedef struct target_proc_s target_proc_t;
66 typedef struct fc_chain_s fc_chain_t;
68 int fc_register_target(const char *name, target_proc_t proc);
71 * TODO: Chain management
74 int fc_chain_add (const char *chain_name,
75 const char *target_name, int target_argc, char **target_argv);
76 int fc_chain_delete (const char *chain_name);
80 * TODO: Rule management
83 int fc_rule_add (const char *chain_name, int position,
84 int match_num, const char **match_name, int *match_argc, char ***match_argv,
85 const char *target_name, int target_argc, char **target_argv);
86 int fc_rule_delete (const char *chain_name, int position);
92 fc_chain_t *fc_chain_get_by_name(const char *chain_name);
94 int fc_process_chain(const data_set_t *ds, value_list_t *vl, fc_chain_t *chain);
96 int fc_default_action(const data_set_t *ds, value_list_t *vl);
99 * Shortcut for global configuration
101 int fc_configure(const oconfig_item_t *ci);
103 #endif /* FILTER_CHAIN_H */
104 /* vim: set sw=2 sts=2 et : */