Open SCAP Library
/home/pvrabec/project/openscap/openscap-0.7.4/src/OVAL/public/oval_results.h
Go to the documentation of this file.
00001 
00019 /*
00020  * Copyright 2009-2010 Red Hat Inc., Durham, North Carolina.
00021  * All Rights Reserved.
00022  *
00023  * This library is free software; you can redistribute it and/or
00024  * modify it under the terms of the GNU Lesser General Public
00025  * License as published by the Free Software Foundation; either
00026  * version 2.1 of the License, or (at your option) any later version.
00027  *
00028  * This library is distributed in the hope that it will be useful,
00029  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00030  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00031  * Lesser General Public License for more details.
00032  *
00033  * You should have received a copy of the GNU Lesser General Public
00034  * License along with this library; if not, write to the Free Software
00035  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00036  *
00037  * Authors:
00038  *      "David Niemoller" <David.Niemoller@g2-inc.com>
00039  */
00040 
00041 
00042 #ifndef OVAL_RESULTS_H_
00043 #define OVAL_RESULTS_H_
00044 
00045 #include "oval_types.h"
00046 #include "oval_system_characteristics.h"
00047 #include <stdbool.h>
00048 
00053 typedef enum {
00054         OVAL_RESULT_TRUE = 1,    
00055         OVAL_RESULT_FALSE = 2,   
00056         OVAL_RESULT_UNKNOWN = 4, 
00057         OVAL_RESULT_ERROR = 8,  
00058         OVAL_RESULT_NOT_EVALUATED = 16, 
00059         OVAL_RESULT_NOT_APPLICABLE = 32 
00060 } oval_result_t;
00061 
00066 typedef enum {
00067         OVAL_DIRECTIVE_CONTENT_UNKNOWN = 0, 
00068         OVAL_DIRECTIVE_CONTENT_THIN = 1,    
00069         OVAL_DIRECTIVE_CONTENT_FULL = 2     
00070 } oval_result_directive_content_t;
00071 
00072 
00073 const char *oval_result_get_text(oval_result_t);
00074 
00075 
00076 
00081 struct oval_results_model;
00082 
00086 struct oval_result_system;
00091 struct oval_result_system_iterator;
00092 
00096 struct oval_result_definition;
00101 struct oval_result_definition_iterator;
00102 
00106 struct oval_result_test;
00111 struct oval_result_test_iterator;
00112 
00116 struct oval_result_item;
00121 struct oval_result_item_iterator;
00122 
00123 
00127 struct oval_result_criteria_node;
00132 struct oval_result_criteria_node_iterator;
00133 
00150 struct oval_result_directives;
00151 
00152 
00153 
00154 
00155 
00163 struct oval_results_model *oval_results_model_new(struct oval_definition_model *definition_model,
00164                                                   struct oval_syschar_model **);
00173 struct oval_result_directives *oval_results_model_import(struct oval_results_model *model, const char *file);
00179 struct oval_results_model *oval_results_model_clone(struct oval_results_model *);
00185 void oval_results_model_free(struct oval_results_model *model);
00192 int oval_results_model_export(struct oval_results_model *, struct oval_result_directives *, const char *file);
00193 
00198 void oval_results_model_set_generator(struct oval_results_model *model, struct oval_generator *generator);
00205 struct oval_generator *oval_results_model_get_generator(struct oval_results_model *model);
00211 struct oval_definition_model *oval_results_model_get_definition_model(struct oval_results_model *model);
00212 
00218 struct oval_result_system_iterator *oval_results_model_get_systems(struct oval_results_model *);
00230 int oval_results_model_eval(struct oval_results_model *);
00241 struct oval_result_system *oval_result_system_new(struct oval_results_model *, struct oval_syschar_model *);
00246 struct oval_result_system *oval_result_system_clone(struct oval_results_model *new_model,
00247                                                     struct oval_result_system *old_system);
00251 void oval_result_system_free(struct oval_result_system *);
00252 
00260 void oval_result_system_add_definition(struct oval_result_system *, struct oval_result_definition *);
00264 void oval_result_system_add_test(struct oval_result_system *, struct oval_result_test *);
00274 struct oval_results_model *oval_result_system_get_results_model(struct oval_result_system *);
00278 struct oval_result_definition *oval_result_system_get_definition(struct oval_result_system *, const char *);
00282 struct oval_result_definition_iterator *oval_result_system_get_definitions(struct oval_result_system *);
00286 struct oval_result_test_iterator *oval_result_system_get_tests(struct oval_result_system *);
00290 struct oval_syschar_model *oval_result_system_get_syschar_model(struct oval_result_system *);
00294 struct oval_sysinfo *oval_result_system_get_sysinfo(struct oval_result_system *);
00304 bool oval_result_system_iterator_has_more(struct oval_result_system_iterator *);
00308 struct oval_result_system *oval_result_system_iterator_next(struct oval_result_system_iterator *);
00312 void oval_result_system_iterator_free(struct oval_result_system_iterator *);
00326 int oval_result_system_eval(struct oval_result_system *sys);
00335 int oval_result_system_eval_definition(struct oval_result_system *sys, const char *id);
00346 struct oval_result_definition *oval_result_definition_new(struct oval_result_system *, char *);
00351 struct oval_result_definition *oval_result_definition_clone
00352     (struct oval_result_system *new_system, struct oval_result_definition *old_definition);
00356 void oval_result_definition_free(struct oval_result_definition *);
00357 
00365 void oval_result_definition_set_result(struct oval_result_definition *, oval_result_t);
00369 void oval_result_definition_set_instance(struct oval_result_definition *, int);
00373 void oval_result_definition_set_criteria(struct oval_result_definition *, struct oval_result_criteria_node *);
00377 void oval_result_definition_add_message(struct oval_result_definition *, struct oval_message *);
00387 struct oval_definition *oval_result_definition_get_definition(struct oval_result_definition *);
00391 struct oval_result_system *oval_result_definition_get_system(struct oval_result_definition *);
00395 int oval_result_definition_get_instance(struct oval_result_definition *);
00399 oval_result_t oval_result_definition_eval(struct oval_result_definition *);
00403 oval_result_t oval_result_definition_get_result(struct oval_result_definition *);
00407 struct oval_message_iterator *oval_result_definition_get_messages(struct oval_result_definition *);
00411 struct oval_result_criteria_node *oval_result_definition_get_criteria(struct oval_result_definition *);
00421 bool oval_result_definition_iterator_has_more(struct oval_result_definition_iterator *);
00425 struct oval_result_definition *oval_result_definition_iterator_next(struct oval_result_definition_iterator *);
00429 void oval_result_definition_iterator_free(struct oval_result_definition_iterator *);
00446 struct oval_result_test *oval_result_test_new(struct oval_result_system *, char *);
00451 struct oval_result_test *oval_result_test_clone
00452     (struct oval_result_system *new_system, struct oval_result_test *old_test);
00456 void oval_result_test_free(struct oval_result_test *);
00457 
00465 void oval_result_test_set_result(struct oval_result_test *, oval_result_t);
00469 void oval_result_test_set_instance(struct oval_result_test *test, int instance);
00473 void oval_result_test_add_message(struct oval_result_test *, struct oval_message *);
00477 void oval_result_test_add_item(struct oval_result_test *, struct oval_result_item *);
00481 void oval_result_test_add_binding(struct oval_result_test *, struct oval_variable_binding *);
00491 struct oval_test *oval_result_test_get_test(struct oval_result_test *);
00495 struct oval_result_system *oval_result_test_get_system(struct oval_result_test *);
00499 oval_result_t oval_result_test_eval(struct oval_result_test *);
00503 oval_result_t oval_result_test_get_result(struct oval_result_test *);
00507 int oval_result_test_get_instance(struct oval_result_test *);
00511 struct oval_message_iterator *oval_result_test_get_messages(struct oval_result_test *);
00515 struct oval_result_item_iterator *oval_result_test_get_items(struct oval_result_test *);
00519 struct oval_variable_binding_iterator *oval_result_test_get_bindings(struct oval_result_test *);
00529 bool oval_result_test_iterator_has_more(struct oval_result_test_iterator *);
00533 struct oval_result_test *oval_result_test_iterator_next(struct oval_result_test_iterator *);
00537 void oval_result_test_iterator_free(struct oval_result_test_iterator *);
00554 struct oval_result_item *oval_result_item_new(struct oval_result_system *, char *);
00559 struct oval_result_item *oval_result_item_clone
00560     (struct oval_result_system *new_system, struct oval_result_item *old_item);
00564 void oval_result_item_free(struct oval_result_item *);
00565 
00573 void oval_result_item_set_result(struct oval_result_item *, oval_result_t);
00577 void oval_result_item_add_message(struct oval_result_item *, struct oval_message *);
00587 struct oval_sysitem *oval_result_item_get_sysitem(struct oval_result_item *);
00591 oval_result_t oval_result_item_get_result(struct oval_result_item *);
00595 struct oval_message_iterator *oval_result_item_get_messages(struct oval_result_item *);
00605 bool oval_result_item_iterator_has_more(struct oval_result_item_iterator *);
00609 struct oval_result_item *oval_result_item_iterator_next(struct oval_result_item_iterator *);
00613 void oval_result_item_iterator_free(struct oval_result_item_iterator *);
00630 struct oval_result_criteria_node *oval_result_criteria_node_new(struct oval_result_system *, oval_criteria_node_type_t,
00631                                                                 int, ...);
00636 struct oval_result_criteria_node *oval_result_criteria_node_clone
00637     (struct oval_result_system *new_system, struct oval_result_criteria_node *old_node);
00641 void oval_result_criteria_node_free(struct oval_result_criteria_node *);
00642 
00650 void oval_result_criteria_node_set_result(struct oval_result_criteria_node *, oval_result_t);
00654 void oval_result_criteria_node_set_negate(struct oval_result_criteria_node *, bool);
00658 void oval_result_criteria_node_set_operator(struct oval_result_criteria_node *, oval_operator_t);       //type==NODETYPE_CRITERIA
00662 void oval_result_criteria_node_add_subnode(struct oval_result_criteria_node *, struct oval_result_criteria_node *);     //type==NODETYPE_CRITERIA
00666 void oval_result_criteria_node_set_test(struct oval_result_criteria_node *, struct oval_result_test *); //type==NODETYPE_CRITERION
00670 void oval_result_criteria_node_set_extends(struct oval_result_criteria_node *, struct oval_result_definition *);        //type==NODETYPE_EXTENDDEF
00679 oval_criteria_node_type_t oval_result_criteria_node_get_type(struct oval_result_criteria_node *);
00683 oval_result_t oval_result_criteria_node_eval(struct oval_result_criteria_node *);
00687 oval_result_t oval_result_criteria_node_get_result(struct oval_result_criteria_node *);
00691 bool oval_result_criteria_node_get_negate(struct oval_result_criteria_node *);
00695 oval_operator_t oval_result_criteria_node_get_operator(struct oval_result_criteria_node *);     //type==NODETYPE_CRITERIA
00699 struct oval_result_criteria_node_iterator *oval_result_criteria_node_get_subnodes(struct oval_result_criteria_node *);  //type==NODETYPE_CRITERIA
00703 struct oval_result_test *oval_result_criteria_node_get_test(struct oval_result_criteria_node *);        //type==NODETYPE_CRITERION
00707 struct oval_result_definition *oval_result_criteria_node_get_extends(struct oval_result_criteria_node *);       //type==NODETYPE_EXTENDDEF
00717 bool oval_result_criteria_node_iterator_has_more(struct oval_result_criteria_node_iterator *);
00721 struct oval_result_criteria_node *oval_result_criteria_node_iterator_next(struct oval_result_criteria_node_iterator *);
00725 void oval_result_criteria_node_iterator_free(struct oval_result_criteria_node_iterator *);
00741 struct oval_result_directives *oval_result_directives_new(struct oval_results_model *);
00745 void oval_result_directives_free(struct oval_result_directives *);
00746 
00747 
00756 void oval_result_directives_set_reported(struct oval_result_directives *, int flag, bool val);
00761 void oval_result_directives_set_content(struct oval_result_directives *, int flag, oval_result_directive_content_t);
00771 bool oval_result_directives_get_reported(struct oval_result_directives *, oval_result_t);
00775 oval_result_directive_content_t oval_result_directives_get_content(struct oval_result_directives *, oval_result_t);
00795 #endif                          /* OVAL_RESULTS_H_ */