Debian Codegraph @

src/OVAL/public/oval_definitions.h

raw symbols SCIP
1 /**
2 * @addtogroup OVAL
3 * @{
4 * @addtogroup OVALDEF
5 * Interface for Definition model.
6 * @{
7 *
8 * Class diagram
9 * \image html definition_model.png
10 *
11 * @file
12 *
13 * @author "David Niemoller" <[email protected]>
14 */
15
16 /*
17 * Copyright 2009-2014 Red Hat Inc., Durham, North Carolina.
18 * All Rights Reserved.
19 *
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License as published by the Free Software Foundation; either
23 * version 2.1 of the License, or (at your option) any later version.
24 *
25 * This library is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 * Lesser General Public License for more details.
29 *
30 * You should have received a copy of the GNU Lesser General Public
31 * License along with this library; if not, write to the Free Software
32 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33 *
34 * Authors:
35 * "David Niemoller" <[email protected]>
36 */
37
38
39 #ifndef OVAL_DEFINITIONS
40 #define OVAL_DEFINITIONS
41
42 #include "oscap.h"
43 #include "oscap_source.h"
44 #include "oval_adt.h"
45 #include "oval_types.h"
46 #include "oval_schema_version.h"
47 #include <stdbool.h>
48 #include "oscap_export.h"
49
50 /**
51 * Affected family enumeration.
52 * Since new family values can only be added with new version of the schema,
53 * the value OVAL_AFCFML_UNDEFINED is to be used when the desired family is not available
54 */
55 typedef enum {
56 OVAL_AFCFML_UNKNOWN = 0,
57 OVAL_AFCFML_CATOS = 1,
58 OVAL_AFCFML_IOS = 2,
59 OVAL_AFCFML_MACOS = 3,
60 OVAL_AFCFML_PIXOS = 4,
61 OVAL_AFCFML_UNDEFINED = 5,
62 OVAL_AFCFML_UNIX = 6,
63 OVAL_AFCFML_WINDOWS = 7
64 } oval_affected_family_t;
65
66 /// Criteria node type
67 typedef enum {
68 OVAL_NODETYPE_UNKNOWN = 0,
69 OVAL_NODETYPE_CRITERIA = 1,
70 OVAL_NODETYPE_CRITERION = 2,
71 OVAL_NODETYPE_EXTENDDEF = 3
72 } oval_criteria_node_type_t;
73
74 /// Boolean operators
75 typedef enum {
76 OVAL_OPERATOR_UNKNOWN = 0,
77 OVAL_OPERATOR_AND = 1,
78 OVAL_OPERATOR_ONE = 2,
79 OVAL_OPERATOR_OR = 3,
80 OVAL_OPERATOR_XOR = 4
81 } oval_operator_t;
82
83 /// Operations
84 typedef enum {
85 OVAL_OPERATION_UNKNOWN = 0,
86 OVAL_OPERATION_BITWISE_AND,
87 OVAL_OPERATION_BITWISE_OR,
88 OVAL_OPERATION_CASE_INSENSITIVE_EQUALS,
89 OVAL_OPERATION_CASE_INSENSITIVE_NOT_EQUAL,
90 OVAL_OPERATION_EQUALS,
91 OVAL_OPERATION_GREATER_THAN,
92 OVAL_OPERATION_GREATER_THAN_OR_EQUAL,
93 OVAL_OPERATION_LESS_THAN,
94 OVAL_OPERATION_LESS_THAN_OR_EQUAL,
95 OVAL_OPERATION_NOT_EQUAL,
96 OVAL_OPERATION_PATTERN_MATCH,
97 OVAL_OPERATION_SUBSET_OF,
98 OVAL_OPERATION_SUPERSET_OF,
99 } oval_operation_t;
100
101
102 /// Existence check enumeration
103 typedef enum {
104 OVAL_EXISTENCE_UNKNOWN = 0,
105 OVAL_ALL_EXIST = 1,
106 OVAL_ANY_EXIST = 2,
107 OVAL_AT_LEAST_ONE_EXISTS = 3,
108 OVAL_ONLY_ONE_EXISTS = 4,
109 OVAL_NONE_EXIST = 5
110 } oval_existence_t;
111
112 /// Check enumeration
113 typedef enum {
114 OVAL_CHECK_UNKNOWN = 0,
115 OVAL_CHECK_ALL = 1,
116 OVAL_CHECK_AT_LEAST_ONE = 2,
117 OVAL_CHECK_NONE_EXIST = 3,
118 OVAL_CHECK_NONE_SATISFY = 4,
119 OVAL_CHECK_ONLY_ONE = 5
120 } oval_check_t;
121
122 /// Type of object content
123 typedef enum {
124 OVAL_OBJECTCONTENT_UNKNOWN = 0,
125 OVAL_OBJECTCONTENT_ENTITY = 1,
126 OVAL_OBJECTCONTENT_SET = 2,
127 OVAL_OBJECTCONTENT_FILTER = 3
128 } oval_object_content_type_t;
129
130 /// Type of OVAL entity
131 typedef enum {
132 OVAL_ENTITY_TYPE_UNKNOWN,
133 OVAL_ENTITY_TYPE_ANY,
134 OVAL_ENTITY_TYPE_BINARY,
135 OVAL_ENTITY_TYPE_BOOLEAN,
136 OVAL_ENTITY_TYPE_FLOAT,
137 OVAL_ENTITY_TYPE_INTEGER,
138 OVAL_ENTITY_TYPE_STRING,
139 } oval_entity_type_t;
140
141 /// Type of filter action
142 typedef enum {
143 OVAL_FILTER_ACTION_UNKNOWN = 0,
144 OVAL_FILTER_ACTION_EXCLUDE,
145 OVAL_FILTER_ACTION_INCLUDE
146 } oval_filter_action_t;
147
148 /// Datatypes
149 typedef enum {
150 OVAL_DATATYPE_UNKNOWN = 0,
151 OVAL_DATATYPE_BINARY,
152 OVAL_DATATYPE_BOOLEAN,
153 OVAL_DATATYPE_EVR_STRING,
154 OVAL_DATATYPE_FILESET_REVISION,
155 OVAL_DATATYPE_FLOAT,
156 OVAL_DATATYPE_INTEGER,
157 OVAL_DATATYPE_IOS_VERSION,
158 OVAL_DATATYPE_IPV4ADDR,
159 OVAL_DATATYPE_IPV6ADDR,
160 OVAL_DATATYPE_RECORD,
161 OVAL_DATATYPE_SEXP,
162 OVAL_DATATYPE_STRING,
163 OVAL_DATATYPE_STRING_M,
164 OVAL_DATATYPE_VERSION,
165 OVAL_DATATYPE_DEBIAN_EVR_STRING
166 } oval_datatype_t;
167
168 /// Varref types
169 typedef enum {
170 OVAL_ENTITY_VARREF_UNKNOWN,
171 OVAL_ENTITY_VARREF_NONE,
172 OVAL_ENTITY_VARREF_ATTRIBUTE,
173 OVAL_ENTITY_VARREF_ELEMENT
174 } oval_entity_varref_type_t;
175
176 /// OVAL set object types
177 typedef enum {
178 OVAL_SET_UNKNOWN,
179 OVAL_SET_AGGREGATE,
180 OVAL_SET_COLLECTIVE
181 } oval_setobject_type_t;
182
183 /// Set operations
184 typedef enum {
185 OVAL_SET_OPERATION_UNKNOWN,
186 OVAL_SET_OPERATION_COMPLEMENT = 1,
187 OVAL_SET_OPERATION_INTERSECTION = 2,
188 OVAL_SET_OPERATION_UNION = 3
189 } oval_setobject_operation_t;
190
191 /// OVAL variable types
192 typedef enum {
193 OVAL_VARIABLE_UNKNOWN,
194 OVAL_VARIABLE_EXTERNAL,
195 OVAL_VARIABLE_CONSTANT,
196 OVAL_VARIABLE_LOCAL
197 } oval_variable_type_t;
198
199 #define OVAL_FUNCTION 4
200 /// Component types
201 typedef enum {
202 OVAL_COMPONENT_UNKNOWN = 0,
203 OVAL_COMPONENT_LITERAL = 1,
204 OVAL_COMPONENT_OBJECTREF = 2,
205 OVAL_COMPONENT_VARREF = 3,
206 OVAL_COMPONENT_FUNCTION = 4,
207 OVAL_FUNCTION_BEGIN = OVAL_FUNCTION + 1,
208 OVAL_FUNCTION_CONCAT = OVAL_FUNCTION + 2,
209 OVAL_FUNCTION_END = OVAL_FUNCTION + 3,
210 OVAL_FUNCTION_SPLIT = OVAL_FUNCTION + 4,
211 OVAL_FUNCTION_SUBSTRING = OVAL_FUNCTION + 5,
212 OVAL_FUNCTION_TIMEDIF = OVAL_FUNCTION + 6,
213 OVAL_FUNCTION_ESCAPE_REGEX = OVAL_FUNCTION + 7,
214 OVAL_FUNCTION_REGEX_CAPTURE = OVAL_FUNCTION + 8,
215 OVAL_FUNCTION_ARITHMETIC = OVAL_FUNCTION + 9,
216 OVAL_FUNCTION_COUNT = OVAL_FUNCTION + 10,
217 OVAL_FUNCTION_UNIQUE = OVAL_FUNCTION + 11,
218 OVAL_FUNCTION_GLOB_TO_REGEX = OVAL_FUNCTION + 12,
219 OVAL_FUNCTION_LAST = OVAL_FUNCTION + 13
220 } oval_component_type_t;
221
222 /// Arithmetic format enumeration
223 typedef enum {
224 OVAL_ARITHMETIC_UNKNOWN = 0,
225 OVAL_ARITHMETIC_ADD = 1,
226 OVAL_ARITHMETIC_MULTIPLY = 2,
227 OVAL_ARITHMETIC_SUBTRACT = 3, //NOT YET SUPPORTED BY OVAL
228 OVAL_ARITHMETIC_DIVIDE = 4 //NOT YET SUPPORTED BY OVAL
229 } oval_arithmetic_operation_t;
230
231 /// Datetime format enumeration.
232 typedef enum {
233 OVAL_DATETIME_UNKNOWN = 0,
234 OVAL_DATETIME_YEAR_MONTH_DAY = 1,
235 OVAL_DATETIME_MONTH_DAY_YEAR = 2,
236 OVAL_DATETIME_DAY_MONTH_YEAR = 3,
237 OVAL_DATETIME_WIN_FILETIME = 4,
238 OVAL_DATETIME_SECONDS_SINCE_EPOCH = 5,
239 OVAL_DATETIME_CIM_DATETIME = 6
240 } oval_datetime_format_t;
241
242 typedef enum {
243 OVAL_RECORD_FIELD_UNKNOWN = 0,
244 OVAL_RECORD_FIELD_STATE = 1,
245 OVAL_RECORD_FIELD_ITEM = 2,
246 } oval_record_field_type_t;
247
248 /**
249 * Get the family associated with a given subtype.
250 */
251 OSCAP_API oval_family_t oval_subtype_get_family(oval_subtype_t);
252 OSCAP_API const char *oval_operator_get_text(oval_operator_t);
253 OSCAP_API const char *oval_subtype_get_text(oval_subtype_t);
254 OSCAP_API const char *oval_subtype_to_str(oval_subtype_t);
255 OSCAP_API oval_subtype_t oval_subtype_from_str(const char *family_str, const char *subtype_str);
256 OSCAP_API const char *oval_family_get_text(oval_family_t);
257 OSCAP_API const char *oval_check_get_text(oval_check_t);
258 OSCAP_API const char *oval_existence_get_text(oval_existence_t);
259 OSCAP_API const char *oval_affected_family_get_text(oval_affected_family_t);
260 OSCAP_API const char *oval_datatype_get_text(oval_datatype_t);
261 OSCAP_API oval_datatype_t oval_datatype_from_text(const char *);
262 OSCAP_API const char *oval_operation_get_text(oval_operation_t);
263 OSCAP_API oval_operation_t oval_operation_from_text(const char *);
264 OSCAP_API const char *oval_set_operation_get_text(oval_setobject_operation_t);
265 OSCAP_API const char *oval_datetime_format_get_text(oval_datetime_format_t);
266 OSCAP_API const char *oval_arithmetic_operation_get_text(oval_arithmetic_operation_t);
267 OSCAP_API const char *oval_filter_action_get_text(oval_filter_action_t);
268
269
270 /**
271 * @struct oval_definition_model
272 * Oval definition model
273 */
274 struct oval_definition_model;
275
276 /**
277 * @struct oval_definition
278 * Oval definition specification.
279 * A definition is the key structure in OVAL. It is analogous to the logical sentence or proposition:
280 * if a computer's state matches the configuration parameters laid out in the criteria, then that computer exhibits the state described.
281 */
282 struct oval_definition;
283 /**
284 * @struct oval_definition_iterator
285 * @see oval_definition_model_get_definitions
286 */
287 struct oval_definition_iterator;
288 /**
289 * @struct oval_test
290 * An Oval_test specifies a technical control by identifying an @ref oval_object that is evaluated on an instrumented host platform and,
291 * optionally, an @ref Oval_state instance that matches the object query.
292 */
293 struct oval_test;
294 /**
295 * @struct oval_test_iterator
296 * @see oval_definition_model_get_tests
297 */
298 struct oval_test_iterator;
299 /**
300 * @struct oval_object
301 * An Oval_object instance describes a set of items to look for on an instrumented host platform.
302 * A simple object will usually result in a single file, process, etc being identified.
303 * But through the use pattern matches, sets, and variables, multiple matching objects can be identified.
304 * Therefore an OVAL Object can identify a set of many individual items on a system.
305 * This set of items defined by the OVAL Object can then be used by an OVAL Test and compared against an OVAL State.
306 */
307 struct oval_object;
308 /**
309 * @struct oval_object_iterator
310 * @see oval_definition_model_get_objects
311 */
312 struct oval_object_iterator;
313 /**
314 * @struct oval_state
315 * An Oval_state instance is a collection of one or more characteristics pertaining to a specific object type.
316 * The Oval_state is used by an during the evaluation of an Oval_test to determine if a set of items queried
317 * by an Oval_object on a instrumented host meet certain characteristics.
318 */
319 struct oval_state;
320 /**
321 * @struct oval_state_iterator
322 * @see oval_definition_model_get_states
323 */
324 struct oval_state_iterator;
325 /**
326 * @struct oval_variable
327 * An oval variable resolves an @ref oval_value stream which specifies constraints for @ref oval_object\b s and @ref oval_state\b s.
328 * - if @ref oval_variable_type == @ref OVAL_VARIABLE_EXTERNAL
329 * - The value stream is determined by @ref oval_definition_model_bind_variable_model
330 * - if @ref oval_variable_type == @ref OVAL_VARIABLE_CONSTANT
331 * - The value stream is determined by a set of specified constants (see @ref oval_variable_add_value)
332 * - if @ref oval_variable_type == @ref OVAL_VARIABLE_LOCAL
333 * - The value stream is specified by either a single component or a complex function, meaning that a value can be as simple as a literal string or as
334 * complex as multiple registry keys concatenated together.
335 * Note that if an individual component is used and it returns multiple values, then there will be multiple values associated with the Oval_local.
336 * For example, if an object is specified as the local source and it references a file object that identifies a set of 5 files,
337 * then the local variable would represent these 5 values.
338 */
339 struct oval_variable;
340 /**
341 * @struct oval_variable_possible_value
342 */
343 struct oval_variable_possible_value;
344 struct oval_variable_possible_value_iterator;
345 /**
346 * @struct oval_variable_possible_restriction
347 */
348 struct oval_variable_possible_restriction;
349 struct oval_variable_possible_restriction_iterator;
350 /**
351 * @struct oval_variable_restriction
352 */
353 struct oval_variable_restriction;
354 struct oval_variable_restriction_iterator;
355 /**
356 * @struct oval_variable_iterator
357 * @see oval_definition_model_get_variables
358 */
359 struct oval_variable_iterator;
360 /**
361 * @struct oval_affected
362 * Each OVAL Definition specifies certain type of affected system(s). The family, platform(s),
363 * and product(s) of this target are described by the Oval_affected component whose main purpose is to provide hints
364 * for tools using OVAL Definitions. For instance, to help a reporting tool only use Windows definitions,
365 * or to preselect only Red Hat definitions to be evaluated. Note, the inclusion of a particular platform
366 * or product does not mean the definition is physically checking for the existence of the platform or product.
367 * For the actual test to be performed, the correct test must still be included in the definition's criteria section.
368 *
369 * The AffectedType complex type details the specific system, application, subsystem, library, etc. for which a
370 * definition has been written. If a definition is not tied to a specific product, then this element should not
371 * be included. The absence of the platform or product element can be thought of as definition applying to
372 * all platforms or products. The inclusion of a particular platform or product does not mean the definition
373 * is physically checking for the existence of the platform or product. For the actual test to be performed,
374 * the correct test must still be included in the definition's criteria section. To increase the utility of this element,
375 * care should be taken when assigning and using strings for product names. The schema places no restrictions on the values
376 * that can be assigned, potentially leading to many different representations of the same value. For example
377 * 'Internet Explorer' and 'IE'. The current convention is to fully spell out all terms, and avoid the use of
378 * abbreviations at all costs.
379 */
380 struct oval_affected;
381 /**
382 * @struct oval_affected_iterator
383 * @see oval_definition_get_affected
384 */
385 struct oval_affected_iterator;
386 /**
387 * @struct oval_reference
388 * An Oval_reference links an @ref Oval_definition to a definitive external reference.
389 * For example, CVE Identifiers for vulnerabilities.
390 * The intended purpose for this reference is to link the definition to a variety of other sources that address the same
391 * issue being specified by the Oval_definition.
392 */
393 struct oval_reference;
394 /**
395 * @struct oval_reference_iterator
396 * @see oval_definition_get_references
397 */
398 struct oval_reference_iterator;
399 /**
400 * @struct oval_criteria_node
401 * Specify @ref oval_definition dependencies.
402 * An Oval_criteria_node specifies @ref oval_definition dependencies as follows:
403 * - if @ref oval_criteria_node_get_type == @ref OVAL_NODETYPE_CRITERIA - a hierarchic dependency on other Oval_criteria_nodes
404 * - if @ref oval_criteria_node_get_type == @ref OVAL_NODETYPE_CRITERION - an @ref oval_test dependency
405 * - if @ref oval_criteria_node_get_type == @ref OVAL_NODETYPE_EXTENDDEF - an @ref oval_definition dependency
406 */
407 struct oval_criteria_node;
408 /**
409 * @struct oval_criteria_node_iterator
410 * @see oval_criteria_node_get_subnodes
411 */
412 struct oval_criteria_node_iterator;
413 /**
414 * @struct oval_object_content
415 * An Oval_object_content instance specifies an @ref oval_object field.
416 */
417 struct oval_object_content;
418 /**
419 * @struct oval_object_content_iterator
420 * @see oval_object_get_object_contents
421 */
422 struct oval_object_content_iterator;
423 /**
424 * @struct oval_behavior
425 * OVAL behavior
426 */
427 struct oval_behavior;
428 /**
429 * @struct oval_behavior_iterator
430 * @see oval_object_get_behaviors
431 */
432 struct oval_behavior_iterator;
433 /**
434 * @struct oval_state_content
435 * An Oval_state_content instance specifies an @ref oval_state field.
436 */
437 struct oval_state_content;
438 /**
439 * @struct oval_state_content_iterator
440 * @see oval_state_get_contents
441 */
442 struct oval_state_content_iterator;
443 /**
444 * @struct oval_value
445 * OVAL object or item entity value
446 */
447 struct oval_value;
448 /**
449 * @struct oval_value_iterator
450 * @see oval_variable_get_values
451 */
452 struct oval_value_iterator;
453 /**
454 * @struct oval_entity
455 * OVAL entity
456 */
457 struct oval_entity;
458 /**
459 * @struct oval_entity_iterator
460 */
461 struct oval_entity_iterator;
462 /**
463 * @struct oval_record_field
464 */
465 struct oval_record_field;
466 /**
467 * @struct oval_record_field_iterator
468 */
469 struct oval_record_field_iterator;
470 /**
471 * @struct oval_setobject
472 * OVAL set object
473 */
474 struct oval_setobject;
475 /**
476 * @struct oval_setobject_iteraor
477 * @see oval_setobject_get_subsets
478 */
479 struct oval_setobject_iterator;
480 /**
481 * @struct oval_filter
482 * OVAL filter
483 */
484 struct oval_filter;
485 /**
486 * @struct oval_filter_iterator
487 */
488 struct oval_filter_iterator;
489 /**
490 * @struct oval_component
491 * OVAL variable component
492 * Oval_component instances specify evaluation constraints on local variables (see @ref oval_variable_get_type).
493 *
494 * - If @ref oval_component_get_type == @ref OVAL_FUNCTION_CONCAT - Concatenation function
495 * - Oval_function_CONCAT takes two or more components and sub-concatenates them together to form a single string.
496 * The first component makes up the begining of the resulting string and any following components are added to the end it.
497 * If one of the components returns multiple values then the concat function would be performed multiple times and the end result would be an array of values for the local variable.
498 * For example assume a local variable has two sub-components: a basic component element returns the values "abc" and "def", and a literal component element that has a value of "xyz".
499 * The local_variable element would be evaluated to have two values, "abcxyz" and "defxyz". If one of the components does not exist,
500 * then the result of the concat operation should be does not exist.
501 * - If @ref oval_component_get_type == @ref OVAL_FUNCTION_COUNT - Counting function.
502 * - The count function counts the values represented by one or more components as an integer. This function determines the total number of values referenced
503 * by all of thespecified sub-components.
504 * - If @ref oval_component_get_type == @ref OVAL_FUNCTION_ARITHMETIC - Arithmetic function.
505 * - The arithmetic function takes two or more integer or float components and performs a basic mathmetical function on them.
506 * The result of this function in a single integer or float unless one of the components returns multiple values.
507 * In this case the specified arithmetic function would be performed multiple times and the end result would be an array of values for the local variable.
508 * For example assume a local_variable specifies the arithmetic function with an arithmetic_operation of "add" and has two sub-components under this function:
509 * the first component returns multiple values "1" and "2", and the second component returns multiple values "3" and "4" and "5".
510 * The local_variable element would be evaluated to have six values: 1+3, 1+4, 1+5, 2+3, 2+4, and 2+5.
511 * - If @ref oval_component_get_type == @ref OVAL_FUNCTION_REGEX_CAPTURE - Regex_capture function.
512 * - The regex_capture function captures a single substring from a string component.
513 * The 'pattern' attribute provides a regular expression that must contain a single subexpression (using parentheses).
514 * The first match of the subexpression is considered the captured substring.
515 * For example, the pattern ^abc(.*)xyz$ would capture a substring from each of the string component's values if the value starts with abc and ends with xyz.
516 * In this case the subexpression would be all the characters that exist in between the abc and the xyz.
517 * If more than one subexpression is supplied only the first match is considered.
518 * If more than one match is identified by a single subexpression only the first match is considered.
519 * If no matches are found or a subexpression is not supplied the function will evaluate to an empty string.
520 * Note that subexpressions match the longest possible substrings.
521 * - If @ref oval_component_get_type == @ref OVAL_FUNCTION_BEGIN - Begin function
522 * - The begin function takes a single string component and defines a character (or string) that the component string should start with.
523 * The character attribute defines the specific character (or string).
524 * The character (or string) is only added to the component string if the component string doesn't already start with the specified character (or string).
525 * - If @ref oval_component_get_type == @ref OVAL_FUNCTION_END - End function
526 * - The end function takes a single string component and defines a character (or string) that the component string should end with.
527 * The character attribute defines the specific character (or string).
528 * The character (or string) is only added to the component string if the component string doesn't already end with the specified character (or string).
529 * If the desired end character is a string, then the entire end string must exist at the end if the component string.
530 * If the entire end string is not present then the entire end string is appended to the component string.
531 * - If @ref oval_component_get_type == @ref OVAL_FUNCTION_SPLIT - Split function
532 * - The split function takes a single string component and turns it into multiple values based on a delimiter string.
533 * For example, assume that a basic component element returns the value "a-b-c-d" to the split function with the delimiter set to "-".
534 * The local_variable element would be evaluated to have four values "a", "b", "c", and "d".
535 * If the basic component returns a value that begins, or ends, with a delimiter, the local_variable element would contain empty string
536 * values at the beginning, or end, of the set of values returned for that string component.
537 * For example, if the delimiter is "-", and the basic component element returns the value "-a-a-",
538 * the local_variable element would be evaluated to have four values "", "a", "a", and "".
539 * Likewise, if the basic component element returns a value that contains adjacent delimiters such as "---",
540 * the local_variable element would be evaluated to have four values "", "", "", and "".
541 * Lastly, if the basic component element used by the split function returns multiple values,
542 * then the split function is performed multiple times, and all of the results, from each of the split functions, are returned.
543 * - If @ref oval_component_get_type == @ref OVAL_FUNCTION_SUBSTRING - Substring function
544 * - The substring function takes a single string component and produces a single value that contains a portion
545 * of the original string. The substring_start attribute defines the starting position in the original string.
546 * Note, to include the first character of the string, the start position would be 1.
547 * Also note that a value less than one also means starting at the first character of the string.
548 * The substring_length attribute defines how many character after and including the starting character to include.
549 * Note that a substring_length value greater than the actual length of the string or a negative value means to
550 * include all the characters after the starting character.
551 * For example assume a basic component element that returns the value "abcdefg" with a substring_start value of
552 * 3 and a substring_length value of 2. The local_variable element would be evaluate to have a single value of
553 * "cd". If the string component used by the substring function returns multiple values, then the substring
554 * operation is performed multiple times and results in multiple values for the component.
555 * - If @ref oval_component_get_type == @ref OVAL_FUNCTION_TIMEDIF - Time difference function
556 * - Oval_function_TIMEDIF calculates the difference in seconds between date-time values.
557 * If one component is specified, the values of that component are subtracted from the current time (UTC).
558 * If two components are specified, the value of the second component is subtracted from the value of the first component.
559 * If the component(s) contain multiple values,
560 * the operation is performed multiple times on the Cartesian product of the component(s) and the result is an array of time difference values.
561 * For example, assume a local_variable specifies the time_difference function and has two sub-components under this function: the first
562 * component returns multiple values "04/02/2009" and "04/03/2009", and the second component returns multiple values "02/02/2005"
563 * and "02/03/2005" and "02/04/2005".
564 * The local_variable element would be evaluated to have six values: (ToSeconds("04/02/2009") - ToSeconds("02/02/2005")),
565 * (ToSeconds("04/02/2009") - ToSeconds("02/03/2005")), (ToSeconds("04/02/2009") - ToSeconds("02/04/2005")),
566 * (ToSeconds("04/03/2009") - ToSeconds("02/02/2005")), (ToSeconds("04/03/2009") - ToSeconds("02/03/2005")),
567 * and (ToSeconds("04/03/2009") - ToSeconds("02/04/2005"))..
568 * - If @ref oval_component_get_type == @ref OVAL_FUNCTION_ESCAPE_REGEX - Escape Regular Expression function
569 * - Oval_function_ESCAPE_REGEX takes a single string component and escapes all the regular expression characters.
570 * The purpose for this is that many times, a component used in pattern match needs to be treated as a literal string and not a regular expression.
571 * For example, assume a basic component element that identifies a file path that is held in the Windows registry.
572 * This path is a string that might contain regular expression characters.
573 * These characters are likely not intended to be treated as regular expression characters and need to be escaped.
574 * This function allows a definition writer to mark convert the values of components to regular expression format.
575 * Note that when using regular expressions, OVAL supports a common subset of the regular expression character
576 * classes, operations, expressions and other lexical tokens defined within Perl 5's regular expression specification.
577 * For more information on the supported regular expression syntax in OVAL see: http://oval.mitre.org/language/about/re_support_5.6.html.
578 * - If @ref oval_component_get_type == @ref OVAL_COMPONENT_LITERAL - Literal component
579 * - Oval_literal evaluates to a literal value.
580 * - If @ref oval_component_get_type == @ref OVAL_COMPONENT_OBJECTREF - Object component
581 * - Oval_component_object binds an Oval_object.
582 * During evaluation of the component, the object is queried and the resultant item stream is transformed to provide the Oval_value stream that
583 * constitutes the evaluation result of this component. The item stream transformation consists of using the component object_field attribute to identify the name of a specific item field
584 * whose value is appended to the component value stream.
585 * - If @ref oval_component_get_type == @ref OVAL_COMPONENT_VARREF - Variable component
586 * - Oval_variable_component binds an Oval_variable. The component evaluation is the result of the evaluation of the bound
587 * Oval_variable.
588 */
589 struct oval_component;
590 /**
591 * @struct oval_component_iterator
592 * @see oval_component_get_function_components
593 */
594 struct oval_component_iterator;
595
596 /**
597 * @struct oval_generator
598 */
599 struct oval_generator;
600
601 OSCAP_API struct oval_generator *oval_generator_new(void);
602 OSCAP_API void oval_generator_free(struct oval_generator *generator);
603 OSCAP_API struct oval_generator *oval_generator_clone(struct oval_generator *old_generator);
604 OSCAP_API char *oval_generator_get_product_name(struct oval_generator *generator);
605 OSCAP_API char *oval_generator_get_product_version(struct oval_generator *generator);
606 OSCAP_API const char *oval_generator_get_core_schema_version(struct oval_generator *generator);
607 OSCAP_API char *oval_generator_get_timestamp(struct oval_generator *generator);
608 OSCAP_API const char *oval_generator_get_platform_schema_version (struct oval_generator *generator, const char *platform);
609 OSCAP_API void oval_generator_set_product_name(struct oval_generator *generator, const char *product_name);
610 OSCAP_API void oval_generator_set_product_version(struct oval_generator *generator, const char *product_version);
611 OSCAP_API void oval_generator_set_core_schema_version(struct oval_generator *generator, const char *schema_version);
612 OSCAP_API void oval_generator_add_platform_schema_version(struct oval_generator *generator, const char *platform, const char *schema_version);
613 OSCAP_API void oval_generator_set_timestamp(struct oval_generator *generator, const char *timestamp);
614 OSCAP_API void oval_generator_update_timestamp(struct oval_generator *generator);
615
616 /**
617 * Create an empty oval_definition_model.
618 * @memberof oval_definition_model
619 */
620 OSCAP_API struct oval_definition_model *oval_definition_model_new(void);
621
622 /**
623 * Import the content of the oscap_source into the oval_definition_model
624 * @memberof oval_definition_model
625 * @param source The oscap_source to import from
626 * @returns newly build oval_definition_model, or NULL if something went wrong
627 */
628 OSCAP_API struct oval_definition_model *oval_definition_model_import_source(struct oscap_source *source);
629
630 /**
631 * Copy an oval_definition_model.
632 * @return A copy of the specified @ref oval_definition_model.
633 * @memberof oval_definition_model
634 */
635 OSCAP_API struct oval_definition_model *oval_definition_model_clone(struct oval_definition_model *);
636 /**
637 * Export an oval_definition_model into file.
638 * @memberof oval_definition_model
639 *
640 */
641 OSCAP_API int oval_definition_model_export(struct oval_definition_model *, const char *file);
642 /**
643 * Free OVAL object model and all binded variable models.
644 * @memberof oval_definition_model
645 */
646 OSCAP_API void oval_definition_model_free(struct oval_definition_model *model);
647
648 /**
649 * @name Setters
650 * @{
651 */
652 OSCAP_API void oval_definition_model_set_generator(struct oval_definition_model *model, struct oval_generator *generator);
653 /**
654 * Bind an oval_variable_model to the specified oval_definition_model.
655 * @return zero on success or non zero value if an error occurred
656 * @memberof oval_definition_model
657 */
658 OSCAP_API int oval_definition_model_bind_variable_model(struct oval_definition_model *, struct oval_variable_model *);
659
660 OSCAP_API void oval_definition_model_clear_external_variables(struct oval_definition_model *);
661 /** @} */
662
663 /**
664 * @name Getters
665 * @{
666 */
667 OSCAP_API struct oval_generator *oval_definition_model_get_generator(struct oval_definition_model *model);
668 /**
669 * Returns the appended @ref oval_definition having the specified id.
670 * IF the specified id does not resolve to an appended Oval_definition the method shall return NULL.
671 * @see oval_definition_add_definition
672 * @param id the definition id.
673 * @memberof oval_definition_model
674 */
675 OSCAP_API struct oval_definition *oval_definition_model_get_definition(struct oval_definition_model *, const char *id);
676 /**
677 * Get oval test by ID.
678 * Return a designated oval_test from the specified oval_definition_model.
679 * If the specified id does not resolve to an oval_test the function returns NULL.
680 * @param model the queried model.
681 * @param id the test id.
682 * @memberof oval_definition_model
683 */
684 OSCAP_API struct oval_test *oval_definition_model_get_test(struct oval_definition_model *model, const char *id);
685 /**
686 * Get OVAL object by ID.
687 * Return a designated oval_object from the specified oval_definition_model.
688 * If the specified id does not resolve to an oval_object the function returns NULL.
689 * @param model the queried model.
690 * @param id the object id.
691 * @memberof oval_definition_model
692 */
693 OSCAP_API struct oval_object *oval_definition_model_get_object(struct oval_definition_model *model, const char *id);
694 /**
695 * Get OVAL state by ID.
696 * Return a designated oval_state from the specified oval_definition_model.
697 * If the specified id does not resolve to an oval_state the function returns NULL.
698 * @param model the queried model.
699 * @param id the state id.
700 * @memberof oval_definition_model
701 */
702 OSCAP_API struct oval_state *oval_definition_model_get_state(struct oval_definition_model *model, const char *id);
703 /**
704 * Get OVAL variable by ID.
705 * Return a designated oval_variable from the specified oval_definition_model.
706 * If the specified id does not resolve to an oval_variable the function returns NULL.
707 * @param model the queried model.
708 * @param id the variable id.
709 * @memberof oval_definition_model
710 */
711 OSCAP_API struct oval_variable *oval_definition_model_get_variable(struct oval_definition_model *model, const char *id);
712 /**
713 * Returns all appended @ref oval_definition instances.
714 * @memberof oval_definition_model
715 */
716 OSCAP_API struct oval_definition_iterator *oval_definition_model_get_definitions(struct oval_definition_model *model);
717 /**
718 * Get OVAL tests.
719 * Return all oval_tests from the specified oval_definition_model.
720 * @param model the queried model.
721 * @memberof oval_definition_model
722 */
723 OSCAP_API struct oval_test_iterator *oval_definition_model_get_tests(struct oval_definition_model *model);
724 /**
725 * Get OVAL objects.
726 * Return all oval_objects from the specified oval_definition_model.
727 * @param model the queried model.
728 * @memberof oval_definition_model
729 */
730 OSCAP_API struct oval_object_iterator *oval_definition_model_get_objects(struct oval_definition_model *model);
731 /**
732 * Get OVAL states.
733 * Return all oval_states from the specified oval_definition_model.
734 * @param model the queried model.
735 * @memberof oval_definition_model
736 */
737 OSCAP_API struct oval_state_iterator *oval_definition_model_get_states(struct oval_definition_model *model);
738 /**
739 * Get OVAL variables.
740 * Return all oval_variables from the specified oval_definition_model.
741 * @param model the queried model.
742 * @memberof oval_definition_model
743 */
744 OSCAP_API struct oval_variable_iterator *oval_definition_model_get_variables(struct oval_definition_model *model);
745
746 /**
747 * Get supported version of OVAL XML
748 * @return version of XML file format
749 * @memberof oval_definition_model
750 */
751 OSCAP_API const char * oval_definition_model_supported(void);
752 /**
753 * Return the list of variable models bound to the specified oval_definition_model.
754 * @return iterator over oval_variable_model collection
755 * @memberof oval_definition_model
756 */
757 OSCAP_API struct oval_variable_model_iterator *oval_definition_model_get_variable_models(struct oval_definition_model *);
758 /** @} */
759
760 /**
761 * @name Evaluators
762 * @{
763 */
764
765 /** @} */
766
767 /**
768 * Construct an instance of @ref oval_definition.
769 * Initialized attribute values are
770 * - id bound to value specified by id parameter.
771 * - version bound to 0.
772 * - class bound to @ref OVAL_CLASS_UNKNOWN
773 * - deprecated bound to <b>false</b>
774 * - title bound to NULL
775 * - description bound to NULL
776 * - criteria bound to NULL
777 * - affected bound to empty iterator
778 * - references bound to empty iterator
779 * - notes bound to empty iterator
780 * @param id - (non-NULL) A copy of this string is bound to the id attribute of the created instance.
781 * @memberof oval_definition
782 */
783 OSCAP_API struct oval_definition *oval_definition_new(struct oval_definition_model *, const char *id);
784
785 /**
786 * Clone instance of @ref oval_definition and add it to the specified @ref oval_definition_model.
787 * @return A copy of the specified @ref oval_definition.
788 * @memberof oval_definition
789 */
790 OSCAP_API struct oval_definition *oval_definition_clone(struct oval_definition_model *new_model, struct oval_definition *old_definition);
791
792 /**
793 * Release an instance of @ref oval_definition.
794 * All attributes of the Oval_definition are also released.
795 *
796 * @note Applications should not call this method to free an Oval_definition that is bound
797 * to an instance of @ref OVALDEF. These bound definitions are released when the @ref OVALDEF are
798 * released.
799 * @memberof oval_definition
800 */
801 OSCAP_API void oval_definition_free(struct oval_definition *);
802
803 /**
804 * @name Setters
805 * @{
806 */
807 /**
808 * Set attribute @ref oval_definition->version.
809 * This method shall overwrite a zero version attribute value with the value of the version parameter.
810 * Valid values of the version attribute shall not be overwritten by this method.
811 * @param version - the required version
812 * @memberof oval_definition
813 */
814 OSCAP_API void oval_definition_set_version(struct oval_definition *, int version);
815 /**
816 * Set attribute @ref oval_definition->class.
817 * This method shall overwrite a @ref OVAL_CLASS_UNKNOWN class attribute value with the value of the class parameter.
818 * Valid values of the class attribute shall not be overwritten by this method.
819 * @param class - the required class
820 * @memberof oval_definition
821 */
822 OSCAP_API void oval_definition_set_class(struct oval_definition *, oval_definition_class_t);
823 /**
824 * Set attribute @ref oval_definition->deprecated.
825 * @param deprecated - the required deprecation toggle.
826 * @memberof oval_definition
827 */
828 OSCAP_API void oval_definition_set_deprecated(struct oval_definition *, bool deprecated);
829 /**
830 * Set attribute @ref oval_definition->title.
831 * This method shall overwrite a NULL title attribute value with a copy of the title parameter.
832 * Valid values of the title attribute shall not be overwritten by this method.
833 * @param title - the required title
834 * @memberof oval_definition
835 */
836 OSCAP_API void oval_definition_set_title(struct oval_definition *, char *title);
837 /**
838 * Set attribute @ref oval_definition->description.
839 * This method shall overwrite a NULL description attribute value with a copy of the description parameter.
840 * Valid values of the description attribute shall not be overwritten by this method.
841 * @param description - the required description
842 * @memberof oval_definition
843 */
844 OSCAP_API void oval_definition_set_description(struct oval_definition *, char *description);
845 /**
846 * Append instance of @ref oval_affected to attribute @ref oval_definition->affected.
847 * @note Instances of Oval_affected bound to Oval_definition by this method should not be subsequently freed by
848 * the application using @ref oval_affected_free. These instances shall be freed by the API when
849 * the Oval_definition is freed.
850 * @note A given instance of Oval_affected should not be appended by an application to more than one instance of Oval_definition, nor should
851 * the given instance of Oval_affected be appended more than once to a single instance of Oval_definition.
852 * @param affected - appended instance of Oval_affected.
853 * @memberof oval_definition
854 */
855 OSCAP_API void oval_definition_add_affected(struct oval_definition *, struct oval_affected *affected);
856 /**
857 * Append instance of @ref oval_reference to attribute @ref oval_definition->references.
858 * @note Instances of Oval_reference bound to Oval_definition by this method should not be subsequently freed by
859 * the application using @ref oval_reference_free. These instances shall be freed by the API when
860 * the Oval_definition is freed.
861 * @note A given instance of Oval_reference should not be appended by an application to more than one instance of Oval_definition, nor should
862 * the given instance of Oval_reference be appended more than once to a single instance of Oval_definition.
863 * @param reference - appended instance of Oval_reference.
864 * @memberof oval_definition
865 */
866 OSCAP_API void oval_definition_add_reference(struct oval_definition *, struct oval_reference *reference);
867 /**
868 * Append a copy of the note parameter to attribute @ref Oval_definition->notes.
869 * @param note - the note text.
870 * @memberof oval_definition
871 */
872 OSCAP_API void oval_definition_add_note(struct oval_definition *, char *note);
873 /**
874 * Set attribute @ref oval_definition->criteria.
875 * This method shall overwrite a NULL criteria attribute value with the criteria parameter only if the criteria parameter is an instance of @ref Oval_criteria
876 * (i.e. criteria->type == @ref OVAL_NODETYPE_CRITERIA).
877 * Other values of the criteria attribute shall not be overwritten by this method.
878 * @note Instances of Oval_criteria bound to Oval_definition by this method should not be subsequently freed by the application using oval_criteria_node_free.
879 * These instances shall be freed by the API when the Oval_definition is freed.
880 *
881 * @note An application should not bind a given instance of Oval_criteria to more than one instance of Oval_definition,
882 * nor should a given instance of Oval_criteria be bound to both an Oval_definition and an Oval_criteria (using @ref oval_criteria_node_add_subnode).
883 * @param criteria - the required instance of Oval_criteria
884 * @memberof oval_definition
885 */
886 OSCAP_API void oval_definition_set_criteria(struct oval_definition *, struct oval_criteria_node *criteria);
887 /** @} */
888
889 /**
890 * @name Getters
891 * @{
892 */
893 /**
894 * Returns attribute @ref oval_definition->id (identifier).
895 * @memberof oval_definition
896 */
897 OSCAP_API char *oval_definition_get_id(struct oval_definition *);
898 /**
899 * Returns attribute @ref oval_definition->version.
900 * @return A pointer to the id attribute of the specified @ref oval_definition.
901 * @memberof oval_definition
902 */
903 OSCAP_API int oval_definition_get_version(struct oval_definition *);
904 /**
905 * Returns attribute @ref oval_definition->class.
906 * @memberof oval_definition
907 */
908 OSCAP_API oval_definition_class_t oval_definition_get_class(struct oval_definition *);
909 /**
910 * Returns attribute @ref oval_definition->deprecated.
911 * @memberof oval_definition
912 */
913 OSCAP_API bool oval_definition_get_deprecated(struct oval_definition *);
914 /**
915 * Returns attribute @ref oval_definition->title.
916 * @return A pointer to the title attribute of the specified @ref oval_definition.
917 * @memberof oval_definition
918 */
919 OSCAP_API char *oval_definition_get_title(struct oval_definition *);
920 /**
921 * Returns attribute @ref oval_definition->description.
922 * @return A pointer to the description attribute of the specified @ref oval_definition.
923 * @memberof oval_definition
924 */
925 OSCAP_API char *oval_definition_get_description(struct oval_definition *);
926 /**
927 * Returns attribute @ref oval_definition->affected.
928 * @return A new iterator for the affected attribute of the specified @ref oval_definition.
929 * It should be freed after use by the calling application.
930 * @memberof oval_definition
931 */
932 OSCAP_API struct oval_affected_iterator *oval_definition_get_affected(struct oval_definition *);
933 /**
934 * Returns attribute @ref oval_definition->references.
935 * @return A new iterator for the reference attribute of the specified @ref oval_definition.
936 * It should be freed after use by the calling application.
937 * @memberof oval_definition
938 */
939 OSCAP_API struct oval_reference_iterator *oval_definition_get_references(struct oval_definition *);
940 /**
941 * Returns attribute @ref oval_definition->notes.
942 * @return A new iterator for the notes attribute of the specified @ref oval_definition.
943 * It should be freed after use by the calling application.
944 * @memberof oval_definition
945 */
946 OSCAP_API struct oval_string_iterator *oval_definition_get_notes(struct oval_definition *);
947 /**
948 * Returns attribute @ref oval_definition->criteria.
949 * @return A pointer to the criteria attribute of the specified @ref oval_definition.
950 * @memberof oval_definition
951 */
952 OSCAP_API struct oval_criteria_node *oval_definition_get_criteria(struct oval_definition *);
953 /** @} */
954
955 /**
956 * @name Evaluators
957 * @{
958 */
959 /** @} */
960
961 /**
962 * @name Iterators
963 * @{
964 */
965 /**
966 * Returns <b>true</b> if the iterator contains more instances of @ref oval_definition.
967 * @memberof oval_definition_iterator
968 */
969 OSCAP_API bool oval_definition_iterator_has_more(struct oval_definition_iterator *);
970 /**
971 * Returns the next iterated instance of @ref oval_definition.
972 * NULL is returned if the iterator is exhausted (@ref oval_definition_iterator_has_more == <b>false</b>)
973 * @memberof oval_definition_iterator
974 */
975 OSCAP_API struct oval_definition *oval_definition_iterator_next(struct oval_definition_iterator *);
976 /**
977 * Free the iterator.
978 * @memberof oval_definition_iterator
979 */
980 OSCAP_API void oval_definition_iterator_free(struct oval_definition_iterator *);
981 /** @} */
982
983 /**
984 * Construct new instance of @ref oval_test.
985 * Attribute values shall be initialized:
986 * - family -- initialized to @ref OVAL_FAMILY_UNKNOWN
987 * - subtype -- initialized to @ref OVAL_SUBTYPE_UNKNOWN
988 * - notes -- initialized to empty iterator.
989 * - comment -- initialized to NULL
990 * - id -- initialized to a copy of the id parameter
991 * - deprecated -- initialized to <b>false</b>
992 * - version -- initialized to zero
993 * - existence -- initialized to @ref OVAL_CHECK_UNKNOWN
994 * - check -- initialized to @ref OVAL_CHECK_UNKNOWN
995 * - object -- initialized to NULL
996 * - state -- initialized to NULL
997 *
998 * @note This method shall not construct a new instance of Oval_test and shall return NULL if the text of the id parameter is not matched
999 * by the regular expression <b>^oval:[\.A-Za-z0-9_\-]+:tst:[1-9][0-9]*$</b>.
1000 * @param id - (Not NULL) the text of the required test id.
1001 * @memberof oval_test
1002 */
1003 OSCAP_API struct oval_test *oval_test_new(struct oval_definition_model *, const char *id);
1004 /**
1005 * Clone instance of @ref oval_test and add it to the specified @ref oval_definition_model.
1006 * @return A copy of the specified @ref oval_test.
1007 * @memberof oval_test
1008 */
1009 OSCAP_API struct oval_test *oval_test_clone(struct oval_definition_model *new_model, struct oval_test *old_test);
1010 /**
1011 * Destruct instance of @ref oval_test.
1012 * @memberof oval_test
1013 */
1014 OSCAP_API void oval_test_free(struct oval_test *);
1015
1016 /**
1017 * @name Setters
1018 * @{
1019 */
1020 /**
1021 * Sets attributes @ref oval_test->subtype and @ref Oval_test->family.
1022 * If Oval_test->subtype == @ref OVAL_SUBTYPE_UNKNOWN and parameter subtype <> @ref OVAL_SUBTYPE_UNKNOWN,
1023 * this method shall overwrite Oval_test->subtype with the value of the subtype parameter and Oval_test->family
1024 * with the value of @ref oval_family_t corresponding to the specified subtype.
1025 * Otherwise, the state of the Oval_test instance shall not be changed by this method.
1026 * @param subtype - the required subtype value.
1027 * @memberof oval_test
1028 */
1029 OSCAP_API void oval_test_set_subtype(struct oval_test *, oval_subtype_t subtype);
1030 /**
1031 * Appends a copy of the note parameter to attribute @ref oval_test->notes.
1032 * @param note - (Not NULL) the text of the appended note.
1033 * @memberof oval_test
1034 */
1035 OSCAP_API void oval_test_add_note(struct oval_test *, char *note);
1036 /**
1037 * Sets a copy of the comment parameter to attribute @ref oval_test->comment.
1038 * @param comment - (Not NULL) the text of the comment.
1039 * @memberof oval_test
1040 */
1041 OSCAP_API void oval_test_set_comment(struct oval_test *, char *comment);
1042 /**
1043 * Sets attribute @ref oval_test->deprecated.
1044 * @memberof oval_test
1045 */
1046 OSCAP_API void oval_test_set_deprecated(struct oval_test *, bool deprecated);
1047 /**
1048 * Sets attribute @ref oval_test->version.
1049 * If Oval_test->version == 0 and parameter version >0,
1050 * this method shall overwrite Oval_test->version with the parameter value.
1051 * Otherwise, the method shall leave the Oval_test state unchanged.
1052 * @param version - (>0) the required version
1053 * @memberof oval_test
1054 */
1055 OSCAP_API void oval_test_set_version(struct oval_test *, int version);
1056 /**
1057 * Sets attribute @ref oval_test->state_operator.
1058 * @memberof oval_test
1059 */
1060 OSCAP_API void oval_test_set_state_operator(struct oval_test *, oval_operator_t);
1061 /**
1062 * Sets attribute @ref oval_test->existence.
1063 * If Oval_test->existence == @ref OVAL_CHECK_UNKNOWN and parameter existence <> @ref OVAL_CHECK_UNKNOWN,
1064 * this method shall overwrite Oval_test->existence with the parameter value.
1065 * Otherwise, the method shall leave the Oval_test state unchanged.
1066 * @param existence - (<> @ref OVAL_CHECK_UNKNOWN) the required existence
1067 * @memberof oval_test
1068 */
1069 OSCAP_API void oval_test_set_existence(struct oval_test *, oval_existence_t);
1070 /**
1071 * Sets attribute @ref oval_test->check.
1072 * If Oval_test->check == @ref OVAL_CHECK_UNKNOWN and parameter check <> @ref OVAL_CHECK_UNKNOWN,
1073 * this method shall overwrite Oval_test->check with the parameter check.
1074 * Otherwise, the method shall leave the Oval_test state unchanged.
1075 * @note If Oval_test->state == NULL, the value of Oval_test->check is ignored.
1076 * @param check - (<> @ref OVAL_CHECK_UNKNOWN) the required check
1077 * @memberof oval_test
1078 */
1079 OSCAP_API void oval_test_set_check(struct oval_test *, oval_check_t);
1080 /**
1081 * Sets attribute @ref oval_test->object.
1082 * If Oval_test->object == NULL and parameter object <> NULL,
1083 * this method shall overwrite Oval_test->object with the parameter object.
1084 * Otherwise, the method shall leave the Oval_test state unchanged.
1085 * @param object - (<> NULL) the required object
1086 * @memberof oval_test
1087 */
1088 OSCAP_API void oval_test_set_object(struct oval_test *, struct oval_object *);
1089 /**
1090 * Add the specified state to the state list of the specified test.
1091 * @param state - (<> NULL) the required state
1092 * @memberof oval_test
1093 */
1094 OSCAP_API void oval_test_add_state(struct oval_test *, struct oval_state *);
1095 /** @} */
1096
1097 /**
1098 * @name Getters
1099 * @{
1100 */
1101 /**
1102 * Returns attribute @ref Oval_test->family
1103 * @memberof oval_test
1104 */
1105 OSCAP_API oval_family_t oval_test_get_family(struct oval_test *);
1106 /**
1107 * Returns attribute @ref Oval_test->subtype
1108 * @memberof oval_test
1109 */
1110 OSCAP_API oval_subtype_t oval_test_get_subtype(struct oval_test *);
1111 /**
1112 * Returns attribute @ref oval_test->notes.
1113 * @return A new iterator for the notes attribute of the specified @ref oval_test.
1114 * It should be freed after use by the calling application.
1115 * @memberof oval_test
1116 */
1117 OSCAP_API struct oval_string_iterator *oval_test_get_notes(struct oval_test *);
1118 /**
1119 * Returns attribute @ref Oval_test->comment.
1120 * @return A pointer to the comment attribute of the specified @ref oval_test.
1121 * @memberof oval_test
1122 */
1123 OSCAP_API char *oval_test_get_comment(struct oval_test *);
1124 /**
1125 * Returns attribute @ref oval_test->id.
1126 * @return A pointer to the id attribute of the specified @ref oval_test.
1127 * @memberof oval_test
1128 */
1129 OSCAP_API char *oval_test_get_id(struct oval_test *);
1130 /**
1131 * Returns attribute @ref oval_test->deprecated.
1132 * @memberof oval_test
1133 */
1134 OSCAP_API bool oval_test_get_deprecated(struct oval_test *);
1135 /**
1136 * Returns attribute @ref oval_test->version.
1137 * @memberof oval_test
1138 */
1139 OSCAP_API int oval_test_get_version(struct oval_test *);
1140 /**
1141 * Returns attribute @ref oval_test->state_operator.
1142 * @memberof oval_test
1143 */
1144 OSCAP_API oval_operator_t oval_test_get_state_operator(struct oval_test *);
1145 /**
1146 * Returns attribute @ref oval_test->existence.
1147 * @memberof oval_test
1148 */
1149 OSCAP_API oval_existence_t oval_test_get_existence(struct oval_test *);
1150 /**
1151 * Returns attribute @ref oval_test->check.
1152 * @memberof oval_test
1153 */
1154 OSCAP_API oval_check_t oval_test_get_check(struct oval_test *);
1155 /**
1156 * Returns attribute @ref oval_test->object.
1157 * @return A pointer to the object attribute of the specified @ref oval_test.
1158 * @memberof oval_test
1159 */
1160 OSCAP_API struct oval_object *oval_test_get_object(struct oval_test *);
1161 /**
1162 * Returns attribute @ref oval_test->states.
1163 * @return A new iterator for the states attribute of the specified @ref oval_test.
1164 * It should be freed after use by the calling application.
1165 * @memberof oval_test
1166 */
1167 OSCAP_API struct oval_state_iterator *oval_test_get_states(struct oval_test *);
1168
1169 /** @} */
1170
1171 /**
1172 * @name Evaluators
1173 * @{
1174 */
1175 /** @} */
1176
1177 /**
1178 * @name Iterators
1179 * @{
1180 */
1181 /**
1182 * Returns <b>true</b> if the iterator is not exhausted.
1183 * @memberof oval_test_iterator
1184 */
1185 OSCAP_API bool oval_test_iterator_has_more(struct oval_test_iterator *);
1186 /**
1187 * Returns the next instance of @ref oval_test.
1188 * @memberof oval_test_iterator
1189 */
1190 OSCAP_API struct oval_test *oval_test_iterator_next(struct oval_test_iterator *);
1191 /**
1192 * Frees the iterator.
1193 * @memberof oval_test_iterator
1194 */
1195 OSCAP_API void oval_test_iterator_free(struct oval_test_iterator *);
1196 /** @} */
1197
1198 /**
1199 * Construct new intance of @ref oval_object.
1200 * Attribute values shall be initialized:
1201 * - family -- initialized to @ref OVAL_FAMILY_UNKNOWN
1202 * - subtype -- initialized to @ref OVAL_SUBTYPE_UNKNOWN
1203 * - notes -- initialized to empty iterator
1204 * - comment -- initialized to NULL
1205 * - id -- initialized to a copy of the id parameter
1206 * - deprecated -- initialized to <b>false</b>
1207 * - version -- initialized to zero
1208 * - contents -- initialized to empty iterator
1209 * - behaviors -- initialized to empty iterator
1210 *
1211 * @note This method shall not construct a new instance of Oval_object and shall return NULL if the text of the id parameter is not matched
1212 * by the regular expression <b>^oval:[\.A-Za-z0-9_\-]+:obj:[1-9][0-9]*$</b>.
1213 * @param id - (Not NULL) the text of the required object id.
1214 * @memberof oval_object
1215 */
1216 OSCAP_API struct oval_object *oval_object_new(struct oval_definition_model *, const char *id);
1217 /**
1218 * Clone instance of @ref oval_object and add it to the specified @ref oval_definition_model.
1219 * @return A copy of the specified @ref oval_object.
1220 * @memberof oval_object
1221 */
1222 OSCAP_API struct oval_object *oval_object_clone(struct oval_definition_model *new_model, struct oval_object *old_object);
1223 /**
1224 * Free instance of @ref oval_object
1225 * @memberof oval_object
1226 */
1227 OSCAP_API void oval_object_free(struct oval_object *);
1228
1229 /**
1230 * @name Setters
1231 * @{
1232 */
1233 /**
1234 * Sets attributes @ref oval_object->subtype and @ref oval_object->family.
1235 * If Oval_object->subtype == @ref OVAL_SUBTYPE_UNKNOWN and parameter subtype <> @ref OVAL_SUBTYPE_UNKNOWN,
1236 * this method shall overwrite Oval_object->subtype with the value of the subtype parameter and Oval_object->family
1237 * with the value of @ref oval_family_t corresponding to the specified subtype.
1238 * Otherwise, the state of the Oval_object instance shall not be changed by this method.
1239 * @param subtype - the required subtype value.
1240 * @memberof oval_object
1241 */
1242 OSCAP_API void oval_object_set_subtype(struct oval_object *, oval_subtype_t subtype);
1243 /**
1244 * Appends a copy of the note parameter to attribute @ref oval_object->notes.
1245 * @param note - (Not NULL) the text of the appended note.
1246 * @memberof oval_object
1247 */
1248 OSCAP_API void oval_object_add_note(struct oval_object *, char *note);
1249
1250 /**
1251 * Sets a copy of the comment parameter to attribute @ref oval_object->comment.
1252 * @param comment - (Not NULL) the text of the comment.
1253 * @memberof oval_object
1254 */
1255 OSCAP_API void oval_object_set_comment(struct oval_object *, char *comment);
1256
1257 /**
1258 * Sets attribute @ref oval_object->deprecated.
1259 * @memberof oval_object
1260 */
1261 OSCAP_API void oval_object_set_deprecated(struct oval_object *, bool deprecated);
1262 /**
1263 * Sets attribute @ref oval_object->version.
1264 * If Oval_object->version == 0 and parameter version >0,
1265 * this method shall overwrite Oval_object->version with the parameter value.
1266 * Otherwise, the method shall leave the Oval_object state unchanged.
1267 * @param version - (>0) the required version
1268 * @memberof oval_object
1269 */
1270 OSCAP_API void oval_object_set_version(struct oval_object *, int version);
1271 /**
1272 * Append instance of @ref oval_object_content to attribute @ref oval_object->object_contents.
1273 *
1274 * Oval_object_contents appended to a given Oval_object shall be freed by the API when the Oval_object is freed.
1275 *
1276 * @note A specific instance of Oval_object_content should not be appended to more than one Oval_object,
1277 * and an instance of Oval_object_content should not be appended more than once to a single Oval_object.
1278 * @note An instance of Oval_object_content that is appended to an Oval_object should not be freed
1279 * independently by the application using @ref oval_object_content_free.
1280 * @param content - (Not NULL) the Oval_object_content to be appended.
1281 * @memberof oval_object
1282 */
1283 OSCAP_API void oval_object_add_object_content(struct oval_object *, struct oval_object_content *content);
1284 /**
1285 * Append instance of @ref oval_behavior to attribute @ref oval_object->behaviors.
1286 *
1287 * Oval_behaviors appended to a given Oval_object shall be freed by the API when the Oval_object is freed.
1288 *
1289 * @note A specific instance of Oval_behavior should not be appended to more than one Oval_object,
1290 * and an instance of Oval_behavior should not be appended more than once to a single Oval_object.
1291 * @note An instance of Oval_behavior that is appended to an Oval_object should not be freed
1292 * independently by the application using @ref oval_behavior_free.
1293 * @param behavior - (Not NULL) the Oval_behavior to be appended.
1294 * @memberof oval_object
1295 */
1296 OSCAP_API void oval_object_add_behavior(struct oval_object *, struct oval_behavior *behavior);
1297 /** @} */
1298
1299 /**
1300 * @name Getters
1301 * @{
1302 */
1303 /**
1304 * Returns attribute @ref oval_object->family
1305 * @memberof oval_object
1306 */
1307 OSCAP_API oval_family_t oval_object_get_family(struct oval_object *);
1308 /**
1309 * Returns the name of an @ref oval_object.
1310 * This is a convenience method that is equivalent to @ref oval_subtype_get_text (@ref oval_object_get_subtype)+"_object".
1311 * @memberof oval_object
1312 */
1313 OSCAP_API const char *oval_object_get_name(struct oval_object *);
1314 /**
1315 * Returns attribute @ref oval_object->subtype
1316 * @memberof oval_object
1317 */
1318 OSCAP_API oval_subtype_t oval_object_get_subtype(struct oval_object *);
1319 /**
1320 * Returns attribute @ref oval_object->notes.
1321 * @return A new iterator for the notes attribute of the specified @ref oval_object.
1322 * It should be freed after use by the calling application.
1323 * @memberof oval_object
1324 */
1325 OSCAP_API struct oval_string_iterator *oval_object_get_notes(struct oval_object *);
1326 /**
1327 * Returns attribute @ref oval_object->comment.
1328 * @return A pointer to the comment attribute of the specified @ref oval_object.
1329 * @memberof oval_object
1330 */
1331 OSCAP_API char *oval_object_get_comment(struct oval_object *);
1332 /**
1333 * Returns attribute @ref oval_object->id.
1334 * @return A pointer to the id attribute of the specified @ref oval_object.
1335 * @memberof oval_object
1336 */
1337 OSCAP_API char *oval_object_get_id(struct oval_object *);
1338
1339 /**
1340 * Returns attribute @ref oval_object->deprecated.
1341 * @memberof oval_object
1342 */
1343 OSCAP_API bool oval_object_get_deprecated(struct oval_object *);
1344 /**
1345 * Returns attribute @ref oval_object->version.
1346 * @memberof oval_object
1347 */
1348 OSCAP_API int oval_object_get_version(struct oval_object *);
1349
1350 /**
1351 * Returns schema version of the associated platform extension definition model
1352 * @memberof oval_object
1353 */
1354 OSCAP_API oval_schema_version_t oval_object_get_platform_schema_version(struct oval_object *object);
1355
1356 /**
1357 * Returns attribute @ref oval_object->contents.
1358 * @return A new iterator for the object_content attribute of the specified @ref oval_object.
1359 * It should be freed after use by the calling application.
1360 * @memberof oval_object
1361 */
1362 OSCAP_API struct oval_object_content_iterator *oval_object_get_object_contents(struct oval_object *);
1363 /**
1364 * Returns attribute @ref oval_object->behaviors.
1365 * @return A new iterator for the behaviors attribute of the specified @ref oval_object.
1366 * It should be freed after use by the calling application.
1367 * @memberof oval_object
1368 */
1369 OSCAP_API struct oval_behavior_iterator *oval_object_get_behaviors(struct oval_object *);
1370 /** @} */
1371
1372 /**
1373 * @name Evaluators
1374 * @{
1375 */
1376 /** @} */
1377
1378 /**
1379 * @name Iterators
1380 * @{
1381 */
1382 /**
1383 * Returns <b>true</b> if the iterator is not exhausted.
1384 * @memberof oval_object_iterator
1385 */
1386 OSCAP_API bool oval_object_iterator_has_more(struct oval_object_iterator *);
1387 /**
1388 * Returns the next instance of @ref oval_object.
1389 * @memberof oval_object_iterator
1390 */
1391 OSCAP_API struct oval_object *oval_object_iterator_next(struct oval_object_iterator *);
1392 /**
1393 * Frees the iterator.
1394 * @memberof oval_object_iterator
1395 */
1396 OSCAP_API void oval_object_iterator_free(struct oval_object_iterator *);
1397 /** @} */
1398
1399 /**
1400 * Construct new intance of @ref oval_state.
1401 * Attribute values shall be initialized:
1402 * - family -- initialized to @ref OVAL_FAMILY_UNKNOWN
1403 * - subtype -- initialized to @ref OVAL_SUBTYPE_UNKNOWN
1404 * - notes -- initialized to empty iterator
1405 * - comment -- initialized to NULL
1406 * - id -- initialized to a copy of the id parameter
1407 * - deprecated -- initialized to <b>false</b>
1408 * - version -- initialized to zero
1409 * - operator -- initialized to @ref OVAL_OPERATOR_AND
1410 * - contents -- initialized to empty iterator
1411 *
1412 * @note This method shall not construct a new instance of Oval_state and shall return NULL if the text of the id parameter is not matched
1413 * by the regular expression <b>^oval:[\.A-Za-z0-9_\-]+:stt:[1-9][0-9]*$</b>.
1414 * @param id - (Not NULL) the text of the required state id.
1415 * @memberof oval_state
1416 */
1417 OSCAP_API struct oval_state *oval_state_new(struct oval_definition_model *, const char *id);
1418 /**
1419 * Clone instance of @ref oval_state and add it to the specified @ref oval_definition_model.
1420 * @return A copy of the specified @ref oval_state.
1421 * @memberof oval_state
1422 */
1423 OSCAP_API struct oval_state *oval_state_clone(struct oval_definition_model *new_model, struct oval_state *old_state);
1424 /**
1425 * Free instance of @ref oval_state
1426 * @memberof oval_state
1427 */
1428 OSCAP_API void oval_state_free(struct oval_state *);
1429
1430 /**
1431 * @name Setters
1432 * @{
1433 */
1434 /**
1435 * Sets attributes @ref oval_state->subtype and @ref oval_state->family.
1436 * If oval_state->subtype == @ref OVAL_SUBTYPE_UNKNOWN and parameter subtype <> @ref OVAL_SUBTYPE_UNKNOWN,
1437 * this method shall overwrite oval_state->subtype with the value of the subtype parameter and oval_state->family
1438 * with the value of @ref oval_family_t corresponding to the specified subtype.
1439 * Otherwise, the state of the oval_state instance shall not be changed by this method.
1440 * @param subtype - the required subtype value.
1441 * @memberof oval_state
1442 */
1443 OSCAP_API void oval_state_set_subtype(struct oval_state *, oval_subtype_t subtype);
1444 /**
1445 * Appends a copy of the note parameter to attribute @ref oval_state->notes.
1446 * @param note - (Not NULL) the text of the appended note.
1447 * @memberof oval_state
1448 */
1449 OSCAP_API void oval_state_add_note(struct oval_state *, char *note);
1450 /**
1451 * Sets a copy of the comment parameter to attribute @ref oval_state->comment.
1452 * @param comment - (Not NULL) the text of the comment.
1453 * @memberof oval_state
1454 */
1455 OSCAP_API void oval_state_set_comment(struct oval_state *, char *comment);
1456 /**
1457 * Sets attribute @ref oval_state->deprecated.
1458 * @memberof oval_state
1459 */
1460 OSCAP_API void oval_state_set_deprecated(struct oval_state *, bool deprecated);
1461 /**
1462 * Sets attribute @ref oval_state->version.
1463 * If oval_state->version == 0 and parameter version >0,
1464 * this method shall overwrite oval_state->version with the parameter value.
1465 * Otherwise, the method shall leave the oval_state state unchanged.
1466 * @param version - (>0) the required version
1467 * @memberof oval_state
1468 */
1469 OSCAP_API void oval_state_set_version(struct oval_state *, int version);
1470 /**
1471 * Sets attribute @ref oval_state->operator.
1472 * @memberof oval_state
1473 */
1474 OSCAP_API void oval_state_set_operator(struct oval_state *, oval_operator_t);
1475 /**
1476 * Append instance of @ref oval_state_content to attribute @ref oval_state->state_contents.
1477 *
1478 * oval_state_contents appended to a given oval_state shall be freed by the API when the oval_state is freed.
1479 *
1480 * @note A specific instance of oval_state_content should not be appended to more than one oval_state,
1481 * and an instance of oval_state_content should not be appended more than once to a single oval_state.
1482 * @note An instance of oval_state_content that is appended to an oval_state should not be freed
1483 * independently by the application using @ref oval_state_content_free.
1484 * @param content - (Not NULL) the oval_state_content to be appended.
1485 * @memberof oval_state
1486 */
1487 OSCAP_API void oval_state_add_content(struct oval_state *, struct oval_state_content *content);
1488 /** @} */
1489
1490 /**
1491 * @name Getters
1492 * @{
1493 */
1494 /**
1495 * Returns attribute @ref oval_state->family
1496 * @memberof oval_state
1497 */
1498 OSCAP_API oval_family_t oval_state_get_family(struct oval_state *);
1499 /**
1500 * Returns the name of an @ref oval_state.
1501 * This is a convenience method that is equivalent to @ref oval_subtype_get_text (@ref oval_state_get_subtype)+"_state".
1502 * @memberof oval_state
1503 */
1504 OSCAP_API const char *oval_state_get_name(struct oval_state *);
1505 /**
1506 * Returns attribute @ref oval_state->subtype
1507 * @memberof oval_state
1508 */
1509 OSCAP_API oval_subtype_t oval_state_get_subtype(struct oval_state *);
1510 /**
1511 * Returns attribute @ref oval_state->notes.
1512 * @return A new iterator for the notes attribute of the specified @ref oval_state.
1513 * It should be freed after use by the calling application.
1514 * @memberof oval_state
1515 */
1516 OSCAP_API struct oval_string_iterator *oval_state_get_notes(struct oval_state *);
1517 /**
1518 * Returns attribute @ref oval_state->comment.
1519 * @return A pointer to the comment attribute of the specified @ref oval_state.
1520 * @memberof oval_state
1521 */
1522 OSCAP_API char *oval_state_get_comment(struct oval_state *);
1523 /**
1524 * Returns attribute @ref oval_state->id.
1525 * @return A pointer to the id attribute of the specified @ref oval_state.
1526 * @memberof oval_state
1527 */
1528 OSCAP_API char *oval_state_get_id(struct oval_state *);
1529 /**
1530 * Returns attribute @ref oval_state->deprecated.
1531 * @memberof oval_state
1532 */
1533 OSCAP_API bool oval_state_get_deprecated(struct oval_state *);
1534 /**
1535 * Returns attribute @ref oval_state->version.
1536 * @memberof oval_state
1537 */
1538 OSCAP_API int oval_state_get_version(struct oval_state *);
1539 /**
1540 * Returns attribute @ref oval_state->operator.
1541 * @memberof oval_state
1542 */
1543 OSCAP_API int oval_state_get_operator(struct oval_state *);
1544 /**
1545 * Returns attribute @ref oval_state->contents.
1546 * @return A new iterator for the contents attribute of the specified @ref oval_state.
1547 * It should be freed after use by the calling application.
1548 * @memberof oval_state
1549 */
1550 OSCAP_API struct oval_state_content_iterator *oval_state_get_contents(struct oval_state *);
1551 /** @} */
1552
1553 /**
1554 * @name Iterators
1555 * @{
1556 */
1557 /**
1558 * Returns <b>true</b> if the iterator is not exhausted.
1559 * @memberof oval_state_iterator
1560 */
1561 OSCAP_API bool oval_state_iterator_has_more(struct oval_state_iterator *);
1562 /**
1563 * Returns the next instance of @ref oval_state.
1564 * @memberof oval_state_iterator
1565 */
1566 OSCAP_API struct oval_state *oval_state_iterator_next(struct oval_state_iterator *);
1567 /**
1568 * Frees the iterator.
1569 * @memberof oval_state_iterator
1570 */
1571 OSCAP_API void oval_state_iterator_free(struct oval_state_iterator *);
1572 /** @} */
1573
1574 /**
1575 * @name Evaluators
1576 * @{
1577 */
1578 /** @} */
1579
1580 /**
1581 * Construct new instance of @ref oval_variable.
1582 * Attribute values shall be initialized:
1583 * - id -- initialized to a copy of the id parameter
1584 * - type -- initialized to the type parameter
1585 * - version -- initialized to zero
1586 * - deprecated -- initialized to <b>false</b>
1587 * - comment -- initialized to NULL
1588 * - datatype -- initialzed to @ref OVAL_DATATYPE_UNKNOWN
1589 * - If type == @ref OVAL_VARIABLE_CONSTANT
1590 * - values -- initialized to empty iterator
1591 * - If type == @ref OVAL_VARIABLE_EXTERNAL
1592 * - values -- initialized to NULL
1593 * - If type == @ref OVAL_VARIABLE_LOCAL
1594 * - component -- initialized to NULL
1595 *
1596 * This method shall not construct a new instance of oval_variable and shall return NULL
1597 * - if the text of the id parameter is not matched by the regular expression <b>^oval:[\.A-Za-z0-9_\-]+:var:[1-9][0-9]*$</b>.
1598 * - if the value of the type parameter is @ref OVAL_VARIABLE_UNKNOWN.
1599 *
1600 * @param id - (Not NULL) the text of the required variable id.
1601 * @param type - (Not @ref OVAL_VARIABLE_UNKNOWN) the required type.
1602 * @memberof oval_variable
1603 */
1604 OSCAP_API struct oval_variable *oval_variable_new(struct oval_definition_model *model, const char *id, oval_variable_type_t type);
1605 /**
1606 * Clone instance of @ref oval_variable and add it to the specified @ref oval_definition_model.
1607 * @return A copy of the specified @ref oval_variable.
1608 * @memberof oval_variable
1609 */
1610 OSCAP_API struct oval_variable *oval_variable_clone(struct oval_definition_model *new_model, struct oval_variable *old_variable);
1611 /**
1612 * Free instance of @ref oval_variable.
1613 * @memberof oval_variable
1614 */
1615 OSCAP_API void oval_variable_free(struct oval_variable *);
1616
1617 /**
1618 * Construct new instance of possible_value element.
1619 * @param hint A short description of what the value means or represents.
1620 * @param value An expected value of an external variable
1621 * @memberof oval_variable_possible_value
1622 */
1623 OSCAP_API struct oval_variable_possible_value *oval_variable_possible_value_new(const char *hint, const char *value);
1624
1625 /**
1626 * Free instance of possible_value
1627 * @memberof oval_variable_possible_value
1628 */
1629 OSCAP_API void oval_variable_possible_value_free(struct oval_variable_possible_value *pv);
1630
1631 /**
1632 * Get the hint of the possible_value
1633 * @memberof oval_variable_possible_value
1634 */
1635 OSCAP_API char* oval_variable_possible_value_get_hint(struct oval_variable_possible_value* pv);
1636
1637 /**
1638 * Get the value of the possible value
1639 * @memberof oval_variable_possible_value
1640 */
1641 OSCAP_API char* oval_variable_possible_value_get_value(struct oval_variable_possible_value* pv);
1642
1643 /**
1644 * @name Iterators
1645 * @{
1646 */
1647 /**
1648 * @memberof oval_variable_possible_value_iterator
1649 */
1650 OSCAP_API bool oval_variable_possible_value_iterator_has_more(struct oval_variable_possible_value_iterator*);
1651 /**
1652 * @memberof oval_variable_possible_value_iterator
1653 */
1654 OSCAP_API struct oval_variable_possible_value *oval_variable_possible_value_iterator_next(struct oval_variable_possible_value_iterator*);
1655 /**
1656 * @memberof oval_variable_possible_value_iterator
1657 */
1658 OSCAP_API int oval_variable_possible_value_iterator_remaining(struct oval_variable_possible_value_iterator*);
1659 /**
1660 * @memberof oval_variable_possible_value_iterator
1661 */
1662 OSCAP_API void oval_variable_possible_value_iterator_free(struct oval_variable_possible_value_iterator*);
1663 /** @} */
1664
1665
1666 /**
1667 * Construct new instance of possible_restriction element.
1668 * @param operator Operator to evaluation
1669 * @param hint A short description of what the value means or represents.
1670 * @memberof oval_variable_possible_restriction
1671 */
1672 OSCAP_API struct oval_variable_possible_restriction *oval_variable_possible_restriction_new(oval_operator_t, const char *);
1673
1674
1675 /**
1676 * Free instance of possible_restriction
1677 * @memberof oval_variable_possible_restriction
1678 */
1679 OSCAP_API void oval_variable_possible_restriction_free(struct oval_variable_possible_restriction *pr);
1680
1681
1682 /**
1683 * @name Iterators
1684 * @{
1685 */
1686 /**
1687 * @memberof oval_variable_possible_restriction_iterator
1688 */
1689 OSCAP_API bool oval_variable_possible_restriction_iterator_has_more(struct oval_variable_possible_restriction_iterator* iter);
1690 /**
1691 * @memberof oval_variable_possible_restriction_iterator
1692 */
1693 OSCAP_API struct oval_variable_possible_restriction *oval_variable_possible_restriction_iterator_next(struct oval_variable_possible_restriction_iterator* iter);
1694 /**
1695 * @memberof oval_variable_possible_restriction_iterator
1696 */
1697 OSCAP_API int oval_variable_possible_restriction_iterator_remaining(struct oval_variable_possible_restriction_iterator* iter);
1698 /**
1699 * @memberof oval_variable_possible_restriction_iterator
1700 */
1701 OSCAP_API void oval_variable_possible_restriction_iterator_free(struct oval_variable_possible_restriction_iterator* iter);
1702 /** @} */
1703
1704
1705 /**
1706 * Construct new instance of restriction element.
1707 * @param operation Operation of restriction.
1708 * @param value Restriction placed on expected values for an external variable.
1709 * @memberof oval_variable_restriction
1710 */
1711 OSCAP_API struct oval_variable_restriction *oval_variable_restriction_new(oval_operation_t operation, const char *value);
1712
1713 /**
1714 * Free instance of restriction element.
1715 * @memberof oval_variable_restriction
1716 */
1717 OSCAP_API void oval_variable_restriction_free(struct oval_variable_restriction *r);
1718
1719 /**
1720 * Get the operation of a restriction element.
1721 * @memberof oval_variable_restriction
1722 */
1723 OSCAP_API oval_operation_t oval_variable_restriction_get_operation(struct oval_variable_restriction* restriction);
1724
1725 /**
1726 * Get the value of a restriction element.
1727 * @memberof oval_variable_restriction
1728 */
1729 OSCAP_API char* oval_variable_restriction_get_value(struct oval_variable_restriction* restriction);
1730
1731 /**
1732 * @name Iterators
1733 * @{
1734 */
1735 /**
1736 * @memberof oval_variable_restriction_iterator
1737 */
1738 OSCAP_API bool oval_variable_restriction_iterator_has_more(struct oval_variable_restriction_iterator*);
1739 /**
1740 * @memberof oval_variable_restriction_iterator
1741 */
1742 OSCAP_API struct oval_variable_restriction *oval_variable_restriction_iterator_next(struct oval_variable_restriction_iterator*);
1743 /**
1744 * @memberof oval_variable_restriction_iterator
1745 */
1746 OSCAP_API int oval_variable_restriction_iterator_remaining(struct oval_variable_restriction_iterator*);
1747 /**
1748 * @memberof oval_variable_restriction_iterator
1749 */
1750 OSCAP_API void oval_variable_restriction_iterator_free(struct oval_variable_restriction_iterator*);
1751 /** @} */
1752
1753
1754 /**
1755 * @name Setters
1756 * @{
1757 */
1758 /**
1759 * set attribute @ref oval_variable->comment.
1760 * If attribute oval_variable->comment == NULL this method shall overwrite the attribute with a copy of the comment parameter.
1761 * Otherwise the variable state shall be unchanged.
1762 * @param comm - (Not NULL) a copy of the comment parameter is set as the comment attribute.
1763 * @memberof oval_variable
1764 */
1765 OSCAP_API void oval_variable_set_comment(struct oval_variable *, char *comment);
1766 /**
1767 * set attribute @ref oval_variable->version.
1768 * If attribute oval_variable->version == 0 this method shall overwrite the attribute with the version parameter.
1769 * Otherwise the variable state shall be unchanged.
1770 * @param version - (>0) the required version.
1771 * @memberof oval_variable
1772 */
1773 OSCAP_API void oval_variable_set_version(struct oval_variable *, int version);
1774 /**
1775 * set attribute @ref oval_variable->deprecated.
1776 * @param deprecated - the required deprecation toggle.
1777 * @memberof oval_variable
1778 */
1779 OSCAP_API void oval_variable_set_deprecated(struct oval_variable *, bool deprecated);
1780 /**
1781 * set attribute @ref oval_variable->datatype.
1782 * If attribute oval_variable->datatype == @ref OVAL_DATATYPE_UNKNOWN this method shall overwrite the attribute with the datatype parameter.
1783 * Otherwise the variable state shall be unchanged.
1784 * @param datatype - (Not @ref OVAL_DATATYPE_UNKNOWN) a the required datatype.
1785 * @memberof oval_variable
1786 */
1787 OSCAP_API void oval_variable_set_datatype(struct oval_variable *, oval_datatype_t);
1788 /**
1789 * Append an instance of @ref Oval_value to the attribute @ref Oval_constant->values.
1790 * If attribute type <> @ref OVAL_VARIABLE_CONSTANT or the value parameter is NULL the state of the oval_variable shall not be changed by this
1791 * method.
1792 * Otherwise, The value parameter shall be appended and shall be freed by the API when the Oval_constant is freed
1793 *
1794 * @note When a value is appended to an Oval_constant by an application, that value should not be subsequently
1795 * freed by the application using @ref oval_value_free.
1796 * @note An application should not append an Oval_value to more than one Oval_constant, and that
1797 * an Oval_value should not be bound more than once to a single Oval_constant.
1798 * @param value - the required value.
1799 * @memberof oval_variable
1800 */
1801 OSCAP_API void oval_variable_add_value(struct oval_variable *, struct oval_value *); //type==OVAL_VARIABLE_CONSTANT
1802
1803 OSCAP_API void oval_variable_clear_values(struct oval_variable *);
1804
1805 /**
1806 * Add a new possible value to an external variable.
1807 * @param variable Variable to add.
1808 * @param pv The new possible_value.
1809 * @memberof oval_variable
1810 */
1811 OSCAP_API void oval_variable_add_possible_value(struct oval_variable *variable, struct oval_variable_possible_value *pv);
1812
1813 /**
1814 * Add a new possible restriction to an external variable.
1815 * @param variable Variable to add.
1816 * @param pr The new possible_restriction.
1817 * @memberof oval_variable
1818 */
1819 OSCAP_API void oval_variable_add_possible_restriction(struct oval_variable *variable, struct oval_variable_possible_restriction *pr);
1820
1821 /**
1822 * Add a restriction to the list of possible restrictions.
1823 * @param pr A possible_restriction type
1824 * @param r Restriction which will be added
1825 * @memberof oval_variable_possible_restriction
1826 */
1827 OSCAP_API void oval_variable_possible_restriction_add_restriction(struct oval_variable_possible_restriction *pr, struct oval_variable_restriction *r);
1828
1829 /**
1830 * Bind an instance of @ref Oval_component to the attribute @ref Oval_local->component.
1831 * If attribute type <> @ref OVAL_VARIABLE_LOCAL, the component attribute <> NULL or the component parameter is NULL the state of the oval_variable shall not be changed by this
1832 * method.
1833 * Otherwise, The component parameter shall be bound to the component attribute and shall be freed by the API when the Oval_local is freed
1834 *
1835 * @note When an Oval_component is bound to an Oval_local by an application, the Oval_component should not be subsequently
1836 * freed by the application using @ref oval_component_free.
1837 * @note An application should not bind a single Oval_component to more than one Oval_local or to an Oval_local and an @ref Oval_function.
1838 * @param component - the required component.
1839 * @memberof oval_variable
1840 */
1841 OSCAP_API void oval_variable_set_component(struct oval_variable *, struct oval_component *component); //type==OVAL_VARIABLE_LOCAL
1842 /** @} */
1843
1844 /**
1845 * @name Getters
1846 * @{
1847 */
1848 /**
1849 * Returns attribute @ref oval_variable->id.
1850 * @return A pointer to the id attribute of the specified @ref oval_variable.
1851 * @memberof oval_variable
1852 */
1853 OSCAP_API char *oval_variable_get_id(struct oval_variable *);
1854 /**
1855 * Returns attribute @ref oval_variable->comment.
1856 * @return A pointer to the comment attribute of the specified @ref oval_variable.
1857 * @memberof oval_variable
1858 */
1859 OSCAP_API char *oval_variable_get_comment(struct oval_variable *);
1860 /**
1861 * Returns attribute @ref oval_variable->version.
1862 * @memberof oval_variable
1863 */
1864 OSCAP_API int oval_variable_get_version(struct oval_variable *);
1865 /**
1866 * Returns attribute @ref oval_variable->deprecated.
1867 * @memberof oval_variable
1868 */
1869 OSCAP_API bool oval_variable_get_deprecated(struct oval_variable *);
1870 /**
1871 * Returns attribute @ref oval_variable->type.
1872 * @memberof oval_variable
1873 */
1874 OSCAP_API oval_variable_type_t oval_variable_get_type(struct oval_variable *);
1875 /**
1876 * Returns attribute @ref oval_variable->datatype.
1877 * @memberof oval_variable
1878 */
1879 OSCAP_API oval_datatype_t oval_variable_get_datatype(struct oval_variable *);
1880 /**
1881 * Returns attribute @ref Oval_external/@ref Oval_constant->values.
1882 * If attribute type == @ref OVAL_VARIABLE_LOCAL or @ref OVAL_VARIABLE_UNKNOWN, this method shall return NULL
1883 * @return A new iterator for the values attribute of the specified @ref oval_variable.
1884 * It should be freed after use by the calling application.
1885 * @memberof oval_variable
1886 */
1887 OSCAP_API struct oval_value_iterator *oval_variable_get_values(struct oval_variable *); //type==OVAL_VARIABLE_CONSTANT
1888 /**
1889 * Returns attribute @ref Oval_local->component.
1890 * If attribute type <> @ref OVAL_VARIABLE_LOCAL this method shall return NULL.
1891 * @return A pointer to the component attribute of the specified @ref oval_variable.
1892 * @memberof oval_variable
1893 */
1894 OSCAP_API struct oval_component *oval_variable_get_component(struct oval_variable *); //type==OVAL_VARIABLE_LOCAL
1895
1896 /**
1897 * Get list of allowed values for an external variable.
1898 * @return A new iterator for the possible_value attribute of the specified @ref oval_variable.
1899 * It should be freed after use by the calling application.
1900 * @memberof oval_variable
1901 */
1902 OSCAP_API struct oval_variable_possible_value_iterator *oval_variable_get_possible_values2(struct oval_variable *variable);
1903
1904 /**
1905 * Get list of constraints for an external variable.
1906 * @return A new iterator for the possible_restriction attribute of the specified @ref oval_variable.
1907 * It should be freed after use by the calling application.
1908 * @memberof oval_variable
1909 */
1910 OSCAP_API struct oval_variable_possible_restriction_iterator *oval_variable_get_possible_restrictions2(struct oval_variable *variable);
1911
1912
1913 /**
1914 * Get restrictions from one possible_restriction element.
1915 * @return A new iterator for the restriction attribute of possible_restriction.
1916 * It should be freed after use by the calling application.
1917 * @memberof oval_variable_possible_restriction
1918 */
1919 OSCAP_API struct oval_variable_restriction_iterator *oval_variable_possible_restriction_get_restrictions2(struct oval_variable_possible_restriction *possible_restriction);
1920
1921 /**
1922 * Get operator of possible_restriction element
1923 * @return operator
1924 * @memberof oval_variable_possible_restriction
1925 */
1926 OSCAP_API oval_operator_t oval_variable_possible_restriction_get_operator(struct oval_variable_possible_restriction *possible_restriction);
1927
1928 /**
1929 * Get hint of possible_restriction element
1930 * @return hint
1931 * @memberof oval_variable_possible_restriction
1932 */
1933 OSCAP_API char* oval_variable_possible_restriction_get_hint(struct oval_variable_possible_restriction* possible_restriction);
1934
1935 /**
1936 * Returns attribute @ref Oval_component_type->text.
1937 * @memberof oval_variable
1938 */
1939 OSCAP_API const char *oval_component_type_get_text(oval_component_type_t type);
1940 /** @} */
1941
1942 /**
1943 * @name Iterators
1944 * @{
1945 */
1946 /**
1947 * Returns <b>true</b> if iterator not exhausted.
1948 * @memberof oval_variable_iterator
1949 */
1950 OSCAP_API bool oval_variable_iterator_has_more(struct oval_variable_iterator *);
1951 /**
1952 * Returns next instance of @ref oval_variable.
1953 * @memberof oval_variable_iterator
1954 */
1955 OSCAP_API struct oval_variable *oval_variable_iterator_next(struct oval_variable_iterator *);
1956 /**
1957 * Free iterator.
1958 * @memberof oval_variable_iterator
1959 */
1960 OSCAP_API void oval_variable_iterator_free(struct oval_variable_iterator *);
1961 /** @} */
1962
1963 /**
1964 * @name Evaluators
1965 * @{
1966 */
1967 /** @} */
1968
1969 /**
1970 * Construct instance of @ref oval_affected.
1971 * @memberof oval_affected
1972 */
1973 OSCAP_API struct oval_affected *oval_affected_new(struct oval_definition_model *);
1974 /**
1975 * Clone instance of @ref oval_affected.
1976 * @return A copy of the specified @ref oval_affected.
1977 * @memberof oval_affected
1978 */
1979 OSCAP_API struct oval_affected *oval_affected_clone(struct oval_definition_model *new_model, struct oval_affected *old_affected);
1980 /**
1981 * Release instance of @ref oval_affected.
1982 * @memberof oval_affected
1983 */
1984 OSCAP_API void oval_affected_free(struct oval_affected *);
1985
1986 /**
1987 * @name Setters
1988 * @{
1989 */
1990 /**
1991 * Set @ref oval_affected family.
1992 * @memberof oval_affected
1993 */
1994 OSCAP_API void oval_affected_set_family(struct oval_affected *, oval_affected_family_t family);
1995 /**
1996 * Append name to @ref oval_affected platform names.
1997 * @memberof oval_affected
1998 */
1999 OSCAP_API void oval_affected_add_platform(struct oval_affected *, char *platform_name);
2000 /**
2001 * Append name to @ref oval_affected product names.
2002 * @memberof oval_affected
2003 */
2004 OSCAP_API void oval_affected_add_product(struct oval_affected *, char *product_name);
2005 /** @} */
2006
2007 /**
2008 * @name Getters
2009 * @{
2010 */
2011 /**
2012 * Get member value @ref oval_affected family.
2013 * @note A family value of @ref OVAL_AFCFML_UNDEFINED signifies some family
2014 * other than one of the defined values is targeted.
2015 * @memberof oval_affected
2016 */
2017 OSCAP_API oval_affected_family_t oval_affected_get_family(struct oval_affected *);
2018 /**
2019 * Get member values @ref oval_affected platform_names.
2020 * If the returned iterator is empty, then the associated Oval_definition is not constrained to a specific platform choice.
2021 * @return A new iterator for the platforms attribute of the specified @ref oval_affected.
2022 * It should be freed after use by the calling application.
2023 * @memberof oval_affected
2024 */
2025 OSCAP_API struct oval_string_iterator *oval_affected_get_platforms(struct oval_affected *);
2026 /**
2027 * Get member values @ref oval_affected product_names.
2028 * If the returned iterator is empty, then the associated Oval_definition is not constrained to a specific product choice.
2029 * @return A new iterator for the products attribute of the specified @ref oval_affected.
2030 * It should be freed after use by the calling application.
2031 * @memberof oval_affected
2032 */
2033 OSCAP_API struct oval_string_iterator *oval_affected_get_products(struct oval_affected *);
2034 /** @} */
2035
2036 /**
2037 * @name Evaluators
2038 * @{
2039 */
2040 /** @} */
2041
2042 /**
2043 * @name Iterators
2044 * @{
2045 */
2046 /**
2047 * Return <b>true</b> if iterator has more @ref oval_affected.
2048 * @memberof oval_affected_iterator
2049 */
2050 OSCAP_API bool oval_affected_iterator_has_more(struct oval_affected_iterator *);
2051 /**
2052 * Return next instance of @ref oval_affected from iterator.
2053 * @memberof oval_affected_iterator
2054 */
2055 OSCAP_API struct oval_affected *oval_affected_iterator_next(struct oval_affected_iterator *);
2056 /**
2057 * Release instance of @ref oval_affected_ iterator.
2058 * @memberof oval_affected_iterator
2059 */
2060 OSCAP_API void oval_affected_iterator_free(struct oval_affected_iterator *);
2061 /** @} */
2062
2063 /**
2064 * @memberof oval_reference
2065 */
2066 OSCAP_API struct oval_reference *oval_reference_new(struct oval_definition_model *);
2067 /**
2068 * @return A copy of the specified @ref oval_reference.
2069 * @memberof oval_reference
2070 */
2071 OSCAP_API struct oval_reference *oval_reference_clone
2072 (struct oval_definition_model *new_model, struct oval_reference *old_reference);
2073 /**
2074 * @memberof oval_reference
2075 */
2076 OSCAP_API void oval_reference_free(struct oval_reference *);
2077
2078 /**
2079 * @name Setters
2080 * @{
2081 */
2082
2083 /**
2084 * Set OVAL reference source
2085 * @memberof oval_reference
2086 */
2087 OSCAP_API void oval_reference_set_source(struct oval_reference *, char *);
2088 /**
2089 * @memberof oval_reference
2090 */
2091 OSCAP_API void oval_reference_set_id(struct oval_reference *, char *);
2092 /**
2093 * @memberof oval_reference
2094 */
2095 OSCAP_API void oval_reference_set_url(struct oval_reference *, char *);
2096 /** @} */
2097
2098 /**
2099 * @name Getters
2100 * @{
2101 */
2102 /**
2103 * Get OVAL reference source.
2104 * @return A pointer to the source attribute of the specified @ref oval_reference.
2105 * @memberof oval_reference
2106 */
2107 OSCAP_API char *oval_reference_get_source(struct oval_reference *);
2108 /**
2109 * Get OVAL reference ID.
2110 * @return A pointer to the id attribute of the specified @ref oval_reference.
2111 * @memberof oval_reference
2112 */
2113 OSCAP_API char *oval_reference_get_id(struct oval_reference *);
2114 /**
2115 * Get OVAL reference URL.
2116 * @return A pointer to the url attribute of the specified @ref oval_reference.
2117 * @memberof oval_reference
2118 */
2119 OSCAP_API char *oval_reference_get_url(struct oval_reference *);
2120 /** @} */
2121
2122 /**
2123 * @name Iterators
2124 * @{
2125 */
2126 /**
2127 * @memberof oval_reference_iterator
2128 */
2129 OSCAP_API bool oval_reference_iterator_has_more(struct oval_reference_iterator *);
2130 /**
2131 * @memberof oval_reference_iterator
2132 */
2133 OSCAP_API struct oval_reference *oval_reference_iterator_next(struct oval_reference_iterator *);
2134 /**
2135 * @memberof oval_reference_iterator
2136 */
2137 OSCAP_API void oval_reference_iterator_free(struct oval_reference_iterator *);
2138 /** @} */
2139
2140 /**
2141 * @name Evaluators
2142 * @{
2143 */
2144 /** @} */
2145
2146 /**
2147 * Construct an instance of @ref oval_criteria_node.
2148 * Initialized attribute values are:
2149 * - type initialized to value of type parameter.
2150 * - negate -- initialized to <b>false</b>
2151 * - comment -- initialized to NULL
2152 * - If type == @ref OVAL_NODETYPE_CRITERIA (@ref Oval_criteria):
2153 * - operator -- initialized to @ref OVAL_OPERATOR_UNKNOWN
2154 * - subnodes -- initialized to empty iterator
2155 * - If type == @ref OVAL_NODETYPE_CRITERION (@ref Oval_criterion):
2156 * - test -- initialized to NULL
2157 * - If type == @ref OVAL_NODETYPE_EXTENDDEF (@ref Oval_extends):
2158 * - definition -- initialized to NULL
2159 * Careful ! Calling this function with inappropriate number of arguments will cause undefined behavior !
2160 *
2161 * If the type parameter is entered as @ref OVAL_NODETYPE_UNKNOWN, no instance shall be constructed
2162 * and the method shall return NULL.
2163 * @param type - the required node type.
2164 * @memberof oval_criteria_node
2165 */
2166 OSCAP_API struct oval_criteria_node *oval_criteria_node_new(struct oval_definition_model *, oval_criteria_node_type_t type);
2167 /**
2168 * Clone an instance of @ref oval_criteria_node.
2169 * @return A copy of the specified @ref oval_criteria_node.
2170 * @memberof oval_criteria_node
2171 */
2172 OSCAP_API struct oval_criteria_node *oval_criteria_node_clone
2173 (struct oval_definition_model *new_model, struct oval_criteria_node *old_node);
2174 /**
2175 * Free an instance of @ref oval_criteria_node.
2176 * @memberof oval_criteria_node
2177 */
2178 OSCAP_API void oval_criteria_node_free(struct oval_criteria_node *);
2179
2180 /**
2181 * @name Setters
2182 * @{
2183 */
2184 /**
2185 * Set attribute @ref Oval_criteria_node->negate.
2186 * @param negate - the required value of the negate attribute
2187 * @memberof oval_criteria_node
2188 */
2189 OSCAP_API void oval_criteria_node_set_negate(struct oval_criteria_node *, bool negate);
2190 /**
2191 * Set attribute @ref Oval_criteria_node->applicability_check.
2192 * @param applicability_check - the required value of the applicability_check attribute
2193 * @memberof oval_criteria_node
2194 */
2195 OSCAP_API void oval_criteria_node_set_applicability_check(struct oval_criteria_node *, bool applicability_check);
2196 /**
2197 * Set attribute @ref Oval_criteria_node->type.
2198 * @param type - the required value of the type attribute
2199 * @memberof oval_criteria_node
2200 */
2201 OSCAP_API void oval_criteria_set_node_type(struct oval_criteria_node *node, oval_criteria_node_type_t type);
2202 /**
2203 * set attribute @ref Oval_criteria_node->comment.
2204 * @param comm - (Not NULL) a copy of the comment parameter is set as the comment attribute.
2205 * @memberof oval_criteria_node
2206 */
2207 OSCAP_API void oval_criteria_node_set_comment(struct oval_criteria_node *, char *comment);
2208 /**
2209 * Set attribute @ref Oval_criteria->operator.
2210 * If Oval_criteria_node->type == @ref OVAL_NODETYPE_CRITERIA and the value of the operator attribute is @ref OVAL_OPERATOR_UNKNOWN,
2211 * this method shall overwrite the operator attribute value with the operator parameter.
2212 * Otherwise the Oval_criteria_node state shall not be changed by this method.
2213 * @memberof oval_criteria_node
2214 */
2215 OSCAP_API void oval_criteria_node_set_operator(struct oval_criteria_node *, oval_operator_t op);
2216 /**
2217 * Append instance of @ref Oval_criteria_node to attribute @ref Oval_criteria->subnodes.
2218 * If Oval_criteria_node->type <> @ref OVAL_NODETYPE_CRITERIA, this method shall return without changing the Oval_criteria_node state.
2219 * @note Instances of Oval_criteria_node bound to an Oval_criteria by this method should not be subsequently freed by the application using oval_criteria_node_free.
2220 * These instances shall be freed by the API when the Oval_criteria is freed.
2221 * @note An application should not bind a given Oval_criteria_node as a subnode to more than one Oval_criteria,
2222 * nor should a given Oval_criteria_node be bound more than once to a single Oval_criteria.
2223 * @param - (Not NULL) the subnode to be appended.
2224 * @memberof oval_criteria_node
2225 */
2226 OSCAP_API void oval_criteria_node_add_subnode(struct oval_criteria_node *, struct oval_criteria_node *node);
2227 /**
2228 * Sets attribute @ref Oval_criterion->test.
2229 * If Oval_criteria_node->type == @ref OVAL_NODETYPE_CRITERION and the value of the test attribute is NULL,
2230 * this method shall overwrite the test attribute value with the test parameter.
2231 * Otherwise the Oval_criteria_node state shall not be changed by this method.
2232 * @memberof oval_criteria_node
2233 */
2234 OSCAP_API void oval_criteria_node_set_test(struct oval_criteria_node *, struct oval_test *);
2235 /**
2236 * Sets attribute @ref Oval_extends->definition.
2237 * If Oval_criteria_node->type == @ref OVAL_NODETYPE_EXTENDDEF and the value of the definition attribute is NULL,
2238 * this method shall overwrite the definition attribute value with the definition parameter.
2239 * Otherwise the Oval_criteria_node state shall not be changed by this method.
2240 * @memberof oval_criteria_node
2241 */
2242 OSCAP_API void oval_criteria_node_set_definition(struct oval_criteria_node *, struct oval_definition *); //type==NODETYPE_EXTENDDEF
2243 /** @} */
2244
2245 /**
2246 * @name Getters
2247 * @{
2248 */
2249 /**
2250 * Returns attribute @ref Oval_criteria_node->type.
2251 * @memberof oval_criteria_node
2252 */
2253 OSCAP_API oval_criteria_node_type_t oval_criteria_node_get_type(struct oval_criteria_node *);
2254 /**
2255 * Returns attribute @ref Oval_criteria_node->negate.
2256 * @memberof oval_criteria_node
2257 */
2258 OSCAP_API bool oval_criteria_node_get_negate(struct oval_criteria_node *);
2259 /**
2260 * Returns attribute @ref Oval_criteria_node->applicability_check.
2261 * @memberof oval_criteria_node
2262 */
2263 OSCAP_API bool oval_criteria_node_get_applicability_check(struct oval_criteria_node *);
2264
2265 /**
2266 * Returns attribute @ref Oval_criteria_node->comment.
2267 * @return A pointer to the comment attribute of the specified @ref oval_criteria_node.
2268 * @memberof oval_criteria_node
2269 */
2270 OSCAP_API char *oval_criteria_node_get_comment(struct oval_criteria_node *);
2271 /**
2272 * Returns attribute @ref Oval_criteria->operator HOWDI.
2273 * @note If Oval_criteria_node->type <> @ref OVAL_NODETYPE_CRITERIA, this method shall return @ref OVAL_OPERATOR_UNKNOWN.
2274 * @memberof oval_criteria_node
2275 */
2276 OSCAP_API oval_operator_t oval_criteria_node_get_operator(struct oval_criteria_node *);
2277 /**
2278 * Returns attribute @ref Oval_criteria_node->subnodes.
2279 * If Oval_criteria_node->type <> @ref OVAL_NODETYPE_CRITERIA, this method shall return NULL.
2280 * @return A new iterator for the subnodes attribute of the specified @ref oval_criteria_node.
2281 * It should be freed after use by the calling application.
2282 * @memberof oval_criteria_node
2283 */
2284 OSCAP_API struct oval_criteria_node_iterator *oval_criteria_node_get_subnodes(struct oval_criteria_node *);
2285 /**
2286 * Returns attribute @ref Oval_criterion->test.
2287 * If Oval_criteria_node->type <> @ref OVAL_NODETYPE_CRITERION, this method shall return NULL.
2288 * @return A pointer to the test attribute of the specified @ref oval_criteria_node.
2289 * @memberof oval_criteria_node
2290 */
2291 OSCAP_API struct oval_test *oval_criteria_node_get_test(struct oval_criteria_node *);
2292 /**
2293 * Returns attribute @ref Oval_extends->definition.
2294 * If Oval_criteria_node->type <> @ref OVAL_NODETYPE_EXTENDDEF, this method shall return NULL.
2295 * @return A pointer to the definition attribute of the specified @ref oval_criteria_node.
2296 * @memberof oval_criteria_node
2297 */
2298 OSCAP_API struct oval_definition *oval_criteria_node_get_definition(struct oval_criteria_node *);
2299 /** @} */
2300
2301 /**
2302 * @name Iterators
2303 * @{
2304 */
2305 /**
2306 * Returns <b>true</b> if the iterator is not exhausted.
2307 * @memberof oval_criteria_node_iterator
2308 */
2309 OSCAP_API bool oval_criteria_node_iterator_has_more(struct oval_criteria_node_iterator *);
2310 /**
2311 * Returns the next instance of @ref Oval_criteria_node from the iterator.
2312 * Returns NULL if the iterator is exhausted.
2313 * @memberof oval_criteria_node_iterator
2314 */
2315 OSCAP_API struct oval_criteria_node *oval_criteria_node_iterator_next(struct oval_criteria_node_iterator *);
2316 /**
2317 * Free the iterator.
2318 * @memberof oval_criteria_node_iterator
2319 */
2320 OSCAP_API void oval_criteria_node_iterator_free(struct oval_criteria_node_iterator *);
2321 /** @} */
2322
2323 /**
2324 * @name Evaluators
2325 * @{
2326 */
2327 /** @} */
2328
2329 /**
2330 * @memberof oval_object_content
2331 */
2332 OSCAP_API struct oval_object_content *oval_object_content_new(struct oval_definition_model *model, oval_object_content_type_t type);
2333
2334 /**
2335 * @return A copy of the specified @ref oval_object_content.
2336 * @memberof oval_object_content
2337 */
2338 OSCAP_API struct oval_object_content *oval_object_content_clone
2339 (struct oval_definition_model *new_model, struct oval_object_content *old_content);
2340
2341 /**
2342 * @memberof oval_object_content
2343 */
2344 OSCAP_API void oval_object_content_free(struct oval_object_content *);
2345
2346 /**
2347 * @name Setters
2348 * @{
2349 */
2350
2351 /**
2352 * @memberof oval_object_content
2353 */
2354 OSCAP_API void oval_object_content_set_type(struct oval_object_content *, oval_object_content_type_t);
2355 /**
2356 * @memberof oval_object_content
2357 */
2358 OSCAP_API void oval_object_content_set_field_name(struct oval_object_content *, char *);
2359 /**
2360 * @memberof oval_object_content
2361 */
2362 OSCAP_API void oval_object_content_set_entity(struct oval_object_content *, struct oval_entity *); //type == OVAL_OBJECTCONTENT_ENTITY
2363 /**
2364 * @memberof oval_object_content
2365 */
2366 OSCAP_API void oval_object_content_set_varCheck(struct oval_object_content *, oval_check_t); //type == OVAL_OBJECTCONTENT_ENTITY
2367 /**
2368 * @memberof oval_object_content
2369 */
2370 OSCAP_API void oval_object_content_set_setobject(struct oval_object_content *, struct oval_setobject *); //type == OVAL_OBJECTCONTENT_SET
2371 /**
2372 * @memberof oval_object_content
2373 */
2374 OSCAP_API void oval_object_content_set_filter(struct oval_object_content *, struct oval_filter *); //type == OVAL_OBJECTCONTENT_FILTER
2375 /** @} */
2376
2377 /**
2378 * @name Getters
2379 * @{
2380 */
2381 /**
2382 * Get field name of a object content.
2383 * @return A pointer to the fieldName attribute of the specified @ref oval_object_content.
2384 * @memberof oval_object_content
2385 */
2386 OSCAP_API char *oval_object_content_get_field_name(struct oval_object_content *);
2387 /**
2388 * Get type of a object content (entity or set).
2389 * @memberof oval_object_content
2390 */
2391 OSCAP_API oval_object_content_type_t oval_object_content_get_type(struct oval_object_content *);
2392 /**
2393 * Get entity of a simple object content.
2394 * @return A pointer to the entity attribute of the specified @ref oval_object_content.
2395 * @memberof oval_object_content
2396 */
2397 OSCAP_API struct oval_entity *oval_object_content_get_entity(struct oval_object_content *); //type == OVAL_OBJECTCONTENT_ENTITY
2398 /**
2399 * Get varCheck of a simple object content.
2400 * @memberof oval_object_content
2401 */
2402 OSCAP_API oval_check_t oval_object_content_get_varCheck(struct oval_object_content *); //type == OVAL_OBJECTCONTENT_ENTITY
2403 /**
2404 * Get setobject of a set object content.
2405 * @return A pointer to the set attribute of the specified @ref oval_object_content.
2406 * @memberof oval_object_content
2407 */
2408 OSCAP_API struct oval_setobject *oval_object_content_get_setobject(struct oval_object_content *); //type == OVAL_OBJECTCONTENT_SET
2409 /**
2410 * Get filter of a set object content.
2411 * @return A pointer to the filter attribute of the specified @ref oval_object_content.
2412 * @memberof oval_object_content
2413 */
2414 OSCAP_API struct oval_filter *oval_object_content_get_filter(struct oval_object_content *content); //type == OVAL_OBJECTCONTENT_FILTER
2415 /** @} */
2416
2417 /**
2418 * @name Iterators
2419 * @{
2420 */
2421 /**
2422 * @memberof oval_object_content_iterator
2423 */
2424 OSCAP_API bool oval_object_content_iterator_has_more(struct oval_object_content_iterator *);
2425 /**
2426 * @memberof oval_object_content_iterator
2427 */
2428 OSCAP_API struct oval_object_content *oval_object_content_iterator_next(struct oval_object_content_iterator *);
2429 /**
2430 * @memberof oval_object_content_iterator
2431 */
2432 OSCAP_API void oval_object_content_iterator_free(struct oval_object_content_iterator *);
2433 /** @} */
2434
2435 /**
2436 * @name Evaluators
2437 * @{
2438 */
2439 /** @} */
2440
2441 /**
2442 * @memberof oval_behavior
2443 */
2444 OSCAP_API struct oval_behavior *oval_behavior_new(struct oval_definition_model *);
2445
2446 /**
2447 * @return A copy of the specified @ref oval_behavior.
2448 * @memberof oval_behavior
2449 */
2450 OSCAP_API struct oval_behavior *oval_behavior_clone(struct oval_definition_model *new_model, struct oval_behavior *old_behavior);
2451 /**
2452 * @memberof oval_behavior
2453 */
2454 OSCAP_API void oval_behavior_free(struct oval_behavior *);
2455
2456 /**
2457 * @name Setters
2458 * @{
2459 */
2460 /**
2461 * @memberof oval_behavior
2462 */
2463 OSCAP_API void oval_behavior_set_keyval(struct oval_behavior *behavior, const char *key, const char *value);
2464 /** @} */
2465
2466 /**
2467 * @name Getters
2468 * @{
2469 */
2470 /**
2471 * Get OVAL behavior name.
2472 * @return A pointer to the key attribute of the specified @ref oval_behavior.
2473 * @memberof oval_behavior
2474 */
2475 OSCAP_API char *oval_behavior_get_key(struct oval_behavior *);
2476 /**
2477 * Get OVAL behavior value.
2478 * @return A pointer to the value attribute of the specified @ref oval_behavior.
2479 * @memberof oval_behavior
2480 */
2481 OSCAP_API char *oval_behavior_get_value(struct oval_behavior *);
2482 /** @} */
2483
2484 /**
2485 * @name Iterators
2486 * @{
2487 */
2488 /**
2489 * @memberof oval_behavior_iterator
2490 */
2491 OSCAP_API bool oval_behavior_iterator_has_more(struct oval_behavior_iterator *);
2492 /**
2493 * @memberof oval_behavior_iterator
2494 */
2495 OSCAP_API struct oval_behavior *oval_behavior_iterator_next(struct oval_behavior_iterator *);
2496 /**
2497 * @memberof oval_behavior_iterator
2498 */
2499 OSCAP_API void oval_behavior_iterator_free(struct oval_behavior_iterator *);
2500 /** @} */
2501
2502 /**
2503 * @name Evaluators
2504 * @{
2505 */
2506 /** @} */
2507
2508 /**
2509 * @memberof oval_state_content
2510 */
2511 OSCAP_API struct oval_state_content *oval_state_content_new(struct oval_definition_model *);
2512 /**
2513 * @return A copy of the specified @ref oval_state_content.
2514 * @memberof oval_state_content
2515 */
2516 OSCAP_API struct oval_state_content *oval_state_content_clone (struct oval_definition_model *new_model, struct oval_state_content *old_content);
2517 /**
2518 * @memberof oval_state_content
2519 */
2520 OSCAP_API void oval_state_content_free(struct oval_state_content *);
2521
2522 /**
2523 * @name Setters
2524 * @{
2525 */
2526 /**
2527 * @memberof oval_state_content
2528 */
2529 OSCAP_API void oval_state_content_set_entity(struct oval_state_content *, struct oval_entity *);
2530 /**
2531 * @memberof oval_state_content
2532 */
2533 OSCAP_API void oval_state_content_add_record_field(struct oval_state_content *, struct oval_record_field *);
2534 /**
2535 * @memberof oval_state_content
2536 */
2537 OSCAP_API void oval_state_content_set_varcheck(struct oval_state_content *, oval_check_t);
2538 /**
2539 * @memberof oval_state_content
2540 */
2541 OSCAP_API void oval_state_content_set_entcheck(struct oval_state_content *, oval_check_t);
2542 /**
2543 * Sets the "check_existence" attribute of an OVAL state entity
2544 * @param content An entity within the state element
2545 * @param existence New value of check_existence attribute of that entity
2546 * @memberof oval_state_content
2547 */
2548 OSCAP_API void oval_state_content_set_check_existence(struct oval_state_content *content, oval_existence_t existence);
2549 /** @} */
2550
2551 /**
2552 * @name Getters
2553 * @{
2554 */
2555 /**
2556 * Get entity of a state content.
2557 * @return A pointer to the entity attribute of the specified @ref oval_state_content.
2558 * @memberof oval_state_content
2559 */
2560 OSCAP_API struct oval_entity *oval_state_content_get_entity(struct oval_state_content *);
2561 /**
2562 * @memberof oval_state_content
2563 */
2564 OSCAP_API struct oval_record_field_iterator *oval_state_content_get_record_fields(struct oval_state_content *);
2565 /**
2566 * Get multipe variable values processing of a state content.
2567 * @memberof oval_state_content
2568 */
2569 OSCAP_API oval_check_t oval_state_content_get_var_check(struct oval_state_content *);
2570 /**
2571 * Get multipe entities processing of a state content.
2572 * @memberof oval_state_content
2573 */
2574 OSCAP_API oval_check_t oval_state_content_get_ent_check(struct oval_state_content *);
2575 /**
2576 * Get "check_existence" attribute of an OVAL state entity
2577 * @param content An entity within the state element
2578 * @return Value of the check_existence attribute
2579 * @memberof oval_state_content
2580 */
2581 OSCAP_API oval_existence_t oval_state_content_get_check_existence(struct oval_state_content *content);
2582 /** @} */
2583
2584 /**
2585 * @name Iterators
2586 * @{
2587 */
2588 /**
2589 * @ingroup oval_state_content_iterators
2590 * @memberof oval_state_content_iterator
2591 */
2592 OSCAP_API bool oval_state_content_iterator_has_more(struct oval_state_content_iterator *);
2593 /**
2594 * @memberof oval_state_content_iterator
2595 */
2596 OSCAP_API struct oval_state_content *oval_state_content_iterator_next(struct oval_state_content_iterator *);
2597 /**
2598 * @memberof oval_state_content_iterator
2599 */
2600 OSCAP_API void oval_state_content_iterator_free(struct oval_state_content_iterator *);
2601 /** @} */
2602
2603 /**
2604 * @memberof oval_value
2605 */
2606 OSCAP_API struct oval_value *oval_value_new(oval_datatype_t datatype, char *text_value);
2607 /**
2608 * @return A copy of the specified @ref oval_value.
2609 * @memberof oval_value
2610 */
2611 OSCAP_API struct oval_value *oval_value_clone(struct oval_value *old_value);
2612 /**
2613 * @memberof oval_value
2614 */
2615 OSCAP_API void oval_value_free(struct oval_value *);
2616
2617 /**
2618 * @name Setters
2619 * @{
2620 */
2621 /**
2622 * @memberof oval_value
2623 */
2624 OSCAP_API void oval_value_set_datatype(struct oval_value *, oval_datatype_t);
2625
2626 /**
2627 * @name Getters
2628 * @{
2629 */
2630 /**
2631 * Get OVAL value datatype.
2632 * @memberof oval_value
2633 */
2634 OSCAP_API oval_datatype_t oval_value_get_datatype(struct oval_value *);
2635 /**
2636 * Get OVAL value as a text.
2637 * @return A pointer to the text attribute of the specified @ref oval_value.
2638 * @memberof oval_value
2639 */
2640 OSCAP_API char *oval_value_get_text(struct oval_value *);
2641 /**
2642 * Get OVAL value as a piece of raw binary data.
2643 * @memberof oval_value
2644 */
2645 OSCAP_API unsigned char *oval_value_get_binary(struct oval_value *); //datatype==OVAL_DATATYPE_BINARY
2646 /**
2647 * Get OVAL value as a boolean.
2648 * @memberof oval_value
2649 */
2650 OSCAP_API bool oval_value_get_boolean(struct oval_value *); //datatype==OVAL_DATATYPE_BOOLEAN
2651 /**
2652 * Get OVAL value as a floating point number.
2653 * @memberof oval_value
2654 */
2655 OSCAP_API float oval_value_get_float(struct oval_value *); //datatype==OVAL_DATATYPE_FLOAT
2656 /**
2657 * Get OVAL value as an integer.
2658 * @memberof oval_value
2659 */
2660 OSCAP_API long long oval_value_get_integer(struct oval_value *); //datatype==OVAL_DATATYPE_INTEGER
2661 /** @} */
2662
2663 /**
2664 * @name Iterators
2665 * @{
2666 */
2667 /**
2668 * @memberof oval_value_iterator
2669 */
2670 OSCAP_API bool oval_value_iterator_has_more(struct oval_value_iterator *);
2671 /**
2672 * @memberof oval_value_iterator
2673 */
2674 OSCAP_API struct oval_value *oval_value_iterator_next(struct oval_value_iterator *);
2675 /**
2676 * @memberof oval_value_iterator
2677 */
2678 OSCAP_API int oval_value_iterator_remaining(struct oval_value_iterator *iterator);
2679 /**
2680 * @memberof oval_value_iterator
2681 */
2682 OSCAP_API void oval_value_iterator_free(struct oval_value_iterator *);
2683 /** @} */
2684
2685 /**
2686 * @name Evaluators
2687 * @{
2688 */
2689 /** @} */
2690
2691 /**
2692 * @memberof oval_entity
2693 */
2694 OSCAP_API struct oval_entity *oval_entity_new(struct oval_definition_model *);
2695 /**
2696 * @return A copy of the specified @ref oval_entity.
2697 * @memberof oval_entity
2698 */
2699 OSCAP_API struct oval_entity *oval_entity_clone(struct oval_definition_model *model, struct oval_entity *old_entity);
2700 /**
2701 * @memberof oval_entity
2702 */
2703 OSCAP_API void oval_entity_free(struct oval_entity *);
2704
2705 /**
2706 * @name Setters
2707 * @{
2708 */
2709 /**
2710 * @memberof oval_entity
2711 */
2712 OSCAP_API void oval_entity_set_type(struct oval_entity *, oval_entity_type_t);
2713 /**
2714 * @memberof oval_entity
2715 */
2716 OSCAP_API void oval_entity_set_datatype(struct oval_entity *, oval_datatype_t);
2717 /**
2718 * @memberof oval_entity
2719 */
2720 OSCAP_API void oval_entity_set_mask(struct oval_entity *, int);
2721 /**
2722 * @memberof oval_entity
2723 */
2724 OSCAP_API void oval_entity_set_varref_type(struct oval_entity *, oval_entity_varref_type_t);
2725 /**
2726 * @memberof oval_entity
2727 */
2728 OSCAP_API void oval_entity_set_variable(struct oval_entity *, struct oval_variable *);
2729 /**
2730 * @memberof oval_entity
2731 */
2732 OSCAP_API void oval_entity_set_value(struct oval_entity *, struct oval_value *);
2733 /**
2734 * @memberof oval_entity
2735 */
2736 OSCAP_API void oval_entity_set_name(struct oval_entity *, char *);
2737 /**
2738 * @memberof oval_entity
2739 */
2740 OSCAP_API void oval_entity_set_operation(struct oval_entity *, oval_operation_t);
2741 /** @} */
2742
2743 /**
2744 * @name Getters
2745 * @{
2746 */
2747 /**
2748 * Get OVAL entity name.
2749 * @return A pointer to the name attribute of the specified @ref oval_entity.
2750 * @memberof oval_entity
2751 */
2752 OSCAP_API char *oval_entity_get_name(struct oval_entity *);
2753 /**
2754 * Get OVAL entity type.
2755 * @memberof oval_entity
2756 */
2757 OSCAP_API oval_entity_type_t oval_entity_get_type(struct oval_entity *);
2758 /**
2759 * Get OVAL entity datatype.
2760 * @memberof oval_entity
2761 */
2762 OSCAP_API oval_datatype_t oval_entity_get_datatype(struct oval_entity *);
2763 /**
2764 * Get OVAL entity operation type.
2765 * @memberof oval_entity
2766 */
2767 OSCAP_API oval_operation_t oval_entity_get_operation(struct oval_entity *);
2768 /**
2769 * Get OVAL entity varref variable.
2770 * @return A pointer to the variable attribute of the specified @ref oval_entity.
2771 * @memberof oval_entity
2772 */
2773 OSCAP_API struct oval_variable *oval_entity_get_variable(struct oval_entity *);
2774 /**
2775 * Get OVAL entity value.
2776 * @return A pointer to the value attribute of the specified @ref oval_entity.
2777 * @memberof oval_entity
2778 */
2779 OSCAP_API struct oval_value *oval_entity_get_value(struct oval_entity *);
2780 /**
2781 * Get OVAL entity mask.
2782 * @memberof oval_entity
2783 */
2784 OSCAP_API int oval_entity_get_mask(struct oval_entity *);
2785 /**
2786 * Get OVAL entity varref type.
2787 * @memberof oval_entity
2788 */
2789 OSCAP_API oval_entity_varref_type_t oval_entity_get_varref_type(struct oval_entity *);
2790 /** @} */
2791
2792 /**
2793 * @name Iterators
2794 * @{
2795 */
2796 /**
2797 * @memberof oval_entity_iterator
2798 */
2799 OSCAP_API bool oval_entity_iterator_has_more(struct oval_entity_iterator *);
2800 /**
2801 * @memberof oval_entity_iterator
2802 */
2803 OSCAP_API struct oval_entity *oval_entity_iterator_next(struct oval_entity_iterator *);
2804 /**
2805 * @memberof oval_entity_iterator
2806 */
2807 OSCAP_API void oval_entity_iterator_free(struct oval_entity_iterator *);
2808 /** @} */
2809
2810 /**
2811 * @name Evaluators
2812 * @{
2813 */
2814 /** @} */
2815
2816 /**
2817 * @memberof oval_record_field
2818 */
2819 OSCAP_API struct oval_record_field *oval_record_field_new(oval_record_field_type_t);
2820 /**
2821 * @memberof oval_record_field
2822 */
2823 OSCAP_API struct oval_record_field *oval_record_field_clone(struct oval_record_field *);
2824 /**
2825 * @memberof oval_record_field
2826 */
2827 OSCAP_API void oval_record_field_free(struct oval_record_field *);
2828
2829 /**
2830 * @name Setters
2831 * @{
2832 */
2833 /**
2834 * @memberof oval_record_field
2835 */
2836 OSCAP_API void oval_record_field_set_name(struct oval_record_field *, char *);
2837 /**
2838 * @memberof oval_record_field
2839 */
2840 OSCAP_API void oval_record_field_set_value(struct oval_record_field *, char *);
2841 /**
2842 * @memberof oval_record_field
2843 */
2844 OSCAP_API void oval_record_field_set_datatype(struct oval_record_field *, oval_datatype_t);
2845 /**
2846 * @memberof oval_record_field
2847 */
2848 OSCAP_API void oval_record_field_set_mask(struct oval_record_field *, int);
2849 /**
2850 * @memberof oval_record_field
2851 */
2852 OSCAP_API void oval_record_field_set_operation(struct oval_record_field *, oval_operation_t);
2853 /**
2854 * @memberof oval_record_field
2855 */
2856 OSCAP_API void oval_record_field_set_variable(struct oval_record_field *, struct oval_variable *);
2857 /**
2858 * @memberof oval_record_field
2859 */
2860 OSCAP_API void oval_record_field_set_var_check(struct oval_record_field *, oval_check_t);
2861 /**
2862 * @memberof oval_record_field
2863 */
2864 OSCAP_API void oval_record_field_set_ent_check(struct oval_record_field *, oval_check_t);
2865 /** @} */
2866
2867 /**
2868 * @name Getters
2869 * @{
2870 */
2871 /**
2872 * @memberof oval_record_field
2873 */
2874 OSCAP_API oval_record_field_type_t oval_record_field_get_type(struct oval_record_field *);
2875 /**
2876 * @memberof oval_record_field
2877 */
2878 OSCAP_API char *oval_record_field_get_name(struct oval_record_field *);
2879 /**
2880 * @memberof oval_record_field
2881 */
2882 OSCAP_API char *oval_record_field_get_value(struct oval_record_field *);
2883 /**
2884 * @memberof oval_record_field
2885 */
2886 OSCAP_API oval_datatype_t oval_record_field_get_datatype(struct oval_record_field *);
2887 /**
2888 * @memberof oval_record_field
2889 */
2890 OSCAP_API int oval_record_field_get_mask(struct oval_record_field *);
2891 /**
2892 * @memberof oval_record_field
2893 */
2894 OSCAP_API oval_operation_t oval_record_field_get_operation(struct oval_record_field *);
2895 /**
2896 * @memberof oval_record_field
2897 */
2898 OSCAP_API struct oval_variable *oval_record_field_get_variable(struct oval_record_field *);
2899 /**
2900 * @memberof oval_record_field
2901 */
2902 OSCAP_API oval_check_t oval_record_field_get_var_check(struct oval_record_field *);
2903 /**
2904 * @memberof oval_record_field
2905 */
2906 OSCAP_API oval_check_t oval_record_field_get_ent_check(struct oval_record_field *);
2907 /** @} */
2908
2909 /**
2910 * @name Iterators
2911 * @{
2912 */
2913 /**
2914 * @memberof oval_record_field
2915 */
2916 OSCAP_API bool oval_record_field_iterator_has_more(struct oval_record_field_iterator *);
2917 /**
2918 * @memberof oval_record_field
2919 */
2920 OSCAP_API struct oval_record_field *oval_record_field_iterator_next(struct oval_record_field_iterator *);
2921 /**
2922 * @memberof oval_record_field
2923 */
2924 OSCAP_API void oval_record_field_iterator_free(struct oval_record_field_iterator *);
2925 /** @} */
2926
2927 /**
2928 * @name Evaluators
2929 * @{
2930 */
2931 /** @} */
2932
2933 /**
2934 * @memberof oval_filter
2935 */
2936 OSCAP_API struct oval_filter *oval_filter_new(struct oval_definition_model *);
2937 /**
2938 * @memberof oval_filter
2939 */
2940 OSCAP_API void oval_filter_free(struct oval_filter *);
2941 /**
2942 * @memberof oval_filter
2943 */
2944 OSCAP_API struct oval_filter *oval_filter_clone(struct oval_definition_model *, struct oval_filter *);
2945
2946 /**
2947 * @name Setters
2948 * @{
2949 */
2950 /**
2951 * @memberof oval_filter
2952 */
2953 OSCAP_API void oval_filter_set_state(struct oval_filter *, struct oval_state *);
2954 /**
2955 * @memberof oval_filter
2956 */
2957 OSCAP_API void oval_filter_set_filter_action(struct oval_filter *, oval_filter_action_t );
2958 /** @} */
2959
2960 /**
2961 * @name Getters
2962 * @{
2963 */
2964 /**
2965 * @memberof oval_filter
2966 */
2967 OSCAP_API struct oval_state *oval_filter_get_state(struct oval_filter *);
2968 /**
2969 * @memberof oval_filter
2970 */
2971 OSCAP_API oval_filter_action_t oval_filter_get_filter_action(struct oval_filter *);
2972 /** @} */
2973
2974 /**
2975 * @name Iterators
2976 * @{
2977 */
2978 /**
2979 * @memberof oval_filter
2980 */
2981 OSCAP_API bool oval_filter_iterator_has_more(struct oval_filter_iterator *);
2982 /**
2983 * @memberof oval_filter
2984 */
2985 OSCAP_API struct oval_filter *oval_filter_iterator_next(struct oval_filter_iterator *);
2986 /**
2987 * @memberof oval_filter
2988 */
2989 OSCAP_API void oval_filter_iterator_free(struct oval_filter_iterator *);
2990 /** @} */
2991
2992 /**
2993 * @name Evaluators
2994 * @{
2995 */
2996 /** @} */
2997
2998 /**
2999 * @memberof oval_setobject
3000 */
3001 OSCAP_API struct oval_setobject *oval_setobject_new(struct oval_definition_model *);
3002 /**
3003 * @return A copy of the specified @ref oval_setobject.
3004 * @memberof oval_setobject
3005 */
3006 OSCAP_API struct oval_setobject *oval_setobject_clone(struct oval_definition_model *new_model, struct oval_setobject *old_setobject);
3007 /**
3008 * @memberof oval_setobject
3009 */
3010 OSCAP_API void oval_setobject_free(struct oval_setobject *);
3011
3012 /**
3013 * @name Setters
3014 * @{
3015 */
3016 /**
3017 */
3018 OSCAP_API void oval_setobject_set_type(struct oval_setobject *, oval_setobject_type_t);
3019 /**
3020 * @memberof oval_setobject
3021 */
3022 OSCAP_API void oval_setobject_set_operation(struct oval_setobject *, oval_setobject_operation_t);
3023 /**
3024 * @memberof oval_setobject
3025 */
3026 OSCAP_API void oval_setobject_add_subset(struct oval_setobject *, struct oval_setobject *); //type==OVAL_SET_AGGREGATE;
3027 /**
3028 * @memberof oval_setobject
3029 */
3030 OSCAP_API void oval_setobject_add_object(struct oval_setobject *, struct oval_object *); //type==OVAL_SET_COLLECTIVE;
3031 /**
3032 * @memberof oval_setobject
3033 */
3034 OSCAP_API void oval_setobject_add_filter(struct oval_setobject *, struct oval_filter *); //type==OVAL_SET_COLLECTIVE;
3035 /** @} */
3036
3037 /**
3038 * @name Getters
3039 * @{
3040 */
3041 /**
3042 * Get OVAL set object type.
3043 * @memberof oval_setobject
3044 */
3045 OSCAP_API oval_setobject_type_t oval_setobject_get_type(struct oval_setobject *);
3046 /**
3047 * Get OVAL set object operation type.
3048 * @memberof oval_setobject
3049 */
3050 OSCAP_API oval_setobject_operation_t oval_setobject_get_operation(struct oval_setobject *);
3051 /**
3052 * Get OVAL set object subsets.
3053 * This works only with sets of OVAL_SET_AGGREGATE type.
3054 * @return A new iterator for the subsets attribute of the specified @ref oval_setobject.
3055 * It should be freed after use by the calling application.
3056 * @memberof oval_setobject
3057 */
3058 OSCAP_API struct oval_setobject_iterator *oval_setobject_get_subsets(struct oval_setobject *); //type==OVAL_SET_AGGREGATE;
3059 /**
3060 * Get OVAL set object referenced objects.
3061 * This works only with sets of OVAL_SET_COLLECTIVE type.
3062 * @return A new iterator for the objects attribute of the specified @ref oval_setobject.
3063 * It should be freed after use by the calling application.
3064 * @memberof oval_setobject
3065 */
3066 OSCAP_API struct oval_object_iterator *oval_setobject_get_objects(struct oval_setobject *); //type==OVAL_SET_COLLECTIVE;
3067 /**
3068 * Get OVAL set object filters.
3069 * This works only with sets of OVAL_SET_COLLECTIVE type.
3070 * @return A new iterator for the filters attribute of the specified @ref oval_setobject.
3071 * It should be freed after use by the calling application.
3072 * @memberof oval_setobject
3073 */
3074 OSCAP_API struct oval_filter_iterator *oval_setobject_get_filters(struct oval_setobject *); //type==OVAL_SET_COLLECTIVE;
3075 /** @} */
3076
3077 /**
3078 * @name Iterators
3079 * @{
3080 */
3081 /**
3082 * @memberof oval_setobject_iterator
3083 */
3084 OSCAP_API bool oval_setobject_iterator_has_more(struct oval_setobject_iterator *);
3085 /**
3086 * @memberof oval_setobject_iterator
3087 */
3088 OSCAP_API struct oval_setobject *oval_setobject_iterator_next(struct oval_setobject_iterator *);
3089 /**
3090 * @memberof oval_setobject_iterator
3091 */
3092 OSCAP_API void oval_setobject_iterator_free(struct oval_setobject_iterator *);
3093 /** @} */
3094
3095 /**
3096 * @name Evaluators
3097 * @{
3098 */
3099 /** @} */
3100
3101 /**
3102 * Construct new intance of @ref Oval_component.
3103 * Attribute values shall be initialized:
3104 * - type -- initialized to the value of the type parameter.
3105 * - If type == @ref OVAL_FUNCTION_CONCAT
3106 * - components -- initialized to empty iterator
3107 * - If type == @ref OVAL_FUNCTION_COUNT
3108 * - components -- initialized to empty iterator
3109 * - If type == @ref OVAL_FUNCTION_ESCAPE_REGEX
3110 * - components -- initialized to empty iterator
3111 * - If type == @ref OVAL_FUNCTION_ARITHMETIC
3112 * - arithmetic_operation -- initialized to @ref OVAL_ARITHMETIC_UNKNOWN
3113 * - components -- initialized to empty iterator
3114 * - If type == @ref OVAL_FUNCTION_BEGIN
3115 * - prefix -- initialized to NULL
3116 * - components -- initialized to empty iterator
3117 * - If type == @ref OVAL_FUNCTION_END
3118 * - suffix -- initialized to NULL
3119 * - components -- initialized to empty iterator
3120 * - If type == @ref OVAL_FUNCTION_SPLIT
3121 * - delimiter -- initialized to NULL
3122 * - components -- initialized to empty iterator
3123 * - If type == @ref OVAL_FUNCTION_SUBSTRING
3124 * - start, length -- initialized to zero
3125 * - components -- initialized to empty iterator
3126 * - If type == @ref OVAL_FUNCTION_TIMEDIF
3127 * - timedif_format_1, timedif_format_2 -- initialized to @ref OVAL_DATETIME_UNKNOWN
3128 * - components -- initialized to empty iterator
3129 * - If type == @ref OVAL_FUNCTION_REGEX_CAPTURE
3130 * - pattern -- initialized to NULL
3131 * - components -- initialized to empty iterator
3132 * - If type == @ref OVAL_COMPONENT_LITERAL
3133 * - literal -- initialized to NULL
3134 * - If type == @ref OVAL_COMPONENT_OBJECTREF
3135 * - object -- initialized to NULL
3136 * - object_field -- initialized to NULL
3137 * - If type == @ref OVAL_COMPONENT_VARREF
3138 * - variable -- initialized to NULL
3139 *
3140 * This method shall not construct a new instance of Oval_object and shall return NULL if the type parameter is entered as @ref OVAL_COMPONENT_UNKNOWN.
3141 * @param type - the required component type.
3142 * @memberof oval_component
3143 */
3144 OSCAP_API struct oval_component *oval_component_new(struct oval_definition_model *, oval_component_type_t type);
3145 /**
3146 * Clone instance of @ref Oval_component.
3147 * @return A copy of the specified @ref oval_component.
3148 * @memberof oval_component
3149 */
3150 OSCAP_API struct oval_component *oval_component_clone(struct oval_definition_model *new_model,
3151 struct oval_component *old_component);
3152 /**
3153 * Free instance of @ref Oval_component
3154 * @memberof oval_component
3155 */
3156 OSCAP_API void oval_component_free(struct oval_component *);
3157
3158 /**
3159 * @name Setters
3160 * @{
3161 */
3162 /**
3163 * Set type of component @ref Oval_component->type
3164 * @memberof oval_component
3165 */
3166 OSCAP_API void oval_component_set_type(struct oval_component *component, oval_component_type_t type);
3167 /**
3168 * set attribute @ref Oval_component_object->object.
3169 * IF component->type <> @ref OVAL_COMPONENT_OBJECTREF OR component->object <> NULL, this method does nothing .
3170 * @memberof oval_component
3171 */
3172 OSCAP_API void oval_component_set_object(struct oval_component *, struct oval_object *object);
3173 /**
3174 * set attribute @ref Oval_component_object->item_field.
3175 * @memberof oval_component
3176 */
3177 OSCAP_API void oval_component_set_item_field(struct oval_component *, char *);
3178 /**
3179 * set attribute @ref Oval_component_object->record_field.
3180 * @memberof oval_component
3181 */
3182 OSCAP_API void oval_component_set_record_field(struct oval_component *, char *);
3183 /**
3184 * set attribute @ref Oval_component_object->variable.
3185 * IF component->type <> @ref OVAL_COMPONENT_OBJECTREF OR component->variable <> NULL, this method does nothing.
3186 * @memberof oval_component
3187 */
3188 OSCAP_API void oval_component_set_variable(struct oval_component *, struct oval_variable *variable);
3189 /**
3190 * @memberof oval_component
3191 */
3192 OSCAP_API void oval_component_add_function_component(struct oval_component *, struct oval_component *); //type==OVAL_COMPONENT_FUNCTION
3193 /**
3194 * @memberof oval_component
3195 */
3196 OSCAP_API void oval_component_set_arithmetic_operation(struct oval_component *, oval_arithmetic_operation_t); //type==OVAL_COMPONENT_ARITHMETIC
3197 /**
3198 * @memberof oval_component
3199 */
3200 OSCAP_API void oval_component_set_prefix(struct oval_component *, char *); //type==OVAL_COMPONENT_BEGIN
3201 /**
3202 * @memberof oval_component
3203 */
3204 OSCAP_API void oval_component_set_suffix(struct oval_component *, char *); //type==OVAL_COMPONENT_END
3205 /**
3206 * @memberof oval_component
3207 */
3208 OSCAP_API void oval_component_set_split_delimiter(struct oval_component *, char *); //type==OVAL_COMPONENT_SPLIT
3209 /**
3210 * @memberof oval_component
3211 */
3212 OSCAP_API void oval_component_set_glob_to_regex_glob_noescape(struct oval_component *, bool); //type==OVAL_COMPONENT_GLOB
3213 /**
3214 * @memberof oval_component
3215 */
3216 OSCAP_API void oval_component_set_substring_start(struct oval_component *, int); //type==OVAL_COMPONENT_SUBSTRING
3217 /**
3218 * @memberof oval_component
3219 */
3220 OSCAP_API void oval_component_set_substring_length(struct oval_component *, int); //type==OVAL_COMPONENT_SUBSTRING
3221 /**
3222 * @memberof oval_component
3223 */
3224 OSCAP_API void oval_component_set_timedif_format_1(struct oval_component *, oval_datetime_format_t); //type==OVAL_COMPONENT_TIMEDIF
3225 /**
3226 * @memberof oval_component
3227 */
3228 OSCAP_API void oval_component_set_timedif_format_2(struct oval_component *, oval_datetime_format_t); //type==OVAL_COMPONENT_TIMEDIF
3229 /**
3230 * @memberof oval_component
3231 */
3232 OSCAP_API void oval_component_set_regex_pattern(struct oval_component *, char *); //type==OVAL_COMPONENT_REGEX_CAPTURE
3233 /**
3234 * @memberof oval_component
3235 */
3236 OSCAP_API void oval_component_set_literal_value(struct oval_component *, struct oval_value *); //type==OVAL_COMPONENT_LITERAL
3237 /** @} */
3238
3239 /**
3240 * @name Getters
3241 * @{
3242 */
3243 /**
3244 * Returns attribute @ref Oval_component->type
3245 * @memberof oval_component
3246 */
3247 OSCAP_API oval_component_type_t oval_component_get_type(struct oval_component *);
3248 /**
3249 * Returns attribute @ref Oval_component_object->object.
3250 * IF component->type <> @ref OVAL_COMPONENT_OBJECTREF, this method shall return NULL.
3251 * @return A pointer to the object attribute of the specified @ref oval_component.
3252 * @note applications should not free the @ref Oval_object returned by this method
3253 * @memberof oval_component
3254 */
3255 OSCAP_API struct oval_object *oval_component_get_object(struct oval_component *); //type==OVAL_COMPONENT_OBJECTREF
3256 /**
3257 * Returns attribute @ref Oval_component_object->item_field.
3258 * @return A pointer to the item_field attribute of the specified @ref oval_component.
3259 * @note applications should not free the char* returned by this method
3260 * @memberof oval_component
3261 */
3262 OSCAP_API char *oval_component_get_item_field(struct oval_component *);
3263 /**
3264 * Returns attribute @ref Oval_component_object->record_field.
3265 * @return A pointer to the record_field attribute of the specified @ref oval_component.
3266 * @note applications should not free the char* returned by this method
3267 * @memberof oval_component
3268 */
3269 OSCAP_API char *oval_component_get_record_field(struct oval_component *);
3270 /**
3271 * Returns attribute @ref Oval_component_variable->variable.
3272 * IF component->type <> @ref OVAL_COMPONENT_VARREF, this method shall return NULL.
3273 * @return A pointer to the variable attribute of the specified @ref oval_component.
3274 * @note applications should not free the @ref Oval_variable returned by this method
3275 * @memberof oval_component
3276 */
3277 OSCAP_API struct oval_variable *oval_component_get_variable(struct oval_component *);
3278 /**
3279 * Returns attribute @ref Oval_function->components.
3280 * IF component->type < @ref OVAL_COMPONENT_FUNCTION, this method shall return NULL.
3281 * @return A new iterator for the function_components attribute of the specified @ref oval_component.
3282 * It should be freed after use by the calling application.
3283 * @memberof oval_component
3284 */
3285 OSCAP_API struct oval_component_iterator *oval_component_get_function_components(struct oval_component *); //type==OVAL_COMPONENT_FUNCTION
3286 /**
3287 * Returns attribute @ref Oval_function_ARITHMETIC->arithmetic_operation.
3288 * IF component->type <> @ref OVAL_FUNCTION_ARITHMETIC, this method shall return @ref OVAL_ARITHMETIC_UNKNOWN.
3289 * @memberof oval_component
3290 */
3291 OSCAP_API oval_arithmetic_operation_t oval_component_get_arithmetic_operation(struct oval_component *); //type==OVAL_COMPONENT_ARITHMETIC
3292 /**
3293 * Returns attribute @ref Oval_function_BEGIN->prefix.
3294 * IF component->type <> @ref OVAL_FUNCTION_BEGIN, this method shall return NULL
3295 * @return A pointer to the attribute of the specified @ref oval_component.
3296 * @note applications should not free the char* returned by this method
3297 * @memberof oval_component
3298 */
3299 OSCAP_API char *oval_component_get_prefix(struct oval_component *); //type==OVAL_COMPONENT_BEGIN
3300 /**
3301 * Returns attribute @ref Oval_function_END->suffix.
3302 * IF component->type <> @ref OVAL_FUNCTION_END, this method shall return NULL
3303 * @return A pointer to the attribute of the specified @ref oval_component.
3304 * @note applications should not free the char* returned by this method
3305 * @memberof oval_component
3306 */
3307 OSCAP_API char *oval_component_get_suffix(struct oval_component *); //type==OVAL_COMPONENT_END
3308 /**
3309 * Returns attribute @ref Oval_function_SPLIT->delimiter.
3310 * IF component->type <> @ref OVAL_FUNCTION_SPLIT, this method shall return NULL
3311 * @return A pointer to the attribute of the specified @ref oval_component.
3312 * @note applications should not free the char* returned by this method
3313 * @memberof oval_component
3314 */
3315 OSCAP_API char *oval_component_get_split_delimiter(struct oval_component *); //type==OVAL_COMPONENT_SPLIT
3316 /**
3317 * Returns attribute @ref Oval_function_GLOB_TO_REGEX->glob_noescape.
3318 * IF component->type <> @ref OVAL_FUNCTION_GLOB_TO_REGEX, this method shall return false
3319 * @return An attribute of the specified @ref oval_component.
3320 * @memberof oval_component
3321 */
3322 OSCAP_API bool oval_component_get_glob_to_regex_glob_noescape(struct oval_component *); //type==OVAL_COMPONENT_GLOB
3323 /**
3324 * Returns attribute @ref Oval_function_SUBSTRING->start.
3325 * IF component->type <> @ref OVAL_FUNCTION_SUBSTRING, this method shall return 0
3326 * @memberof oval_component
3327 */
3328 OSCAP_API int oval_component_get_substring_start(struct oval_component *); //type==OVAL_COMPONENT_SUBSTRING
3329 /**
3330 * Returns attribute @ref Oval_function_SUBSTRING->length.
3331 * IF component->type <> @ref OVAL_FUNCTION_SUBSTRING, this method shall return 0
3332 * @memberof oval_component
3333 */
3334 OSCAP_API int oval_component_get_substring_length(struct oval_component *); //type==OVAL_COMPONENT_SUBSTRING
3335 /**
3336 * Returns attribute @ref Oval_function_TIMEDIF->timedif_format_1.
3337 * IF component->type <> @ref OVAL_FUNCTION_TIMEDIF, this method shall return @ref OVAL_TIMEDATE_UNKNOWN
3338 * @memberof oval_component
3339 */
3340 OSCAP_API oval_datetime_format_t oval_component_get_timedif_format_1(struct oval_component *); //type==OVAL_COMPONENT_TIMEDIF
3341 /**
3342 * Returns attribute @ref Oval_function_TIMEDIF->timedif_format_2.
3343 * IF component->type <> @ref OVAL_FUNCTION_TIMEDIF, this method shall return @ref OVAL_TIMEDATE_UNKNOWN
3344 * @memberof oval_component
3345 */
3346 OSCAP_API oval_datetime_format_t oval_component_get_timedif_format_2(struct oval_component *); //type==OVAL_COMPONENT_TIMEDIF
3347 /**
3348 * Returns attribute @ref Oval_function_REGEX_CAPTURE->pattern.
3349 * IF component->type <> @ref OVAL_FUNCTION_REGEX_CAPTURE, this method shall return NULL
3350 * @return A pointer to the attribute of the specified @ref oval_component.
3351 * @note applications should not free the char* returned by this method
3352 * @memberof oval_component
3353 */
3354 OSCAP_API char *oval_component_get_regex_pattern(struct oval_component *); //type==OVAL_COMPONENT_REGEX_CAPTURE
3355 /**
3356 * Returns attribute @ref Oval_literal->literal.
3357 * IF component->type <> @ref OVAL_COMPONENT_LITERAL, this method shall return NULL
3358 * @return A pointer to the value attribute of the specified @ref oval_component.
3359 * @note applications should not free the @ref Oval_value returned by this method
3360 * @memberof oval_component
3361 */
3362 OSCAP_API struct oval_value *oval_component_get_literal_value(struct oval_component *); //type==OVAL_COMPONENT_LITERAL
3363 /** @} */
3364
3365 /**
3366 * @name Iterators
3367 * @{
3368 */
3369 /**
3370 * Return <b>true</b> if the iterator is not exhausted.
3371 * @memberof oval_component_iterator
3372 */
3373 OSCAP_API bool oval_component_iterator_has_more(struct oval_component_iterator *);
3374 /**
3375 * return the next instance of @ref Oval_component.
3376 * If the iterator is exhausted this method shall return NULL.
3377 * @memberof oval_component_iterator
3378 */
3379 OSCAP_API struct oval_component *oval_component_iterator_next(struct oval_component_iterator *);
3380 /**
3381 * Free the iterator.
3382 * @memberof oval_component_iterator
3383 */
3384 OSCAP_API void oval_component_iterator_free(struct oval_component_iterator *);
3385 /**
3386 * How many remains.
3387 * @memberof oval_component_iterator
3388 */
3389 OSCAP_API int oval_component_iterator_remaining(struct oval_component_iterator *);
3390 /** @} */
3391
3392 /**
3393 * @name Evaluators
3394 * @{
3395 */
3396 /** @} */
3397
3398 /**
3399 * @} END OVALDEF
3400 */
3401
3402 /**
3403 * @} END OVAL
3404 */
3405 #endif