Open SCAP Library: elements.h Source File

Open SCAP Library

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

XCCDF/elements.h
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
23 #ifndef XCCDF_ELEMENTS_H_
24 #define XCCDF_ELEMENTS_H_
25
26 #include <stdbool.h>
27 #include <time.h>
28
29 #include "common/util.h"
30 #include "common/elements.h"
31 #include "common/_error.h"
32
33 #include <libxml/xmlreader.h>
34
35 OSCAP_HIDDEN_START;
36
42 const struct xccdf_version_info* xccdf_detect_version_parser(xmlTextReaderPtr reader);
43
49 char *xccdf_detect_version_priv(xmlTextReader *reader);
50
54 bool xccdf_is_supported_namespace(xmlNs *ns);
55 int xccdf_version_cmp(const struct xccdf_version_info *actual, const char *desired);
56
57 typedef enum {
58 XCCDFE_ERROR = -1,
59 XCCDFE_UNMATCHED = 0,
60
61 // XCCDF 1.1+ elements
62 XCCDFE_BENCHMARK,
63 XCCDFE_GROUP,
64 XCCDFE_RULE,
65 XCCDFE_VALUE,
66 XCCDFE_PROFILE,
67 XCCDFE_TESTRESULT,
68 XCCDFE_RESULT_BENCHMARK,
69 XCCDFE_CHECK,
70 XCCDFE_CHECK_IMPORT,
71 XCCDFE_CHECK_EXPORT,
72 XCCDFE_CHECK_CONTENT,
73 XCCDFE_CHECK_CONTENT_REF,
74 XCCDFE_CHOICES,
75 XCCDFE_CHOICE,
76 XCCDFE_COMPLEX_CHECK,
77 XCCDFE_CONFLICTS,
78 XCCDFE_CPE_LIST,
79 XCCDFE_DC_STATUS,
80 XCCDFE_DEFAULT,
81 XCCDFE_DESCRIPTION,
82 XCCDFE_FACT,
83 XCCDFE_FIX,
84 XCCDFE_FIXTEXT,
85 XCCDFE_FRONT_MATTER,
86 XCCDFE_IDENT,
87 XCCDFE_IDENTITY,
88 XCCDFE_IMPACT_METRIC,
89 XCCDFE_INSTANCE,
90 XCCDFE_LOWER_BOUND,
91 XCCDFE_MATCH,
92 XCCDFE_MESSAGE,
93 XCCDFE_METADATA,
94 XCCDFE_MODEL,
95 XCCDFE_NEW_RESULT,
96 XCCDFE_NOTICE,
97 XCCDFE_OLD_RESULT,
98 XCCDFE_ORGANIZATION,
99 XCCDFE_OVERRIDE,
100 XCCDFE_PARAM,
101 XCCDFE_PLAIN_TEXT,
102 XCCDFE_PLATFORM,
103 XCCDFE_CPE2_PLATFORMSPEC,
104 XCCDFE_RESULT_PROFILE,
105 XCCDFE_PROFILE_NOTE,
106 XCCDFE_QUESTION,
107 XCCDFE_RATIONALE,
108 XCCDFE_REAR_MATTER,
109 XCCDFE_REFERENCE,
110 XCCDFE_REFINE_RULE,
111 XCCDFE_REFINE_VALUE,
112 XCCDFE_REMARK,
113 XCCDFE_REQUIRES,
114 XCCDFE_RESULT,
115 XCCDFE_RULE_RESULT,
116 XCCDFE_SCORE,
117 XCCDFE_SELECT,
118 XCCDFE_SET_VALUE,
119 XCCDFE_SIGNATURE,
120 XCCDFE_SOURCE,
121 XCCDFE_STATUS,
122 XCCDFE_SUB,
123 XCCDFE_TAILORING,
124 XCCDFE_TARGET,
125 XCCDFE_TARGET_ADDRESS,
126 XCCDFE_TARGET_FACTS,
127 XCCDFE_TARGET_IDENTIFIER,
128 XCCDFE_TITLE,
129 XCCDFE_UPPER_BOUND,
130 XCCDFE_VALUE_VAL,
131 XCCDFE_VERSION,
132 XCCDFE_WARNING,
134 XCCDFE_BENCHMARK_REF = XCCDFE_RESULT_BENCHMARK,
135
136 XCCDFE_END_
137 } xccdf_element_t;
138
139 const char *xccdf_element_to_str(xccdf_element_t element);
140 xccdf_element_t xccdf_element_get(xmlTextReaderPtr reader);
141
142 #define XCCDF_ASSERT_ELEMENT(reader, element) do { if (xccdf_element_get(reader) != element) { oscap_seterr(OSCAP_EFAMILY_XCCDF, "Find element '%s' while expecting element: '%s'", xccdf_element_to_str((xccdf_element_get(reader))), xccdf_element_to_str(element)); return false; } } while(false)
143
144 typedef enum {
145 XCCDFA_NONE,
146 XCCDFA_ABSTRACT,
147 XCCDFA_AUTHENTICATED,
148 XCCDFA_AUTHORITY,
149 XCCDFA_CATEGORY,
150 XCCDFA_CLUSTER_ID,
151 XCCDFA_COMPLEXITY,
152 XCCDFA_CONTEXT,
153 XCCDFA_DATE,
154 XCCDFA_DISRUPTION,
155 XCCDFA_END_TIME,
156 XCCDFA_EXPORT_NAME,
157 XCCDFA_EXTENDS,
158 XCCDFA_FIXREF,
159 XCCDFA_HIDDEN,
160 XCCDFA_HREF,
161 XCCDFA_ID,
162 XCCDFA_IDREF,
163 XCCDFA_IID,
164 XCCDFA_IMPORT_NAME,
165 XCCDFA_IMPORT_XPATH,
166 XCCDFA_INTERACTIVE,
167 XCCDFA_INTERFACEHINT,
168 XCCDFA_MAXIMUM,
169 XCCDFA_MULTICHECK,
170 XCCDFA_MULTIPLE,
171 XCCDFA_MUSTMATCH,
172 XCCDFA_NAME,
173 XCCDFA_NEGATE,
174 XCCDFA_NOTE_TAG,
175 XCCDFA_OPERATOR,
176 XCCDFA_OVERRIDE,
177 XCCDFA_PARENTCONTEXT,
178 XCCDFA_PLATFORM,
179 XCCDFA_PRIVILEDGED,
180 XCCDFA_PROHIBITCHANGES,
181 XCCDFA_REBOOT,
182 XCCDFA_RESOLVED,
183 XCCDFA_ROLE,
184 XCCDFA_SELECTED,
185 XCCDFA_SELECTOR,
186 XCCDFA_SEVERITY,
187 XCCDFA_START_TIME,
188 XCCDFA_STRATEGY,
189 XCCDFA_STYLE,
190 XCCDFA_STYLE_HREF,
191 XCCDFA_SYSTEM,
192 XCCDFA_TAG,
193 XCCDFA_TEST_SYSTEM,
194 XCCDFA_TIME,
195 XCCDFA_TYPE,
196 XCCDFA_UPDATE,
197 XCCDFA_URI,
198 XCCDFA_VALUE_ID,
199 XCCDFA_VERSION,
200 XCCDFA_WEIGHT,
201 XCCDFA_END_
202 } xccdf_attribute_t;
203
204 bool xccdf_attribute_has(xmlTextReaderPtr reader, xccdf_attribute_t attr);
205 const char *xccdf_attribute_get(xmlTextReaderPtr reader, xccdf_attribute_t attr);
206 char *xccdf_attribute_copy(xmlTextReaderPtr reader, xccdf_attribute_t attr);
207 bool xccdf_attribute_get_bool(xmlTextReaderPtr reader, xccdf_attribute_t attr);
208 int xccdf_attribute_get_int(xmlTextReaderPtr reader, xccdf_attribute_t attr);
209 float xccdf_attribute_get_float(xmlTextReaderPtr reader, xccdf_attribute_t attr);
210
211 extern const struct oscap_string_map XCCDF_BOOL_MAP[];
212
213 void xccdf_print_depth(int depth);
214 void xccdf_print_max(const char *str, int max, const char *ellipsis);
215 void xccdf_print_max_text(const struct oscap_text *txt, int max, const char *ellipsis);
216 void xccdf_print_textlist(struct oscap_text_iterator *txt, int depth, int max, const char *ellipsis);
217
218 xmlNs *lookup_xccdf_ns(xmlDoc *doc, xmlNode *parent, const struct xccdf_version_info *version_info);
219
220 OSCAP_HIDDEN_END;
221
222 #endif
oscap_string_map
Define mapping between symbolic constant and its string representation.
Definition: util.h:309
xccdf_version_info
Definition: XCCDF/elements.c:43
oscap_text_iterator
Internationalized string iterator.
oscap_text
Representation of internationalizable character strings.
Definition: text_priv.h:47