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
33 #define FC_MATCH_NO_MATCH 0
34 #define FC_MATCH_MATCHES 1
36 #define FC_TARGET_CONTINUE 0
37 #define FC_TARGET_STOP 1
38 #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);
59 int (*create) (const oconfig_item_t *ci, void **user_data);
60 int (*destroy) (void **user_data);
61 int (*invoke) (const data_set_t *ds, value_list_t *vl,
62 notification_meta_t **meta, void **user_data);
64 typedef struct target_proc_s target_proc_t;
67 typedef struct fc_chain_s fc_chain_t;
69 int fc_register_target (const char *name, target_proc_t proc);
72 * TODO: Chain management
75 int fc_chain_add (const char *chain_name,
76 const char *target_name, int target_argc, char **target_argv);
77 int fc_chain_delete (const char *chain_name);
81 * TODO: Rule management
84 int fc_rule_add (const char *chain_name, int position,
85 int match_num, const char **match_name, int *match_argc, char ***match_argv,
86 const char *target_name, int target_argc, char **target_argv);
87 int fc_rule_delete (const char *chain_name, int position);
93 fc_chain_t *fc_chain_get_by_name (const char *chain_name);
95 int fc_process_chain (const data_set_t *ds, value_list_t *vl,
98 int fc_default_action (const data_set_t *ds, value_list_t *vl);
101 * Shortcut for global configuration
103 int fc_configure (const oconfig_item_t *ci);
105 #endif /* FILTER_CHAIN_H */
106 /* vim: set sw=2 sts=2 et : */