31#ifndef XCCDF_POLICY_H_
32#define XCCDF_POLICY_H_
38#include "oscap_export.h"
59struct xccdf_value_binding_iterator;
73 POLICY_ENGINE_QUERY_NAMES_FOR_HREF = 1,
74 POLICY_ENGINE_QUERY_OVAL_DEFS_FOR_HREF = 2,
183OSCAP_API
char *xccdf_policy_get_readable_item_title(
struct xccdf_policy *policy,
struct xccdf_item *item,
const char *preferred_lang);
195OSCAP_API
char *xccdf_policy_get_readable_item_description(
struct xccdf_policy *policy,
struct xccdf_item *item,
const char *preferred_lang);
252OSCAP_API
bool xccdf_policy_model_register_output_callback(
struct xccdf_policy_model * model, policy_reporter_output func,
void * usr);
254typedef int (*policy_reporter_start)(
struct xccdf_rule *,
void *);
264OSCAP_API
bool xccdf_policy_model_register_start_callback(
struct xccdf_policy_model * model, policy_reporter_start func,
void * usr);
266typedef int (*policy_reporter_multicheck)(
struct oval_definition*,
void *);
276OSCAP_API
bool xccdf_policy_model_register_multicheck_callback(
struct xccdf_policy_model *model, policy_reporter_multicheck func,
void *usr);
325OSCAP_API
int xccdf_policy_model_build_all_useful_policies(
struct xccdf_policy_model *policy_model);
521OSCAP_API
int xccdf_policy_generate_fix(
struct xccdf_policy *policy,
struct xccdf_result *result,
const char *sys,
int output_fd);
535OSCAP_API
const char* oscap_file_entry_get_system(
struct oscap_file_entry* entry);
537OSCAP_API
const char* oscap_file_entry_get_file(
struct oscap_file_entry* entry);
642OSCAP_API
bool xccdf_value_binding_iterator_has_more(
struct xccdf_value_binding_iterator *it);
648OSCAP_API
struct xccdf_value_binding * xccdf_value_binding_iterator_next(
struct xccdf_value_binding_iterator *it);
654OSCAP_API
void xccdf_value_binding_iterator_free(
struct xccdf_value_binding_iterator *it);
660OSCAP_API
void xccdf_value_binding_iterator_reset(
struct xccdf_value_binding_iterator *it);
687OSCAP_API
const char *xccdf_policy_get_value_of_item(
struct xccdf_policy * policy,
struct xccdf_item * item);
OSCAP_API void xccdf_policy_iterator_reset(struct xccdf_policy_iterator *it)
Reset the iterator structure (it will point to the first item in the list)
OSCAP_API bool xccdf_policy_is_item_selected(struct xccdf_policy *policy, const char *id)
Get the selection settings of the item.
Definition: xccdf_policy.c:620
OSCAP_API 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:1504
OSCAP_API 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:1599
OSCAP_API struct xccdf_policy_model * xccdf_policy_model_new(struct xccdf_benchmark *benchmark)
Constructor of Policy Model structure.
Definition: xccdf_policy.c:1726
OSCAP_API 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:2225
OSCAP_API struct xccdf_result_iterator * xccdf_policy_get_results(const struct xccdf_policy *policy)
Get results of all XCCDF Policy results.
OSCAP_API 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:1905
OSCAP_API struct xccdf_select_iterator * xccdf_policy_get_selects(const struct xccdf_policy *)
Get rules from Policy.
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:103
OSCAP_API bool xccdf_policy_model_add_cpe_autodetect_source(struct xccdf_policy_model *model, struct oscap_source *source)
Registers an additional CPE resource (either dictionary or language) Autodetects given file and acts ...
Definition: xccdf_policy.c:1618
OSCAP_API 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:2230
OSCAP_API bool xccdf_policy_add_select(struct xccdf_policy *, struct xccdf_select *)
Add rule to Policy.
Definition: xccdf_policy.c:1807
OSCAP_API struct xccdf_policy * xccdf_policy_new(struct xccdf_policy_model *model, struct xccdf_profile *profile)
Constructor of Policy structure.
Definition: xccdf_policy.c:1860
OSCAP_API 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:2172
OSCAP_API char * xccdf_value_binding_get_name(const struct xccdf_value_binding *)
Get variable name from value bindings.
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:93
OSCAP_API 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_policy_engine_query_t
Type of a query over checking-engine data.
Definition: xccdf_policy.h:72
OSCAP_API void xccdf_policy_iterator_free(struct xccdf_policy_iterator *it)
Free the iterator structure (it makes no changes to the list structure)
OSCAP_API struct xccdf_profile * xccdf_policy_get_profile(const struct xccdf_policy *)
Get XCCDF Profile from Policy.
OSCAP_API 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:1395
OSCAP_API char * xccdf_value_binding_get_value(const struct xccdf_value_binding *)
Get value from value bindings.
OSCAP_API struct xccdf_value_binding_iterator * xccdf_policy_get_values(const struct xccdf_policy *item)
Get Value Bindings from XCCDF Policy.
OSCAP_API bool xccdf_policy_iterator_has_more(struct xccdf_policy_iterator *it)
Return true if the list is not empty, false otherwise.
OSCAP_API void xccdf_value_binding_free(struct xccdf_value_binding *)
Destructor of Value binding structure.
Definition: xccdf_policy.c:2284
OSCAP_API bool xccdf_policy_add_value(struct xccdf_policy *, struct xccdf_value_binding *)
Add value binding to the Policy structure.
OSCAP_API xccdf_value_type_t xccdf_value_binding_get_type(const struct xccdf_value_binding *)
get variable type from value bindings
OSCAP_API struct xccdf_policy_iterator * xccdf_policy_model_get_policies(const struct xccdf_policy_model *model)
Get policies from Policy Model.
OSCAP_API bool xccdf_policy_model_add_policy(struct xccdf_policy_model *, struct xccdf_policy *)
Add Policy to Policy Model.
OSCAP_API 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:1570
OSCAP_API 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:210
OSCAP_API 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.
OSCAP_API 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:1626
OSCAP_API bool xccdf_policy_model_add_cpe_lang_model_source(struct xccdf_policy_model *model, struct oscap_source *source)
Registers an additional CPE lang model for applicability testing The one embedded in the evaluated XC...
Definition: xccdf_policy.c:1610
OSCAP_API bool xccdf_policy_model_add_cpe_dict_source(struct xccdf_policy_model *model, struct oscap_source *source)
Registers an additional CPE dictionary for applicability testing The one embedded in the evaluated XC...
Definition: xccdf_policy.c:1591
OSCAP_API 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:309
OSCAP_API char * xccdf_value_binding_get_setvalue(const struct xccdf_value_binding *)
get Set Value from value bindings
OSCAP_API struct xccdf_benchmark * xccdf_policy_model_get_benchmark(const struct xccdf_policy_model *item)
Get Benchmark from Policy Model.
OSCAP_API xccdf_operator_t xccdf_value_binding_get_operator(const struct xccdf_value_binding *)
get Value operator from value bindings
OSCAP_API int xccdf_policy_get_selected_rules_count(struct xccdf_policy *policy)
Retrieves number of selected items in the policy.
Definition: xccdf_policy.c:633
OSCAP_API int xccdf_policy_recalculate_score(struct xccdf_policy *policy, struct xccdf_result *test_result)
Recalculate score of the XCCDF Benchmark.
Definition: xccdf_policy.c:2178
OSCAP_API bool xccdf_policy_add_result(struct xccdf_policy *policy, struct xccdf_result *item)
Add result to XCCDF Policy Model.
xccdf_operator_t
Operator to be applied on an xccdf_value.
Definition: xccdf_benchmark.h:101
xccdf_value_type_t
Type of an xccdf_value.
Definition: xccdf_benchmark.h:94
xccdf_test_result_type_t
Test result.
Definition: xccdf_benchmark.h:170
General OpenScap functions and types.
Definition: xccdf_policy.c:1249
Definition: oscap_source.c:66
Oval definition specification.
Definition: oval_definition.c:53
Top level XCCDF structure containing profiles, rules, values and results.
A base class for XCCDF items.
Definition: item.h:220
Iterate through policies.
XCCDF policy model structure contains xccdf_benchmark as reference to Benchmark element in XML file a...
Definition: xccdf_policy_priv.h:38
struct xccdf_benchmark * benchmark
Benchmark element (root element of XML file)
Definition: xccdf_policy_priv.h:40
XCCDF policy structure is abstract (class) structure of Profile element from benchmark.
Definition: xccdf_policy_priv.h:57
struct xccdf_policy_model * model
XCCDF Policy model.
Definition: xccdf_policy_priv.h:59
struct xccdf_profile * profile
Profile structure (from benchmark)
Definition: xccdf_policy_priv.h:60
XCCDF profile is a set of tests and their settings in a compact package.
Actual results of running a XCCDF test or profile.
XCCDF rule result.
Definition: item.h:344
XCCDF rule defines a test execution.
XCCDF score.
Definition: item.h:369
XCCDF select option usen in the profile.
Definition: item.h:253
Stores content from xccdf:Tailoring element which can be loaded from a separate file.
Definition: item.h:171
XCCDF value binding structure is binding between Refine values, Set values, Value element and Check e...
Definition: xccdf_policy.c:78
Open-scap XCCDF library interface.
bool xccdf_policy_resolve(struct xccdf_policy *policy)
Resolve benchmark - apply all refine_rules to the benchmark items.
Definition: xccdf_policy.c:1964
struct xccdf_policy * xccdf_policy_model_get_policy_by_id(struct xccdf_policy_model *policy_model, const char *id)
Get Policy from Policy model by it's id.
Definition: xccdf_policy.c:1946
const char * xccdf_policy_get_id(struct xccdf_policy *policy)
Get ID of XCCDF Profile that belongs to XCCDF Policy.
Definition: xccdf_policy.c:1639
struct xccdf_result * xccdf_policy_evaluate(struct xccdf_policy *policy)
Evaluate XCCDF Policy Iterate through Benchmark items and evaluate one by one by calling callback for...
Definition: xccdf_policy.c:2077
struct xccdf_select * xccdf_policy_get_select_by_id(struct xccdf_policy *policy, const char *item_id)
If policy has the select specified by item_id return the select, NULL otherwise.
Definition: xccdf_policy.c:1929