00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00029 #ifndef OSCAP_H_
00030 #define OSCAP_H_
00031 #include <stdbool.h>
00032
00045 #define OSCAP_FOREACH_GENERIC(itype, vtype, val, init_val, code) \
00046 { \
00047 struct itype##_iterator *val##_iter = (init_val); \
00048 vtype val; \
00049 while (itype##_iterator_has_more(val##_iter)) { \
00050 val = itype##_iterator_next(val##_iter); \
00051 code \
00052 } \
00053 itype##_iterator_free(val##_iter); \
00054 }
00055
00064 #define OSCAP_FOREACH(type, val, init_val, code) \
00065 OSCAP_FOREACH_GENERIC(type, struct type *, val, init_val, code)
00066
00074 #define OSCAP_FOREACH_STR(val, init_val, code) \
00075 OSCAP_FOREACH_GENERIC(oscap_string, const char *, val, init_val, code)
00076
00077
00078
00079
00080
00081 struct xml_metadata {
00082 char *namespace;
00083 char *URI;
00084 char *lang;
00085 };
00086
00087 struct xml_metadata *xml_metadata_new(void);
00088
00089 const char *xml_metadata_get_namespace(const struct xml_metadata *xml);
00090 const char *xml_metadata_get_lang(const struct xml_metadata *xml);
00091 const char *xml_metadata_get_URI(const struct xml_metadata *xml);
00092
00093 bool xml_metadata_set_namespace(struct xml_metadata *xml, const char *new_namespace);
00094 bool xml_metadata_set_lang(struct xml_metadata *xml, const char *new_lang);
00095 bool xml_metadata_set_URI(struct xml_metadata *xml, const char *new_uri);
00096
00097 void xml_metadata_free(struct xml_metadata *xml);
00098
00104 struct xml_metadata_iterator;
00108 struct xml_metadata *xml_metadata_iterator_next(struct xml_metadata_iterator *it);
00112 bool xml_metadata_iterator_has_more(struct xml_metadata_iterator *it);
00116 void xml_metadata_iterator_free(struct xml_metadata_iterator *it);
00117
00121 void xml_metadata_iterator_remove(struct xml_metadata_iterator *it);
00122
00127 struct oscap_string_iterator;
00129 const char *oscap_string_iterator_next(struct oscap_string_iterator *it);
00131 bool oscap_string_iterator_has_more(struct oscap_string_iterator *it);
00133 void oscap_string_iterator_free(struct oscap_string_iterator *it);
00135 void oscap_string_iterator_remove(struct oscap_string_iterator *it);
00136
00141 struct oscap_title;
00142
00147 const char *oscap_title_get_content(const struct oscap_title *title);
00148
00153 const char *oscap_title_get_language(const struct oscap_title *title);
00154
00159 bool oscap_title_set_content(struct oscap_title *title, const char *new_content);
00160
00166 struct oscap_title_iterator;
00168 struct oscap_title *oscap_title_iterator_next(struct oscap_title_iterator *it);
00170 void oscap_title_iterator_free(struct oscap_title_iterator *it);
00172 bool oscap_title_iterator_has_more(struct oscap_title_iterator *it);
00174 void oscap_title_iterator_remove(struct oscap_title_iterator *it);
00175
00183 void oscap_cleanup(void);
00184
00187 struct oscap_export_target;
00190 struct oscap_import_source;
00191
00192 typedef enum {
00193 OSCAP_STREAM_UNKNOWN = 0,
00194 OSCAP_STREAM_FILE = 1,
00195 OSCAP_STREAM_URL = 2,
00196 } oscap_stream_type_t;
00197
00200 oscap_stream_type_t oscap_import_source_get_type(const struct oscap_import_source *item);
00201
00204 const char *oscap_import_source_get_name(const struct oscap_import_source *item);
00205
00208 oscap_stream_type_t oscap_export_target_get_type(const struct oscap_export_target *item);
00212 const char *oscap_export_target_get_name(const struct oscap_export_target *item);
00216 const char *oscap_export_target_get_encoding(const struct oscap_export_target *item);
00220 int oscap_export_target_get_indent(const struct oscap_export_target *item);
00224 const char *oscap_export_target_get_indent_string(const struct oscap_export_target *item);
00228 struct oscap_import_source *oscap_import_source_new_file(const char *filename, const char *encoding);
00232 struct oscap_import_source *oscap_import_source_new_URL(const char *url, const char *encoding);
00236 void oscap_import_source_free(struct oscap_import_source *target);
00240 struct oscap_export_target *oscap_export_target_new_file(const char *filename, const char *encoding);
00244 struct oscap_export_target *oscap_export_target_new_URL(const char *url, const char *encoding);
00248 void oscap_export_target_free(struct oscap_export_target *target);
00249
00250 #endif