00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00032 #ifndef OSCAP_H_
00033 #define OSCAP_H_
00034 #include <stdbool.h>
00035 #include <wchar.h>
00036
00037 #include "text.h"
00038 #include "reference.h"
00039 #include "reporter.h"
00040
00041
00065 #define OSCAP_FOREACH_GENERIC(itype, vtype, val, init_val, code) \
00066 { \
00067 struct itype##_iterator *val##_iter = (init_val); \
00068 vtype val; \
00069 while (itype##_iterator_has_more(val##_iter)) { \
00070 val = itype##_iterator_next(val##_iter); \
00071 code \
00072 } \
00073 itype##_iterator_free(val##_iter); \
00074 }
00075
00084 #define OSCAP_FOREACH(type, val, init_val, code) \
00085 OSCAP_FOREACH_GENERIC(type, struct type *, val, init_val, code)
00086
00094 #define OSCAP_FOREACH_STR(val, init_val, code) \
00095 OSCAP_FOREACH_GENERIC(oscap_string, const char *, val, init_val, code)
00096
00108 #define OSCAP_FOR_GENERIC(itype, vtype, val, init_val) \
00109 vtype val = NULL; struct itype##_iterator *val##_iter = (init_val); \
00110 while (itype##_iterator_has_more(val##_iter) \
00111 ? (val = itype##_iterator_next(val##_iter), true) \
00112 : (itype##_iterator_free(val##_iter), val##_iter = NULL, false))
00113
00121 #define OSCAP_FOR(type, val, init_val) OSCAP_FOR_GENERIC(type, struct type *, val, init_val)
00122
00129 #define OSCAP_FOR_STR(val, init_val) OSCAP_FOR_GENERIC(oscap_string, const char *, val, init_val)
00130
00133
00134 extern const char * const OSCAP_OS_PATH_DELIM;
00135
00137 extern const char * const OSCAP_SCHEMA_PATH;
00138
00140 extern const char * const OSCAP_XSLT_PATH;
00141
00142
00152 void oscap_init(void);
00153
00161 void oscap_cleanup(void);
00162
00164 const char *oscap_get_version(void);
00165
00166
00173
00174 typedef enum oscap_document_type {
00175 OSCAP_DOCUMENT_OVAL_DEFINITIONS = 1,
00176 OSCAP_DOCUMENT_OVAL_VARIABLES,
00177 OSCAP_DOCUMENT_OVAL_SYSCHAR,
00178 OSCAP_DOCUMENT_OVAL_RESULTS,
00179 OSCAP_DOCUMENT_OVAL_DIRECTIVES,
00180 OSCAP_DOCUMENT_XCCDF,
00181 OSCAP_DOCUMENT_CPE_LANGUAGE,
00182 OSCAP_DOCUMENT_CPE_DICTIONARY,
00183 OSCAP_DOCUMENT_SCE_RESULT,
00184 } oscap_document_type_t;
00185
00186
00204 bool oscap_validate_document(const char *xmlfile, oscap_document_type_t doctype, const char *version, oscap_reporter reporter, void *arg);
00205
00219 bool oscap_apply_xslt(const char *xmlfile, const char *xsltfile, const char *outfile, const char **params);
00220
00234 bool oscap_apply_xslt_var(const char *xmlfile, const char *xsltfile, const char *outfile, const char **params, const char *pathvar, const char *defpath);
00235
00236
00241 #endif