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
414OSCAP_API
int xccdf_session_load(
struct xccdf_session *session);
428OSCAP_API
int xccdf_session_load_xccdf(
struct xccdf_session *session);
437OSCAP_API
int xccdf_session_load_cpe(
struct xccdf_session *session);
445OSCAP_API
int xccdf_session_load_oval(
struct xccdf_session *session);
461OSCAP_API
int xccdf_session_load_check_engine_plugin2(
struct xccdf_session *session,
const char* plugin_name,
bool quiet);
462OSCAP_API
int xccdf_session_load_check_engine_plugin(
struct xccdf_session *session,
const char* plugin_name);
474OSCAP_API
int xccdf_session_load_check_engine_plugins(
struct xccdf_session *session);
482OSCAP_API
int xccdf_session_load_tailoring(
struct xccdf_session *session);
490OSCAP_API
int xccdf_session_evaluate(
struct xccdf_session *session);
498OSCAP_API
int xccdf_session_export_xccdf(
struct xccdf_session *session);
506OSCAP_API
int xccdf_session_export_oval(
struct xccdf_session *session);
516OSCAP_API
int xccdf_session_export_check_engine_plugins(
struct xccdf_session *session);
524OSCAP_API
int xccdf_session_export_arf(
struct xccdf_session *session);
557OSCAP_API
unsigned int xccdf_session_get_oval_agents_count(
const struct xccdf_session *session);
567OSCAP_API
unsigned int xccdf_session_get_cpe_oval_agents_count(
const struct xccdf_session *session);
575OSCAP_API
bool xccdf_session_contains_fail_result(
const struct xccdf_session *session);
585OSCAP_API
int xccdf_session_remediate(
struct xccdf_session *session);
597OSCAP_API
int xccdf_session_build_policy_from_testresult(
struct xccdf_session *session,
const char *testresult_id);
#define OSCAP_DEPRECATED(func)
This macro will warn, when a deprecated function is used.
Definition: oscap.h:50
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:462
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:369
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 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:475
OSCAP_API struct xccdf_session * xccdf_session_new(const char *filename)
Costructor of xccdf_session.
Definition: xccdf_session.c:184
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:364
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:412
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:535
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:440
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:497
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:1972
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:514
OSCAP_API struct xccdf_session * xccdf_session_new_from_source(struct oscap_source *source)
Costructor of xccdf_session.
Definition: xccdf_session.c:137
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:469
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:631
OSCAP_API void xccdf_session_free(struct xccdf_session *session)
Destructor of xccdf_session.
Definition: xccdf_session.c:327
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:391
OSCAP_API void xccdf_session_set_signature_validation(struct xccdf_session *session, bool validate)
Set XML signature validation.
Definition: xccdf_session.c:397
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:451
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:969
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:487
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:374
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:502
OSCAP_API const char * xccdf_session_get_datastream_id(struct xccdf_session *session)
Retrieves the datastream id.
Definition: xccdf_session.c:418
OSCAP_API const char * xccdf_session_get_component_id(struct xccdf_session *session)
Retrieves the component id.
Definition: xccdf_session.c:432
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:647
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:407
OSCAP_API const char * xccdf_session_get_benchmark_id(struct xccdf_session *session)
Retrieves the benchmark_id.
Definition: xccdf_session.c:446
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:507
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:521
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 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:666
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:1931
OSCAP_API void xccdf_session_set_signature_enforcement(struct xccdf_session *session, bool enforce)
Set XML signature enforcement.
Definition: xccdf_session.c:402
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:589
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:426
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:456
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:528
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:381
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:492
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:480
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:386
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
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:111
char * arf_file
Path to ARF file to export.
Definition: xccdf_session.c:104
char * user_cpe
Path to CPE dictionary required by user.
Definition: xccdf_session.c:114
const char * local_files
Path to the directory where local copies of remote components are located.
Definition: xccdf_session.c:91
bool full_validation
True value indicates that every possible step will be validated by XSD.
Definition: xccdf_session.c:120
bool validate
False value indicates to skip any XSD validation.
Definition: xccdf_session.c:119
char * product_cpe
CPE of scanner product.
Definition: xccdf_session.c:97
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:106
char * profile_id
Last selected profile.
Definition: xccdf_session.c:78
char * xccdf_file
Path to XCCDF file to export.
Definition: xccdf_session.c:105
char * report_file
Path to HTML file to export.
Definition: xccdf_session.c:107
struct oscap_source * source
Main source assigned with the main file (SDS or XCCDF)
Definition: xccdf_session.c:73
struct ds_sds_session * session
SDS Registry abstract structure.
Definition: xccdf_session.c:84
Open-scap XCCDF Policy library interface.