00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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_