Debian Codegraph @

src/XCCDF_POLICY/reporter.c

raw symbols SCIP
1 /*
2 * Copyright 2014 Red Hat Inc., Durham, North Carolina.
3 * All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 * Authors:
20 * Šimon Lukašík
21 */
22
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26
27 #include "common/util.h"
28 #include "public/xccdf_policy.h"
29 #include "reporter_priv.h"
30
31 struct reporter {
32 char * system; ///< Identificator of checking engine (output engine)
33 int (*callback)(void*,void*); ///< policy report callback {output,start}
34 void * usr; ///< User data structure
35 };
36
37 struct reporter *reporter_new(char *report_type, void *output_func, void *usr)
38 {
39 struct reporter *reporter = malloc(sizeof(struct reporter));
40 if (reporter != NULL) {
41 reporter->system = report_type;
42 reporter->callback = output_func;
43 reporter->usr = usr;
44 }
45 return reporter;
46 }
47
48 int reporter_send_simple(struct reporter *reporter, void *data)
49 {
50 return reporter->callback(data, reporter->usr);
51 }