Open SCAP Library
Loading...
Searching...
No Matches
Files | Data Structures | Enumerations | Functions
Session
Collaboration diagram for Session:

Files

file  xccdf_session.h
 High Level API for OpenSCAP XCCDF operations.
 

Data Structures

struct  xccdf_session
 A structure encapsulating the context of XCCDF operations. More...
 
struct  xccdf_rule_result_iterator
 Override iterator. More...
 

Enumerations

enum  xccdf_session::xccdf_session_loading_flags_t
 Loading flags for XCCDF sessionThe flags set which components will be loaded in XCCDF session.
 

Functions

OSCAP_API struct oscap_sourcexccdf_session_get_user_tailoring_file (struct xccdf_session *session)
 
OSCAP_API int xccdf_session_load_check_engine_plugin (struct xccdf_session *session, const char *plugin_name)
 
OSCAP_API int xccdf_session_generate_guide (struct xccdf_session *session, const char *outfile)
 Generate HTML guide form a loaded XCCDF session.
 
OSCAP_API int xccdf_session_export_all (struct xccdf_session *session)
 Export XCCDF results, ARF results and HTML report from the given XCCDF session based on values set in the XCCDF session.
 
OSCAP_API void xccdf_session_set_reference_filter (struct xccdf_session *session, const char *reference_filter)
 Set reference filter to the XCCDF session.
 
OSCAP_API struct xccdf_sessionxccdf_session::xccdf_session_new (const char *filename)
 Costructor of xccdf_session.
 
OSCAP_API struct xccdf_sessionxccdf_session::xccdf_session_new_from_source (struct oscap_source *source)
 Costructor of xccdf_session.
 
OSCAP_API void xccdf_session::xccdf_session_free (struct xccdf_session *session)
 Destructor of xccdf_session.
 
OSCAP_API void xccdf_session::xccdf_session_result_reset (struct xccdf_session *session)
 Reset xccdf_session results.
 
OSCAP_API const char * xccdf_session::xccdf_session_get_filename (const struct xccdf_session *session)
 Retrieves the filename the session was created with.
 
OSCAP_API bool xccdf_session::xccdf_session_is_sds (const struct xccdf_session *session)
 Query if the session is based on Source DataStream.
 
OSCAP_API void xccdf_session::xccdf_session_set_rule (struct xccdf_session *session, const char *rule)
 Set rule for session - if rule is not NULL, session will use only this one rule.
 
OSCAP_API void xccdf_session::xccdf_session_add_rule (struct xccdf_session *session, const char *rule)
 Add specific rule for session - if at least one rule is added to the session, only the added rules will be evaluated.
 
OSCAP_API void xccdf_session::xccdf_session_skip_rule (struct xccdf_session *session, const char *rule)
 Skip rule during evaluation of the session.
 
OSCAP_API void xccdf_session::xccdf_session_set_validation (struct xccdf_session *session, bool validate, bool full_validation)
 Set XSD validation level to one of three possibilities:
 
OSCAP_API void xccdf_session::xccdf_session_set_signature_validation (struct xccdf_session *session, bool validate)
 Set XML signature validation.
 
OSCAP_API void xccdf_session::xccdf_session_set_signature_enforcement (struct xccdf_session *session, bool enforce)
 Set XML signature enforcement.
 
OSCAP_API void xccdf_session::xccdf_session_set_thin_results (struct xccdf_session *session, bool thin_result)
 Set whether the thin results override is enabled.
 
OSCAP_API void xccdf_session::xccdf_session_set_datastream_id (struct xccdf_session *session, const char *datastream_id)
 Set requested datastream_id for this session.
 
OSCAP_API const char * xccdf_session::xccdf_session_get_datastream_id (struct xccdf_session *session)
 Retrieves the datastream id.
 
OSCAP_API void xccdf_session::xccdf_session_set_component_id (struct xccdf_session *session, const char *component_id)
 Set requested component_id for this session.
 
OSCAP_API const char * xccdf_session::xccdf_session_get_component_id (struct xccdf_session *session)
 Retrieves the component id.
 
OSCAP_API void xccdf_session::xccdf_session_set_benchmark_id (struct xccdf_session *session, const char *benchmark_id)
 Sets requested benchmark_id for this session.
 
OSCAP_API const char * xccdf_session::xccdf_session_get_benchmark_id (struct xccdf_session *session)
 Retrieves the benchmark_id.
 
OSCAP_API const char * xccdf_session::xccdf_session_get_result_id (struct xccdf_session *session)
 Retrieves the result id.
 
OSCAP_API void xccdf_session::xccdf_session_set_user_cpe (struct xccdf_session *session, const char *user_cpe)
 Set path to custom CPE dictionary for the session.
 
OSCAP_API void xccdf_session::xccdf_session_set_user_tailoring_file (struct xccdf_session *session, const char *user_tailoring_file)
 Set path to custom Tailoring file for the session.
 
OSCAP_API void xccdf_session::xccdf_session_set_user_tailoring_cid (struct xccdf_session *session, const char *user_tailoring_cid)
 Set ID of Tailoring component for the session.
 
OSCAP_API void xccdf_session::xccdf_session_set_remote_resources (struct xccdf_session *session, bool allowed, download_progress_calllback_t callback)
 Set properties of remote content.
 
OSCAP_API void xccdf_session::xccdf_session_configure_remote_resources (struct xccdf_session *session, bool allowed, const char *local_files, download_progress_calllback_t callback)
 Set properties of remote content.
 
OSCAP_API void xccdf_session::xccdf_session_set_loading_flags (struct xccdf_session *session, xccdf_session_loading_flags_t flags)
 Disable or allow loading of depending content (OVAL, SCE, CPE)
 
OSCAP_API void xccdf_session::xccdf_session_set_custom_oval_files (struct xccdf_session *session, char **oval_filenames)
 Set custom oval files for this session.
 
OSCAP_API void xccdf_session::xccdf_session_set_custom_oval_eval_fn (struct xccdf_session *session, xccdf_policy_engine_eval_fn eval_fn)
 Set custom OVAL eval function to register with each OVAL session.
 
OSCAP_API bool xccdf_session::xccdf_session_set_product_cpe (struct xccdf_session *session, const char *product_cpe)
 Set custom product CPE name.
 
OSCAP_API void xccdf_session::xccdf_session_set_without_sys_chars_export (struct xccdf_session *session, bool without_sys_chars)
 Set whether the System Characteristics shall be exported in result files.
 
OSCAP_API void xccdf_session::xccdf_session_set_oval_results_export (struct xccdf_session *session, bool to_export_oval_results)
 Set whether the OVAL result files shall be exported.
 
OSCAP_API void xccdf_session::xccdf_session_set_check_engine_plugins_results_export (struct xccdf_session *session, bool to_export_results)
 Set that check engine plugin's result files shall be exported.
 
OSCAP_API void xccdf_session::xccdf_session_set_oval_variables_export (struct xccdf_session *session, bool to_export_oval_variables)
 Set whether the OVAL variables files shall be exported.
 
OSCAP_API bool xccdf_session::xccdf_session_set_xccdf_export (struct xccdf_session *session, const char *xccdf_file)
 Set where to export XCCDF file.
 
OSCAP_API bool xccdf_session::xccdf_session_set_xccdf_stig_viewer_export (struct xccdf_session *session, const char *xccdf_stig_viewer_file)
 Set where to export STIG Viewer XCCDF file.
 
OSCAP_API bool xccdf_session::xccdf_session_set_arf_export (struct xccdf_session *session, const char *arf_file)
 Set where to export ARF file.
 
OSCAP_API bool xccdf_session::xccdf_session_set_report_export (struct xccdf_session *session, const char *report_file)
 Set where to export HTML Report file.
 
OSCAP_API bool xccdf_session::xccdf_session_set_profile_id (struct xccdf_session *session, const char *profile_id)
 Select XCCDF Profile for evaluation.
 
OSCAP_API int xccdf_session::xccdf_session_set_profile_id_by_suffix (struct xccdf_session *session, const char *profile_suffix)
 Select XCCDF Profile for evaluation with only profile suffix as input.
 
OSCAP_API const char * xccdf_session::xccdf_session_get_profile_id (struct xccdf_session *session)
 Retrieves ID of the profile that we will evaluate with, or NULL.
 
OSCAP_API struct ds_sds_indexxccdf_session::xccdf_session_get_sds_idx (struct xccdf_session *session)
 Get Source DataStream index of the session.
 
OSCAP_API int xccdf_session::xccdf_session_load (struct xccdf_session *session)
 Load and parse all XCCDF structures needed to evaluate this session.
 
OSCAP_API int xccdf_session::xccdf_session_load_xccdf (struct xccdf_session *session)
 Load and parse XCCDF file.
 
OSCAP_API int xccdf_session::xccdf_session_load_cpe (struct xccdf_session *session)
 Load and parse CPE dictionaries.
 
OSCAP_API int xccdf_session::xccdf_session_load_oval (struct xccdf_session *session)
 Load and parse OVAL definitions files for the XCCDF session.
 
OSCAP_API int xccdf_session::xccdf_session_load_check_engine_plugin2 (struct xccdf_session *session, const char *plugin_name, bool quiet)
 Load extra check engine from a plugin of given name to the XCCDF session.
 
OSCAP_API int xccdf_session::xccdf_session_load_check_engine_plugins (struct xccdf_session *session)
 Load extra check engines (if any are available) to the XCCDF session.
 
OSCAP_API int xccdf_session::xccdf_session_load_tailoring (struct xccdf_session *session)
 Load Tailoring file (if applicable) to the XCCDF session.
 
OSCAP_API int xccdf_session::xccdf_session_evaluate (struct xccdf_session *session)
 Evaluate XCCDF Policy.
 
OSCAP_API int xccdf_session::xccdf_session_export_xccdf (struct xccdf_session *session)
 Export XCCDF file.
 
OSCAP_API int xccdf_session::xccdf_session_export_oval (struct xccdf_session *session)
 Export OVAL (result and variables) files.
 
OSCAP_API int xccdf_session::xccdf_session_export_check_engine_plugins (struct xccdf_session *session)
 Export results (if any) from any check engine plugins that are loaded.
 
OSCAP_API int xccdf_session::xccdf_session_export_arf (struct xccdf_session *session)
 Export ARF (if enabled by xccdf_session_set_arf_export).
 
OSCAP_API struct xccdf_policy_modelxccdf_session::xccdf_session_get_policy_model (const struct xccdf_session *session)
 Get policy_model of the session.
 
OSCAP_API struct xccdf_policyxccdf_session::xccdf_session_get_xccdf_policy (const struct xccdf_session *session)
 Get xccdf_policy of the session.
 
OSCAP_API float xccdf_session::xccdf_session_get_base_score (const struct xccdf_session *session)
 Get the base score of the latest XCCDF evaluation in the session.
 
OSCAP_API unsigned int xccdf_session::xccdf_session_get_oval_agents_count (const struct xccdf_session *session)
 Get count of OVAL agent sessions not used for CPE in the xccdf_session.
 
OSCAP_API unsigned int xccdf_session::xccdf_session_get_cpe_oval_agents_count (const struct xccdf_session *session)
 Get count of OVAL agent sessions for CPE in the xccdf_session.
 
OSCAP_API bool xccdf_session::xccdf_session_contains_fail_result (const struct xccdf_session *session)
 Query if the result of evaluation contains FAIL, ERROR, or UNKNOWN rule-result elements.
 
OSCAP_API struct xccdf_rule_result_iteratorxccdf_session::xccdf_session_get_rule_results (const struct xccdf_session *session)
 Get rule results.
 
OSCAP_API int xccdf_session::xccdf_session_remediate (struct xccdf_session *session)
 Run XCCDF Remediation.
 
OSCAP_API int xccdf_session::xccdf_session_build_policy_from_testresult (struct xccdf_session *session, const char *testresult_id)
 Load xccdf:TestResult to the session from file and prepare session for remediation.
 
OSCAP_API int xccdf_session::xccdf_session_add_report_from_source (struct xccdf_session *session, struct oscap_source *report_source)
 Load xccdf:TestResult to the session from oscap_source.
 

Detailed Description

Function Documentation

◆ xccdf_session_add_report_from_source()

OSCAP_API int xccdf_session_add_report_from_source ( struct xccdf_session * session,
struct oscap_source * report_source )

Load xccdf:TestResult to the session from oscap_source.

Parameters
sessionXCCDF Session
report_sourceStructure conataining oscap_source of the test results
Returns
zero on success.

◆ xccdf_session_add_rule()

OSCAP_API void xccdf_session_add_rule ( struct xccdf_session * session,
const char * rule )

Add specific rule for session - if at least one rule is added to the session, only the added rules will be evaluated.

Parameters
sessionXCCDF Session
rulerule ID

◆ xccdf_session_build_policy_from_testresult()

OSCAP_API int xccdf_session_build_policy_from_testresult ( struct xccdf_session * session,
const char * testresult_id )

Load xccdf:TestResult to the session from file and prepare session for remediation.

This function assumes that the session internals has the policy_model prepared, it calculates all the other internals which might be needed for remediation.

Parameters
sessionXCCDF Session
testresult_idID of the TestResult element in the file (the NULL value stands for the last TestResult). Suffix match is attempted if exact match is not found.
Returns
zero on success.

◆ xccdf_session_configure_remote_resources()

OSCAP_API void xccdf_session_configure_remote_resources ( struct xccdf_session * session,
bool allowed,
const char * local_files,
download_progress_calllback_t callback )

Set properties of remote content.

Parameters
sessionXCCDF Session
allowedWhether is download od remote resources allowed in this session (defaults to false)
local_filesAllows to use a locally downloaded copy of the remote resources. Contains a path to a directory where the files are stored (defaults to NULL).
callbackused to notify user about download proceeds. This might be safely set to NULL – ignoring user notification.

◆ xccdf_session_contains_fail_result()

OSCAP_API bool xccdf_session_contains_fail_result ( const struct xccdf_session * session)

Query if the result of evaluation contains FAIL, ERROR, or UNKNOWN rule-result elements.

Parameters
sessionXCCDF Session
Returns
Exists such rule-result r . r = FAIL | r = UNKNOWN | r = ERROR

◆ xccdf_session_evaluate()

OSCAP_API int xccdf_session_evaluate ( struct xccdf_session * session)

Evaluate XCCDF Policy.

Parameters
sessionXCCDF Session
Returns
zero on success

◆ xccdf_session_export_all()

OSCAP_API int xccdf_session_export_all ( struct xccdf_session * session)

Export XCCDF results, ARF results and HTML report from the given XCCDF session based on values set in the XCCDF session.

This is a destructive operation that modifies the oscap_source structures, specifically the XML trees. Callers must not perform any operation with the session after this call and they must free the session immediately.

Parameters
sessionXCCDF Session
Returns
zero on success

◆ xccdf_session_export_arf()

OSCAP_API int xccdf_session_export_arf ( struct xccdf_session * session)

Export ARF (if enabled by xccdf_session_set_arf_export).

Parameters
sessionXCCDF Session
Returns
zero on success

◆ xccdf_session_export_check_engine_plugins()

OSCAP_API int xccdf_session_export_check_engine_plugins ( struct xccdf_session * session)

Export results (if any) from any check engine plugins that are loaded.

Only applicable if enabled by xccdf_session_set_check_engine_plugins_results_export).

Parameters
sessionXCCDF Session
Returns
zero on success

◆ xccdf_session_export_oval()

OSCAP_API int xccdf_session_export_oval ( struct xccdf_session * session)

Export OVAL (result and variables) files.

Parameters
sessionXCCDF Session
Returns
zero on success

◆ xccdf_session_export_xccdf()

OSCAP_API int xccdf_session_export_xccdf ( struct xccdf_session * session)

Export XCCDF file.

Parameters
sessionXCCDF Session
Returns
zero on success

◆ xccdf_session_free()

OSCAP_API void xccdf_session_free ( struct xccdf_session * session)

Destructor of xccdf_session.

Parameters
sessionto destroy.

◆ xccdf_session_generate_guide()

OSCAP_API int xccdf_session_generate_guide ( struct xccdf_session * session,
const char * outfile )

Generate HTML guide form a loaded XCCDF session.

Parameters
sessionXCCDF Session
outfilepath to the output file
Returns
zero on success

◆ xccdf_session_get_base_score()

OSCAP_API float xccdf_session_get_base_score ( const struct xccdf_session * session)

Get the base score of the latest XCCDF evaluation in the session.

Parameters
sessionXCCDF Session
Returns
the score

◆ xccdf_session_get_benchmark_id()

OSCAP_API const char * xccdf_session_get_benchmark_id ( struct xccdf_session * session)

Retrieves the benchmark_id.

See also
xccdf_session_set_benchmark_id

◆ xccdf_session_get_component_id()

OSCAP_API const char * xccdf_session_get_component_id ( struct xccdf_session * session)

Retrieves the component id.

See also
xccdf_session_set_component_id

◆ xccdf_session_get_cpe_oval_agents_count()

OSCAP_API unsigned int xccdf_session_get_cpe_oval_agents_count ( const struct xccdf_session * session)

Get count of OVAL agent sessions for CPE in the xccdf_session.

CPE uses OVAL on demand, we do not count OVAL agents that were referenced but weren't used.

Parameters
sessionXCCDF Session
Returns
number of OVAL agents for CPE.

◆ xccdf_session_get_datastream_id()

OSCAP_API const char * xccdf_session_get_datastream_id ( struct xccdf_session * session)

Retrieves the datastream id.

See also
xccdf_session_set_datastream_id

◆ xccdf_session_get_oval_agents_count()

OSCAP_API unsigned int xccdf_session_get_oval_agents_count ( const struct xccdf_session * session)

Get count of OVAL agent sessions not used for CPE in the xccdf_session.

Parameters
sessionXCCDF Session
Returns
number of OVAL agents.

◆ xccdf_session_get_policy_model()

OSCAP_API struct xccdf_policy_model * xccdf_session_get_policy_model ( const struct xccdf_session * session)

Get policy_model of the session.

The xccdf_session_load_xccdf shall be run before this to parse XCCDF file to the policy_model.

Parameters
sessionXCCDF Session
Returns
XCCDF Policy Model or NULL in case of failure.

◆ xccdf_session_get_profile_id()

OSCAP_API const char * xccdf_session_get_profile_id ( struct xccdf_session * session)

Retrieves ID of the profile that we will evaluate with, or NULL.

Parameters
sessionXCCDF Session

◆ xccdf_session_get_rule_results()

OSCAP_API struct xccdf_rule_result_iterator * xccdf_session_get_rule_results ( const struct xccdf_session * session)

Get rule results.

Parameters
sessionXCCDF Session

◆ xccdf_session_get_sds_idx()

struct ds_sds_index * xccdf_session_get_sds_idx ( struct xccdf_session * session)

Get Source DataStream index of the session.

Warning
This is applicable only on sessions which are SDS. NULL is returned otherwise.
Returns
sds index
Warning
This is applicable only on sessions which are SDS.
Returns
sds index

◆ xccdf_session_get_xccdf_policy()

OSCAP_API struct xccdf_policy * xccdf_session_get_xccdf_policy ( const struct xccdf_session * session)

Get xccdf_policy of the session.

Parameters
sessionXCCDF Session
Returns
XCCDF Policy or NULL in case of failure.

◆ xccdf_session_is_sds()

OSCAP_API bool xccdf_session_is_sds ( const struct xccdf_session * session)

Query if the session is based on Source DataStream.

Parameters
sessionXCCDF Session
Returns
true if the session is based on Source Datastream

◆ xccdf_session_load()

OSCAP_API int xccdf_session_load ( struct xccdf_session * session)

Load and parse all XCCDF structures needed to evaluate this session.

This is only a placeholder for load_xccdf, load_cpe, load_oval and load_check_engine_plugins functions.

Parameters
sessionXCCDF Session
Returns
zero on success

◆ xccdf_session_load_check_engine_plugin2()

OSCAP_API int xccdf_session_load_check_engine_plugin2 ( struct xccdf_session * session,
const char * plugin_name,
bool quiet )

Load extra check engine from a plugin of given name to the XCCDF session.

Extra check engines are in loadable shared objects. This function is designed to be called !after! xccdf_session_load has been called. XCCDF has to have already been loaded for this to work because the callbacks are registered as part of this function!

Parameters
sessionXCCDF Session
plugin_nameName of the plugin to load
quietIf true we will not output errors if loading fails
Returns
zero on success

◆ xccdf_session_load_check_engine_plugins()

OSCAP_API int xccdf_session_load_check_engine_plugins ( struct xccdf_session * session)

Load extra check engines (if any are available) to the XCCDF session.

Extra check engines are in loadable shared objects and this function searches if any such are available and loads them if they are.

Parameters
sessionXCCDF Session
Returns
zero on success

◆ xccdf_session_load_cpe()

OSCAP_API int xccdf_session_load_cpe ( struct xccdf_session * session)

Load and parse CPE dictionaries.

Function xccdf_session_set_user_cpe might be called before this to set custom CPE dictionary.

Parameters
sessionXCCDF Session
Returns
zero on success

◆ xccdf_session_load_oval()

OSCAP_API int xccdf_session_load_oval ( struct xccdf_session * session)

Load and parse OVAL definitions files for the XCCDF session.

Parameters
sessionXCCDF Session
Returns
zero on success

◆ xccdf_session_load_tailoring()

OSCAP_API int xccdf_session_load_tailoring ( struct xccdf_session * session)

Load Tailoring file (if applicable) to the XCCDF session.

Parameters
sessionXCCDF Session
Returns
zero on success

◆ xccdf_session_load_xccdf()

OSCAP_API int xccdf_session_load_xccdf ( struct xccdf_session * session)

Load and parse XCCDF file.

If the file upon which is based this session is Source DataStream use functions xccdf_session_set_datastream_id and xccdf_session_set_component_id to select particular component within that DataStream to parse. This function is reentrant meaning that it allows user to change i.e. component_id and load_xccdf again in the very same session. However in such case, previous xccdf structures will be deallocated from session and pointers to it become invalid.

Parameters
sessionXCCDF Session
Returns
zero on success

◆ xccdf_session_new()

OSCAP_API struct xccdf_session * xccdf_session_new ( const char * filename)

Costructor of xccdf_session.

It attempts to recognize type of the filename.

Parameters
filenamepath to XCCDF or DS file.
Returns
newly created xccdf_session.
Return values
NULLis returned in case of error. Details might be found through oscap_err_desc()

◆ xccdf_session_new_from_source()

OSCAP_API struct xccdf_session * xccdf_session_new_from_source ( struct oscap_source * source)

Costructor of xccdf_session.

It creates a new xccdf_session from an oscap_source structure.

Parameters
sourceoscap_source which can represent a DS or XCCDF file.
Returns
newly created xccdf_session.
Return values
NULLis returned in case of error. Details might be found through oscap_err_desc()

◆ xccdf_session_remediate()

OSCAP_API int xccdf_session_remediate ( struct xccdf_session * session)

Run XCCDF Remediation.

It uses XCCDF Policy and XCCDF TestResult from the session and modifies the TestResult. This also drops and recreate OVAL Agent Session, thus users are advised to run xccdf_session_export_oval first.

Parameters
sessionXCCDF Session
Returns
zero on success

◆ xccdf_session_result_reset()

OSCAP_API void xccdf_session_result_reset ( struct xccdf_session * session)

Reset xccdf_session results.

This function resets XCCDF policies, session rules, skipped rules, OVAL system characteristics and OVAL results.

Parameters
sessionto reset results from.

◆ xccdf_session_set_arf_export()

OSCAP_API bool xccdf_session_set_arf_export ( struct xccdf_session * session,
const char * arf_file )

Set where to export ARF file.

NULL value means to not export at all.

Parameters
sessionXCCDF Session
arf_filepath to ARF file
Returns
true on success

◆ xccdf_session_set_benchmark_id()

OSCAP_API void xccdf_session_set_benchmark_id ( struct xccdf_session * session,
const char * benchmark_id )

Sets requested benchmark_id for this session.

It is only used when no component_id and no datastream_id are requested. Benchmark ID selects the @id attribute of Benchmark element inside a component that is referenced with a checklist component-ref.

◆ xccdf_session_set_check_engine_plugins_results_export()

OSCAP_API void xccdf_session_set_check_engine_plugins_results_export ( struct xccdf_session * session,
bool to_export_results )

Set that check engine plugin's result files shall be exported.

Parameters
sessionXCCDF Session
to_export_resultswhether to export results from check engine plugins or not.

◆ xccdf_session_set_component_id()

OSCAP_API void xccdf_session_set_component_id ( struct xccdf_session * session,
const char * component_id )

Set requested component_id for this session.

This component_id is later pased down to ds_sds_index_select_checklist to determine target component. This function is applicable only for sessions based on a DataStream.

Parameters
sessionXCCDF Session
component_idrequested component_id for this session.

◆ xccdf_session_set_custom_oval_eval_fn()

OSCAP_API void xccdf_session_set_custom_oval_eval_fn ( struct xccdf_session * session,
xccdf_policy_engine_eval_fn eval_fn )

Set custom OVAL eval function to register with each OVAL session.

This function shall be called before OVAL files are parsed.

Parameters
sessionXCCDF Session.
eval_fnCallback - pointer to function called by XCCDF Policy for each evaluated rule.

◆ xccdf_session_set_custom_oval_files()

OSCAP_API void xccdf_session_set_custom_oval_files ( struct xccdf_session * session,
char ** oval_filenames )

Set custom oval files for this session.

Parameters
sessionXCCDF Session
oval_filenames- Array of paths to custom OVAL files. If the array is empty no OVAL file will be used for the session. If this parameter is NULL then OVAL files will be find automatically, as defined in XCCDF (which is default).

◆ xccdf_session_set_datastream_id()

OSCAP_API void xccdf_session_set_datastream_id ( struct xccdf_session * session,
const char * datastream_id )

Set requested datastream_id for this session.

This datastream_id is later passed down to ds_sds_index_select_checklist to determine target component. This function is applicable only for sessions based on a DataStream.

Parameters
sessionXCCDF Session
datastream_idrequested datastream_id for this session.

◆ xccdf_session_set_loading_flags()

OSCAP_API void xccdf_session_set_loading_flags ( struct xccdf_session * session,
xccdf_session_loading_flags_t flags )

Disable or allow loading of depending content (OVAL, SCE, CPE)

Parameters
sessionXCCDF Session
flagsBit mask that sets loading of other content in the session.

◆ xccdf_session_set_oval_results_export()

OSCAP_API void xccdf_session_set_oval_results_export ( struct xccdf_session * session,
bool to_export_oval_results )

Set whether the OVAL result files shall be exported.

Parameters
sessionXCCDF Session
to_export_oval_resultswhether to export results or not.

◆ xccdf_session_set_oval_variables_export()

OSCAP_API void xccdf_session_set_oval_variables_export ( struct xccdf_session * session,
bool to_export_oval_variables )

Set whether the OVAL variables files shall be exported.

Parameters
sessionXCCDF Session
to_export_oval_variableswhether to export results or not.

◆ xccdf_session_set_product_cpe()

OSCAP_API bool xccdf_session_set_product_cpe ( struct xccdf_session * session,
const char * product_cpe )

Set custom product CPE name.

Parameters
sessionXCCDF Session.
product_cpeName of the scanner product.
Returns
true on success

◆ xccdf_session_set_profile_id()

OSCAP_API bool xccdf_session_set_profile_id ( struct xccdf_session * session,
const char * profile_id )

Select XCCDF Profile for evaluation.

Parameters
sessionXCCDF Session
profile_idID of profile to set
Returns
true on success

◆ xccdf_session_set_profile_id_by_suffix()

OSCAP_API int xccdf_session_set_profile_id_by_suffix ( struct xccdf_session * session,
const char * profile_suffix )

Select XCCDF Profile for evaluation with only profile suffix as input.

Reports error if multiple profiles match the suffix.

Parameters
sessionXCCDF Session
profile_suffixunique profile ID or suffix of the ID of the profile to set
Returns
0 on success, 1 if profile is not found, and 2 if multiple matches are found.

◆ xccdf_session_set_reference_filter()

OSCAP_API void xccdf_session_set_reference_filter ( struct xccdf_session * session,
const char * reference_filter )

Set reference filter to the XCCDF session.

If this filter is set, the XCCDF session will evaluate only rules that conform to the filter.

Parameters
sessionXCCDF session
reference_filtera string in a form "key:identifier"

◆ xccdf_session_set_remote_resources()

OSCAP_API void xccdf_session_set_remote_resources ( struct xccdf_session * session,
bool allowed,
download_progress_calllback_t callback )

Set properties of remote content.

Parameters
sessionXCCDF Session
allowedWhether is download od remote resources allowed in this session (defaults to false)
callbackused to notify user about download proceeds. This might be safely set to NULL – ignoring user notification.

◆ xccdf_session_set_report_export()

OSCAP_API bool xccdf_session_set_report_export ( struct xccdf_session * session,
const char * report_file )

Set where to export HTML Report file.

NULL value means to not export at all.

Parameters
sessionXCCDF Session
report_file
Returns
true on success

◆ xccdf_session_set_rule()

OSCAP_API void xccdf_session_set_rule ( struct xccdf_session * session,
const char * rule )

Set rule for session - if rule is not NULL, session will use only this one rule.

Parameters
sessionXCCDF Session
ruleIf not NULL, session will use only this rule

◆ xccdf_session_set_signature_enforcement()

OSCAP_API void xccdf_session_set_signature_enforcement ( struct xccdf_session * session,
bool enforce )

Set XML signature enforcement.

Parameters
sessionXCCDF Session
enforceTrue value renders all unsigned XMLs invalid.

◆ xccdf_session_set_signature_validation()

OSCAP_API void xccdf_session_set_signature_validation ( struct xccdf_session * session,
bool validate )

Set XML signature validation.

Parameters
sessionXCCDF Session
validateFalse value indicates to skip any XML signature validation.

◆ xccdf_session_set_thin_results()

OSCAP_API void xccdf_session_set_thin_results ( struct xccdf_session * session,
bool thin_result )

Set whether the thin results override is enabled.

If true the OVAL results put in ARF or separate files will have thin results. Thin results do not contain details about the evaluated criteria, only minimal OVAL results.

Parameters
thin_resultstrue to enable thin_results, default is false

◆ xccdf_session_set_user_cpe()

OSCAP_API void xccdf_session_set_user_cpe ( struct xccdf_session * session,
const char * user_cpe )

Set path to custom CPE dictionary for the session.

This function is applicable only before session loads. It has no effect if run afterwards.

Parameters
sessionXCCDF Session
user_cpeFile path to user defined cpe dictionary.

◆ xccdf_session_set_user_tailoring_cid()

OSCAP_API void xccdf_session_set_user_tailoring_cid ( struct xccdf_session * session,
const char * user_tailoring_cid )

Set ID of Tailoring component for the session.

This function is applicable only before session loads. It has no effect if run afterwards.

Parameters
sessionXCCDF Session
user_tailoring_cidID of component with a tailoring file.

◆ xccdf_session_set_user_tailoring_file()

OSCAP_API void xccdf_session_set_user_tailoring_file ( struct xccdf_session * session,
const char * user_tailoring_file )

Set path to custom Tailoring file for the session.

This function is applicable only before session loads. It has no effect if run afterwards.

Parameters
sessionXCCDF Session
user_tailoring_fileFile path to user defined tailoring file.

◆ xccdf_session_set_validation()

OSCAP_API void xccdf_session_set_validation ( struct xccdf_session * session,
bool validate,
bool full_validation )

Set XSD validation level to one of three possibilities:

  • None: All XSD validations will be skipped.
  • Default: Partial (input) XSD validations will be done.
  • Full Valid.: Every possible (input & output) XSD validation will be done.
Parameters
sessionXCCDF Session
validateFalse value indicates to skip any XSD validation.
full_validationTrue value indicates that every possible step will be validated by XSD.

◆ xccdf_session_set_without_sys_chars_export()

OSCAP_API void xccdf_session_set_without_sys_chars_export ( struct xccdf_session * session,
bool without_sys_chars )

Set whether the System Characteristics shall be exported in result files.

Parameters
sessionXCCDF Session
without_sys_charswhether to export System Characteristics or not.

◆ xccdf_session_set_xccdf_export()

OSCAP_API bool xccdf_session_set_xccdf_export ( struct xccdf_session * session,
const char * xccdf_file )

Set where to export XCCDF file.

NULL value means to not export at all.

Parameters
sessionXCCDF Session
xccdf_filepath to XCCDF file
Returns
true on success

◆ xccdf_session_set_xccdf_stig_viewer_export()

OSCAP_API bool xccdf_session_set_xccdf_stig_viewer_export ( struct xccdf_session * session,
const char * xccdf_stig_viewer_file )

Set where to export STIG Viewer XCCDF file.

NULL value means to not export at all.

Parameters
sessionXCCDF Session
xccdf_filepath to STIG Viewer file
Returns
true on success

◆ xccdf_session_skip_rule()

OSCAP_API void xccdf_session_skip_rule ( struct xccdf_session * session,
const char * rule )

Skip rule during evaluation of the session.

Parameters
sessionXCCDF Session
rulerule ID