Open SCAP Library
Loading...
Searching...
No Matches
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
 Retrieves iterator over all components inside the <extended-components> element. More...
 
struct  ds_stream_index_iterator
 
struct  rds_report_request_index
 
struct  rds_asset_index
 
struct  rds_report_index
 
struct  rds_report_request_index_iterator
 
struct  rds_asset_index_iterator
 
struct  rds_report_index_iterator
 
struct  rds_index
 Represents <asset-report-collection> element - the root element of each result datastream in Asset Reporting Format = ARF. More...
 

Functions

OSCAP_API int ds_sds_compose_from_xccdf (const char *xccdf_file, const char *target_datastream)
 takes given xccdf file and constructs a source datastream
 
OSCAP_API int ds_sds_compose_add_component (const char *target_datastream, const char *datastream_id, const char *new_component, bool extended)
 append a new given component to the existing source datastream
 
OSCAP_API 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
 
OSCAP_API 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
 
OSCAP_API int ds_sds_index_select_checklist_by_benchmark_id (struct ds_sds_index *s, const char *benchmark_id, const char **datastream_id, const char **component_ref_id)
 chooses datastream and checklist component ref ID combination, given benchmark ID
 
OSCAP_API struct rds_report_request_indexrds_report_request_index_new (void)
 
OSCAP_API void rds_report_request_index_free (struct rds_report_request_index *s)
 
OSCAP_API const char * rds_report_request_index_get_id (struct rds_report_request_index *s)
 
OSCAP_API struct rds_asset_indexrds_asset_index_new (void)
 
OSCAP_API void rds_asset_index_free (struct rds_asset_index *s)
 
OSCAP_API const char * rds_asset_index_get_id (struct rds_asset_index *s)
 
OSCAP_API void rds_asset_index_add_report_ref (struct rds_asset_index *s, struct rds_report_index *report)
 
OSCAP_API struct rds_report_index_iteratorrds_asset_index_get_reports (struct rds_asset_index *s)
 
OSCAP_API struct rds_report_indexrds_report_index_new (void)
 
OSCAP_API void rds_report_index_free (struct rds_report_index *s)
 
OSCAP_API const char * rds_report_index_get_id (struct rds_report_index *s)
 
OSCAP_API void rds_report_index_set_request (struct rds_report_index *s, struct rds_report_request_index *request)
 
OSCAP_API struct rds_report_request_indexrds_report_index_get_request (struct rds_report_index *s)
 
OSCAP_API struct ds_stream_indexds_stream_index::ds_stream_index_new (void)
 
OSCAP_API void ds_stream_index::ds_stream_index_free (struct ds_stream_index *s)
 
OSCAP_API 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.
 
OSCAP_API 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.
 
OSCAP_API 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.
 
OSCAP_API 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.
 
OSCAP_API 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.
 
OSCAP_API 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.
 
OSCAP_API struct ds_sds_indexds_sds_index::ds_sds_index_new (void)
 
OSCAP_API void ds_sds_index::ds_sds_index_free (struct ds_sds_index *s)
 
OSCAP_API 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
 
OSCAP_API struct ds_stream_index_iteratords_sds_index::ds_sds_index_get_streams (struct ds_sds_index *s)
 retrieves all streams indexed inside this structure
 
OSCAP_API struct ds_stream_indexds_stream_index_iterator::ds_stream_index_iterator_next (struct ds_stream_index_iterator *it)
 
OSCAP_API bool ds_stream_index_iterator::ds_stream_index_iterator_has_more (struct ds_stream_index_iterator *it)
 
OSCAP_API void ds_stream_index_iterator::ds_stream_index_iterator_free (struct ds_stream_index_iterator *it)
 
OSCAP_API struct rds_report_request_indexrds_report_request_index_iterator::rds_report_request_index_iterator_next (struct rds_report_request_index_iterator *it)
 
OSCAP_API bool rds_report_request_index_iterator::rds_report_request_index_iterator_has_more (struct rds_report_request_index_iterator *it)
 
OSCAP_API void rds_report_request_index_iterator::rds_report_request_index_iterator_free (struct rds_report_request_index_iterator *it)
 
OSCAP_API struct rds_asset_indexrds_asset_index_iterator::rds_asset_index_iterator_next (struct rds_asset_index_iterator *it)
 
OSCAP_API bool rds_asset_index_iterator::rds_asset_index_iterator_has_more (struct rds_asset_index_iterator *it)
 
OSCAP_API void rds_asset_index_iterator::rds_asset_index_iterator_free (struct rds_asset_index_iterator *it)
 
OSCAP_API struct rds_report_indexrds_report_index_iterator::rds_report_index_iterator_next (struct rds_report_index_iterator *it)
 
OSCAP_API bool rds_report_index_iterator::rds_report_index_iterator_has_more (struct rds_report_index_iterator *it)
 
OSCAP_API void rds_report_index_iterator::rds_report_index_iterator_free (struct rds_report_index_iterator *it)
 
OSCAP_API struct rds_indexrds_index::rds_index_new (void)
 
OSCAP_API void rds_index::rds_index_free (struct rds_index *s)
 
OSCAP_API struct rds_report_request_index_iteratorrds_index::rds_index_get_report_requests (struct rds_index *s)
 
OSCAP_API struct rds_asset_index_iteratorrds_index::rds_index_get_assets (struct rds_index *s)
 
OSCAP_API struct rds_report_index_iteratorrds_index::rds_index_get_reports (struct rds_index *s)
 
OSCAP_API struct rds_report_request_indexrds_index::rds_index_get_report_request (struct rds_index *rds, const char *id)
 
OSCAP_API struct rds_asset_indexrds_index::rds_index_get_asset (struct rds_index *rds, const char *id)
 
OSCAP_API struct rds_report_indexrds_index::rds_index_get_report (struct rds_index *rds, const char *id)
 
OSCAP_API int rds_index::rds_index_select_report (struct rds_index *s, const char **report_id)
 

Detailed Description

Function Documentation

◆ ds_rds_create()

OSCAP_API 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

◆ ds_sds_compose_add_component()

OSCAP_API int ds_sds_compose_add_component ( const char * target_datastream,
const char * datastream_id,
const char * new_component,
bool extended )

append a new given component to the existing source datastream

Parameters
target_datastreamPath of the existing source datastream into which the new component shall be added.
datastream_idID of the datastream into which the component shall be added. Null value indicates the very first datastream in the collection.
new_componentPath to the new component file (XCCDF, OVAL, or CPE Dictionary).
Returns
0 in case of success

◆ ds_sds_compose_from_xccdf()

OSCAP_API 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

◆ ds_sds_index_select_checklist()

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

component_id is actually a component-ref ID, the reason is that we need the component-ref to know which other components are in the catalog and thus needed when splitting.

◆ ds_sds_index_select_checklist_by_benchmark_id()

OSCAP_API int ds_sds_index_select_checklist_by_benchmark_id ( struct ds_sds_index * s,
const char * benchmark_id,
const char ** datastream_id,
const char ** component_ref_id )

chooses datastream and checklist component ref ID combination, given benchmark ID

Parameters
benchmark_idWhich XCCDF Benchmark ID are we looking for? Parameters are similar to ds_sds_index_select_checklist, except for benchmark_id.
See also
ds_sds_index_select_checklist

This function looks through to datastream index to find the first component-ref (top-down) which satisfies the following condition: "it does point to a component which contains XCCDF Benchmark with id exactly the same as given benchmark_id".

Please note that datastream_id AND component_ref_id are pointers to pointers and they will be overwritten if 0 is returned. The values are never used, unlike with ds_sds_index_select_checklist.