Loading...
Searching...
No Matches
xccdf_policy Struct Reference
XCCDF_POLICY

XCCDF policy structure is abstract (class) structure of Profile element from benchmark. More...

`#include <xccdf_policy_priv.h>`

Collaboration diagram for xccdf_policy:
[legend]

## Public Member Functions

OSCAP_API struct xccdf_policy * | xccdf_policy_new (struct xccdf_policy_model *model, struct xccdf_profile *profile)
| Constructor of Policy structure.
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.
OSCAP_API char * | xccdf_policy_get_readable_item_rationale (struct xccdf_policy *policy, struct xccdf_item *item, const char *preferred_lang)
| Get human readable rationale of given XCCDF Item.
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.
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.
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.
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.
struct xccdf_benchmark * | xccdf_policy_get_benchmark (const struct xccdf_policy *policy)
| Get XCCDF Benchmark for given policy.
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).
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.
OSCAP_API struct xccdf_profile * | xccdf_policy_get_profile (const struct xccdf_policy *)
| Get XCCDF Profile from Policy.
OSCAP_API struct xccdf_select_iterator * | xccdf_policy_get_selects (const struct xccdf_policy *)
| Get rules from Policy.
OSCAP_API const char * | xccdf_policy_get_id (struct xccdf_policy *policy)
| Get ID of XCCDF Profile that is implemented by XCCDF Policy.
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.
OSCAP_API bool | xccdf_policy_add_value (struct xccdf_policy *, struct xccdf_value_binding *)
| Add value binding to the Policy structure.
OSCAP_API bool | xccdf_policy_is_item_selected (struct xccdf_policy *policy, const char *id)
| Get the selection settings of the item.
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.
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.
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.
OSCAP_API int | xccdf_policy_generate_fix (struct xccdf_policy *policy, struct xccdf_result *result, const char *sys, const char *input_file_name, struct oscap_source *tailoring, int output_fd, int raw)
| Generate remediation prescription (presumably a remediation script).
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.

## 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.
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.
struct oscap_htable * | selected_final
| A hash which for given item defines final selection.
struct oscap_htable * | refine_rules_internal
struct { |
bool active |
char * href |
char * title |
} | reference_filter
bool | show_rule_details

## 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

## xccdf_policy_get_benchmark()

struct xccdf_benchmark * xccdf_policy_get_benchmark | ( | const struct xccdf_policy * | policy | ) |

Get XCCDF Benchmark for given policy.

Parameters

  policy | XCCDF Policy

Returns
  the benchmark element or NULL.

## xccdf_policy_remediate()

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

  policy | XCCDF Policy
  result | TestResult containing rule-results to remediate

## xccdf_policy_report_cb()

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

  policy | XCCDF Policy
  sysname | identifier of the reporting callback
  rule | pointer to xccdf:Rule or xccdf:rule-result

Returns
  zero on success. Non zero value may indicate user interuption or error.

## xccdf_policy_resolve_fix_substitution()

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

  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

Returns
  0 on success, 1 on failure, other value indicate warning

## Field Documentation

## rules

struct oscap_htable* xccdf_policy::rules

A list of all selects.

Either from profile or later added through API.

## selected_internal

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:

- xccdf_policy_priv.h
- xccdf_policy.h