Open SCAP Library
|
00001 /* 00002 * Copyright 2010 Red Hat Inc., Durham, North Carolina. 00003 * All Rights Reserved. 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 * 00019 * Authors: 00020 * Lukas Kuklinek <lkuklinek@redhat.com> 00021 */ 00022 00028 #ifndef OSCAP_REPORTER_H_ 00029 #define OSCAP_REPORTER_H_ 00030 00031 #include <stdbool.h> 00032 #include <stdarg.h> 00033 00073 00074 typedef enum oscap_reporter_family { 00075 OSCAP_REPORTER_FAMILY_XML = 1, 00076 OSCAP_REPORTER_FAMILY_XCCDF = 2, 00077 OSCAP_REPORTER_FAMILY_OVAL = 3, 00078 OSCAP_REPORTER_FAMILY_USER_START = 1024 00079 } oscap_reporter_family_t; 00080 00082 typedef unsigned int oscap_reporter_code_t; 00083 00085 extern const oscap_reporter_code_t OSCAP_REPORTER_CODE_MAX; 00086 00091 struct oscap_reporter_message; 00092 00096 typedef int (*oscap_reporter)(const struct oscap_reporter_message *msg, void *arg); 00097 00098 00100 struct oscap_reporter_message *oscap_reporter_message_new(void); 00102 struct oscap_reporter_message *oscap_reporter_message_new_fill(oscap_reporter_family_t family, oscap_reporter_code_t code, const char *string); 00104 struct oscap_reporter_message *oscap_reporter_message_new_fmt(oscap_reporter_family_t family, oscap_reporter_code_t code, const char *fmt, ...); 00106 struct oscap_reporter_message *oscap_reporter_message_clone(const struct oscap_reporter_message *msg); 00108 oscap_reporter_family_t oscap_reporter_message_get_family(const struct oscap_reporter_message *item); 00110 oscap_reporter_code_t oscap_reporter_message_get_code(const struct oscap_reporter_message *item); 00112 const char *oscap_reporter_message_get_string(const struct oscap_reporter_message *item); 00113 00115 const char *oscap_reporter_message_get_user1str(const struct oscap_reporter_message *msg); 00117 int oscap_reporter_message_get_user1num(const struct oscap_reporter_message *msg); 00119 void *oscap_reporter_message_get_user1ptr(const struct oscap_reporter_message *msg); 00121 const char *oscap_reporter_message_get_user2str(const struct oscap_reporter_message *msg); 00123 int oscap_reporter_message_get_user2num(const struct oscap_reporter_message *msg); 00125 void *oscap_reporter_message_get_user2ptr(const struct oscap_reporter_message *msg); 00127 const char *oscap_reporter_message_get_user3str(const struct oscap_reporter_message *msg); 00129 int oscap_reporter_message_get_user3num(const struct oscap_reporter_message *msg); 00131 void *oscap_reporter_message_get_user3ptr(const struct oscap_reporter_message *msg); 00132 00133 00139 int oscap_reporter_dispatch(oscap_reporter reporter, const struct oscap_reporter_message *msg, void *arg); 00140 00148 int oscap_reporter_report(oscap_reporter reporter, struct oscap_reporter_message *msg, void *arg); 00149 00156 int oscap_reporter_report_fmt(oscap_reporter reporter, void *arg, oscap_reporter_family_t family, oscap_reporter_code_t code, const char *fmt, ...); 00157 00159 int oscap_reporter_fd(const struct oscap_reporter_message *msg, void *arg); 00160 00168 struct oscap_reporter_switch_ctxt; 00170 struct oscap_reporter_switch_ctxt *oscap_reporter_switch_ctxt_new(void); 00172 void oscap_reporter_switch_ctxt_add_range_reporter(struct oscap_reporter_switch_ctxt *ctxt, oscap_reporter reporter, void *arg, 00173 oscap_reporter_family_t family, oscap_reporter_code_t min_code, oscap_reporter_code_t max_code); 00175 void oscap_reporter_switch_ctxt_add_family_reporter(struct oscap_reporter_switch_ctxt *ctxt, oscap_reporter reporter, void *arg, oscap_reporter_family_t family); 00177 void oscap_reporter_switch_ctxt_add_reporter(struct oscap_reporter_switch_ctxt *ctxt, oscap_reporter reporter, void *arg); 00179 void oscap_reporter_switch_ctxt_free(struct oscap_reporter_switch_ctxt *ctxt); 00181 int oscap_reporter_switch(const struct oscap_reporter_message *msg, void *arg); 00182 00183 #endif // OSCAP_REPORTER_H_