32 #ifndef XCCDF_SESSION_H_
33 #define XCCDF_SESSION_H_
36 #include "oscap_download_cb.h"
37 #include "oscap_export.h"
51 XCCDF_SESSION_LOAD_NONE = 0,
52 XCCDF_SESSION_LOAD_XCCDF = 1 << 0,
53 XCCDF_SESSION_LOAD_CPE = 1 << 1,
54 XCCDF_SESSION_LOAD_OVAL = 1 << 2,
55 XCCDF_SESSION_LOAD_CHECK_ENGINE_PLUGINS = 1 << 3,
56 XCCDF_SESSION_LOAD_ALL = XCCDF_SESSION_LOAD_XCCDF | XCCDF_SESSION_LOAD_CPE | XCCDF_SESSION_LOAD_OVAL | XCCDF_SESSION_LOAD_CHECK_ENGINE_PLUGINS
470 OSCAP_API
int xccdf_session_load_check_engine_plugin(
struct xccdf_session *session,
const char* plugin_name);
#define OSCAP_DEPRECATED(func)
This macro will warn, when a deprecated function is used.
Definition: oscap.h:50
OSCAP_API int xccdf_session_evaluate(struct xccdf_session *session)
Evaluate XCCDF Policy.
Definition: xccdf_session.c:1368
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.
Definition: xccdf_session.c:498
OSCAP_API bool xccdf_session_is_sds(const struct xccdf_session *session)
Query if the session is based on Source DataStream.
Definition: xccdf_session.c:405
xccdf_session_loading_flags_t
Loading flags for XCCDF sessionThe flags set which components will be loaded in XCCDF session.
Definition: xccdf_session.h:50
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.
Definition: xccdf_session.c:1860
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.
Definition: xccdf_session.c:511
OSCAP_API struct xccdf_session * xccdf_session_new(const char *filename)
Costructor of xccdf_session.
Definition: xccdf_session.c:185
OSCAP_API int xccdf_session_load_xccdf(struct xccdf_session *session)
Load and parse XCCDF file.
Definition: xccdf_session.c:867
OSCAP_API const char * xccdf_session_get_filename(const struct xccdf_session *session)
Retrieves the filename the session was created with.
Definition: xccdf_session.c:400
OSCAP_API void xccdf_session_set_datastream_id(struct xccdf_session *session, const char *datastream_id)
Set requested datastream_id for this session.
Definition: xccdf_session.c:448
OSCAP_API bool xccdf_session_set_profile_id(struct xccdf_session *session, const char *profile_id)
Select XCCDF Profile for evaluation.
Definition: xccdf_session.c:571
OSCAP_API void xccdf_session_set_benchmark_id(struct xccdf_session *session, const char *benchmark_id)
Sets requested benchmark_id for this session.
Definition: xccdf_session.c:476
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.
Definition: xccdf_session.c:533
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...
Definition: xccdf_session.c:2018
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.
Definition: xccdf_session.c:1887
OSCAP_API int xccdf_session_export_xccdf(struct xccdf_session *session)
Export XCCDF file.
Definition: xccdf_session.c:1537
OSCAP_API bool xccdf_session_set_xccdf_export(struct xccdf_session *session, const char *xccdf_file)
Set where to export XCCDF file.
Definition: xccdf_session.c:550
OSCAP_API struct xccdf_session * xccdf_session_new_from_source(struct oscap_source *source)
Costructor of xccdf_session.
Definition: xccdf_session.c:138
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.
Definition: xccdf_session.c:505
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.
Definition: xccdf_session.c:667
OSCAP_API void xccdf_session_free(struct xccdf_session *session)
Destructor of xccdf_session.
Definition: xccdf_session.c:328
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:
Definition: xccdf_session.c:427
OSCAP_API void xccdf_session_set_signature_validation(struct xccdf_session *session, bool validate)
Set XML signature validation.
Definition: xccdf_session.c:433
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)
OSCAP_API const char * xccdf_session_get_result_id(struct xccdf_session *session)
Retrieves the result id.
Definition: xccdf_session.c:487
OSCAP_API void xccdf_session_set_custom_oval_files(struct xccdf_session *session, char **oval_filenames)
Set custom oval files for this session.
Definition: xccdf_session.c:1007
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.
Definition: xccdf_session.c:523
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.
Definition: xccdf_session.c:410
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.
Definition: xccdf_session.c:538
OSCAP_API const char * xccdf_session_get_datastream_id(struct xccdf_session *session)
Retrieves the datastream id.
Definition: xccdf_session.c:454
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.
Definition: xccdf_session.c:1801
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.
Definition: xccdf_session.c:1258
OSCAP_API const char * xccdf_session_get_component_id(struct xccdf_session *session)
Retrieves the component id.
Definition: xccdf_session.c:468
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.
Definition: xccdf_session.c:683
OSCAP_API void xccdf_session_set_reference_filter(struct xccdf_session *session, const char *reference_filter)
Set reference filter to the XCCDF session.
Definition: xccdf_session.c:2067
OSCAP_API void xccdf_session_set_thin_results(struct xccdf_session *session, bool thin_result)
Set whether the thin results override is enabled.
Definition: xccdf_session.c:443
OSCAP_API const char * xccdf_session_get_benchmark_id(struct xccdf_session *session)
Retrieves the benchmark_id.
Definition: xccdf_session.c:482
OSCAP_API bool xccdf_session_set_arf_export(struct xccdf_session *session, const char *arf_file)
Set where to export ARF file.
Definition: xccdf_session.c:543
OSCAP_API int xccdf_session_export_oval(struct xccdf_session *session)
Export OVAL (result and variables) files.
Definition: xccdf_session.c:1748
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.
Definition: xccdf_session.c:557
OSCAP_API int xccdf_session_load(struct xccdf_session *session)
Load and parse all XCCDF structures needed to evaluate this session.
Definition: xccdf_session.c:726
OSCAP_API int xccdf_session_remediate(struct xccdf_session *session)
Run XCCDF Remediation.
Definition: xccdf_session.c:1909
OSCAP_API void xccdf_session_result_reset(struct xccdf_session *session)
Reset xccdf_session results.
Definition: xccdf_session.c:384
OSCAP_API struct ds_sds_index * xccdf_session_get_sds_idx(struct xccdf_session *session)
Get Source DataStream index of the session.
Definition: xccdf_session.c:718
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.
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.
Definition: xccdf_session.c:1284
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.
Definition: xccdf_session.c:1869
OSCAP_API void xccdf_session_set_remote_resources(struct xccdf_session *session, bool allowed, download_progress_calllback_t callback)
Set properties of remote content.
Definition: xccdf_session.c:702
OSCAP_API int xccdf_session_export_arf(struct xccdf_session *session)
Export ARF (if enabled by xccdf_session_set_arf_export).
Definition: xccdf_session.c:1825
OSCAP_API int xccdf_session_generate_guide(struct xccdf_session *session, const char *outfile)
Generate HTML guide form a loaded XCCDF session.
Definition: xccdf_session.c:1977
OSCAP_API void xccdf_session_set_signature_enforcement(struct xccdf_session *session, bool enforce)
Set XML signature enforcement.
Definition: xccdf_session.c:438
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.
Definition: xccdf_session.c:625
OSCAP_API struct xccdf_policy * xccdf_session_get_xccdf_policy(const struct xccdf_session *session)
Get xccdf_policy of the session.
Definition: xccdf_session.c:1851
OSCAP_API struct xccdf_rule_result_iterator * xccdf_session_get_rule_results(const struct xccdf_session *session)
Get rule results.
Definition: xccdf_session.c:1904
OSCAP_API void xccdf_session_set_component_id(struct xccdf_session *session, const char *component_id)
Set requested component_id for this session.
Definition: xccdf_session.c:462
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.
Definition: xccdf_session.c:492
OSCAP_API int xccdf_session_load_cpe(struct xccdf_session *session)
Load and parse CPE dictionaries.
Definition: xccdf_session.c:922
OSCAP_API int xccdf_session_load_oval(struct xccdf_session *session)
Load and parse OVAL definitions files for the XCCDF session.
Definition: xccdf_session.c:1173
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.
Definition: xccdf_session.c:1935
OSCAP_API bool xccdf_session_set_report_export(struct xccdf_session *session, const char *report_file)
Set where to export HTML Report file.
Definition: xccdf_session.c:564
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 wi...
Definition: xccdf_session.c:417
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.
Definition: xccdf_session.c:528
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.
Definition: xccdf_session.c:1965
OSCAP_API int xccdf_session_load_tailoring(struct xccdf_session *session)
Load Tailoring file (if applicable) to the XCCDF session.
Definition: xccdf_session.c:1319
OSCAP_API bool xccdf_session_set_product_cpe(struct xccdf_session *session, const char *product_cpe)
Set custom product CPE name.
Definition: xccdf_session.c:516
OSCAP_API void xccdf_session_skip_rule(struct xccdf_session *session, const char *rule)
Skip rule during evaluation of the session.
Definition: xccdf_session.c:422
OSCAP_API struct xccdf_policy_model * xccdf_session_get_policy_model(const struct xccdf_session *session)
Get policy_model of the session.
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
Represents <data-stream-collection> element - the root element of each source datastream.
Definition: sds_index.c:215
Definition: oscap_source.c:66
XCCDF policy model structure contains xccdf_benchmark as reference to Benchmark element in XML file a...
Definition: xccdf_policy_priv.h:38
XCCDF policy structure is abstract (class) structure of Profile element from benchmark.
Definition: xccdf_policy_priv.h:57
Override iterator.
Definition: xccdf_benchmark.h:590
A structure encapsulating the context of XCCDF operations.
Definition: xccdf_session.c:69
bool without_sys_chars
Shall system characteristics be exported?
Definition: xccdf_session.c:112
char * arf_file
Path to ARF file to export.
Definition: xccdf_session.c:105
char * user_cpe
Path to CPE dictionary required by user.
Definition: xccdf_session.c:115
const char * local_files
Path to the directory where local copies of remote components are located.
Definition: xccdf_session.c:92
bool full_validation
True value indicates that every possible step will be validated by XSD.
Definition: xccdf_session.c:121
bool validate
False value indicates to skip any XSD validation.
Definition: xccdf_session.c:120
char * product_cpe
CPE of scanner product.
Definition: xccdf_session.c:98
const char * filename
File name of SCAP (SDS or XCCDF) file for this session.
Definition: xccdf_session.c:70
char * xccdf_stig_viewer_file
Path to STIG Viewer XCCDF file to export.
Definition: xccdf_session.c:107
char * profile_id
Last selected profile.
Definition: xccdf_session.c:79
char * xccdf_file
Path to XCCDF file to export.
Definition: xccdf_session.c:106
char * report_file
Path to HTML file to export.
Definition: xccdf_session.c:108
struct oscap_source * source
Main source assigned with the main file (SDS or XCCDF)
Definition: xccdf_session.c:74
struct ds_sds_session * session
SDS Registry abstract structure.
Definition: xccdf_session.c:85
Open-scap XCCDF Policy library interface.