Loading...
Searching...
No Matches
ds_sds_session Struct Reference
Collaboration diagram for ds_sds_session:
[legend]

## Public Member Functions

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.
OSCAP_API struct ds_sds_index * | ds_sds_session_get_sds_idx (struct ds_sds_session *session)
| Get Source DataStream index.
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.
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.
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_source * | ds_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_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.
const char * | checklist_uri
| URI of selected checklist.
struct oscap_htable * | component_sources
| oscap_source for parsed components
struct oscap_htable * | component_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

  session | The source data stream session
  allowed | Whether is download of remote resources allowed in this session (defaults to false)
  local_files | Allows to use a locally downloaded copy of the remote resources. Contains a path to a directory where the files are stored (defaults to NULL).
  callback | used 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

  session | The 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

  session | The 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

  session | The 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

  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.

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

  session | The 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

  session | Registry 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

  source | The 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

  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

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

  session | The 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

  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

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

  session | Source DataStream session to choose from
  component_id | ID 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

  session | Source DataStream session
  datastream_id | DataStream 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

  session | The Source DataStream session
  target_dir | Path to the target storage dir

Returns
  0 on success

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

- ds_sds_session.c
- ds_sds_session.h