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 "reporter.h"
00039
00063 #define OSCAP_FOREACH_GENERIC(itype, vtype, val, init_val, code) \
00064 { \
00065 struct itype##_iterator *val##_iter = (init_val); \
00066 vtype val; \
00067 while (itype##_iterator_has_more(val##_iter)) { \
00068 val = itype##_iterator_next(val##_iter); \
00069 code \
00070 } \
00071 itype##_iterator_free(val##_iter); \
00072 }
00073
00082 #define OSCAP_FOREACH(type, val, init_val, code) \
00083 OSCAP_FOREACH_GENERIC(type, struct type *, val, init_val, code)
00084
00092 #define OSCAP_FOREACH_STR(val, init_val, code) \
00093 OSCAP_FOREACH_GENERIC(oscap_string, const char *, val, init_val, code)
00094
00106 #define OSCAP_FOR_GENERIC(itype, vtype, val, init_val) \
00107 vtype val = NULL; struct itype##_iterator *val##_iter = (init_val); \
00108 while (itype##_iterator_has_more(val##_iter) \
00109 ? (val = itype##_iterator_next(val##_iter), true) \
00110 : (itype##_iterator_free(val##_iter), val##_iter = NULL, false))
00111
00119 #define OSCAP_FOR(type, val, init_val) OSCAP_FOR_GENERIC(type, struct type *, val, init_val)
00120
00127 #define OSCAP_FOR_STR(val, init_val) OSCAP_FOR_GENERIC(oscap_string, const char *, val, init_val)
00128
00144 struct xml_metadata;
00145
00151 struct xml_metadata_iterator;
00152
00157 struct xml_metadata *xml_metadata_new(void);
00158
00159
00171 const char *xml_metadata_get_nspace(const struct xml_metadata *xml);
00172
00177 const char *xml_metadata_get_lang(const struct xml_metadata *xml);
00178
00183 const char *xml_metadata_get_URI(const struct xml_metadata *xml);
00184
00185
00188
00200 bool xml_metadata_set_nspace(struct xml_metadata *xml, const char *new_namespace);
00201
00206 bool xml_metadata_set_lang(struct xml_metadata *xml, const char *new_lang);
00207
00212 bool xml_metadata_set_URI(struct xml_metadata *xml, const char *new_uri);
00213
00214
00221 void xml_metadata_free(struct xml_metadata *xml);
00222
00223
00230
00231 struct xml_metadata *xml_metadata_iterator_next(struct xml_metadata_iterator *it);
00232
00234 bool xml_metadata_iterator_has_more(struct xml_metadata_iterator *it);
00235
00237 void xml_metadata_iterator_free(struct xml_metadata_iterator *it);
00238
00240 void xml_metadata_iterator_remove(struct xml_metadata_iterator *it);
00241
00242
00243
00254 void oscap_cleanup(void);
00255
00256
00267 struct oscap_nsinfo;
00274 struct oscap_nsinfo_entry;
00280 struct oscap_nsinfo_entry_iterator;
00281
00283 struct oscap_nsinfo *oscap_nsinfo_new(void);
00285 struct oscap_nsinfo *oscap_nsinfo_new_file(const char *fname);
00287 void oscap_nsinfo_free(struct oscap_nsinfo *info);
00288
00289
00295
00296 struct oscap_nsinfo_entry_iterator *oscap_nsinfo_get_entries(const struct oscap_nsinfo *item);
00298 struct oscap_nsinfo_entry *oscap_nsinfo_get_root_entry(const struct oscap_nsinfo *item);
00300 struct oscap_nsinfo_entry *oscap_nsinfo_get_entry_by_ns(struct oscap_nsinfo *info, const char *ns);
00301
00310
00311 bool oscap_nsinfo_add_entry(struct oscap_nsinfo *obj, struct oscap_nsinfo_entry *item);
00313 bool oscap_nsinfo_set_root_entry(struct oscap_nsinfo *obj, struct oscap_nsinfo_entry *newval);
00314
00318
00319 struct oscap_nsinfo_entry *oscap_nsinfo_entry_new(void);
00321 struct oscap_nsinfo_entry *oscap_nsinfo_entry_new_fill(const char *nsprefix, const char *nsname);
00323 void oscap_nsinfo_entry_free(struct oscap_nsinfo_entry *entry);
00324
00330
00331 const char *oscap_nsinfo_entry_get_nsname(const struct oscap_nsinfo_entry *item);
00333 const char *oscap_nsinfo_entry_get_nsprefix(const struct oscap_nsinfo_entry *item);
00335 const char *oscap_nsinfo_entry_get_schema_location(const struct oscap_nsinfo_entry *item);
00336
00345
00346 bool oscap_nsinfo_entry_set_nsname(struct oscap_nsinfo_entry *obj, const char *newval);
00348 bool oscap_nsinfo_entry_set_nsprefix(struct oscap_nsinfo_entry *obj, const char *newval);
00350 bool oscap_nsinfo_entry_set_schema_location(struct oscap_nsinfo_entry *obj, const char *newval);
00351
00354
00359
00360 bool oscap_nsinfo_entry_iterator_has_more(struct oscap_nsinfo_entry_iterator *it);
00362 struct oscap_nsinfo_entry *oscap_nsinfo_entry_iterator_next(struct oscap_nsinfo_entry_iterator *it);
00364 void oscap_nsinfo_entry_iterator_free(struct oscap_nsinfo_entry_iterator *it);
00365
00372
00373 bool oscap_validate_xml(const char *xmlfile, const char *schemafile, struct oscap_reporter* reporter);
00374
00379 #endif