Open SCAP Library
Files | Data Structures | Functions
DS

Files

file  scap_ds.h
 Open-scap Data Stream interface.
 

Data Structures

struct  ds_stream_index
 Contains information about one particular "<data-stream>" element in the datastream collection (also called SDS = source datastream). More...
 
struct  ds_sds_index
 Represents <data-stream-collection> element - the root element of each source datastream. More...
 
struct  ds_stream_index_iterator
 

Functions

int ds_sds_decompose (const char *input_file, const char *id, const char *xccdf_id, const char *target_dir, const char *target_filename)
 takes given source data stream and decomposes it into separate files More...
 
int ds_sds_decompose_custom (const char *input_file, const char *id, const char *target_dir, const char *container_name, const char *component_id, const char *target_filename)
 same as ds_sds_decompose but works with other components than just XCCDFs More...
 
int ds_sds_compose_from_xccdf (const char *xccdf_file, const char *target_datastream)
 takes given xccdf file and constructs a source datastream More...
 
int ds_rds_create (const char *sds_file, const char *xccdf_result_file, const char **oval_result_files, const char *target_file)
 takes given source data stream and XCCDF result file and makes a result data stream More...
 
int ds_sds_index_select_checklist (struct ds_sds_index *s, const char **datastream_id, const char **component_id)
 chooses datastream and checklist id combination given the IDs More...
 
struct ds_stream_indexds_stream_index::ds_stream_index_new (void)
 
void ds_stream_index::ds_stream_index_free (struct ds_stream_index *s)
 
const char * ds_stream_index::ds_stream_index_get_id (struct ds_stream_index *s)
 Gets ID of the <data-stream> element the index represents.
 
const char * ds_stream_index::ds_stream_index_get_timestamp (struct ds_stream_index *s)
 Timestamp of creation OR modification of the <data-stream> element the index represents.
 
const char * ds_stream_index::ds_stream_index_get_version (struct ds_stream_index *s)
 scap-version of the the <data-stream> element the index represents.
 
struct oscap_string_iteratords_stream_index::ds_stream_index_get_checks (struct ds_stream_index *s)
 Retrieves iterator over all components inside the <checks> element.
 
struct oscap_string_iteratords_stream_index::ds_stream_index_get_checklists (struct ds_stream_index *s)
 Retrieves iterator over all components inside the <checklists> element.
 
struct oscap_string_iteratords_stream_index::ds_stream_index_get_dictionaries (struct ds_stream_index *s)
 Retrieves iterator over all components inside the <dictionaries> element.
 
struct oscap_string_iteratords_stream_index::ds_stream_index_get_extended_components (struct ds_stream_index *s)
 Retrieves iterator over all components inside the <extended-components> element.
 
struct ds_sds_indexds_sds_index::ds_sds_index_new (void)
 
void ds_sds_index::ds_sds_index_free (struct ds_sds_index *s)
 
struct ds_stream_indexds_sds_index::ds_sds_index_get_stream (struct ds_sds_index *s, const char *stream_id)
 retrieves a stream index by data-stream ID
 
struct ds_stream_index_iteratords_sds_index::ds_sds_index_get_streams (struct ds_sds_index *s)
 retrieves all streams indexed inside this structure
 
struct ds_sds_indexds_sds_index::ds_sds_index_import (const char *file)
 imports given source datastream and indexes it
 
struct ds_stream_indexds_stream_index_iterator::ds_stream_index_iterator_next (struct ds_stream_index_iterator *it)
 
bool ds_stream_index_iterator::ds_stream_index_iterator_has_more (struct ds_stream_index_iterator *it)
 
void ds_stream_index_iterator::ds_stream_index_iterator_free (struct ds_stream_index_iterator *it)
 

Detailed Description

Function Documentation

int ds_rds_create ( const char *  sds_file,
const char *  xccdf_result_file,
const char **  oval_result_files,
const char *  target_file 
)

takes given source data stream and XCCDF result file and makes a result data stream

Parameters
sds_filePath to the source data stream file that was used to generate the result XCCDF
xccdf_result_fileContains xccdf:TestResult(s) and the embedded Benchmark (optionally). The embedded Benchmark (source data) will not be included in the result data stream, we will instead bundle the source data stream.
oval_result_filesNULL terminated list of paths to OVAL result files that should be bundled in the result data stream.
target_filePath to the file where the result data stream will be stored
Returns
0 if no errors were encountered -1 in case of errors
int ds_sds_compose_from_xccdf ( const char *  xccdf_file,
const char *  target_datastream 
)

takes given xccdf file and constructs a source datastream

Parameters
xccdf_filePath to the XCCDF file that should be included in the datastream (including its dependencies).
target_datastreamID of the datastream that should contain the XCCDF file. It will be the only datastream in the resulting data-stream-collection.
Returns
0 if no errors were encountered -1 in case of errors
int ds_sds_decompose ( const char *  input_file,
const char *  id,
const char *  xccdf_id,
const char *  target_dir,
const char *  target_filename 
)

takes given source data stream and decomposes it into separate files

This function bases the output on an XCCDF embedded in the "checklists" element in the datastream. Most of the times this is what everybody wants.

If you want to decompose just an OVAL file or some other custom behavior, see ds_sds_decompose_custom.

Parameters
input_fileFile containing a datastream collection we want to decompose parts from
idID of a datastream we want to use from the given datastream collection. The first encountered datastream is used if id is NULL.
xccdf_idID of the component containing the XCCDF we want to process. The first encountered XCCDF component is used if id is NULL.
target_dirDirectory where the resulting files will be stored, names of the files are deduced using component-refs inside the datastream.
target_filenameBase name of the target XCCDF file, if NULL is given the filename will be deduced from the contents of the datastream.
Returns
0 if no errors were encountered -1 in case of errors
int ds_sds_decompose_custom ( const char *  input_file,
const char *  id,
const char *  target_dir,
const char *  container_name,
const char *  component_id,
const char *  target_filename 
)

same as ds_sds_decompose but works with other components than just XCCDFs

Parameters
containercomponent reference container such as "checklists", "checks", ...
component_idid of the component you want to start the export from. If NULL, all components refs inside given container will be exported.
target_filenameBase name of the target file, if NULL is given the filename will be deduced from the contents of the datastream.
See Also
ds_sds_decompose
void ds_sds_index_free ( struct ds_sds_index s)
struct ds_sds_index * ds_sds_index_new ( void  )
read
int ds_sds_index_select_checklist ( struct ds_sds_index s,
const char **  datastream_id,
const char **  component_id 
)

chooses datastream and checklist id combination given the IDs

Parameters
datastream_idhas to point to an allocated char*, selected datastream ID will be filled into it
component_idhas to point to an allocated char*, selected xccdf ID will be filled into it

datastream_id and component_id must not point to the same memory! However, the pointers pointed to may be NULL (which means any ID will do).

void ds_stream_index_free ( struct ds_stream_index s)
void ds_stream_index_iterator_free ( struct ds_stream_index_iterator it)
bool ds_stream_index_iterator_has_more ( struct ds_stream_index_iterator it)
struct ds_stream_index * ds_stream_index_iterator_next ( struct ds_stream_index_iterator it)
read
struct ds_stream_index * ds_stream_index_new ( void  )
read