Open SCAP Library
|
Public Member Functions | |
struct ds_sds_session * | ds_sds_session_new_from_source (struct oscap_source *source) |
Create new ds_sds_session from existing oscap_source. More... | |
struct ds_sds_index * | ds_sds_session_get_sds_idx (struct ds_sds_session *session) |
Get Source DataStream index. More... | |
struct oscap_source * | ds_sds_session_select_checklist (struct ds_sds_session *session, const char *datastream_id, const char *component_id, const char *benchmark_id) |
Select Checklist (XCCDF presumably) from DataStream collection. More... | |
struct oscap_source * | ds_sds_session_select_tailoring (struct ds_sds_session *session, const char *component_id) |
Select XCCDF Tailoring from DataStream collection. More... | |
int | ds_sds_session_set_datastream_id (struct ds_sds_session *session, const char *datastream_id) |
Set the ID of DataStream within collection to use. More... | |
const char * | ds_sds_session_get_datastream_id (const struct ds_sds_session *session) |
Return ID of currently selected DataStream within the DataStream collection. More... | |
const char * | ds_sds_session_get_checklist_id (const struct ds_sds_session *session) |
Return ID of currently selected component representing XCCDF within the DataStream. More... | |
struct oscap_source * | ds_sds_session_get_component_by_href (struct ds_sds_session *session, const char *href) |
Get component from Source DataStream by its href. More... | |
int | ds_sds_session_register_component_with_dependencies (struct ds_sds_session *session, const char *container_name, const char *component_id, const char *target_filename) |
Register component and its dependencies to internal cache. More... | |
int | ds_sds_session_dump_component_files (struct ds_sds_session *session) |
Store cached component files to the disc. More... | |
int | ds_sds_session_set_target_dir (struct ds_sds_session *session, const char *target_dir) |
Set target directory for the component files. More... | |
void | ds_sds_session_reset (struct ds_sds_session *session) |
Reset session for further use. More... | |
void | ds_sds_session_set_remote_resources (struct ds_sds_session *session, bool allowed, download_progress_calllback_t callback) |
Set property of remote content. More... | |
char * | ds_sds_session_get_html_guide (struct ds_sds_session *session, const char *profile_id) |
Returns HTML representation of selected checklist in form of OpenSCAP guide. More... | |
Data Fields | |
struct oscap_source * | source |
Source DataStream raw representation. | |
struct ds_sds_index * | index |
Source DataStream index. | |
char * | temp_dir |
Temp directory managed by the session. | |
const char * | target_dir |
Target directory for current split. | |
const char * | datastream_id |
ID of selected datastream. | |
const char * | checklist_id |
ID of selected checklist. | |
struct oscap_htable * | component_sources |
oscap_source for parsed components | |
bool | fetch_remote_resources |
Allows loading of external components;. | |
download_progress_calllback_t | progress |
Callback to report progress of download. | |
int ds_sds_session_dump_component_files | ( | struct ds_sds_session * | session | ) |
Store cached component files to the disc.
session | The Source DataStream session |
const char * ds_sds_session_get_checklist_id | ( | const struct ds_sds_session * | session | ) |
Return ID of currently selected component representing XCCDF within the DataStream.
session | The Source DataStream session |
struct oscap_source * ds_sds_session_get_component_by_href | ( | struct ds_sds_session * | session, |
const char * | href | ||
) |
Get component from Source DataStream by its href.
This assumes that the component has been already cached by the session. You can cache component or its dependencies by calling ds_sds_session_select_checklist or ds_sds_session_register_component_with_dependencies. Returned oscap_source is owned by ds_sds_session.
session | The Source DataStream session |
href | The href of the component. The href refers to either file name from the catalogue element or the target name provided previously by caller of upper mentioned functions. |
const char * ds_sds_session_get_datastream_id | ( | const struct ds_sds_session * | session | ) |
Return ID of currently selected DataStream within the DataStream collection.
session | The Source DataStream sesssion |
char * ds_sds_session_get_html_guide | ( | struct ds_sds_session * | session, |
const char * | profile_id | ||
) |
Returns HTML representation of selected checklist in form of OpenSCAP guide.
session | The Source DataStream session to generate guide from |
profile_id | ID of XCCDF profile within selected checklist to generate guide for |
struct ds_sds_index * ds_sds_session_get_sds_idx | ( | struct ds_sds_session * | session | ) |
Get Source DataStream index.
session | Registry to query SDS index from |
struct ds_sds_session * ds_sds_session_new_from_source | ( | struct oscap_source * | source | ) |
Create new ds_sds_session from existing oscap_source.
This assumes that the given oscap_source represents source DataStream. This function does not own the oscap_source, but it needs it for operation.
source | The oscap_source representing a source datastream |
int ds_sds_session_register_component_with_dependencies | ( | struct ds_sds_session * | session, |
const char * | container_name, | ||
const char * | component_id, | ||
const char * | target_filename | ||
) |
Register component and its dependencies to internal cache.
This functions extracts component from selected datastream within collection and all it dependencies. The components may be later queried by ds_sds_session_get_component_by_href.
session | The Source DataStream session |
container_name | The name of container like: "checks", "checklists", or "dictionaries". |
component_id | Id of component within selected datastream or NULL |
target | filename or NULL |
void ds_sds_session_reset | ( | struct ds_sds_session * | session | ) |
Reset session for further use.
Rationale: The ds_sds_session is not versatile structure that would allow to work with all the DataStream content at once. The ds_sds_session structure remembers certain selections like: selected datastream within collection, selected checklist, and cached catalogue files. If caller wants to open different checklist with different catalogue, they need to reset the session.
session | The Source DataStream session to reset |
struct oscap_source * ds_sds_session_select_checklist | ( | struct ds_sds_session * | session, |
const char * | datastream_id, | ||
const char * | component_id, | ||
const char * | benchmark_id | ||
) |
Select Checklist (XCCDF presumably) from DataStream collection.
Parameters may be skipped (passing NULL) to let the ds_sds_session guess them.
session | Source DataStream session to choose from |
datastream_id | ID of DataStream within collection |
component_id | ID of (XCCDF) checklist within datastream |
benchmark_id | ID of Benchmark element within checklist |
struct oscap_source * ds_sds_session_select_tailoring | ( | struct ds_sds_session * | session, |
const char * | component_id | ||
) |
Select XCCDF Tailoring from DataStream collection.
The ds_sds_session_select_checklist needs to be called first. To determine what datastream should be used within collection.
session | Source DataStream session to choose from |
component_id | ID of tailoring file within checklist container |
int ds_sds_session_set_datastream_id | ( | struct ds_sds_session * | session, |
const char * | datastream_id | ||
) |
Set the ID of DataStream within collection to use.
Note that ds_sds_session_select_checklist may set this automatically.
session | Source DataStream session |
datastream_id | DataStream ID to set |
void ds_sds_session_set_remote_resources | ( | struct ds_sds_session * | session, |
bool | allowed, | ||
download_progress_calllback_t | callback | ||
) |
Set property of remote content.
session | The Source DataStream Session |
allowed | Whether is download of remote resources allowed in this session (defaults to false) |
callback | used to notify user about download proceeds. This might be safely set to NULL – ignoring user notification. |
int ds_sds_session_set_target_dir | ( | struct ds_sds_session * | session, |
const char * | target_dir | ||
) |
Set target directory for the component files.
session | The Source DataStream session |
target_dir | Path to the target storage dir |