Open SCAP Library
oscap.h
Go to the documentation of this file.
1 /*
2  * Copyright 2009 Red Hat Inc., Durham, North Carolina.
3  * All Rights Reserved.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Authors:
20  * Lukas Kuklinek <lkuklinek@redhat.com>
21  */
22 
32 #ifndef OSCAP_H_
33 #define OSCAP_H_
34 #include <stdbool.h>
35 #include <wchar.h>
36 
37 #include "text.h"
38 #include "reference.h"
39 #include "reporter.h"
40 
41 
65 #define OSCAP_FOREACH_GENERIC(itype, vtype, val, init_val, code) \
66  { \
67  struct itype##_iterator *val##_iter = (init_val); \
68  vtype val; \
69  while (itype##_iterator_has_more(val##_iter)) { \
70  val = itype##_iterator_next(val##_iter); \
71  code \
72  } \
73  itype##_iterator_free(val##_iter); \
74  }
75 
84 #define OSCAP_FOREACH(type, val, init_val, code) \
85  OSCAP_FOREACH_GENERIC(type, struct type *, val, init_val, code)
86 
94 #define OSCAP_FOREACH_STR(val, init_val, code) \
95  OSCAP_FOREACH_GENERIC(oscap_string, const char *, val, init_val, code)
96 
108 #define OSCAP_FOR_GENERIC(itype, vtype, val, init_val) \
109  vtype val = NULL; struct itype##_iterator *val##_iter = (init_val); \
110  while (itype##_iterator_has_more(val##_iter) \
111  ? (val = itype##_iterator_next(val##_iter), true) \
112  : (itype##_iterator_free(val##_iter), val##_iter = NULL, false))
113 
121 #define OSCAP_FOR(type, val, init_val) OSCAP_FOR_GENERIC(type, struct type *, val, init_val)
122 
129 #define OSCAP_FOR_STR(val, init_val) OSCAP_FOR_GENERIC(oscap_string, const char *, val, init_val)
130 
133 
134 extern const char * const OSCAP_OS_PATH_DELIM;
135 
137 extern const char * const OSCAP_SCHEMA_PATH;
138 
140 extern const char * const OSCAP_XSLT_PATH;
141 
142 
152 void oscap_init(void);
153 
161 void oscap_cleanup(void);
162 
164 const char *oscap_get_version(void);
165 
166 
173 
174 typedef enum oscap_document_type {
187 
188 
206 int oscap_validate_document(const char *xmlfile, oscap_document_type_t doctype, const char *version, oscap_reporter reporter, void *arg);
207 
221 int oscap_schematron_validate_document(const char *xmlfile, oscap_document_type_t doctype, const char *version, const char *outfile);
222 
236 int oscap_apply_xslt(const char *xmlfile, const char *xsltfile, const char *outfile, const char **params);
237 
251 int oscap_apply_xslt_var(const char *xmlfile, const char *xsltfile, const char *outfile, const char **params, const char *pathvar, const char *defpath);
252 
253 /************************************************************/
258 #endif