Open SCAP Library
|
XCCDF policy structure is abstract (class) structure of Profile element from benchmark. More...
#include <xccdf_policy_priv.h>
Public Member Functions | |
OSCAP_API struct xccdf_policy * | xccdf_policy_new (struct xccdf_policy_model *model, struct xccdf_profile *profile) |
Constructor of Policy structure. More... | |
OSCAP_API void | xccdf_policy_free (struct xccdf_policy *) |
Destructor of Policy structure. | |
OSCAP_API 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. More... | |
OSCAP_API 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. More... | |
int | xccdf_policy_resolve_fix_substitution (struct xccdf_policy *policy, struct xccdf_fix *fix, struct xccdf_rule_result *rule_result, struct xccdf_result *test_result) |
Resolve text substitution in given fix element. More... | |
int | xccdf_policy_remediate (struct xccdf_policy *policy, struct xccdf_result *result) |
Remediate all rule-results in the given result, with settings of given policy. More... | |
int | xccdf_policy_report_cb (struct xccdf_policy *policy, const char *sysname, void *rule) |
Report given "rule" to all callbacks with given sysname registered with the policy. More... | |
struct xccdf_benchmark * | xccdf_policy_get_benchmark (const struct xccdf_policy *policy) |
Get XCCDF Benchmark for given policy. More... | |
Getters | |
Return value is pointer to structure's member. Do not free unless you null the pointer in the structure. Use remove function otherwise. | |
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) More... | |
OSCAP_API struct xccdf_value_binding_iterator * | xccdf_policy_get_values (const struct xccdf_policy *item) |
Get Value Bindings from XCCDF Policy. | |
OSCAP_API struct xccdf_select_iterator * | xccdf_policy_get_selected_rules (struct xccdf_policy *) |
Get selected rules from policy. More... | |
OSCAP_API struct xccdf_profile * | xccdf_policy_get_profile (const struct xccdf_policy *) |
Get XCCDF Profile from Policy. More... | |
OSCAP_API struct xccdf_select_iterator * | xccdf_policy_get_selects (const struct xccdf_policy *) |
Get rules from Policy. More... | |
OSCAP_API const char * | xccdf_policy_get_id (struct xccdf_policy *policy) |
Get ID of XCCDF Profile that is implemented by XCCDF Policy. More... | |
Setters | |
For lists use add functions. Parameters of set functions are duplicated in memory and need to be freed by caller. | |
OSCAP_API bool | xccdf_policy_add_select (struct xccdf_policy *, struct xccdf_select *) |
Add rule to Policy. More... | |
OSCAP_API bool | xccdf_policy_add_value (struct xccdf_policy *, struct xccdf_value_binding *) |
Add value binding to the Policy structure. More... | |
OSCAP_API bool | xccdf_policy_is_item_selected (struct xccdf_policy *policy, const char *id) |
Get the selection settings of the item. More... | |
OSCAP_API 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. More... | |
Evaluators | |
OSCAP_API struct xccdf_result * | xccdf_policy_evaluate (struct xccdf_policy *policy) |
Call the checking engine for each selected rule in given policy structure. More... | |
OSCAP_API bool | xccdf_policy_resolve (struct xccdf_policy *policy) |
Resolve benchmark by applying all refine_rules and refine_values to rules / values of benchmark. More... | |
OSCAP_API 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). More... | |
Iterators | |
OSCAP_API const char * | xccdf_policy_get_value_of_item (struct xccdf_policy *policy, struct xccdf_item *item) |
Get value of given value item in context of given policy. More... | |
Data Fields | |
struct xccdf_policy_model * | model |
XCCDF Policy model. | |
struct xccdf_profile * | profile |
Profile structure (from benchmark) | |
struct oscap_htable * | rules |
A list of all selects. More... | |
struct oscap_htable * | rules_found |
struct oscap_htable * | skip_rules |
struct oscap_list * | selects |
struct oscap_list * | values |
Bound values of profile. | |
struct oscap_list * | results |
List of XCCDF results. | |
struct oscap_htable * | selected_internal |
A hash which for given item points to the latest selector applicable. More... | |
struct oscap_htable * | selected_final |
A hash which for given item defines final selection. | |
struct oscap_htable * | refine_rules_internal |
XCCDF policy structure is abstract (class) structure of Profile element from benchmark.
Policy structure that abstract benchmark's profile.
Structure contains rules and bound values to abstract these lists from the benchmark file. Can be modified temporaly so changes can be discarded or saved to the existing model.
struct xccdf_benchmark * xccdf_policy_get_benchmark | ( | const struct xccdf_policy * | policy | ) |
Get XCCDF Benchmark for given policy.
policy | XCCDF Policy |
int xccdf_policy_remediate | ( | struct xccdf_policy * | policy, |
struct xccdf_result * | result | ||
) |
Remediate all rule-results in the given result, with settings of given policy.
policy | XCCDF Policy |
result | TestResult containing rule-results to remediate |
int xccdf_policy_report_cb | ( | struct xccdf_policy * | policy, |
const char * | sysname, | ||
void * | rule | ||
) |
Report given "rule" to all callbacks with given sysname registered with the policy.
policy | XCCDF Policy |
sysname | identifier of the reporting callback |
rule | pointer to xccdf:Rule or xccdf:rule-result |
int xccdf_policy_resolve_fix_substitution | ( | struct xccdf_policy * | policy, |
struct xccdf_fix * | fix, | ||
struct xccdf_rule_result * | rule_result, | ||
struct xccdf_result * | test_result | ||
) |
Resolve text substitution in given fix element.
Use given xccdf_policy settings for resolving.
policy | XCCDF policy used for substitution |
fix | a fix element to modify |
rule_result | the rule-result for substitution instnace in fix |
test_result | the TestResult for xccdf:fact resolution |
struct oscap_htable* xccdf_policy::rules |
A list of all selects.
Either from profile or later added through API.
struct oscap_htable* xccdf_policy::selected_internal |
A hash which for given item points to the latest selector applicable.
There might not be one. Note that it migth be a selector for cluster-id.