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
00060 #define OSCAP_FOREACH_GENERIC(itype, vtype, val, init_val, code) \
00061 { \
00062 struct itype##_iterator *val##_iter = (init_val); \
00063 vtype val; \
00064 while (itype##_iterator_has_more(val##_iter)) { \
00065 val = itype##_iterator_next(val##_iter); \
00066 code \
00067 } \
00068 itype##_iterator_free(val##_iter); \
00069 }
00070
00079 #define OSCAP_FOREACH(type, val, init_val, code) \
00080 OSCAP_FOREACH_GENERIC(type, struct type *, val, init_val, code)
00081
00089 #define OSCAP_FOREACH_STR(val, init_val, code) \
00090 OSCAP_FOREACH_GENERIC(oscap_string, const char *, val, init_val, code)
00091
00107 struct xml_metadata;
00108
00110 struct xml_metadata *xml_metadata_new(void);
00111
00113 const char *xml_metadata_get_nspace(const struct xml_metadata *xml);
00115 const char *xml_metadata_get_lang(const struct xml_metadata *xml);
00117 const char *xml_metadata_get_URI(const struct xml_metadata *xml);
00118
00120 bool xml_metadata_set_nspace(struct xml_metadata *xml, const char *new_namespace);
00122 bool xml_metadata_set_lang(struct xml_metadata *xml, const char *new_lang);
00124 bool xml_metadata_set_URI(struct xml_metadata *xml, const char *new_uri);
00125
00127 void xml_metadata_free(struct xml_metadata *xml);
00128
00129
00130
00136 struct xml_metadata_iterator;
00140 struct xml_metadata *xml_metadata_iterator_next(struct xml_metadata_iterator *it);
00144 bool xml_metadata_iterator_has_more(struct xml_metadata_iterator *it);
00148 void xml_metadata_iterator_free(struct xml_metadata_iterator *it);
00149
00153 void xml_metadata_iterator_remove(struct xml_metadata_iterator *it);
00154
00170 struct oscap_string_iterator;
00172 const char *oscap_string_iterator_next(struct oscap_string_iterator *it);
00174 bool oscap_string_iterator_has_more(struct oscap_string_iterator *it);
00176 void oscap_string_iterator_free(struct oscap_string_iterator *it);
00178 void oscap_string_iterator_remove(struct oscap_string_iterator *it);
00179
00184 struct oscap_stringlist;
00186 struct oscap_string_iterator *oscap_stringlist_get_strings(const struct oscap_stringlist* list);
00188 bool oscap_stringlist_add_string(struct oscap_stringlist* list, const char *str);
00189
00195 struct oscap_stringlist_iterator;
00197 struct oscap_stringlist *oscap_stringlist_iterator_next(struct oscap_stringlist_iterator *it);
00199 bool oscap_stringlist_iterator_has_more(struct oscap_stringlist_iterator *it);
00201 void oscap_stringlist_iterator_free(struct oscap_stringlist_iterator *it);
00203 void oscap_stringlist_iterator_remove(struct oscap_stringlist_iterator *it);
00204
00209 struct oscap_title;
00210
00215 const char *oscap_title_get_content(const struct oscap_title *title);
00216
00221 const char *oscap_title_get_language(const struct oscap_title *title);
00222
00227 bool oscap_title_set_content(struct oscap_title *title, const char *new_content);
00228
00234 struct oscap_title_iterator;
00236 struct oscap_title *oscap_title_iterator_next(struct oscap_title_iterator *it);
00238 void oscap_title_iterator_free(struct oscap_title_iterator *it);
00240 bool oscap_title_iterator_has_more(struct oscap_title_iterator *it);
00242 void oscap_title_iterator_remove(struct oscap_title_iterator *it);
00243
00253 void oscap_cleanup(void);
00254
00255
00265 struct oscap_export_target;
00269 struct oscap_import_source;
00270
00274 typedef enum {
00275 OSCAP_STREAM_UNKNOWN = 0,
00276 OSCAP_STREAM_FILE = 1,
00277 OSCAP_STREAM_URL = 2,
00278 } oscap_stream_type_t;
00279
00284 oscap_stream_type_t oscap_import_source_get_type(const struct oscap_import_source *item);
00285
00290 const char *oscap_import_source_get_name(const struct oscap_import_source *item);
00291
00296 oscap_stream_type_t oscap_export_target_get_type(const struct oscap_export_target *item);
00297
00302 const char *oscap_export_target_get_name(const struct oscap_export_target *item);
00303
00308 const char *oscap_export_target_get_encoding(const struct oscap_export_target *item);
00309
00314 int oscap_export_target_get_indent(const struct oscap_export_target *item);
00315
00320 const char *oscap_export_target_get_indent_string(const struct oscap_export_target *item);
00321
00326 struct oscap_import_source *oscap_import_source_new_file(const char *filename, const char *encoding);
00327
00332 struct oscap_import_source *oscap_import_source_new_URL(const char *url, const char *encoding);
00333
00338 void oscap_import_source_free(struct oscap_import_source *target);
00339
00344 struct oscap_export_target *oscap_export_target_new_file(const char *filename, const char *encoding);
00345
00350 struct oscap_export_target *oscap_export_target_new_URL(const char *url, const char *encoding);
00351
00356 void oscap_export_target_free(struct oscap_export_target *target);
00357
00360 #endif