Open SCAP Library
|
00001 /* 00002 * Copyright 2009 Red Hat Inc., Durham, North Carolina. 00003 * All Rights Reserved. 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 * 00019 * Authors: 00020 * Lukas Kuklinek <lkuklinek@redhat.com> 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_XCCDF, 00180 OSCAP_DOCUMENT_CPE_LANGUAGE, 00181 OSCAP_DOCUMENT_CPE_DICTIONARY, 00182 } oscap_document_type_t; 00183 00184 00202 bool oscap_validate_document(const char *xmlfile, oscap_document_type_t doctype, const char *version, oscap_reporter reporter, void *arg); 00203 00217 bool oscap_apply_xslt(const char *xmlfile, const char *xsltfile, const char *outfile, const char **params); 00218 00232 bool oscap_apply_xslt_var(const char *xmlfile, const char *xsltfile, const char *outfile, const char **params, const char *pathvar, const char *defpath); 00233 00234 /************************************************************/ 00239 #endif