f2e22af2b36e8e0953734ccb17075191302c3782
1 /**
2 * collectd - src/filter_chain.h
3 * Copyright (C) 2008 Florian octo Forster
4 *
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.
8 *
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.
13 *
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
17 *
18 * Authors:
19 * Florian octo Forster <octo at verplant.org>
20 **/
22 #ifndef FILTER_CHAIN_H
23 #define FILTER_CHAIN_H 1
25 #include "collectd.h"
26 #include "plugin.h"
28 #define FC_MATCH_NO_MATCH 0
29 #define FC_MATCH_MATCHES 1
31 #define FC_ACTION_CONTINUE 0
32 #define FC_ACTION_STOP 1
34 /*
35 * Match functions
36 */
37 struct match_proc_s
38 {
39 int (*create) (const oconfig_item_t *ci, void **user_data);
40 int (*destroy) (void **user_data);
41 int (*match) (const data_set_t *ds, const value_list_t *vl,
42 notification_meta_t **meta, void **user_data);
43 };
44 typedef struct match_proc_s match_proc_t;
46 int fc_register_match (const char *name, match_proc_t proc);
48 /*
49 * Target functions
50 */
51 struct target_proc_s
52 {
53 int (*create) (const oconfig_item_t *ci, void **user_data);
54 int (*destroy) (void **user_data);
55 int (*invoke) (const data_set_t *ds, value_list_t *vl,
56 notification_meta_t **meta, void **user_data);
57 };
58 typedef struct target_proc_s target_proc_t;
60 int fc_register_target (const char *name, target_proc_t proc);
62 /*
63 * TODO: Chain management
64 */
65 #if 0
66 int fc_chain_add (const char *chain_name,
67 const char *target_name, int target_argc, char **target_argv);
68 int fc_chain_delete (const char *chain_name);
69 #endif
71 /*
72 * TODO: Rule management
73 */
74 #if 0
75 int fc_rule_add (const char *chain_name, int position,
76 int match_num, const char **match_name, int *match_argc, char ***match_argv,
77 const char *target_name, int target_argc, char **target_argv);
78 int fc_rule_delete (const char *chain_name, int position);
79 #endif
81 /*
82 * Processing function
83 */
84 int fc_process (const data_set_t *ds, value_list_t *vl);
86 /*
87 * Shortcut for global configuration
88 */
89 int fc_configure (const oconfig_item_t *ci);
91 #endif /* FILTER_CHAIN_H */
92 /* vim: set sw=2 sts=2 et : */