Open SCAP Library
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
oscap_source Struct Reference

Public Member Functions

struct oscap_sourceoscap_source_new_from_xmlDoc (xmlDoc *doc, const char *filepath)
 Build new oscap_source from existing xmlDoc.
 
xmlTextReader * oscap_source_get_xmlTextReader (struct oscap_source *source)
 Get an xmlTextReader assigned with this resource.
 
xmlDoc * oscap_source_get_xmlDoc (struct oscap_source *source)
 Get a DOM representation of this resource.
 
xmlDoc * oscap_source_pop_xmlDoc (struct oscap_source *source)
 Get a DOM representation of this resource.
 
OSCAP_API const char * oscap_source_get_filepath (struct oscap_source *source)
 Get filepath of the given resource.
 
OSCAP_API oscap_document_type_t oscap_source_get_scap_type (struct oscap_source *source)
 Get SCAP document type of the given resource.
 
OSCAP_API const char * oscap_source_get_schema_version (struct oscap_source *source)
 Get the version of the schema for the particular document type.
 
OSCAP_API int oscap_source_validate (struct oscap_source *source, xml_reporter reporter, void *user)
 Validate the SCAP document against particular XML schema definition.
 
OSCAP_API int oscap_source_validate_schematron (struct oscap_source *source)
 Validate the SCAP document against schematron assertions.
 
OSCAP_API const char * oscap_source_readable_origin (const struct oscap_source *source)
 Returns human readable description of oscap_source origin.
 
OSCAP_API int oscap_source_save_as (struct oscap_source *source, const char *filename)
 Store the resource represented by oscap_source to the file.
 
OSCAP_API int oscap_source_to_fd (struct oscap_source *source, int fd)
 Store the resource represented by oscap_source to the file descriptor.
 
int oscap_source_apply_xslt_path (struct oscap_source *source, const char *xsltfile, const char *outfile, const char **params, const char *path_to_xslt)
 Apply stylesheet on XML file (represented by oscap_source structure).
 
char * oscap_source_apply_xslt_path_mem (struct oscap_source *source, const char *xsltfile, const char **params, const char *path_to_xslt)
 Apply stylesheet on XML file (represented by oscap_source structure).
 

Data Fields

oscap_document_type_t scap_type
 Type of SCAP document (XCCDF, OVAL, ...)
 
struct { 
 
   oscap_source_type_t   type 
 Internal type of the oscap_source.
 
   char *   version 
 Version of the particular document type.
 
   char *   filepath 
 Filepath (if originated from file)
 
   char *   memory 
 Memory buffer (if originated from memory)
 
   size_t   memory_size 
 Size of the memory buffer (if originated from memory)
 
origin 
 
struct { 
 
   xmlDoc *   doc 
 
xml 
 

Member Function Documentation

◆ oscap_source_apply_xslt_path()

int oscap_source_apply_xslt_path ( struct oscap_source * source,
const char * xsltfile,
const char * outfile,
const char ** params,
const char * path_to_xslt )

Apply stylesheet on XML file (represented by oscap_source structure).

If xsltfile is an absolute path to the stylesheet, path_to_xslt will not be used.

Parameters
sourceoscap_surce structure representing file to transform
xsltfileabsolute path to the stylesheet document or relative given the path_to_xslt
outfileoutput filename
paramsexternal params for xsl transformation
path_to_xsltoptional path to xsl transformations
Returns
0 on success

◆ oscap_source_apply_xslt_path_mem()

char * oscap_source_apply_xslt_path_mem ( struct oscap_source * source,
const char * xsltfile,
const char ** params,
const char * path_to_xslt )

Apply stylesheet on XML file (represented by oscap_source structure).

If xsltfile is an absolute path to the stylesheet, path_to_xslt will not be used.

Parameters
sourceoscap_surce structure representing file to transform
xsltfileabsolute path to the stylesheet document or relative given the path_to_xslt
paramsexternal params for xsl transformation
path_to_xsltoptional path to xsl transformations
Returns
newly allocated buffer containing result of XSLT application. NULL is returned on error

◆ oscap_source_get_filepath()

OSCAP_API const char * oscap_source_get_filepath ( struct oscap_source * source)

Get filepath of the given resource.

Parameters
source
Returns
filepath of the original source or NULL

◆ oscap_source_get_scap_type()

OSCAP_API oscap_document_type_t oscap_source_get_scap_type ( struct oscap_source * source)

Get SCAP document type of the given resource.

Parameters
source
Returns
determined document type
Note
This function returns OSCAP_DOCUMENT_UNKNOWN to signal an error. Not being able to determine a valid documnent type is treated as an error.

◆ oscap_source_get_schema_version()

OSCAP_API const char * oscap_source_get_schema_version ( struct oscap_source * source)

Get the version of the schema for the particular document type.

Parameters
sourceThe oscap_source to get the schema version from.
Returns
the schema version

◆ oscap_source_get_xmlDoc()

xmlDoc * oscap_source_get_xmlDoc ( struct oscap_source * source)

Get a DOM representation of this resource.

The document ins still owned by oscap_source.

Parameters
sourceResource to build DOM representation from
Returns
xmlDoc structure to read the content

◆ oscap_source_get_xmlTextReader()

xmlTextReader * oscap_source_get_xmlTextReader ( struct oscap_source * source)

Get an xmlTextReader assigned with this resource.

The reader needs to be disposed by caller.

Parameters
sourceResource to read the content
Returns
xmlTextReader structure to read the content

◆ oscap_source_new_from_xmlDoc()

struct oscap_source * oscap_source_new_from_xmlDoc ( xmlDoc * doc,
const char * filepath )

Build new oscap_source from existing xmlDoc.

The xmlDoc becomes owned by oscap_source.

Parameters
docXML DOM to build from
filepathSuggested filename for the file or NULL
Returns
newly created oscap_source

◆ oscap_source_pop_xmlDoc()

xmlDoc * oscap_source_pop_xmlDoc ( struct oscap_source * source)

Get a DOM representation of this resource.

The document is removed from oscap_source and isn't owned by oscap_source anymore.

Parameters
sourceResource to build DOM representation from
Returns
xmlDoc structure to read the content

◆ oscap_source_readable_origin()

OSCAP_API const char * oscap_source_readable_origin ( const struct oscap_source * source)

Returns human readable description of oscap_source origin.

Parameters
sourceThe oscap_source to get readable source from.
Returns
human readable description

◆ oscap_source_save_as()

OSCAP_API int oscap_source_save_as ( struct oscap_source * source,
const char * filename )

Store the resource represented by oscap_source to the file.

Parameters
sourceThe oscap_source to save
filenameThe filename or NULL, the previously supplied name will be used if filename is NULL.
Returns
0 on success, 1 or -1 to indicate error

◆ oscap_source_to_fd()

OSCAP_API int oscap_source_to_fd ( struct oscap_source * source,
int fd )

Store the resource represented by oscap_source to the file descriptor.

Parameters
sourceThe oscap_source to save
fdfile descriptor
Returns
0 on success, 1 or -1 to indicate error

◆ oscap_source_validate()

OSCAP_API int oscap_source_validate ( struct oscap_source * source,
xml_reporter reporter,
void * user )

Validate the SCAP document against particular XML schema definition.

Parameters
sourceThe oscap_source to validate
Note
The held resource has to be XML for this function to work.
Returns
0 on pass; 1 on fail, and -1 on internal error

◆ oscap_source_validate_schematron()

OSCAP_API int oscap_source_validate_schematron ( struct oscap_source * source)

Validate the SCAP document against schematron assertions.

Parameters
sourceThe oscap_source to validate
Note
The held resource has to be XML for this function to work.
Returns
0 on pass; 1 on fail, and -1 on internal error

The documentation for this struct was generated from the following files: