Open SCAP Library
scap_ds.h
Go to the documentation of this file.
1 
10 /*
11  * Copyright 2012 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 
69 int ds_sds_decompose(const char* input_file, const char* id, const char* xccdf_id,
70  const char* target_dir, const char* target_filename);
71 
87 int ds_sds_decompose_custom(const char* input_file, const char* id, const char* target_dir,
88  const char* container_name, const char* component_id, const char* target_filename);
89 
105 int ds_sds_compose_from_xccdf(const char* xccdf_file, const char* target_datastream);
106 
123 int ds_sds_compose_add_component(const char *target_datastream, const char *datastream_id, const char *new_component, bool extended);
124 
125 int ds_rds_decompose(const char* input_file, const char* report_id, const char* request_id, const char* target_dir);
126 
149 int ds_rds_create(const char* sds_file, const char* xccdf_result_file,
150  const char** oval_result_files, const char* target_file);
151 
168 struct ds_stream_index;
169 
173 void ds_stream_index_free(struct ds_stream_index* s);
174 
180 const char* ds_stream_index_get_id(struct ds_stream_index* s);
181 
187 const char* ds_stream_index_get_timestamp(struct ds_stream_index* s);
188 
194 const char* ds_stream_index_get_version(struct ds_stream_index* s);
195 
202 
209 
216 
223 
235 struct ds_sds_index;
236 
238 struct ds_sds_index* ds_sds_index_new(void);
240 void ds_sds_index_free(struct ds_sds_index* s);
241 
247 struct ds_stream_index* ds_sds_index_get_stream(struct ds_sds_index* s, const char* stream_id);
248 
255 
261 struct ds_sds_index *ds_sds_index_import(const char* file);
262 
276  const char** datastream_id, const char** component_id);
277 
295  const char *benchmark_id, const char **datastream_id, const char **component_ref_id);
296 
302 
309 
314 
315 struct rds_report_request_index* rds_report_request_index_new(void);
316 void rds_report_request_index_free(struct rds_report_request_index* s);
317 const char* rds_report_request_index_get_id(struct rds_report_request_index* s);
318 
322 struct rds_asset_index;
323 
327 struct rds_report_index;
328 
329 struct rds_asset_index* rds_asset_index_new(void);
330 void rds_asset_index_free(struct rds_asset_index* s);
331 const char* rds_asset_index_get_id(struct rds_asset_index* s);
332 void rds_asset_index_add_report_ref(struct rds_asset_index* s, struct rds_report_index* report);
333 struct rds_report_index_iterator* rds_asset_index_get_reports(struct rds_asset_index* s);
334 
335 struct rds_report_index* rds_report_index_new(void);
336 void rds_report_index_free(struct rds_report_index* s);
337 const char* rds_report_index_get_id(struct rds_report_index* s);
338 void rds_report_index_set_request(struct rds_report_index* s, struct rds_report_request_index *request);
339 struct rds_report_request_index *rds_report_index_get_request(struct rds_report_index* s);
340 
346 
353 
359 
366 
372 
379 
388 struct rds_index;
389 
391 struct rds_index* rds_index_new(void);
393 void rds_index_free(struct rds_index *s);
394 
401 
403 struct rds_report_request_index *rds_index_get_report_request(struct rds_index *rds, const char *id);
405 struct rds_asset_index *rds_index_get_asset(struct rds_index *rds, const char *id);
407 struct rds_report_index *rds_index_get_report(struct rds_index *rds, const char *id);
408 
410 struct rds_index *rds_index_import(const char *file);
411 
413 int rds_index_select_report(struct rds_index *s, const char **report_id);
414 
415 /************************************************************/
418 #endif
struct ds_sds_index * ds_sds_index_new(void)
Definition: sds_index.c:218
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:94
General OpenScap functions and types.
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:423
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:89
struct rds_report_index * rds_index_get_report(struct rds_index *rds, const char *id)
Definition: rds_index.c:286
Definition: rds_index.c:137
Definition: rds_index.c:80
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:394
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:1030
void rds_report_request_index_iterator_free(struct rds_report_request_index_iterator *it)
Definition: rds_index.c:518
bool rds_report_index_iterator_has_more(struct rds_report_index_iterator *it)
Definition: rds_index.c:543
struct ds_sds_index * ds_sds_index_import(const char *file)
imports given source datastream and indexes it
Definition: sds_index.c:406
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:471
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:244
struct rds_index * rds_index_new(void)
Definition: rds_index.c:199
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:109
void ds_sds_index_free(struct ds_sds_index *s)
Definition: sds_index.c:228
Contains information about one particular "<data-stream>" element in the datastream collection (also ...
Definition: sds_index.c:36
bool rds_report_request_index_iterator_has_more(struct rds_report_request_index_iterator *it)
Definition: rds_index.c:513
struct rds_report_index_iterator * rds_index_get_reports(struct rds_index *s)
Definition: rds_index.c:243
struct rds_report_request_index * rds_report_request_index_iterator_next(struct rds_report_request_index_iterator *it)
Definition: rds_index.c:508
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:991
void rds_report_index_iterator_free(struct rds_report_index_iterator *it)
Definition: rds_index.c:548
struct rds_asset_index_iterator * rds_index_get_assets(struct rds_index *s)
Definition: rds_index.c:233
struct ds_stream_index * ds_stream_index_new(void)
Definition: sds_index.c:50
Represents <data-stream-collection> element - the root element of each source datastream.
Definition: sds_index.c:211
bool ds_stream_index_iterator_has_more(struct ds_stream_index_iterator *it)
Definition: sds_index.c:509
void ds_stream_index_free(struct ds_stream_index *s)
Definition: sds_index.c:68
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:84
void rds_asset_index_iterator_free(struct rds_asset_index_iterator *it)
Definition: rds_index.c:533
struct ds_stream_index * ds_stream_index_iterator_next(struct ds_stream_index_iterator *it)
Definition: sds_index.c:504
bool rds_asset_index_iterator_has_more(struct rds_asset_index_iterator *it)
Definition: rds_index.c:528
Represents <asset-report-collection> element - the root element of each result datastream in Asset Re...
Definition: rds_index.c:192
struct rds_report_index * rds_report_index_iterator_next(struct rds_report_index_iterator *it)
Definition: rds_index.c:538
struct rds_asset_index * rds_index_get_asset(struct rds_index *rds, const char *id)
Definition: rds_index.c:267
struct rds_index * rds_index_import(const char *file)
Definition: rds_index.c:491
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:474
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:114
String iterator.
void rds_index_free(struct rds_index *s)
Definition: rds_index.c:209
Definition: rds_index.c:36
void ds_stream_index_iterator_free(struct ds_stream_index_iterator *it)
Definition: sds_index.c:514
struct rds_report_request_index * rds_index_get_report_request(struct rds_index *rds, const char *id)
Definition: rds_index.c:248
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:99
int rds_index_select_report(struct rds_index *s, const char **report_id)
Definition: rds_index.c:553
struct rds_report_request_index_iterator * rds_index_get_report_requests(struct rds_index *s)
Definition: rds_index.c:223
struct rds_asset_index * rds_asset_index_iterator_next(struct rds_asset_index_iterator *it)
Definition: rds_index.c:523
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:104
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:802
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:264