Debian Codegraph @

src/OVAL/public/oval_results.h

raw symbols SCIP
1 /**
2 * @addtogroup OVAL
3 * @{
4 * @addtogroup OVALRES
5 * Interface for Results model
6 * @{
7 *
8 * Class diagram
9 * \image html result_model.png
10 *
11 * @file
12 *
13 * @author "David Niemoller" <[email protected]>
14 *
15 *
16 */
17
18
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
36 *
37 * Authors:
38 * "David Niemoller" <[email protected]>
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"
49 #include "oval_system_characteristics.h"
50 #include "oval_directives.h"
51 #include <stdbool.h>
52 #include "oscap_export.h"
53
54
55 OSCAP_API const char *oval_result_get_text(oval_result_t);
56
57 /**
58 * @struct oval_results_model
59 * OVAL Results Model holds OVAL results structure instances.
60 */
61 struct oval_results_model;
62
63 /**
64 * @struct oval_result_system
65 */
66 struct oval_result_system;
67 /**
68 * @struct oval_result_system_iterator
69 * @see oval_results_model_get_systems
70 */
71 struct oval_result_system_iterator;
72
73 /**
74 * @struct oval_result_definition
75 */
76 struct oval_result_definition;
77 /**
78 * @struct oval_result_definition_iterator
79 * @see oval_result_system_get_definitions
80 */
81 struct oval_result_definition_iterator;
82
83 /**
84 * @struct oval_result_test
85 */
86 struct oval_result_test;
87 /**
88 * @struct oval_result_test_iterator
89 * @see oval_result_system_get_tests
90 */
91 struct oval_result_test_iterator;
92
93 /**
94 * @struct oval_result_item
95 */
96 struct oval_result_item;
97 /**
98 * @struct oval_result_item_iterator
99 * @see oval_result_test_get_items
100 */
101 struct oval_result_item_iterator;
102
103
104 /**
105 * @struct oval_result_criteria_node
106 */
107 struct oval_result_criteria_node;
108 /**
109 * @struct oval_result_criteria_node_iterator
110 * @see oval_result_criteria_node_get_subnodes
111 */
112 struct oval_result_criteria_node_iterator;
113
114 /**
115 * Create new oval_results_model.
116 * The new model is bound to a specified oval_definition_model and variable bindings.
117 * @param definition_model the specified oval_definition_model.
118 * @param syschar_model the array of specified oval_syschar_model(s) terminated by NULL.
119 * @memberof oval_results_model
120 */
121 OSCAP_API struct oval_results_model *oval_results_model_new(struct oval_definition_model *definition_model,
122 struct oval_syschar_model **);
123
124 /**
125 * Import the content from the oscap_source into an oval_result_model.
126 * If imported content specifies a model entity that is already registered within the model its content is overwritten.
127 * @memberof oval_results_model
128 * @param model the oval_results_model
129 * @param source The oscap_source to import from
130 * @return -1 if an error occurred
131 */
132 OSCAP_API int oval_results_model_import_source(struct oval_results_model *model, struct oscap_source *source);
133
134 /**
135 * Copy an oval_results_model.
136 * @return A copy of the specified @ref oval_results_model.
137 * @memberof oval_results_model
138 */
139 OSCAP_API struct oval_results_model *oval_results_model_clone(struct oval_results_model *);
140 /**
141 * @memberof oval_results_model
142 */
143 OSCAP_API void oval_results_model_set_export_system_characteristics(struct oval_results_model *, bool export);
144
145 /**
146 * @memberof oval_results_model
147 */
148 OSCAP_API bool oval_results_model_get_export_system_characteristics(struct oval_results_model *);
149 /**
150 * Free memory allocated to a specified oval results model.
151 * @param the specified oval_results model
152 * @memberof oval_results_model
153 */
154 OSCAP_API void oval_results_model_free(struct oval_results_model *model);
155 /**
156 * Export oval results into file.
157 * @param model the oval_results_model
158 * @param model the oval_directives_model
159 * @param file filename
160 * @memberof oval_results_model
161 */
162 OSCAP_API int oval_results_model_export(struct oval_results_model *, struct oval_directives_model *, const char *file);
163
164 /**
165 * Export OVAL results into oscap_source
166 * @param results_model The OVAL Results Model to export
167 * @param directives_model The Directives Model to amend the export
168 * @param filename A suggested name (filename) to assign with the oscap_source
169 * This name may later be used when storing the oscap_source to disk drive.
170 * @returns Newly created oscap_source or NULL in case of failure
171 */
172 OSCAP_API struct oscap_source *oval_results_model_export_source(struct oval_results_model *results_model, struct oval_directives_model *directives_model, const char *name);
173
174 /**
175 * @name Setters
176 * @{
177 */
178 OSCAP_API void oval_results_model_set_generator(struct oval_results_model *model, struct oval_generator *generator);
179 /** @} */
180
181 /**
182 * @name Getters
183 * @{
184 */
185 OSCAP_API struct oval_generator *oval_results_model_get_generator(struct oval_results_model *model);
186
187 /**
188 * Return bound definition model from an oval_results_model.
189 * @param model the specified oval_results_model.
190 * @memberof oval_results_model
191 */
192 OSCAP_API struct oval_definition_model *oval_results_model_get_definition_model(struct oval_results_model *model);
193
194 /**
195 * Return the OVAL directives model
196 * @memberof oval_results_model
197 */
198 OSCAP_API struct oval_directives_model *oval_results_model_get_directives_model(struct oval_results_model *model);
199
200 /**
201 * Return iterator over reporting systems.
202 * @param model the specified results model
203 * @memberof oval_results_model
204 */
205 OSCAP_API struct oval_result_system_iterator *oval_results_model_get_systems(struct oval_results_model *);
206 /** @} */
207
208 /**
209 * @name Evaluators
210 * @{
211 */
212 /**
213 * Evaluate all result_systems. It's assumed that all necessary system
214 * characteristics for evaluation were altready gathered.
215 * @return 0 on sucess and -1 on fail. Use \ref ERRORS mechanism to examine the error.
216 */
217 OSCAP_API int oval_results_model_eval(struct oval_results_model *);
218 /** @} */
219
220
221
222
223
224
225 /**
226 * @memberof oval_result_system
227 */
228 OSCAP_API struct oval_result_system *oval_result_system_new(struct oval_results_model *, struct oval_syschar_model *);
229 /**
230 * @return A copy of the specified @ref oval_result_system.
231 * @memberof oval_result_system
232 */
233 OSCAP_API struct oval_result_system *oval_result_system_clone(struct oval_results_model *new_model,
234 struct oval_result_system *old_system);
235 /**
236 * @memberof oval_result_system
237 */
238 OSCAP_API void oval_result_system_free(struct oval_result_system *);
239
240 /**
241 * @name Setters
242 * @{
243 */
244 /**
245 * @memberof oval_result_system
246 */
247 OSCAP_API void oval_result_system_add_definition(struct oval_result_system *, struct oval_result_definition *);
248 /**
249 * @memberof oval_result_system
250 */
251 OSCAP_API void oval_result_system_add_test(struct oval_result_system *, struct oval_result_test *);
252 /** @} */
253
254 /**
255 * @name Getters
256 * @{
257 */
258 /**
259 * @memberof oval_result_system
260 */
261 OSCAP_API struct oval_results_model *oval_result_system_get_results_model(struct oval_result_system *);
262 /**
263 * @memberof oval_result_system
264 */
265 OSCAP_API struct oval_result_definition *oval_result_system_get_definition(struct oval_result_system *, const char *);
266 /**
267 * @memberof oval_result_system
268 */
269 OSCAP_API struct oval_result_definition_iterator *oval_result_system_get_definitions(struct oval_result_system *);
270 /**
271 * @memberof oval_result_system
272 */
273 OSCAP_API struct oval_result_test_iterator *oval_result_system_get_tests(struct oval_result_system *);
274 /**
275 * @memberof oval_result_system
276 */
277 OSCAP_API struct oval_syschar_model *oval_result_system_get_syschar_model(struct oval_result_system *);
278 /**
279 * @memberof oval_result_system
280 */
281 OSCAP_API struct oval_sysinfo *oval_result_system_get_sysinfo(struct oval_result_system *);
282 /** @} */
283
284 /**
285 * @name Iterators
286 * @{
287 */
288 /**
289 * @memberof oval_result_system_iterator
290 */
291 OSCAP_API bool oval_result_system_iterator_has_more(struct oval_result_system_iterator *);
292 /**
293 * @memberof oval_result_system_iterator
294 */
295 OSCAP_API struct oval_result_system *oval_result_system_iterator_next(struct oval_result_system_iterator *);
296 /**
297 * @memberof oval_result_system_iterator
298 */
299 OSCAP_API void oval_result_system_iterator_free(struct oval_result_system_iterator *);
300 /** @} */
301
302 /**
303 * @name Evaluators
304 * @{
305 */
306 /**
307 * Function evaluates all OVAL definitions of specified result_system. It assumes that all necessary system
308 * characteristics for evaluation were altready gathered.
309 * @memberof oval_result_system
310 * @param sys is result_system from result_model
311 * @return 0 on sucess and -1 on fail. Use \ref ERRORS mechanism to examine the error.
312 */
313 OSCAP_API int oval_result_system_eval(struct oval_result_system *sys);
314 /**
315 * Function evaluates specified OVAL definition in result_system. It assumes that all necessary system
316 * characteristics for evaluation were altready gathered.
317 * @memberof oval_result_system
318 * @param sys is result_system from result_model
319 * @param id of the definition from definition_model from result_model
320 * @return 0 on succeess, or non 0 if an error occurred. Use \ref ERRORS mechanism to examine the error.
321 */
322 OSCAP_API int oval_result_system_eval_definition(struct oval_result_system *sys, const char *id);
323 /** @} */
324
325
326
327
328
329
330 /**
331 * @memberof oval_result_definition
332 */
333 OSCAP_API struct oval_result_definition *oval_result_definition_new(struct oval_result_system *, char *);
334 /**
335 * @return A copy of the specified @ref oval_result_definition.
336 * @memberof oval_result_definition
337 */
338 OSCAP_API struct oval_result_definition *oval_result_definition_clone
339 (struct oval_result_system *new_system, struct oval_result_definition *old_definition);
340 /**
341 * @memberof oval_result_definition
342 */
343 OSCAP_API void oval_result_definition_free(struct oval_result_definition *);
344
345 /**
346 * @name Setters
347 * @{
348 */
349 /**
350 * @memberof oval_result_definition
351 */
352 OSCAP_API void oval_result_definition_set_result(struct oval_result_definition *, oval_result_t);
353 /**
354 * @memberof oval_result_definition
355 */
356 OSCAP_API void oval_result_definition_set_instance(struct oval_result_definition *, int);
357 /**
358 * @memberof oval_result_definition
359 */
360 OSCAP_API void oval_result_definition_set_criteria(struct oval_result_definition *, struct oval_result_criteria_node *);
361 /**
362 * @memberof oval_result_definition
363 */
364 OSCAP_API void oval_result_definition_add_message(struct oval_result_definition *, struct oval_message *);
365 /** @} */
366
367 /**
368 * @name Getters
369 * @{
370 */
371 /**
372 * @memberof oval_result_definition
373 */
374 OSCAP_API struct oval_definition *oval_result_definition_get_definition(const struct oval_result_definition *);
375 /**
376 * Returns the @idref attribute of a given result definition
377 * @memberof oval_result_definition
378 */
379 OSCAP_API const char *oval_result_definition_get_id(const struct oval_result_definition *rslt_definition);
380 /**
381 * @memberof oval_result_definition
382 */
383 OSCAP_API struct oval_result_system *oval_result_definition_get_system(const struct oval_result_definition *);
384 /**
385 * @memberof oval_result_definition
386 */
387 OSCAP_API int oval_result_definition_get_instance(const struct oval_result_definition *);
388 /**
389 * @memberof oval_result_definition
390 */
391 OSCAP_API oval_result_t oval_result_definition_eval(struct oval_result_definition *);
392 /**
393 * @memberof oval_result_definition
394 */
395 OSCAP_API oval_result_t oval_result_definition_get_result(const struct oval_result_definition *);
396 /**
397 * @memberof oval_result_definition
398 */
399 OSCAP_API struct oval_message_iterator *oval_result_definition_get_messages(const struct oval_result_definition *);
400 /**
401 * @memberof oval_result_definition
402 */
403 OSCAP_API struct oval_result_criteria_node *oval_result_definition_get_criteria(const struct oval_result_definition *);
404 /** @} */
405
406 /**
407 * @name Iterators
408 * @{
409 */
410 /**
411 * @memberof oval_result_definition_iterator
412 */
413 OSCAP_API bool oval_result_definition_iterator_has_more(struct oval_result_definition_iterator *);
414 /**
415 * @memberof oval_result_definition_iterator
416 */
417 OSCAP_API struct oval_result_definition *oval_result_definition_iterator_next(struct oval_result_definition_iterator *);
418 /**
419 * @memberof oval_result_definition_iterator
420 */
421 OSCAP_API void oval_result_definition_iterator_free(struct oval_result_definition_iterator *);
422 /** @} */
423
424 /**
425 * @name Evaluators
426 * @{
427 */
428 /** @} */
429
430
431
432
433
434
435 /**
436 * @memberof oval_result_test
437 */
438 OSCAP_API struct oval_result_test *oval_result_test_new(struct oval_result_system *, char *);
439 /**
440 * @return A copy of the specified @ref oval_result_test.
441 * @memberof oval_result_test
442 */
443 OSCAP_API struct oval_result_test *oval_result_test_clone
444 (struct oval_result_system *new_system, struct oval_result_test *old_test);
445 /**
446 * @memberof oval_result_test
447 */
448 OSCAP_API void oval_result_test_free(struct oval_result_test *);
449
450 /**
451 * @name Setters
452 * @{
453 */
454 /**
455 * @memberof oval_result_test
456 */
457 OSCAP_API void oval_result_test_set_result(struct oval_result_test *, oval_result_t);
458 /**
459 * @memberof oval_result_test
460 */
461 OSCAP_API void oval_result_test_set_instance(struct oval_result_test *test, int instance);
462 /**
463 * @memberof oval_result_test
464 */
465 OSCAP_API void oval_result_test_add_message(struct oval_result_test *, struct oval_message *);
466 /**
467 * @memberof oval_result_test
468 */
469 OSCAP_API void oval_result_test_add_item(struct oval_result_test *, struct oval_result_item *);
470 /**
471 * @memberof oval_result_test
472 */
473 OSCAP_API void oval_result_test_add_binding(struct oval_result_test *, struct oval_variable_binding *);
474 /** @} */
475
476 /**
477 * @name Getters
478 * @{
479 */
480 /**
481 * @memberof oval_result_test
482 */
483 OSCAP_API struct oval_test *oval_result_test_get_test(struct oval_result_test *);
484 /**
485 * @memberof oval_result_test
486 */
487 OSCAP_API struct oval_result_system *oval_result_test_get_system(struct oval_result_test *);
488 /**
489 * @memberof oval_result_test
490 */
491 OSCAP_API oval_result_t oval_result_test_eval(struct oval_result_test *);
492 /**
493 * @memberof oval_result_test
494 */
495 OSCAP_API oval_result_t oval_result_test_get_result(struct oval_result_test *);
496 /**
497 * @memberof oval_result_test
498 */
499 OSCAP_API int oval_result_test_get_instance(struct oval_result_test *);
500 /**
501 * @memberof oval_result_test
502 */
503 OSCAP_API struct oval_message_iterator *oval_result_test_get_messages(struct oval_result_test *);
504 /**
505 * @memberof oval_result_test
506 */
507 OSCAP_API struct oval_result_item_iterator *oval_result_test_get_items(struct oval_result_test *);
508 /**
509 * @memberof oval_result_test
510 */
511 OSCAP_API struct oval_variable_binding_iterator *oval_result_test_get_bindings(struct oval_result_test *);
512 /** @} */
513
514 /**
515 * @name Iterators
516 * @{
517 */
518 /**
519 * @memberof oval_result_test_iterator
520 */
521 OSCAP_API bool oval_result_test_iterator_has_more(struct oval_result_test_iterator *);
522 /**
523 * @memberof oval_result_test_iterator
524 */
525 OSCAP_API struct oval_result_test *oval_result_test_iterator_next(struct oval_result_test_iterator *);
526 /**
527 * @memberof oval_result_test_iterator
528 */
529 OSCAP_API void oval_result_test_iterator_free(struct oval_result_test_iterator *);
530 /** @} */
531
532 /**
533 * @name Evaluators
534 * @{
535 */
536 /** @} */
537
538
539
540
541
542
543 /**
544 * @memberof oval_result_item
545 */
546 OSCAP_API struct oval_result_item *oval_result_item_new(struct oval_result_system *, char *);
547 /**
548 * @return A copy of the specified @ref oval_result_item.
549 * @memberof oval_result_item
550 */
551 OSCAP_API struct oval_result_item *oval_result_item_clone
552 (struct oval_result_system *new_system, struct oval_result_item *old_item);
553 /**
554 * @memberof oval_result_item
555 */
556 OSCAP_API void oval_result_item_free(struct oval_result_item *);
557
558 /**
559 * @name Setters
560 * @{
561 */
562 /**
563 * @memberof oval_result_item
564 */
565 OSCAP_API void oval_result_item_set_result(struct oval_result_item *, oval_result_t);
566 /**
567 * @memberof oval_result_item
568 */
569 OSCAP_API void oval_result_item_add_message(struct oval_result_item *, struct oval_message *);
570 /** @} */
571
572 /**
573 * @name Getters
574 * @{
575 */
576 /**
577 * @memberof oval_result_item
578 */
579 OSCAP_API struct oval_sysitem *oval_result_item_get_sysitem(struct oval_result_item *);
580 /**
581 * @memberof oval_result_item
582 */
583 OSCAP_API oval_result_t oval_result_item_get_result(struct oval_result_item *);
584 /**
585 * @memberof oval_result_item
586 */
587 OSCAP_API struct oval_message_iterator *oval_result_item_get_messages(struct oval_result_item *);
588 /** @} */
589
590 /**
591 * @name Iterators
592 * @{
593 */
594 /**
595 * @memberof oval_result_item_iterator
596 */
597 OSCAP_API bool oval_result_item_iterator_has_more(struct oval_result_item_iterator *);
598 /**
599 * @memberof oval_result_item_iterator
600 */
601 OSCAP_API struct oval_result_item *oval_result_item_iterator_next(struct oval_result_item_iterator *);
602 /**
603 * @memberof oval_result_item_iterator
604 */
605 OSCAP_API void oval_result_item_iterator_free(struct oval_result_item_iterator *);
606 /** @} */
607
608 /**
609 * @name Evaluators
610 * @{
611 */
612 /** @} */
613
614
615
616
617
618
619 /**
620 * @memberof oval_result_criteria_node
621 */
622 OSCAP_API struct oval_result_criteria_node *oval_result_criteria_node_new(struct oval_result_system *,
623 oval_criteria_node_type_t,
624 int, int, ...);
625 /**
626 * @return A copy of the specified @ref oval_result_criteria_node.
627 * @memberof oval_result_criteria_node
628 */
629 OSCAP_API struct oval_result_criteria_node *oval_result_criteria_node_clone
630 (struct oval_result_system *new_system, struct oval_result_criteria_node *old_node);
631 /**
632 * @memberof oval_result_criteria_node
633 */
634 OSCAP_API void oval_result_criteria_node_free(struct oval_result_criteria_node *);
635
636 /**
637 * @name Setters
638 * @{
639 */
640 /**
641 * @memberof oval_result_criteria_node
642 */
643 OSCAP_API void oval_result_criteria_node_set_result(struct oval_result_criteria_node *, oval_result_t);
644 /**
645 * @memberof oval_result_criteria_node
646 */
647 OSCAP_API void oval_result_criteria_node_set_negate(struct oval_result_criteria_node *, bool);
648 /**
649 * @memberof oval_result_criteria_node
650 */
651 OSCAP_API void oval_result_criteria_node_set_applicability_check(struct oval_result_criteria_node *, bool);
652 /**
653 * @memberof oval_result_criteria_node
654 */
655 OSCAP_API void oval_result_criteria_node_set_operator(struct oval_result_criteria_node *, oval_operator_t); //type==NODETYPE_CRITERIA
656 /**
657 * @memberof oval_result_criteria_node
658 */
659 OSCAP_API void oval_result_criteria_node_add_subnode(struct oval_result_criteria_node *, struct oval_result_criteria_node *); //type==NODETYPE_CRITERIA
660 /**
661 * @memberof oval_result_criteria_node
662 */
663 OSCAP_API void oval_result_criteria_node_set_test(struct oval_result_criteria_node *, struct oval_result_test *); //type==NODETYPE_CRITERION
664 /**
665 * @memberof oval_result_criteria_node
666 */
667 OSCAP_API void oval_result_criteria_node_set_extends(struct oval_result_criteria_node *, struct oval_result_definition *); //type==NODETYPE_EXTENDDEF
668 /** @} */
669
670 /**
671 * @name Getters
672 * @{
673 */
674 /**
675 */
676 OSCAP_API oval_criteria_node_type_t oval_result_criteria_node_get_type(struct oval_result_criteria_node *);
677 /**
678 * @memberof oval_result_criteria_node
679 */
680 OSCAP_API oval_result_t oval_result_criteria_node_eval(struct oval_result_criteria_node *);
681 /**
682 * @memberof oval_result_criteria_node
683 */
684 OSCAP_API oval_result_t oval_result_criteria_node_get_result(struct oval_result_criteria_node *);
685 /**
686 * @memberof oval_result_criteria_node
687 */
688 OSCAP_API bool oval_result_criteria_node_get_negate(struct oval_result_criteria_node *);
689 /**
690 * @memberof oval_result_criteria_node
691 */
692 OSCAP_API bool oval_result_criteria_node_get_applicability_check(struct oval_result_criteria_node *);
693 /**
694 * @memberof oval_result_criteria_node
695 */
696 OSCAP_API oval_operator_t oval_result_criteria_node_get_operator(struct oval_result_criteria_node *); //type==NODETYPE_CRITERIA
697 /**
698 * @memberof oval_result_criteria_node
699 */
700 OSCAP_API struct oval_result_criteria_node_iterator *oval_result_criteria_node_get_subnodes(struct oval_result_criteria_node *); //type==NODETYPE_CRITERIA
701 /**
702 * @memberof oval_result_criteria_node
703 */
704 OSCAP_API struct oval_result_test *oval_result_criteria_node_get_test(struct oval_result_criteria_node *); //type==NODETYPE_CRITERION
705 /**
706 * @memberof oval_result_criteria_node
707 */
708 OSCAP_API struct oval_result_definition *oval_result_criteria_node_get_extends(struct oval_result_criteria_node *); //type==NODETYPE_EXTENDDEF
709 /** @} */
710
711 /**
712 * @name Iterators
713 * @{
714 */
715 /**
716 * @memberof oval_result_criteria_node_iterator
717 */
718 OSCAP_API bool oval_result_criteria_node_iterator_has_more(struct oval_result_criteria_node_iterator *);
719 /**
720 * @memberof oval_result_criteria_node_iterator
721 */
722 OSCAP_API struct oval_result_criteria_node *oval_result_criteria_node_iterator_next(struct oval_result_criteria_node_iterator *);
723 /**
724 * @memberof oval_result_criteria_node_iterator
725 */
726 OSCAP_API void oval_result_criteria_node_iterator_free(struct oval_result_criteria_node_iterator *);
727 /** @} */
728
729 /**
730 * @name Evaluators
731 * @{
732 */
733 /** @} */
734
735
736 /** @} */
737 /**
738 * @}END OVALRES
739 * @}END OVAL
740 */
741
742 #endif /* OVAL_RESULTS_H_ */
743