Open SCAP Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions | Data Fields
xccdf_policy Struct Reference

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_policyxccdf_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_benchmarkxccdf_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_profilexccdf_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_selectxccdf_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_resultxccdf_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_modelmodel
 XCCDF Policy model.
 
struct xccdf_profileprofile
 Profile structure (from benchmark)
 
const char * rule
 A list of all selects. More...
 
int rule_found
 Single-rule feature: flag for rule - if rule is found it is set to 1 otherwise 0.
 
struct oscap_listselects
 
struct oscap_listvalues
 Bound values of profile.
 
struct oscap_listresults
 List of XCCDF results.
 
struct oscap_htableselected_internal
 A hash which for given item points to the latest selector applicable. More...
 
struct oscap_htableselected_final
 A hash which for given item defines final selection.
 
struct oscap_htablerefine_rules_internal
 

Detailed Description

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.

Member Function Documentation

struct xccdf_benchmark * xccdf_policy_get_benchmark ( const struct xccdf_policy policy)

Get XCCDF Benchmark for given policy.

Parameters
policyXCCDF Policy
Returns
the benchmark element or NULL.
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.

Parameters
policyXCCDF Policy
resultTestResult 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.

Parameters
policyXCCDF Policy
sysnameidentifier of the reporting callback
rulepointer to xccdf:Rule or xccdf:rule-result
Returns
zero on success. Non zero value may indicate user interuption or error.
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.

Parameters
policyXCCDF policy used for substitution
fixa fix element to modify
rule_resultthe rule-result for substitution instnace in fix
test_resultthe TestResult for xccdf:fact resolution
Returns
0 on success, 1 on failure, other value indicate warning

Field Documentation

const char* xccdf_policy::rule

A list of all selects.

Either from profile or later added through API. Single-rule feature: if not NULL, only this one rule will be selected.

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.


The documentation for this struct was generated from the following files: