Open SCAP Library
Loading...
Searching...
No Matches
xccdf_session.h
Go to the documentation of this file.
1
12/*
13 * Copyright 2013 Red Hat Inc., Durham, North Carolina.
14 * All Rights Reserved.
15 *
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License as published by the Free Software Foundation; either
19 * version 2.1 of the License, or (at your option) any later version.
20 *
21 * This library is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
25 *
26 * You should have received a copy of the GNU Lesser General Public
27 * License along with this library; if not, write to the Free Software
28 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29 *
30 */
31
32#ifndef XCCDF_SESSION_H_
33#define XCCDF_SESSION_H_
34
35#include "xccdf_policy.h"
36#include "oscap_download_cb.h"
37#include "oscap_export.h"
38
43struct xccdf_session;
44
50typedef enum {
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
58
66OSCAP_API struct xccdf_session *xccdf_session_new(const char *filename);
67
76
82OSCAP_API void xccdf_session_free(struct xccdf_session *session);
83
91
96OSCAP_API const char *xccdf_session_get_filename(const struct xccdf_session *session);
97
104OSCAP_API bool xccdf_session_is_sds(const struct xccdf_session *session);
105
113OSCAP_DEPRECATED(OSCAP_API void xccdf_session_set_rule(struct xccdf_session *session, const char *rule));
114
122OSCAP_API void xccdf_session_add_rule(struct xccdf_session *session, const char *rule);
123
130OSCAP_API void xccdf_session_skip_rule(struct xccdf_session *session, const char *rule);
131
143
151
158OSCAP_API void xccdf_session_set_signature_enforcement(struct xccdf_session *session, bool enforce);
159
168OSCAP_API void xccdf_session_set_thin_results(struct xccdf_session *session, bool thin_result);
169
178OSCAP_API void xccdf_session_set_datastream_id(struct xccdf_session *session, const char *datastream_id);
179
185OSCAP_API const char *xccdf_session_get_datastream_id(struct xccdf_session *session);
186
195OSCAP_API void xccdf_session_set_component_id(struct xccdf_session *session, const char *component_id);
196
202OSCAP_API const char *xccdf_session_get_component_id(struct xccdf_session *session);
203
210OSCAP_API void xccdf_session_set_benchmark_id(struct xccdf_session *session, const char *benchmark_id);
211
217OSCAP_API const char *xccdf_session_get_benchmark_id(struct xccdf_session *session);
218
223OSCAP_API const char *xccdf_session_get_result_id(struct xccdf_session *session);
224
232OSCAP_API void xccdf_session_set_user_cpe(struct xccdf_session *session, const char *user_cpe);
233
241OSCAP_API void xccdf_session_set_user_tailoring_file(struct xccdf_session *session, const char *user_tailoring_file);
242
243OSCAP_API struct oscap_source *xccdf_session_get_user_tailoring_file(struct xccdf_session *session);
244
252OSCAP_API void xccdf_session_set_user_tailoring_cid(struct xccdf_session *session, const char *user_tailoring_cid);
253
262OSCAP_API OSCAP_DEPRECATED(void xccdf_session_set_remote_resources(struct xccdf_session *session, bool allowed, download_progress_calllback_t callback));
263
276OSCAP_API void xccdf_session_configure_remote_resources(struct xccdf_session *session, bool allowed, const char *local_files, download_progress_calllback_t callback);
277
285
294OSCAP_API void xccdf_session_set_custom_oval_files(struct xccdf_session *session, char **oval_filenames);
295
303OSCAP_API void xccdf_session_set_custom_oval_eval_fn(struct xccdf_session *session, xccdf_policy_engine_eval_fn eval_fn);
304
312OSCAP_API bool xccdf_session_set_product_cpe(struct xccdf_session *session, const char *product_cpe);
313
320OSCAP_API void xccdf_session_set_without_sys_chars_export(struct xccdf_session *session, bool without_sys_chars);
321
328OSCAP_API void xccdf_session_set_oval_results_export(struct xccdf_session *session, bool to_export_oval_results);
329
336OSCAP_API void xccdf_session_set_check_engine_plugins_results_export(struct xccdf_session *session, bool to_export_results);
337
344OSCAP_API void xccdf_session_set_oval_variables_export(struct xccdf_session *session, bool to_export_oval_variables);
345
353OSCAP_API bool xccdf_session_set_xccdf_export(struct xccdf_session *session, const char *xccdf_file);
354
362OSCAP_API bool xccdf_session_set_xccdf_stig_viewer_export(struct xccdf_session *session, const char *xccdf_stig_viewer_file);
363
371OSCAP_API bool xccdf_session_set_arf_export(struct xccdf_session *session, const char *arf_file);
372
380OSCAP_API bool xccdf_session_set_report_export(struct xccdf_session *session, const char *report_file);
381
389OSCAP_API bool xccdf_session_set_profile_id(struct xccdf_session *session, const char *profile_id);
390
399OSCAP_API int xccdf_session_set_profile_id_by_suffix(struct xccdf_session *session, const char *profile_suffix);
400
406OSCAP_API const char *xccdf_session_get_profile_id(struct xccdf_session *session);
407
415OSCAP_API struct ds_sds_index *xccdf_session_get_sds_idx(struct xccdf_session *session);
416
424OSCAP_API int xccdf_session_load(struct xccdf_session *session);
425
438OSCAP_API int xccdf_session_load_xccdf(struct xccdf_session *session);
439
447OSCAP_API int xccdf_session_load_cpe(struct xccdf_session *session);
448
455OSCAP_API int xccdf_session_load_oval(struct xccdf_session *session);
456
471OSCAP_API int xccdf_session_load_check_engine_plugin2(struct xccdf_session *session, const char* plugin_name, bool quiet);
472OSCAP_API int xccdf_session_load_check_engine_plugin(struct xccdf_session *session, const char* plugin_name);
473
484OSCAP_API int xccdf_session_load_check_engine_plugins(struct xccdf_session *session);
485
492OSCAP_API int xccdf_session_load_tailoring(struct xccdf_session *session);
493
500OSCAP_API int xccdf_session_evaluate(struct xccdf_session *session);
501
508OSCAP_API int xccdf_session_export_xccdf(struct xccdf_session *session);
509
516OSCAP_API int xccdf_session_export_oval(struct xccdf_session *session);
517
526OSCAP_API int xccdf_session_export_check_engine_plugins(struct xccdf_session *session);
527
534OSCAP_API int xccdf_session_export_arf(struct xccdf_session *session);
535
543OSCAP_API struct xccdf_policy_model *xccdf_session_get_policy_model(const struct xccdf_session *session);
544
551OSCAP_API struct xccdf_policy *xccdf_session_get_xccdf_policy(const struct xccdf_session *session);
552
559OSCAP_API float xccdf_session_get_base_score(const struct xccdf_session *session);
560
567OSCAP_API unsigned int xccdf_session_get_oval_agents_count(const struct xccdf_session *session);
568
577OSCAP_API unsigned int xccdf_session_get_cpe_oval_agents_count(const struct xccdf_session *session);
578
585OSCAP_API bool xccdf_session_contains_fail_result(const struct xccdf_session *session);
586
591
597OSCAP_API struct xccdf_rule_result_iterator *xccdf_session_get_rule_results(const struct xccdf_session *session);
598
607OSCAP_API int xccdf_session_remediate(struct xccdf_session *session);
608
619OSCAP_API int xccdf_session_build_policy_from_testresult(struct xccdf_session *session, const char *testresult_id);
620
628OSCAP_API int xccdf_session_add_report_from_source(struct xccdf_session *session, struct oscap_source *report_source);
629
636OSCAP_API int xccdf_session_generate_guide(struct xccdf_session *session, const char *outfile);
637
647OSCAP_API int xccdf_session_export_all(struct xccdf_session *session);
648
655OSCAP_API void xccdf_session_set_reference_filter(struct xccdf_session *session, const char *reference_filter);
658#endif
#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: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 struct xccdf_session * xccdf_session_new(const char *filename)
Costructor of xccdf_session.
Definition xccdf_session.c:185
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 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 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:2023
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_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_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 const char * xccdf_session_get_datastream_id(struct xccdf_session *session)
Retrieves the datastream id.
Definition xccdf_session.c:454
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_set_reference_filter(struct xccdf_session *session, const char *reference_filter)
Set reference filter to the XCCDF session.
Definition xccdf_session.c:2072
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 void xccdf_session_result_reset(struct xccdf_session *session)
Reset xccdf_session results.
Definition xccdf_session.c:384
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_generate_guide(struct xccdf_session *session, const char *outfile)
Generate HTML guide form a loaded XCCDF session.
Definition xccdf_session.c:1982
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 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 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_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
Retrieves iterator over all components inside the <extended-components> element.
Definition sds_index.c:209
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.
A structure encapsulating the context of XCCDF operations.
Definition xccdf_session.c:69
char * user_cpe
Path to CPE dictionary required by user.
Definition xccdf_session.c:115
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
const char * filename
File name of SCAP (SDS or XCCDF) file for this session.
Definition xccdf_session.c:70
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.