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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 #include "oscap_export.h"
37 
53 OSCAP_API int ds_sds_compose_from_xccdf(const char* xccdf_file, const char* target_datastream);
54 
71 OSCAP_API int ds_sds_compose_add_component(const char *target_datastream, const char *datastream_id, const char *new_component, bool extended);
72 
95 OSCAP_API int ds_rds_create(const char* sds_file, const char* xccdf_result_file,
96  const char** oval_result_files, const char* target_file);
97 
114 struct ds_stream_index;
115 
117 OSCAP_API struct ds_stream_index* ds_stream_index_new(void);
119 OSCAP_API void ds_stream_index_free(struct ds_stream_index* s);
120 
126 OSCAP_API const char* ds_stream_index_get_id(struct ds_stream_index* s);
127 
133 OSCAP_API const char* ds_stream_index_get_timestamp(struct ds_stream_index* s);
134 
140 OSCAP_API const char* ds_stream_index_get_version(struct ds_stream_index* s);
141 
148 
155 
162 
169 
181 struct ds_sds_index;
182 
184 OSCAP_API struct ds_sds_index* ds_sds_index_new(void);
186 OSCAP_API void ds_sds_index_free(struct ds_sds_index* s);
187 
193 OSCAP_API struct ds_stream_index* ds_sds_index_get_stream(struct ds_sds_index* s, const char* stream_id);
194 
201 
214 OSCAP_API int ds_sds_index_select_checklist(struct ds_sds_index* s,
215  const char** datastream_id, const char** component_id);
216 
234  const char *benchmark_id, const char **datastream_id, const char **component_ref_id);
235 
241 
243 OSCAP_API struct ds_stream_index *ds_stream_index_iterator_next(struct ds_stream_index_iterator *it);
245 OSCAP_API bool ds_stream_index_iterator_has_more(struct ds_stream_index_iterator *it);
247 OSCAP_API void ds_stream_index_iterator_free(struct ds_stream_index_iterator *it);
248 
253 
254 OSCAP_API struct rds_report_request_index* rds_report_request_index_new(void);
255 OSCAP_API void rds_report_request_index_free(struct rds_report_request_index* s);
256 OSCAP_API const char* rds_report_request_index_get_id(struct rds_report_request_index* s);
257 
261 struct rds_asset_index;
262 
266 struct rds_report_index;
267 
268 OSCAP_API struct rds_asset_index* rds_asset_index_new(void);
269 OSCAP_API void rds_asset_index_free(struct rds_asset_index* s);
270 OSCAP_API const char* rds_asset_index_get_id(struct rds_asset_index* s);
271 OSCAP_API void rds_asset_index_add_report_ref(struct rds_asset_index* s, struct rds_report_index* report);
272 OSCAP_API struct rds_report_index_iterator* rds_asset_index_get_reports(struct rds_asset_index* s);
273 
274 OSCAP_API struct rds_report_index* rds_report_index_new(void);
275 OSCAP_API void rds_report_index_free(struct rds_report_index* s);
276 OSCAP_API const char* rds_report_index_get_id(struct rds_report_index* s);
277 OSCAP_API void rds_report_index_set_request(struct rds_report_index* s, struct rds_report_request_index *request);
278 OSCAP_API struct rds_report_request_index *rds_report_index_get_request(struct rds_report_index* s);
279 
285 
287 OSCAP_API struct rds_report_request_index *rds_report_request_index_iterator_next(struct rds_report_request_index_iterator *it);
289 OSCAP_API bool rds_report_request_index_iterator_has_more(struct rds_report_request_index_iterator *it);
291 OSCAP_API void rds_report_request_index_iterator_free(struct rds_report_request_index_iterator *it);
292 
298 
300 OSCAP_API struct rds_asset_index *rds_asset_index_iterator_next(struct rds_asset_index_iterator *it);
302 OSCAP_API bool rds_asset_index_iterator_has_more(struct rds_asset_index_iterator *it);
304 OSCAP_API void rds_asset_index_iterator_free(struct rds_asset_index_iterator *it);
305 
311 
313 OSCAP_API struct rds_report_index *rds_report_index_iterator_next(struct rds_report_index_iterator *it);
315 OSCAP_API bool rds_report_index_iterator_has_more(struct rds_report_index_iterator *it);
317 OSCAP_API void rds_report_index_iterator_free(struct rds_report_index_iterator *it);
318 
327 struct rds_index;
328 
330 OSCAP_API struct rds_index* rds_index_new(void);
332 OSCAP_API void rds_index_free(struct rds_index *s);
333 
335 OSCAP_API struct rds_report_request_index_iterator *rds_index_get_report_requests(struct rds_index *s);
337 OSCAP_API struct rds_asset_index_iterator *rds_index_get_assets(struct rds_index *s);
339 OSCAP_API struct rds_report_index_iterator *rds_index_get_reports(struct rds_index *s);
340 
342 OSCAP_API struct rds_report_request_index *rds_index_get_report_request(struct rds_index *rds, const char *id);
344 OSCAP_API struct rds_asset_index *rds_index_get_asset(struct rds_index *rds, const char *id);
346 OSCAP_API struct rds_report_index *rds_index_get_report(struct rds_index *rds, const char *id);
348 OSCAP_API int rds_index_select_report(struct rds_index *s, const char **report_id);
349 
350 /************************************************************/
353 #endif
OSCAP_API 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:106
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
Definition: rds.c:871
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
Definition: sds.c:1296
OSCAP_API 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:101
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
Definition: sds_index.c:409
OSCAP_API 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:86
OSCAP_API 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:247
OSCAP_API 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:267
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
Definition: sds_index.c:457
OSCAP_API 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:116
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
Definition: sds.c:1159
OSCAP_API 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:111
OSCAP_API 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:91
OSCAP_API 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:96
General OpenScap functions and types.
Represents <data-stream-collection> element - the root element of each source datastream.
Definition: sds_index.c:215
Contains information about one particular "<data-stream>" element in the datastream collection (also ...
Definition: sds_index.c:39
String iterator.
Definition: rds_asset_index.c:41
Represents <asset-report-collection> element - the root element of each result datastream in Asset Re...
Definition: rds_index.c:41
Definition: rds_report_index.c:39
Definition: rds_report_request_index.c:39