31 #ifndef XCCDF_POLICY_H_
32 #define XCCDF_POLICY_H_
57 struct xccdf_value_binding_iterator;
71 POLICY_ENGINE_QUERY_NAMES_FOR_HREF = 1,
255 typedef int (*policy_reporter_start)(
struct xccdf_rule *,
void *);
640 bool xccdf_value_binding_iterator_has_more(
struct xccdf_value_binding_iterator *it);
646 struct xccdf_value_binding * xccdf_value_binding_iterator_next(
struct xccdf_value_binding_iterator *it);
652 void xccdf_value_binding_iterator_free(
struct xccdf_value_binding_iterator *it);
658 void xccdf_value_binding_iterator_reset(
struct xccdf_value_binding_iterator *it);
struct oscap_file_entry_iterator * oscap_file_entry_list_get_files(struct oscap_file_entry_list *list)
Definition: xccdf_policy.c:1431
struct xccdf_tailoring * xccdf_policy_model_get_tailoring(struct xccdf_policy_model *model)
Retrieves the Tailoring element used in this policy.
Definition: xccdf_policy.c:1693
struct oscap_file_entry_list * xccdf_policy_model_get_systems_and_files(struct xccdf_policy_model *policy_model)
Return names of files that are used in checks of particular rules.
Definition: xccdf_policy.c:2456
Stores content from xccdf:Tailoring element which can be loaded from a separate file.
Definition: item.h:170
bool oscap_file_entry_iterator_has_more(struct oscap_file_entry_iterator *it)
Definition: xccdf_policy.c:1401
A collection of strings.
Definition: oscap_text.h:59
bool xccdf_policy_model_set_tailoring(struct xccdf_policy_model *model, struct xccdf_tailoring *tailoring)
Sets the Tailoring element to use in the policy.
Definition: xccdf_policy.c:1678
General OpenScap functions and types.
void oscap_file_entry_free(struct oscap_file_entry *entry)
Definition: xccdf_policy.c:1379
int xccdf_policy_generate_fix(struct xccdf_policy *policy, struct xccdf_result *result, const char *sys, int output_fd)
Generate remediation prescription (presumably a remediation script).
Definition: xccdf_policy_remediate.c:537
xccdf_operator_t xccdf_value_binding_get_operator(const struct xccdf_value_binding *)
get Value operator from value bindings
void oscap_file_entry_list_free(struct oscap_file_entry_list *list)
Definition: xccdf_policy.c:1426
XCCDF score.
Definition: item.h:368
struct xccdf_policy_iterator * xccdf_policy_model_get_policies(const struct xccdf_policy_model *model)
Get policies from Policy Model.
Iterate through policies.
Definition: xccdf_policy.h:57
struct oscap_file_entry_list * oscap_file_entry_list_new(void)
Definition: xccdf_policy.c:1416
xccdf_operator_t
Operator to be applied on an xccdf_value.
Definition: xccdf_benchmark.h:99
void xccdf_policy_free(struct xccdf_policy *)
Destructor of Policy structure.
Definition: xccdf_policy.c:2499
struct oscap_file_entry_list * xccdf_item_get_systems_and_files(struct xccdf_item *item)
Return names of files that are used in checks of particular rules.
Definition: xccdf_policy.c:1503
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)
Type of function which implements OpenSCAP checking engine.
Definition: xccdf_policy.h:98
struct xccdf_policy_model * xccdf_policy_model_new(struct xccdf_benchmark *benchmark)
Constructor of Policy Model structure.
Definition: xccdf_policy.c:1838
#define OSCAP_DEPRECATED(func)
This macro will warn, when a deprecated function is used.
Definition: oscap.h:50
struct xccdf_select_iterator * xccdf_policy_get_selected_rules(struct xccdf_policy *)
Get selected rules from policy.
Definition: xccdf_policy.c:2059
struct xccdf_select_iterator * xccdf_policy_get_selects(const struct xccdf_policy *)
Get rules from Policy.
Top level XCCDF structure containing profiles, rules, values and results.
XCCDF select option usen in the profile.
Definition: item.h:252
bool xccdf_policy_model_register_start_callback(struct xccdf_policy_model *model, policy_reporter_start func, void *usr)
Function to register start callback for checking system that will be called BEFORE each rule evaluati...
Definition: xccdf_policy.c:1792
struct oscap_stringlist * xccdf_item_get_files(struct xccdf_item *item)
Return names of files that are used in checks of particular rules.
Definition: xccdf_policy.c:1612
Check import iterator.
Definition: xccdf_benchmark.h:529
void xccdf_policy_iterator_reset(struct xccdf_policy_iterator *it)
Reset the iterator structure (it will point to the first item in the list)
struct oscap_stringlist * xccdf_policy_model_get_files(struct xccdf_policy_model *policy_model)
Return names of files that are used in checks of particular rules.
Definition: xccdf_policy.c:2461
bool xccdf_policy_model_register_output_callback(struct xccdf_policy_model *model, policy_reporter_output func, void *usr)
Function to register output callback for checking system that will be called AFTER each rule evaluati...
Definition: xccdf_policy.c:1800
Select iterator.
Definition: xccdf_benchmark.h:460
XCCDF policy model structure contains xccdf_benchmark as reference to Benchmark element in XML file a...
Definition: xccdf_policy.c:58
void xccdf_policy_model_free(struct xccdf_policy_model *)
Destructor of Policy Model structure.
Definition: xccdf_policy.c:2484
struct xccdf_benchmark * benchmark
Benchmark element (root element of XML file)
Definition: xccdf_policy.c:60
bool xccdf_policy_resolve(struct xccdf_policy *policy)
Resolve benchmark by applying all refine_rules and refine_values to rules / values of benchmark...
Definition: xccdf_policy.c:2130
XCCDF value binding structure is binding between Refine values, Set values, Value element and Check e...
Definition: xccdf_policy.c:113
Actual results of running a XCCDF test or profile.
Definition: xccdf_benchmark.h:222
Open-scap XCCDF library interface.
bool xccdf_policy_is_item_selected(struct xccdf_policy *policy, const char *id)
Get the selection settings of the item.
Definition: xccdf_policy.c:647
xccdf_test_result_type_t
Test result.
Definition: xccdf_benchmark.h:167
bool xccdf_policy_model_add_cpe_lang_model(struct xccdf_policy_model *model, const char *cpe_lang)
Registers an additional CPE lang model for applicability testing The one embedded in the evaluated XC...
Definition: xccdf_policy.c:1707
struct xccdf_result * xccdf_policy_get_result_by_id(struct xccdf_policy *policy, const char *id)
Get XCCDF Result structure by it's idetificator if there is one.
Definition: xccdf_policy.c:1808
struct xccdf_result * xccdf_policy_evaluate(struct xccdf_policy *policy)
Call the checking engine for each selected rule in given policy structure.
Definition: xccdf_policy.c:2188
struct xccdf_policy * xccdf_policy_model_get_policy_by_id(struct xccdf_policy_model *policy_model, const char *id)
Get XCCDF Policy from Policy model by speciefied ID of Profile.
Definition: xccdf_policy.c:2075
bool xccdf_policy_add_select(struct xccdf_policy *, struct xccdf_select *)
Add rule to Policy.
Definition: xccdf_policy.c:1936
void oscap_file_entry_iterator_reset(struct oscap_file_entry_iterator *it)
Definition: xccdf_policy.c:1411
char * xccdf_policy_get_readable_item_description(struct xccdf_policy *policy, struct xccdf_item *item, const char *preferred_lang)
Get human readable description of given XCCDF Item.
Definition: xccdf_policy.c:204
bool xccdf_policy_model_add_policy(struct xccdf_policy_model *, struct xccdf_policy *)
Add Policy to Policy Model.
bool xccdf_policy_add_result(struct xccdf_policy *policy, struct xccdf_result *item)
Add result to XCCDF Policy Model.
struct xccdf_policy_model * xccdf_policy_get_model(const struct xccdf_policy *policy)
Get model from Policy (parent structure of Policy to access the benchmark)
xccdf_value_type_t
Type of an xccdf_value.
Definition: xccdf_benchmark.h:92
bool xccdf_policy_model_register_engine_callback(struct xccdf_policy_model *model, char *sys, void *func, void *usr)
Function to register callback for checking system.
Definition: xccdf_policy.c:1761
struct xccdf_score * xccdf_policy_get_score(struct xccdf_policy *policy, struct xccdf_result *test_result, const char *system)
Get score of the XCCDF Benchmark.
Definition: xccdf_policy.c:2268
char * xccdf_value_binding_get_name(const struct xccdf_value_binding *)
Get variable name from value bindings.
struct xccdf_benchmark * xccdf_policy_model_get_benchmark(const struct xccdf_policy_model *item)
Get Benchmark from Policy Model.
struct xccdf_policy * xccdf_policy_new(struct xccdf_policy_model *model, struct xccdf_profile *profile)
Constructor of Policy structure.
Definition: xccdf_policy.c:1989
const char * oscap_file_entry_get_file(struct oscap_file_entry *entry)
Definition: xccdf_policy.c:1391
char * xccdf_policy_substitute(const char *text, struct xccdf_policy *policy)
Perform textual substitution of cdf:sub elements with respect to given XCCDF policy.
Definition: xccdf_policy_substitute.c:186
XCCDF rule result.
Definition: item.h:343
char * xccdf_policy_get_readable_item_title(struct xccdf_policy *policy, struct xccdf_item *item, const char *preferred_lang)
Get human readable title of given XCCDF Item.
Definition: xccdf_policy.c:194
struct xccdf_select * xccdf_policy_get_select_by_id(struct xccdf_policy *policy, const char *item_id)
Get select from policy by specified ID of XCCDF Item.
Definition: xccdf_policy.c:2052
struct xccdf_value_binding * xccdf_value_binding_new(void)
Constructor of structure with profile bindings - refine_rules, refine_values and set_values.
Definition: xccdf_policy.c:2028
xccdf_value_type_t xccdf_value_binding_get_type(const struct xccdf_value_binding *)
get variable type from value bindings
bool xccdf_policy_set_selected(struct xccdf_policy *policy, char *idref)
Set a new selector to the Policy structure.
Definition: xccdf_policy.c:2070
XCCDF rule defines a test execution.
Definition: xccdf_benchmark.h:204
bool xccdf_policy_model_add_cpe_autodetect(struct xccdf_policy_model *model, const char *filepath)
Registers an additional CPE resource (either dictionary or language) Autodetects given file and acts ...
Definition: xccdf_policy.c:1716
struct xccdf_policy_model * model
XCCDF Policy model.
Definition: xccdf_policy.c:85
struct xccdf_profile * xccdf_policy_get_profile(const struct xccdf_policy *)
Get XCCDF Profile from Policy.
void xccdf_policy_iterator_free(struct xccdf_policy_iterator *it)
Free the iterator structure (it makes no changes to the list structure)
struct xccdf_value_binding_iterator * xccdf_policy_get_values(const struct xccdf_policy *item)
Get Value Bindings from XCCDF Policy.
struct xccdf_policy * xccdf_policy_iterator_next(struct xccdf_policy_iterator *it)
Return the next xccdf_policy structure from the list and increment the iterator.
void xccdf_value_binding_free(struct xccdf_value_binding *)
Destructor of Value binding structure.
Definition: xccdf_policy.c:2516
const struct oscap_file_entry * oscap_file_entry_iterator_next(struct oscap_file_entry_iterator *it)
Definition: xccdf_policy.c:1396
struct xccdf_result_iterator * xccdf_policy_get_results(const struct xccdf_policy *policy)
Get results of all XCCDF Policy results.
xccdf_test_result_type_t xccdf_test_result_resolve_and_operation(xccdf_test_result_type_t A, xccdf_test_result_type_t B)
Return result of the AND operation for two given attributes.
Definition: xccdf_policy.c:365
XCCDF profile is a set of tests and their settings in a compact package.
Definition: xccdf_benchmark.h:192
bool xccdf_policy_iterator_has_more(struct xccdf_policy_iterator *it)
Return true if the list is not empty, false otherwise.
struct oscap_file_entry * oscap_file_entry_new(void)
Definition: xccdf_policy.c:1362
XCCDF policy structure is abstract (class) structure of Profile element from benchmark.
Definition: xccdf_policy.c:83
struct oscap_htable_iterator * xccdf_policy_model_get_cpe_oval_sessions(struct xccdf_policy_model *model)
Retrieves an iterator of all OVAL sessions created for CPE applicability evaluation key is the OVAL h...
Definition: xccdf_policy.c:1737
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)
Function to register callback for checking system.
Definition: xccdf_policy.c:1764
xccdf_policy_engine_query_t
Type of a query over checking-engine data.
Definition: xccdf_policy.h:70
int xccdf_policy_get_selected_rules_count(struct xccdf_policy *policy)
Retrieves number of selected items in the policy.
Definition: xccdf_policy.c:660
bool xccdf_policy_add_value(struct xccdf_policy *, struct xccdf_value_binding *)
Add value binding to the Policy structure.
struct oscap_file_entry * oscap_file_entry_dup(struct oscap_file_entry *file_entry)
Definition: xccdf_policy.c:1368
char * xccdf_value_binding_get_value(const struct xccdf_value_binding *)
Get value from value bindings.
struct xccdf_profile * profile
Profile structure (from benchmark)
Definition: xccdf_policy.c:86
const char * oscap_file_entry_get_system(struct oscap_file_entry *entry)
Definition: xccdf_policy.c:1386
bool xccdf_policy_model_add_cpe_dict(struct xccdf_policy_model *model, const char *cpe_dict)
Registers an additional CPE dictionary for applicability testing The one embedded in the evaluated XC...
Definition: xccdf_policy.c:1698
struct xccdf_item * xccdf_policy_tailor_item(struct xccdf_policy *policy, struct xccdf_item *item)
Clone the item and tailor it against given policy (profile)
Definition: xccdf_policy.c:2385
Result iterator.
Definition: xccdf_benchmark.h:446
char * xccdf_value_binding_get_setvalue(const struct xccdf_value_binding *)
get Set Value from value bindings
A base class for XCCDF items.
Definition: item.h:219
Definition: xccdf_policy.c:1357
void oscap_file_entry_iterator_free(struct oscap_file_entry_iterator *it)
Definition: xccdf_policy.c:1406
const char * xccdf_policy_get_id(struct xccdf_policy *policy)
Get ID of XCCDF Profile that is implemented by XCCDF Policy.
Definition: xccdf_policy.c:1745
void *(* xccdf_policy_engine_query_fn)(void *, xccdf_policy_engine_query_t, void *)
Type of function which implements queries defined within xccdf_policy_engine_query_t.
Definition: xccdf_policy.h:88