Open SCAP Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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. More...
 
xmlTextReader * oscap_source_get_xmlTextReader (struct oscap_source *source)
 Get an xmlTextReader assigned with this resource. More...
 
xmlDoc * oscap_source_get_xmlDoc (struct oscap_source *source)
 Get a DOM representation of this resource. More...
 
const char * oscap_source_get_filepath (struct oscap_source *source)
 Get filepath of the given resource. More...
 
oscap_document_type_t oscap_source_get_scap_type (struct oscap_source *source)
 Get SCAP document type of the given resource. More...
 
const char * oscap_source_get_schema_version (struct oscap_source *source)
 Get the version of the schema for the particular document type. More...
 
int oscap_source_validate (struct oscap_source *source, xml_reporter reporter, void *user)
 Validate the SCAP document against particular XML schema definition. More...
 
int oscap_source_validate_schematron (struct oscap_source *source, const char *outfile)
 Validate the SCAP document against schematron assertions. More...
 
const char * oscap_source_readable_origin (const struct oscap_source *source)
 Returns human readable description of oscap_source origin. More...
 
int oscap_source_save_as (struct oscap_source *source, const char *filename)
 Store the resource represented by oscap_source to the file. More...
 
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). More...
 
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). More...
 

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

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
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
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_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.
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
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
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
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
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
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
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
int oscap_source_validate_schematron ( struct oscap_source source,
const char *  outfile 
)

Validate the SCAP document against schematron assertions.

Parameters
sourceThe oscap_source to validate
outfilepath to out file containing errors, NULL for stdout
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: