Open SCAP Library

scap_ds.h
Go to the documentation of this file.
1
10 /*
11 * Copyright 2012--2014 Red Hat Inc., Durham, North Carolina.
12 * All Rights Reserved.
13 *
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 *
28 * Authors:
29 * Martin Preisler <mpreisle@redhat.com>
30 */
31
32 #ifndef OPENSCAP_DS_H
33 #define OPENSCAP_DS_H
34
35 #include "oscap.h"
36
72 OSCAP_DEPRECATED(int ds_sds_decompose(const char* input_file, const char* id, const char* xccdf_id, const char* target_dir, const char* target_filename));
73
92 OSCAP_DEPRECATED(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));
93
109 int ds_sds_compose_from_xccdf(const char* xccdf_file, const char* target_datastream);
110
127 int ds_sds_compose_add_component(const char *target_datastream, const char *datastream_id, const char *new_component, bool extended);
128
133 OSCAP_DEPRECATED(int ds_rds_decompose(const char* input_file, const char* report_id, const char* request_id, const char* target_dir));
134
157 int ds_rds_create(const char* sds_file, const char* xccdf_result_file,
158 const char** oval_result_files, const char* target_file);
159
176 struct ds_stream_index;
177
179 struct ds_stream_index* ds_stream_index_new(void);
181 void ds_stream_index_free(struct ds_stream_index* s);
182
188 const char* ds_stream_index_get_id(struct ds_stream_index* s);
189
195 const char* ds_stream_index_get_timestamp(struct ds_stream_index* s);
196
202 const char* ds_stream_index_get_version(struct ds_stream_index* s);
203
209 struct oscap_string_iterator* ds_stream_index_get_checks(struct ds_stream_index* s);
210
216 struct oscap_string_iterator* ds_stream_index_get_checklists(struct ds_stream_index* s);
217
223 struct oscap_string_iterator* ds_stream_index_get_dictionaries(struct ds_stream_index* s);
224
230 struct oscap_string_iterator* ds_stream_index_get_extended_components(struct ds_stream_index* s);
231
243 struct ds_sds_index;
244
246 struct ds_sds_index* ds_sds_index_new(void);
248 void ds_sds_index_free(struct ds_sds_index* s);
249
255 struct ds_stream_index* ds_sds_index_get_stream(struct ds_sds_index* s, const char* stream_id);
256
262 struct ds_stream_index_iterator* ds_sds_index_get_streams(struct ds_sds_index* s);
263
272 OSCAP_DEPRECATED(struct ds_sds_index *ds_sds_index_import(const char* file));
273
286 int ds_sds_index_select_checklist(struct ds_sds_index* s,
287 const char** datastream_id, const char** component_id);
288
305 int ds_sds_index_select_checklist_by_benchmark_id(struct ds_sds_index* s,
306 const char *benchmark_id, const char **datastream_id, const char **component_ref_id);
307
312 struct ds_stream_index_iterator;
313
315 struct ds_stream_index *ds_stream_index_iterator_next(struct ds_stream_index_iterator *it);
317 bool ds_stream_index_iterator_has_more(struct ds_stream_index_iterator *it);
319 void ds_stream_index_iterator_free(struct ds_stream_index_iterator *it);
320
324 struct rds_report_request_index;
325
326 struct rds_report_request_index* rds_report_request_index_new(void);
327 void rds_report_request_index_free(struct rds_report_request_index* s);
328 const char* rds_report_request_index_get_id(struct rds_report_request_index* s);
329
333 struct rds_asset_index;
334
338 struct rds_report_index;
339
340 struct rds_asset_index* rds_asset_index_new(void);
341 void rds_asset_index_free(struct rds_asset_index* s);
342 const char* rds_asset_index_get_id(struct rds_asset_index* s);
343 void rds_asset_index_add_report_ref(struct rds_asset_index* s, struct rds_report_index* report);
344 struct rds_report_index_iterator* rds_asset_index_get_reports(struct rds_asset_index* s);
345
346 struct rds_report_index* rds_report_index_new(void);
347 void rds_report_index_free(struct rds_report_index* s);
348 const char* rds_report_index_get_id(struct rds_report_index* s);
349 void rds_report_index_set_request(struct rds_report_index* s, struct rds_report_request_index *request);
350 struct rds_report_request_index *rds_report_index_get_request(struct rds_report_index* s);
351
356 struct rds_report_request_index_iterator;
357
359 struct rds_report_request_index *rds_report_request_index_iterator_next(struct rds_report_request_index_iterator *it);
361 bool rds_report_request_index_iterator_has_more(struct rds_report_request_index_iterator *it);
363 void rds_report_request_index_iterator_free(struct rds_report_request_index_iterator *it);
364
369 struct rds_asset_index_iterator;
370
372 struct rds_asset_index *rds_asset_index_iterator_next(struct rds_asset_index_iterator *it);
374 bool rds_asset_index_iterator_has_more(struct rds_asset_index_iterator *it);
376 void rds_asset_index_iterator_free(struct rds_asset_index_iterator *it);
377
382 struct rds_report_index_iterator;
383
385 struct rds_report_index *rds_report_index_iterator_next(struct rds_report_index_iterator *it);
387 bool rds_report_index_iterator_has_more(struct rds_report_index_iterator *it);
389 void rds_report_index_iterator_free(struct rds_report_index_iterator *it);
390
399 struct rds_index;
400
402 struct rds_index* rds_index_new(void);
404 void rds_index_free(struct rds_index *s);
405
407 struct rds_report_request_index_iterator *rds_index_get_report_requests(struct rds_index *s);
409 struct rds_asset_index_iterator *rds_index_get_assets(struct rds_index *s);
411 struct rds_report_index_iterator *rds_index_get_reports(struct rds_index *s);
412
414 struct rds_report_request_index *rds_index_get_report_request(struct rds_index *rds, const char *id);
416 struct rds_asset_index *rds_index_get_asset(struct rds_index *rds, const char *id);
418 struct rds_report_index *rds_index_get_report(struct rds_index *rds, const char *id);
419
425 OSCAP_DEPRECATED(struct rds_index *rds_index_import(const char *file));
426
428 int rds_index_select_report(struct rds_index *s, const char **report_id);
429
430 /************************************************************/
433 #endif
ds_sds_index::ds_sds_index_new
struct ds_sds_index * ds_sds_index_new(void)
Definition: sds_index.c:222
rds_report_index_iterator
ds_stream_index::ds_stream_index_get_version
const char * ds_stream_index_get_version(struct ds_stream_index *s)
scap-version of the the <data-stream> element the index represents.
Definition: sds_index.c:97
ds_stream_index_iterator
oscap.h
General OpenScap functions and types.
ds_sds_index_select_checklist
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
Definition: sds_index.c:427
ds_stream_index::ds_stream_index_get_timestamp
const char * ds_stream_index_get_timestamp(struct ds_stream_index *s)
Timestamp of creation OR modification of the <data-stream> element the index represents.
Definition: sds_index.c:92
rds_index::rds_index_get_report
struct rds_report_index * rds_index_get_report(struct rds_index *rds, const char *id)
Definition: rds_index.c:136
rds_report_index
Definition: rds_report_index.c:39
rds_asset_index
Definition: rds_asset_index.c:41
ds_sds_decompose_custom
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
Definition: sds.c:562
ds_sds_compose_from_xccdf
int ds_sds_compose_from_xccdf(const char *xccdf_file, const char *target_datastream)
takes given xccdf file and constructs a source datastream
Definition: sds.c:1247
rds_report_request_index_iterator::rds_report_request_index_iterator_free
void rds_report_request_index_iterator_free(struct rds_report_request_index_iterator *it)
Definition: rds_report_request_index.c:94
rds_report_index_iterator::rds_report_index_iterator_has_more
bool rds_report_index_iterator_has_more(struct rds_report_index_iterator *it)
Definition: rds_report_index.c:100
ds_sds_index::ds_sds_index_import
struct ds_sds_index * ds_sds_index_import(const char *file)
imports given source datastream and indexes it
Definition: sds_index.c:410
ds_sds_index_select_checklist_by_benchmark_id
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 ...
Definition: sds_index.c:475
ds_sds_index::ds_sds_index_get_stream
struct ds_stream_index * ds_sds_index_get_stream(struct ds_sds_index *s, const char *stream_id)
retrieves a stream index by data-stream ID
Definition: sds_index.c:248
rds_index::rds_index_new
struct rds_index * rds_index_new(void)
Definition: rds_index.c:48
OSCAP_DEPRECATED
#define OSCAP_DEPRECATED(func)
This macro will warn, when a deprecated function is used.
Definition: oscap.h:50
ds_stream_index::ds_stream_index_get_dictionaries
struct oscap_string_iterator * ds_stream_index_get_dictionaries(struct ds_stream_index *s)
Retrieves iterator over all components inside the <dictionaries> element.
Definition: sds_index.c:112
ds_sds_index::ds_sds_index_free
void ds_sds_index_free(struct ds_sds_index *s)
Definition: sds_index.c:232
ds_stream_index
Contains information about one particular "<data-stream>" element in the datastream collection (also ...
Definition: sds_index.c:39
rds_report_request_index_iterator::rds_report_request_index_iterator_has_more
bool rds_report_request_index_iterator_has_more(struct rds_report_request_index_iterator *it)
Definition: rds_report_request_index.c:89
rds_index::rds_index_get_reports
struct rds_report_index_iterator * rds_index_get_reports(struct rds_index *s)
Definition: rds_index.c:93
rds_report_request_index_iterator::rds_report_request_index_iterator_next
struct rds_report_request_index * rds_report_request_index_iterator_next(struct rds_report_request_index_iterator *it)
Definition: rds_report_request_index.c:84
rds_report_request_index_iterator
ds_sds_compose_add_component
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
Definition: sds.c:1110
rds_report_index_iterator::rds_report_index_iterator_free
void rds_report_index_iterator_free(struct rds_report_index_iterator *it)
Definition: rds_report_index.c:105
rds_index::rds_index_get_assets
struct rds_asset_index_iterator * rds_index_get_assets(struct rds_index *s)
Definition: rds_index.c:83
ds_stream_index::ds_stream_index_new
struct ds_stream_index * ds_stream_index_new(void)
Definition: sds_index.c:53
ds_sds_index
Represents <data-stream-collection> element - the root element of each source datastream.
Definition: sds_index.c:215
ds_stream_index_iterator::ds_stream_index_iterator_has_more
bool ds_stream_index_iterator_has_more(struct ds_stream_index_iterator *it)
Definition: sds_index.c:513
ds_stream_index::ds_stream_index_free
void ds_stream_index_free(struct ds_stream_index *s)
Definition: sds_index.c:71
ds_stream_index::ds_stream_index_get_id
const char * ds_stream_index_get_id(struct ds_stream_index *s)
Gets ID of the <data-stream> element the index represents.
Definition: sds_index.c:87
rds_asset_index_iterator
rds_asset_index_iterator::rds_asset_index_iterator_free
void rds_asset_index_iterator_free(struct rds_asset_index_iterator *it)
Definition: rds_asset_index.c:108
ds_stream_index_iterator::ds_stream_index_iterator_next
struct ds_stream_index * ds_stream_index_iterator_next(struct ds_stream_index_iterator *it)
Definition: sds_index.c:508
rds_asset_index_iterator::rds_asset_index_iterator_has_more
bool rds_asset_index_iterator_has_more(struct rds_asset_index_iterator *it)
Definition: rds_asset_index.c:103
rds_index
Represents <asset-report-collection> element - the root element of each result datastream in Asset Re...
Definition: rds_index.c:41
rds_report_index_iterator::rds_report_index_iterator_next
struct rds_report_index * rds_report_index_iterator_next(struct rds_report_index_iterator *it)
Definition: rds_report_index.c:95
rds_index::rds_index_get_asset
struct rds_asset_index * rds_index_get_asset(struct rds_index *rds, const char *id)
Definition: rds_index.c:117
rds_index::rds_index_import
struct rds_index * rds_index_import(const char *file)
Definition: rds_index.c:353
ds_sds_decompose
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
Definition: sds.c:594
ds_stream_index::ds_stream_index_get_extended_components
struct oscap_string_iterator * ds_stream_index_get_extended_components(struct ds_stream_index *s)
Retrieves iterator over all components inside the <extended-components> element.
Definition: sds_index.c:117
oscap_string_iterator
String iterator.
rds_index::rds_index_free
void rds_index_free(struct rds_index *s)
Definition: rds_index.c:58
rds_report_request_index
Definition: rds_report_request_index.c:39
ds_stream_index_iterator::ds_stream_index_iterator_free
void ds_stream_index_iterator_free(struct ds_stream_index_iterator *it)
Definition: sds_index.c:518
rds_index::rds_index_get_report_request
struct rds_report_request_index * rds_index_get_report_request(struct rds_index *rds, const char *id)
Definition: rds_index.c:98
ds_rds_decompose
int ds_rds_decompose(const char *input_file, const char *report_id, const char *request_id, const char *target_dir)
Definition: rds.c:177
ds_stream_index::ds_stream_index_get_checks
struct oscap_string_iterator * ds_stream_index_get_checks(struct ds_stream_index *s)
Retrieves iterator over all components inside the <checks> element.
Definition: sds_index.c:102
rds_index::rds_index_select_report
int rds_index_select_report(struct rds_index *s, const char **report_id)
Definition: rds_index.c:369
rds_index::rds_index_get_report_requests
struct rds_report_request_index_iterator * rds_index_get_report_requests(struct rds_index *s)
Definition: rds_index.c:73
rds_asset_index_iterator::rds_asset_index_iterator_next
struct rds_asset_index * rds_asset_index_iterator_next(struct rds_asset_index_iterator *it)
Definition: rds_asset_index.c:98
ds_stream_index::ds_stream_index_get_checklists
struct oscap_string_iterator * ds_stream_index_get_checklists(struct ds_stream_index *s)
Retrieves iterator over all components inside the <checklists> element.
Definition: sds_index.c:107
ds_rds_create
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 ...
Definition: rds.c:780
ds_sds_index::ds_sds_index_get_streams
struct ds_stream_index_iterator * ds_sds_index_get_streams(struct ds_sds_index *s)
retrieves all streams indexed inside this structure
Definition: sds_index.c:268