Open SCAP Library: xccdf_policy.h Source File

Open SCAP Library

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

xccdf_policy.h
Go to the documentation of this file.
1 /*
2 * Copyright 2009 Red Hat Inc., Durham, North Carolina.
3 * All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 */
20
21
31 #ifndef XCCDF_POLICY_H_
32 #define XCCDF_POLICY_H_
33
34 #include <xccdf_benchmark.h>
35 #include <stdbool.h>
36 #include <time.h>
37 #include <oscap.h>
38
43 struct xccdf_policy_model;
44
49 struct xccdf_policy;
50
55 struct xccdf_value_binding;
56
57 struct xccdf_value_binding_iterator;
58
64 struct xccdf_policy_iterator;
65
70 typedef enum {
71 POLICY_ENGINE_QUERY_NAMES_FOR_HREF = 1,
72 } xccdf_policy_engine_query_t;
73
88 typedef void *(*xccdf_policy_engine_query_fn) (void *, xccdf_policy_engine_query_t, void *);
89
98 typedef xccdf_test_result_type_t (*xccdf_policy_engine_eval_fn) (struct xccdf_policy *policy, const char *rule_id, const char *definition_id, const char *href_if, struct xccdf_value_binding_iterator *value_binding_it, struct xccdf_check_import_iterator *check_imports_it, void *user_data);
99
100 /************************************************************/
101
111 struct xccdf_policy_model *xccdf_policy_model_new(struct xccdf_benchmark *benchmark);
112
119 struct xccdf_policy * xccdf_policy_new(struct xccdf_policy_model * model, struct xccdf_profile * profile);
120
126 struct xccdf_value_binding * xccdf_value_binding_new(void);
127
132 void xccdf_policy_model_free(struct xccdf_policy_model *);
133
138 void xccdf_policy_free(struct xccdf_policy *);
139
144 void xccdf_value_binding_free(struct xccdf_value_binding *);
145
161 bool xccdf_policy_model_set_tailoring(struct xccdf_policy_model *model, struct xccdf_tailoring *tailoring);
162
167 struct xccdf_tailoring *xccdf_policy_model_get_tailoring(struct xccdf_policy_model *model);
168
173 bool xccdf_policy_model_add_cpe_dict(struct xccdf_policy_model * model, const char * cpe_dict);
174
179 bool xccdf_policy_model_add_cpe_lang_model(struct xccdf_policy_model * model, const char * cpe_lang);
180
186 bool xccdf_policy_model_add_cpe_autodetect(struct xccdf_policy_model *model, const char* filepath);
187
192 struct oscap_htable_iterator *xccdf_policy_model_get_cpe_oval_sessions(struct xccdf_policy_model *model);
193
206 OSCAP_DEPRECATED(bool xccdf_policy_model_register_engine_callback(struct xccdf_policy_model * model, char * sys, void * func, void * usr));
207
218 bool xccdf_policy_model_register_engine_and_query_callback(struct xccdf_policy_model *model, char *sys, xccdf_policy_engine_eval_fn eval_fn, void *usr, xccdf_policy_engine_query_fn query_fn);
219
220 typedef int (*policy_reporter_output)(struct xccdf_rule_result *, void *);
221
230 bool xccdf_policy_model_register_output_callback(struct xccdf_policy_model * model, policy_reporter_output func, void * usr);
231
232 typedef int (*policy_reporter_start)(struct xccdf_rule *, void *);
233
242 bool xccdf_policy_model_register_start_callback(struct xccdf_policy_model * model, policy_reporter_start func, void * usr);
243
244 /************************************************************/
258 struct xccdf_policy_model * xccdf_policy_get_model(const struct xccdf_policy * policy);
259
266 struct xccdf_benchmark * xccdf_policy_model_get_benchmark(const struct xccdf_policy_model * item);
267
272 struct xccdf_value_binding_iterator * xccdf_policy_get_values(const struct xccdf_policy * item);
273
281 struct xccdf_policy_iterator * xccdf_policy_model_get_policies(const struct xccdf_policy_model *model);
282
289 struct xccdf_select_iterator * xccdf_policy_get_selected_rules(struct xccdf_policy *);
290
296 struct xccdf_profile * xccdf_policy_get_profile(const struct xccdf_policy *);
297
303 struct xccdf_select_iterator * xccdf_policy_get_selects(const struct xccdf_policy *);
304
310 char * xccdf_value_binding_get_name(const struct xccdf_value_binding *);
311
317 char * xccdf_value_binding_get_value(const struct xccdf_value_binding *);
318
324 xccdf_value_type_t xccdf_value_binding_get_type(const struct xccdf_value_binding *);
325
331 xccdf_operator_t xccdf_value_binding_get_operator(const struct xccdf_value_binding *);
332
338 char * xccdf_value_binding_get_setvalue(const struct xccdf_value_binding *);
339
344 struct xccdf_result_iterator * xccdf_policy_get_results(const struct xccdf_policy * policy);
345
351 struct xccdf_result * xccdf_policy_get_result_by_id(struct xccdf_policy * policy, const char * id);
352
359 const char * xccdf_policy_get_id(struct xccdf_policy * policy);
360
368 struct xccdf_policy * xccdf_policy_model_get_policy_by_id(struct xccdf_policy_model * policy_model, const char * id);
369
370 /************************************************************/
373 /************************************************************/
386 bool xccdf_policy_model_add_policy(struct xccdf_policy_model *, struct xccdf_policy *);
387
393 bool xccdf_policy_add_select(struct xccdf_policy *, struct xccdf_select *);
394
402 OSCAP_DEPRECATED(
403 bool xccdf_policy_set_selected(struct xccdf_policy * policy, char * idref)
404 );
405
410 bool xccdf_policy_add_result(struct xccdf_policy * policy, struct xccdf_result * item);
411
417 bool xccdf_policy_add_value(struct xccdf_policy *, struct xccdf_value_binding *);
418
424 bool xccdf_policy_is_item_selected(struct xccdf_policy *policy, const char *id);
425
430 int xccdf_policy_get_selected_rules_count(struct xccdf_policy *policy);
431
437 struct xccdf_select * xccdf_policy_get_select_by_id(struct xccdf_policy * policy, const char *item_id);
438
439 /************************************************************/
442 /************************************************************/
466 struct xccdf_result * xccdf_policy_evaluate(struct xccdf_policy * policy);
467
476 bool xccdf_policy_resolve(struct xccdf_policy * policy);
477
488 int xccdf_policy_generate_fix(struct xccdf_policy *policy, struct xccdf_result *result, const char *sys, int output_fd);
489
496 struct xccdf_item * xccdf_policy_tailor_item(struct xccdf_policy * policy, struct xccdf_item * item);
497
501 struct oscap_file_entry;
502
504 struct oscap_file_entry *oscap_file_entry_new(void);
506 struct oscap_file_entry *oscap_file_entry_dup(struct oscap_file_entry* file_entry);
508 void oscap_file_entry_free(struct oscap_file_entry* entry);
510 const char* oscap_file_entry_get_system(struct oscap_file_entry* entry);
512 const char* oscap_file_entry_get_file(struct oscap_file_entry* entry);
513
517 struct oscap_file_entry_iterator;
518
520 const struct oscap_file_entry *oscap_file_entry_iterator_next(struct oscap_file_entry_iterator *it);
522 bool oscap_file_entry_iterator_has_more(struct oscap_file_entry_iterator *it);
524 void oscap_file_entry_iterator_free(struct oscap_file_entry_iterator *it);
526 void oscap_file_entry_iterator_reset(struct oscap_file_entry_iterator *it);
527
531 struct oscap_file_entry_list;
532
534 struct oscap_file_entry_list* oscap_file_entry_list_new(void);
536 void oscap_file_entry_list_free(struct oscap_file_entry_list* list);
538 struct oscap_file_entry_iterator* oscap_file_entry_list_get_files(struct oscap_file_entry_list* list);
539
548 struct oscap_file_entry_list * xccdf_policy_model_get_systems_and_files(struct xccdf_policy_model * policy_model);
549
557 struct oscap_file_entry_list * xccdf_item_get_systems_and_files(struct xccdf_item * item);
558
564 struct oscap_stringlist * xccdf_policy_model_get_files(struct xccdf_policy_model * policy_model);
565
571 struct oscap_stringlist * xccdf_item_get_files(struct xccdf_item * item);
572
578 xccdf_test_result_type_t xccdf_test_result_resolve_and_operation(xccdf_test_result_type_t A, xccdf_test_result_type_t B);
579
580 /************************************************************/
583 /************************************************************/
593 bool xccdf_policy_iterator_has_more(struct xccdf_policy_iterator *it);
594
599 struct xccdf_policy * xccdf_policy_iterator_next(struct xccdf_policy_iterator *it);
600
605 void xccdf_policy_iterator_free(struct xccdf_policy_iterator *it);
606
611 void xccdf_policy_iterator_reset(struct xccdf_policy_iterator *it);
612
617 bool xccdf_value_binding_iterator_has_more(struct xccdf_value_binding_iterator *it);
618
623 struct xccdf_value_binding * xccdf_value_binding_iterator_next(struct xccdf_value_binding_iterator *it);
624
629 void xccdf_value_binding_iterator_free(struct xccdf_value_binding_iterator *it);
630
635 void xccdf_value_binding_iterator_reset(struct xccdf_value_binding_iterator *it);
636
644 struct xccdf_score * xccdf_policy_get_score(struct xccdf_policy * policy, struct xccdf_result * test_result, const char * system);
645
651 char* xccdf_policy_substitute(const char *text, struct xccdf_policy *policy);
652
653 /************************************************************/
659 #endif
660
661