Open SCAP Library
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
ds_sds_session Struct Reference
Collaboration diagram for ds_sds_session:
[legend]

Public Member Functions

OSCAP_API struct ds_sds_sessionds_sds_session_new_from_source (struct oscap_source *source)
 Create new ds_sds_session from existing oscap_source.
 
OSCAP_API struct ds_sds_indexds_sds_session_get_sds_idx (struct ds_sds_session *session)
 Get Source DataStream index.
 
OSCAP_API struct oscap_sourceds_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.
 
OSCAP_API struct oscap_sourceds_sds_session_select_tailoring (struct ds_sds_session *session, const char *component_id)
 Select XCCDF Tailoring from DataStream collection.
 
OSCAP_API 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.
 
OSCAP_API const char * ds_sds_session_get_datastream_id (const struct ds_sds_session *session)
 Return ID of currently selected DataStream within the DataStream collection.
 
OSCAP_API 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.
 
OSCAP_API const char * ds_sds_session_get_checklist_uri (const struct ds_sds_session *session)
 Return URI of currently selected component representing XCCDF within the DataStream.
 
OSCAP_API struct oscap_sourceds_sds_session_get_component_by_href (struct ds_sds_session *session, const char *href)
 Get component from Source DataStream by its href.
 
OSCAP_API 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.
 
OSCAP_API int ds_sds_session_dump_component_files (struct ds_sds_session *session)
 Store cached component files to the disc.
 
OSCAP_API int ds_sds_session_set_target_dir (struct ds_sds_session *session, const char *target_dir)
 Set target directory for the component files.
 
OSCAP_API void ds_sds_session_reset (struct ds_sds_session *session)
 Reset session for further use.
 
OSCAP_API void ds_sds_session_configure_remote_resources (struct ds_sds_session *session, bool allowed, const char *local_files, download_progress_calllback_t callback)
 Set property of remote content.
 

Data Fields

struct oscap_sourcesource
 Source DataStream raw representation.
 
struct ds_sds_indexindex
 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.
 
const char * checklist_uri
 URI of selected checklist.
 
struct oscap_htablecomponent_sources
 oscap_source for parsed components
 
struct oscap_htablecomponent_uris
 maps component refs to component URIs
 
bool fetch_remote_resources
 Allows loading of external components;.
 
download_progress_calllback_t progress
 Callback to report progress of download.
 
const char * local_files
 Path to the directory where local copies of remote components are located.
 

Member Function Documentation

◆ ds_sds_session_configure_remote_resources()

OSCAP_API void ds_sds_session_configure_remote_resources ( struct ds_sds_session * session,
bool allowed,
const char * local_files,
download_progress_calllback_t callback )

Set property of remote content.

Parameters
sessionThe source data stream session
allowedWhether is download of 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.

◆ ds_sds_session_dump_component_files()

OSCAP_API int ds_sds_session_dump_component_files ( struct ds_sds_session * session)

Store cached component files to the disc.

Parameters
sessionThe Source DataStream session
Returns
0 on success

◆ ds_sds_session_get_checklist_id()

OSCAP_API 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.

Parameters
sessionThe Source DataStream session
Returns
ID of selected component or NULL

◆ ds_sds_session_get_checklist_uri()

OSCAP_API const char * ds_sds_session_get_checklist_uri ( const struct ds_sds_session * session)

Return URI of currently selected component representing XCCDF within the DataStream.

Parameters
sessionThe Source DataStream session
Returns
URI of selected component or NULL

◆ ds_sds_session_get_component_by_href()

OSCAP_API 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.

Parameters
sessionThe Source DataStream session
hrefThe 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.
Returns
oscap_source representing the component or NULL

◆ ds_sds_session_get_datastream_id()

OSCAP_API const char * ds_sds_session_get_datastream_id ( const struct ds_sds_session * session)

Return ID of currently selected DataStream within the DataStream collection.

Parameters
sessionThe Source DataStream sesssion
Returns
ID of selected datastream or NULL

◆ ds_sds_session_get_sds_idx()

OSCAP_API struct ds_sds_index * ds_sds_session_get_sds_idx ( struct ds_sds_session * session)

Get Source DataStream index.

Parameters
sessionRegistry to query SDS index from
Returns
source DataStream owned by session

◆ ds_sds_session_new_from_source()

OSCAP_API 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.

Parameters
sourceThe oscap_source representing a source datastream
Returns
newly created ds_sds_session structure

◆ ds_sds_session_register_component_with_dependencies()

OSCAP_API 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.

Parameters
sessionThe Source DataStream session
container_nameThe name of container like: "checks", "checklists", or "dictionaries".
component_idId of component within selected datastream or NULL
targetfilename or NULL
Returns
0 on success

◆ ds_sds_session_reset()

OSCAP_API 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.

Parameters
sessionThe Source DataStream session to reset

◆ ds_sds_session_select_checklist()

OSCAP_API 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.

Parameters
sessionSource DataStream session to choose from
datastream_idID of DataStream within collection
component_idID of (XCCDF) checklist within datastream
benchmark_idID of Benchmark element within checklist
Returns
XCCDF checklist in form of oscap_source

◆ ds_sds_session_select_tailoring()

OSCAP_API 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.

Parameters
sessionSource DataStream session to choose from
component_idID of tailoring file within checklist container
Returns
XCCdF tailoring in form of oscap_source

◆ ds_sds_session_set_datastream_id()

OSCAP_API 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.

Parameters
sessionSource DataStream session
datastream_idDataStream ID to set
Returns
0 on success

◆ ds_sds_session_set_target_dir()

OSCAP_API int ds_sds_session_set_target_dir ( struct ds_sds_session * session,
const char * target_dir )

Set target directory for the component files.

Parameters
sessionThe Source DataStream session
target_dirPath to the target storage dir
Returns
0 on success

The documentation for this struct was generated from the following files: