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_USER_START = 1024
00078 } oscap_reporter_family_t;
00079
00081 typedef unsigned int oscap_reporter_code_t;
00082
00084 extern const oscap_reporter_code_t OSCAP_REPORTER_CODE_MAX;
00085
00090 struct oscap_reporter_message;
00091
00095 typedef int (*oscap_reporter)(const struct oscap_reporter_message *msg, void *arg);
00096
00097
00099 struct oscap_reporter_message *oscap_reporter_message_new(void);
00101 struct oscap_reporter_message *oscap_reporter_message_new_fill(oscap_reporter_family_t family, oscap_reporter_code_t code, const char *string);
00103 struct oscap_reporter_message *oscap_reporter_message_new_fmt(oscap_reporter_family_t family, oscap_reporter_code_t code, const char *fmt, ...);
00105 struct oscap_reporter_message *oscap_reporter_message_clone(const struct oscap_reporter_message *msg);
00107 oscap_reporter_family_t oscap_reporter_message_get_family(const struct oscap_reporter_message *item);
00109 oscap_reporter_code_t oscap_reporter_message_get_code(const struct oscap_reporter_message *item);
00111 const char *oscap_reporter_message_get_string(const struct oscap_reporter_message *item);
00112
00114 const char *oscap_reporter_message_get_user1str(const struct oscap_reporter_message *msg);
00116 int oscap_reporter_message_get_user1num(const struct oscap_reporter_message *msg);
00118 void *oscap_reporter_message_get_user1ptr(const struct oscap_reporter_message *msg);
00120 const char *oscap_reporter_message_get_user2str(const struct oscap_reporter_message *msg);
00122 int oscap_reporter_message_get_user2num(const struct oscap_reporter_message *msg);
00124 void *oscap_reporter_message_get_user2ptr(const struct oscap_reporter_message *msg);
00126 const char *oscap_reporter_message_get_user3str(const struct oscap_reporter_message *msg);
00128 int oscap_reporter_message_get_user3num(const struct oscap_reporter_message *msg);
00130 void *oscap_reporter_message_get_user3ptr(const struct oscap_reporter_message *msg);
00131
00132
00138 int oscap_reporter_dispatch(oscap_reporter reporter, const struct oscap_reporter_message *msg, void *arg);
00139
00147 int oscap_reporter_report(oscap_reporter reporter, struct oscap_reporter_message *msg, void *arg);
00148
00155 int oscap_reporter_report_fmt(oscap_reporter reporter, void *arg, oscap_reporter_family_t family, oscap_reporter_code_t code, const char *fmt, ...);
00156
00158 int oscap_reporter_fd(const struct oscap_reporter_message *msg, void *arg);
00159
00167 struct oscap_reporter_switch_ctxt;
00169 struct oscap_reporter_switch_ctxt *oscap_reporter_switch_ctxt_new(void);
00171 void oscap_reporter_switch_ctxt_add_range_reporter(struct oscap_reporter_switch_ctxt *ctxt, oscap_reporter reporter, void *arg,
00172 oscap_reporter_family_t family, oscap_reporter_code_t min_code, oscap_reporter_code_t max_code);
00174 void oscap_reporter_switch_ctxt_add_family_reporter(struct oscap_reporter_switch_ctxt *ctxt, oscap_reporter reporter, void *arg, oscap_reporter_family_t family);
00176 void oscap_reporter_switch_ctxt_add_reporter(struct oscap_reporter_switch_ctxt *ctxt, oscap_reporter reporter, void *arg);
00178 void oscap_reporter_switch_ctxt_free(struct oscap_reporter_switch_ctxt *ctxt);
00180 int oscap_reporter_switch(const struct oscap_reporter_message *msg, void *arg);
00181
00182 #endif // OSCAP_REPORTER_H_