Open SCAP Library

Public Member Functions | Data Fields
ds_sds_session Struct Reference

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

## Member Function Documentation

## ◆ ds_sds_session_dump_component_files()

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()

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_component_by_href()

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()

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_html_guide()

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.

Parameters

  session | The Source DataStream session to generate guide from
  profile_id | ID of XCCDF profile within selected checklist to generate guide for

Returns
  a buffer of HTML content that should be freed by the caller

## ◆ ds_sds_session_get_sds_idx()

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()

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()

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()

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()

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()

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()

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_remote_resources()

void ds_sds_session_set_remote_resources | ( | struct ds_sds_session * | session,
|  | bool | allowed,
|  | download_progress_calllback_t | callback
| ) |  |

Set property of remote content.

Parameters

  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.

## ◆ ds_sds_session_set_target_dir()

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