Open SCAP Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
oval_results.h
Go to the documentation of this file.
1 
19 /*
20  * Copyright 2009-2014 Red Hat Inc., Durham, North Carolina.
21  * All Rights Reserved.
22  *
23  * This library is free software; you can redistribute it and/or
24  * modify it under the terms of the GNU Lesser General Public
25  * License as published by the Free Software Foundation; either
26  * version 2.1 of the License, or (at your option) any later version.
27  *
28  * This library is distributed in the hope that it will be useful,
29  * but WITHOUT ANY WARRANTY; without even the implied warranty of
30  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
31  * Lesser General Public License for more details.
32  *
33  * You should have received a copy of the GNU Lesser General Public
34  * License along with this library; if not, write to the Free Software
35  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
36  *
37  * Authors:
38  * "David Niemoller" <David.Niemoller@g2-inc.com>
39  * Šimon Lukašík
40  */
41 
42 
43 #ifndef OVAL_RESULTS_H_
44 #define OVAL_RESULTS_H_
45 
46 #include "oscap.h"
47 #include "oscap_source.h"
48 #include "oval_types.h"
50 #include "oval_directives.h"
51 #include <stdbool.h>
52 
53 
54 const char *oval_result_get_text(oval_result_t);
55 
60 struct oval_results_model;
61 
71 
81 
91 
101 
102 
112 
120 struct oval_results_model *oval_results_model_new(struct oval_definition_model *definition_model,
121  struct oval_syschar_model **);
122 
131 int oval_results_model_import_source(struct oval_results_model *model, struct oscap_source *source);
132 
143 OSCAP_DEPRECATED(int oval_results_model_import(struct oval_results_model *model, const char *file));
153 void oval_results_model_set_export_system_characteristics(struct oval_results_model *, bool export);
154 
158 bool oval_results_model_get_export_system_characteristics(struct oval_results_model *);
164 void oval_results_model_free(struct oval_results_model *model);
172 int oval_results_model_export(struct oval_results_model *, struct oval_directives_model *, const char *file);
173 
182 struct oscap_source *oval_results_model_export_source(struct oval_results_model *results_model, struct oval_directives_model *directives_model, const char *name);
183 
188 void oval_results_model_set_generator(struct oval_results_model *model, struct oval_generator *generator);
195 struct oval_generator *oval_results_model_get_generator(struct oval_results_model *model);
196 
203 
209 
238 struct oval_result_system *oval_result_system_new(struct oval_results_model *, struct oval_syschar_model *);
244  struct oval_result_system *old_system);
248 void oval_result_system_free(struct oval_result_system *);
249 
257 void oval_result_system_add_definition(struct oval_result_system *, struct oval_result_definition *);
261 void oval_result_system_add_test(struct oval_result_system *, struct oval_result_test *);
271 struct oval_results_model *oval_result_system_get_results_model(struct oval_result_system *);
275 struct oval_result_definition *oval_result_system_get_definition(struct oval_result_system *, const char *);
279 struct oval_result_definition_iterator *oval_result_system_get_definitions(struct oval_result_system *);
283 struct oval_result_test_iterator *oval_result_system_get_tests(struct oval_result_system *);
287 struct oval_syschar_model *oval_result_system_get_syschar_model(struct oval_result_system *);
291 struct oval_sysinfo *oval_result_system_get_sysinfo(struct oval_result_system *);
301 bool oval_result_system_iterator_has_more(struct oval_result_system_iterator *);
305 struct oval_result_system *oval_result_system_iterator_next(struct oval_result_system_iterator *);
309 void oval_result_system_iterator_free(struct oval_result_system_iterator *);
332 int oval_result_system_eval_definition(struct oval_result_system *sys, const char *id);
343 struct oval_result_definition *oval_result_definition_new(struct oval_result_system *, char *);
349  (struct oval_result_system *new_system, struct oval_result_definition *old_definition);
353 void oval_result_definition_free(struct oval_result_definition *);
354 
362 void oval_result_definition_set_result(struct oval_result_definition *, oval_result_t);
366 void oval_result_definition_set_instance(struct oval_result_definition *, int);
370 void oval_result_definition_set_criteria(struct oval_result_definition *, struct oval_result_criteria_node *);
374 void oval_result_definition_add_message(struct oval_result_definition *, struct oval_message *);
384 struct oval_definition *oval_result_definition_get_definition(const struct oval_result_definition *);
389 const char *oval_result_definition_get_id(const struct oval_result_definition *rslt_definition);
393 struct oval_result_system *oval_result_definition_get_system(const struct oval_result_definition *);
397 int oval_result_definition_get_instance(const struct oval_result_definition *);
401 oval_result_t oval_result_definition_eval(struct oval_result_definition *);
405 oval_result_t oval_result_definition_get_result(const struct oval_result_definition *);
409 struct oval_message_iterator *oval_result_definition_get_messages(const struct oval_result_definition *);
413 struct oval_result_criteria_node *oval_result_definition_get_criteria(const struct oval_result_definition *);
423 bool oval_result_definition_iterator_has_more(struct oval_result_definition_iterator *);
427 struct oval_result_definition *oval_result_definition_iterator_next(struct oval_result_definition_iterator *);
431 void oval_result_definition_iterator_free(struct oval_result_definition_iterator *);
448 struct oval_result_test *oval_result_test_new(struct oval_result_system *, char *);
454  (struct oval_result_system *new_system, struct oval_result_test *old_test);
458 void oval_result_test_free(struct oval_result_test *);
459 
467 void oval_result_test_set_result(struct oval_result_test *, oval_result_t);
471 void oval_result_test_set_instance(struct oval_result_test *test, int instance);
475 void oval_result_test_add_message(struct oval_result_test *, struct oval_message *);
479 void oval_result_test_add_item(struct oval_result_test *, struct oval_result_item *);
483 void oval_result_test_add_binding(struct oval_result_test *, struct oval_variable_binding *);
493 struct oval_test *oval_result_test_get_test(struct oval_result_test *);
497 struct oval_result_system *oval_result_test_get_system(struct oval_result_test *);
501 oval_result_t oval_result_test_eval(struct oval_result_test *);
505 oval_result_t oval_result_test_get_result(struct oval_result_test *);
509 int oval_result_test_get_instance(struct oval_result_test *);
513 struct oval_message_iterator *oval_result_test_get_messages(struct oval_result_test *);
517 struct oval_result_item_iterator *oval_result_test_get_items(struct oval_result_test *);
521 struct oval_variable_binding_iterator *oval_result_test_get_bindings(struct oval_result_test *);
531 bool oval_result_test_iterator_has_more(struct oval_result_test_iterator *);
535 struct oval_result_test *oval_result_test_iterator_next(struct oval_result_test_iterator *);
539 void oval_result_test_iterator_free(struct oval_result_test_iterator *);
556 struct oval_result_item *oval_result_item_new(struct oval_result_system *, char *);
562  (struct oval_result_system *new_system, struct oval_result_item *old_item);
566 void oval_result_item_free(struct oval_result_item *);
567 
575 void oval_result_item_set_result(struct oval_result_item *, oval_result_t);
579 void oval_result_item_add_message(struct oval_result_item *, struct oval_message *);
589 struct oval_sysitem *oval_result_item_get_sysitem(struct oval_result_item *);
593 oval_result_t oval_result_item_get_result(struct oval_result_item *);
597 struct oval_message_iterator *oval_result_item_get_messages(struct oval_result_item *);
607 bool oval_result_item_iterator_has_more(struct oval_result_item_iterator *);
611 struct oval_result_item *oval_result_item_iterator_next(struct oval_result_item_iterator *);
615 void oval_result_item_iterator_free(struct oval_result_item_iterator *);
632 struct oval_result_criteria_node *oval_result_criteria_node_new(struct oval_result_system *,
634  int, int, ...);
640  (struct oval_result_system *new_system, struct oval_result_criteria_node *old_node);
644 void oval_result_criteria_node_free(struct oval_result_criteria_node *);
645 
653 void oval_result_criteria_node_set_result(struct oval_result_criteria_node *, oval_result_t);
657 void oval_result_criteria_node_set_negate(struct oval_result_criteria_node *, bool);
661 void oval_result_criteria_node_set_applicability_check(struct oval_result_criteria_node *, bool);
665 void oval_result_criteria_node_set_operator(struct oval_result_criteria_node *, oval_operator_t); //type==NODETYPE_CRITERIA
669 void oval_result_criteria_node_add_subnode(struct oval_result_criteria_node *, struct oval_result_criteria_node *); //type==NODETYPE_CRITERIA
673 void oval_result_criteria_node_set_test(struct oval_result_criteria_node *, struct oval_result_test *); //type==NODETYPE_CRITERION
677 void oval_result_criteria_node_set_extends(struct oval_result_criteria_node *, struct oval_result_definition *); //type==NODETYPE_EXTENDDEF
686 oval_criteria_node_type_t oval_result_criteria_node_get_type(struct oval_result_criteria_node *);
690 oval_result_t oval_result_criteria_node_eval(struct oval_result_criteria_node *);
694 oval_result_t oval_result_criteria_node_get_result(struct oval_result_criteria_node *);
698 bool oval_result_criteria_node_get_negate(struct oval_result_criteria_node *);
702 bool oval_result_criteria_node_get_applicability_check(struct oval_result_criteria_node *);
706 oval_operator_t oval_result_criteria_node_get_operator(struct oval_result_criteria_node *); //type==NODETYPE_CRITERIA
710 struct oval_result_criteria_node_iterator *oval_result_criteria_node_get_subnodes(struct oval_result_criteria_node *); //type==NODETYPE_CRITERIA
714 struct oval_result_test *oval_result_criteria_node_get_test(struct oval_result_criteria_node *); //type==NODETYPE_CRITERION
718 struct oval_result_definition *oval_result_criteria_node_get_extends(struct oval_result_criteria_node *); //type==NODETYPE_EXTENDDEF
728 bool oval_result_criteria_node_iterator_has_more(struct oval_result_criteria_node_iterator *);
732 struct oval_result_criteria_node *oval_result_criteria_node_iterator_next(struct oval_result_criteria_node_iterator *);
736 void oval_result_criteria_node_iterator_free(struct oval_result_criteria_node_iterator *);
752 #endif /* OVAL_RESULTS_H_ */
753 
oval_operator_t
Boolean operators.
Definition: oval_definitions.h:75
OVAL System Characteristics model.
Definition: oval_sysModel.c:54
int oval_result_system_eval(struct oval_result_system *sys)
Function evaluates all OVAL definitions of specified result_system.
Definition: oval_resultSystem.c:331
Definition: oval_results.h:65
Definition: oval_results.h:75
Definition: oval_resultSystem.c:54
General instrumented host description.
Definition: oval_sysInfo.c:45
OVAL Results Model holds OVAL results structure instances.
Definition: oval_resModel.c:54
Oval definition specification.
Definition: oval_definition.c:54
oval_criteria_node_type_t
Criteria node type.
Definition: oval_definitions.h:67
General OpenScap functions and types.
Definition: oval_system_characteristics.h:181
This structure holds instance of OVAL Directives.
struct oval_directives_model * oval_results_model_get_directives_model(struct oval_results_model *model)
Return the OVAL directives model.
Definition: oval_resModel.c:149
#define OSCAP_DEPRECATED(func)
This macro will warn, when a deprecated function is used.
Definition: oscap.h:50
struct oval_results_model * oval_results_model_new(struct oval_definition_model *definition_model, struct oval_syschar_model **)
Create new oval_results_model.
Definition: oval_resModel.c:63
Definition: oval_results.h:95
OVAL message.
Definition: oval_message.c:45
Binding of an value to an OVAL variable.
Definition: oval_variableBinding.c:45
struct oval_result_definition * oval_result_definition_clone(struct oval_result_system *new_system, struct oval_result_definition *old_definition)
Definition: oval_resultDefinition.c:75
Each instance of Oval_sysitem represents one item.
Definition: oval_sysItem.c:45
struct oval_results_model * oval_results_model_clone(struct oval_results_model *)
Copy an oval_results_model.
Definition: oval_resModel.c:95
Definition: oval_system_characteristics.h:171
void oval_results_model_free(struct oval_results_model *model)
Free memory allocated to a specified oval results model.
Definition: oval_resModel.c:121
struct oval_result_system_iterator * oval_results_model_get_systems(struct oval_results_model *)
Return iterator over reporting systems.
Definition: oval_resModel.c:161
struct oval_definition_model * oval_results_model_get_definition_model(struct oval_results_model *model)
Return bound definition model from an oval_results_model.
Definition: oval_resModel.c:155
Definition: oval_results.h:106
struct oval_result_test * oval_result_test_clone(struct oval_result_system *new_system, struct oval_result_test *old_test)
Definition: oval_resultTest.c:83
int oval_results_model_import_source(struct oval_results_model *model, struct oscap_source *source)
Import the content from the oscap_source into an oval_result_model.
Definition: oval_resModel.c:182
int oval_results_model_import(struct oval_results_model *model, const char *file)
Import the content from the file into an oval_result_model.
Definition: oval_resModel.c:221
Definition: oval_results.h:85
int oval_results_model_eval(struct oval_results_model *)
Evaluate all result_systems.
Definition: oval_resModel.c:236
Definition: oscap_source.c:62
struct oscap_source * oval_results_model_export_source(struct oval_results_model *results_model, struct oval_directives_model *directives_model, const char *name)
Export OVAL results into oscap_source.
Definition: oval_resModel.c:304
struct oval_result_item * oval_result_item_clone(struct oval_result_system *new_system, struct oval_result_item *old_item)
Definition: oval_resultItem.c:69
int oval_results_model_export(struct oval_results_model *, struct oval_directives_model *, const char *file)
Export oval results into file.
Definition: oval_resModel.c:318
const char * oval_result_definition_get_id(const struct oval_result_definition *rslt_definition)
Returns the attribute of a given result definition.
Definition: oval_resultDefinition.c:354
int oval_result_system_eval_definition(struct oval_result_system *sys, const char *id)
Function evaluates specified OVAL definition in result_system.
Definition: oval_resultSystem.c:354
oval_result_t
Result values for the evaluation of an OVAL Definition or an OVAL Test.
Definition: oval_types.h:327
Definition: oval_resultDefinition.c:46
Oval definition model.
Definition: oval_defModel.c:51
Definition: oval_resultCriteriaNode.c:46
Definition: oval_resultItem.c:44
An Oval_test specifies a technical control by identifying an oval_object that is evaluated on an inst...
Definition: oval_test.c:48
struct oval_result_criteria_node * oval_result_criteria_node_clone(struct oval_result_system *new_system, struct oval_result_criteria_node *old_node)
Definition: oval_resultCriteriaNode.c:153
struct oval_result_system * oval_result_system_clone(struct oval_results_model *new_model, struct oval_result_system *old_system)
Definition: oval_resultSystem.c:125
Definition: oval_generator.c:44
Definition: oval_resultTest.c:51