Open SCAP Library
oval_results.h
Go to the documentation of this file.
1 
19 /*
20  * Copyright 2009-2013 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 "oval_types.h"
48 #include "oval_directives.h"
49 #include <stdbool.h>
50 
51 
52 const char *oval_result_get_text(oval_result_t);
53 
58 struct oval_results_model;
59 
69 
79 
89 
99 
100 
110 
118 struct oval_results_model *oval_results_model_new(struct oval_definition_model *definition_model,
119  struct oval_syschar_model **);
128 int oval_results_model_import(struct oval_results_model *model, const char *file);
140 void oval_results_model_free(struct oval_results_model *model);
148 int oval_results_model_export(struct oval_results_model *, struct oval_directives_model *, const char *file);
149 
154 void oval_results_model_set_generator(struct oval_results_model *model, struct oval_generator *generator);
161 struct oval_generator *oval_results_model_get_generator(struct oval_results_model *model);
168 
197 struct oval_result_system *oval_result_system_new(struct oval_results_model *, struct oval_syschar_model *);
203  struct oval_result_system *old_system);
207 void oval_result_system_free(struct oval_result_system *);
208 
216 void oval_result_system_add_definition(struct oval_result_system *, struct oval_result_definition *);
220 void oval_result_system_add_test(struct oval_result_system *, struct oval_result_test *);
230 struct oval_results_model *oval_result_system_get_results_model(struct oval_result_system *);
234 struct oval_result_definition *oval_result_system_get_definition(struct oval_result_system *, const char *);
238 struct oval_result_definition_iterator *oval_result_system_get_definitions(struct oval_result_system *);
242 struct oval_result_test_iterator *oval_result_system_get_tests(struct oval_result_system *);
246 struct oval_syschar_model *oval_result_system_get_syschar_model(struct oval_result_system *);
250 struct oval_sysinfo *oval_result_system_get_sysinfo(struct oval_result_system *);
260 bool oval_result_system_iterator_has_more(struct oval_result_system_iterator *);
264 struct oval_result_system *oval_result_system_iterator_next(struct oval_result_system_iterator *);
268 void oval_result_system_iterator_free(struct oval_result_system_iterator *);
291 int oval_result_system_eval_definition(struct oval_result_system *sys, const char *id);
302 struct oval_result_definition *oval_result_definition_new(struct oval_result_system *, char *);
308  (struct oval_result_system *new_system, struct oval_result_definition *old_definition);
312 void oval_result_definition_free(struct oval_result_definition *);
313 
321 void oval_result_definition_set_result(struct oval_result_definition *, oval_result_t);
325 void oval_result_definition_set_instance(struct oval_result_definition *, int);
329 void oval_result_definition_set_criteria(struct oval_result_definition *, struct oval_result_criteria_node *);
333 void oval_result_definition_add_message(struct oval_result_definition *, struct oval_message *);
343 struct oval_definition *oval_result_definition_get_definition(const struct oval_result_definition *);
348 const char *oval_result_definition_get_id(const struct oval_result_definition *rslt_definition);
352 struct oval_result_system *oval_result_definition_get_system(const struct oval_result_definition *);
356 int oval_result_definition_get_instance(const struct oval_result_definition *);
360 oval_result_t oval_result_definition_eval(struct oval_result_definition *);
364 oval_result_t oval_result_definition_get_result(const struct oval_result_definition *);
368 struct oval_message_iterator *oval_result_definition_get_messages(const struct oval_result_definition *);
372 struct oval_result_criteria_node *oval_result_definition_get_criteria(const struct oval_result_definition *);
382 bool oval_result_definition_iterator_has_more(struct oval_result_definition_iterator *);
386 struct oval_result_definition *oval_result_definition_iterator_next(struct oval_result_definition_iterator *);
390 void oval_result_definition_iterator_free(struct oval_result_definition_iterator *);
407 struct oval_result_test *oval_result_test_new(struct oval_result_system *, char *);
413  (struct oval_result_system *new_system, struct oval_result_test *old_test);
417 void oval_result_test_free(struct oval_result_test *);
418 
426 void oval_result_test_set_result(struct oval_result_test *, oval_result_t);
430 void oval_result_test_set_instance(struct oval_result_test *test, int instance);
434 void oval_result_test_add_message(struct oval_result_test *, struct oval_message *);
438 void oval_result_test_add_item(struct oval_result_test *, struct oval_result_item *);
442 void oval_result_test_add_binding(struct oval_result_test *, struct oval_variable_binding *);
452 struct oval_test *oval_result_test_get_test(struct oval_result_test *);
456 struct oval_result_system *oval_result_test_get_system(struct oval_result_test *);
460 oval_result_t oval_result_test_eval(struct oval_result_test *);
464 oval_result_t oval_result_test_get_result(struct oval_result_test *);
468 int oval_result_test_get_instance(struct oval_result_test *);
472 struct oval_message_iterator *oval_result_test_get_messages(struct oval_result_test *);
476 struct oval_result_item_iterator *oval_result_test_get_items(struct oval_result_test *);
480 struct oval_variable_binding_iterator *oval_result_test_get_bindings(struct oval_result_test *);
490 bool oval_result_test_iterator_has_more(struct oval_result_test_iterator *);
494 struct oval_result_test *oval_result_test_iterator_next(struct oval_result_test_iterator *);
498 void oval_result_test_iterator_free(struct oval_result_test_iterator *);
515 struct oval_result_item *oval_result_item_new(struct oval_result_system *, char *);
521  (struct oval_result_system *new_system, struct oval_result_item *old_item);
525 void oval_result_item_free(struct oval_result_item *);
526 
534 void oval_result_item_set_result(struct oval_result_item *, oval_result_t);
538 void oval_result_item_add_message(struct oval_result_item *, struct oval_message *);
548 struct oval_sysitem *oval_result_item_get_sysitem(struct oval_result_item *);
552 oval_result_t oval_result_item_get_result(struct oval_result_item *);
556 struct oval_message_iterator *oval_result_item_get_messages(struct oval_result_item *);
566 bool oval_result_item_iterator_has_more(struct oval_result_item_iterator *);
570 struct oval_result_item *oval_result_item_iterator_next(struct oval_result_item_iterator *);
574 void oval_result_item_iterator_free(struct oval_result_item_iterator *);
591 struct oval_result_criteria_node *oval_result_criteria_node_new(struct oval_result_system *,
593  int, int, ...);
599  (struct oval_result_system *new_system, struct oval_result_criteria_node *old_node);
603 void oval_result_criteria_node_free(struct oval_result_criteria_node *);
604 
612 void oval_result_criteria_node_set_result(struct oval_result_criteria_node *, oval_result_t);
616 void oval_result_criteria_node_set_negate(struct oval_result_criteria_node *, bool);
620 void oval_result_criteria_node_set_applicability_check(struct oval_result_criteria_node *, bool);
624 void oval_result_criteria_node_set_operator(struct oval_result_criteria_node *, oval_operator_t); //type==NODETYPE_CRITERIA
628 void oval_result_criteria_node_add_subnode(struct oval_result_criteria_node *, struct oval_result_criteria_node *); //type==NODETYPE_CRITERIA
632 void oval_result_criteria_node_set_test(struct oval_result_criteria_node *, struct oval_result_test *); //type==NODETYPE_CRITERION
636 void oval_result_criteria_node_set_extends(struct oval_result_criteria_node *, struct oval_result_definition *); //type==NODETYPE_EXTENDDEF
645 oval_criteria_node_type_t oval_result_criteria_node_get_type(struct oval_result_criteria_node *);
649 oval_result_t oval_result_criteria_node_eval(struct oval_result_criteria_node *);
653 oval_result_t oval_result_criteria_node_get_result(struct oval_result_criteria_node *);
657 bool oval_result_criteria_node_get_negate(struct oval_result_criteria_node *);
661 bool oval_result_criteria_node_get_applicability_check(struct oval_result_criteria_node *);
665 oval_operator_t oval_result_criteria_node_get_operator(struct oval_result_criteria_node *); //type==NODETYPE_CRITERIA
669 struct oval_result_criteria_node_iterator *oval_result_criteria_node_get_subnodes(struct oval_result_criteria_node *); //type==NODETYPE_CRITERIA
673 struct oval_result_test *oval_result_criteria_node_get_test(struct oval_result_criteria_node *); //type==NODETYPE_CRITERION
677 struct oval_result_definition *oval_result_criteria_node_get_extends(struct oval_result_criteria_node *); //type==NODETYPE_EXTENDDEF
687 bool oval_result_criteria_node_iterator_has_more(struct oval_result_criteria_node_iterator *);
691 struct oval_result_criteria_node *oval_result_criteria_node_iterator_next(struct oval_result_criteria_node_iterator *);
695 void oval_result_criteria_node_iterator_free(struct oval_result_criteria_node_iterator *);
711 #endif /* OVAL_RESULTS_H_ */
712