Open SCAP Library: oscap_source Struct Reference

Open SCAP Library

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- Data Structures
- Data Structure Index
- Data Fields

Public Member Functions | Data Fields
oscap_source Struct Reference

## Public Member Functions
struct oscap_source * | oscap_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...
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

  source | oscap_surce structure representing file to transform
  xsltfile | absolute path to the stylesheet document or relative given the path_to_xslt
  outfile | output filename
  params | external params for xsl transformation
  path_to_xslt | optional 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

  source | oscap_surce structure representing file to transform
  xsltfile | absolute path to the stylesheet document or relative given the path_to_xslt
  params | external params for xsl transformation
  path_to_xslt | optional path to xsl transformations

Returns
  newly allocated buffer containing result of XSLT application. NULL is returned on error

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

  source | The 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

  source | Resource 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

  source | Resource 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

  doc | XML DOM to build from
  filepath | Suggested 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

  source | The 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

  source | The oscap_source to save
  filename | The 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

  source | The 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

  source | The oscap_source to validate
  outfile | path 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:

- oscap_source.c
- oscap_source_priv.h
- oscap_source.h
- xslt_priv.h