Loading...
Searching...
No Matches
OVALSESSION
OVAL

OVAL Session More...

Collaboration diagram for OVALSESSION:

## Files

file | oval_session.h

## Data Structures

struct | oval_session
| A structure encapsulating the context of OVAL operations. More...

## Functions

OSCAP_API struct oval_session * | oval_session::oval_session_new (const char *filename)
| Costructor of an oval_session.
OSCAP_API void | oval_session::oval_session_set_variables (struct oval_session *session, const char *filename)
| Set OVAL Variables.
OSCAP_API void | oval_session::oval_session_set_directives (struct oval_session *session, const char *filename)
| Set OVAL Directives.
OSCAP_API void | oval_session::oval_session_set_validation (struct oval_session *session, bool validate, bool full_validation)
| Set XSD validation level.
OSCAP_API void | oval_session::oval_session_set_datastream_id (struct oval_session *session, const char *id)
| Set ID of a specific OVAL Definition in an source datastream.
OSCAP_API void | oval_session::oval_session_set_component_id (struct oval_session *session, const char *id)
| Set ID of a particular OVAL component if there are two OVALs in one source datastream.
OSCAP_API void | oval_session::oval_session_set_results_export (struct oval_session *session, const char *filename)
| Set a name of the file that the the OVAL Results will be written into.
OSCAP_API void | oval_session::oval_session_set_report_export (struct oval_session *session, const char *filename)
| Set a name of the file that the the OVAL Results, converted to HTML format, will be written into.
OSCAP_API void | oval_session::oval_session_set_xml_reporter (struct oval_session *session, xml_reporter fn)
| Set XML validation reporter.
OSCAP_API int | oval_session::oval_session_load (struct oval_session *session)
| Load OVAL Definitions and bind OVAL Variables to it if provided.
OSCAP_API int | oval_session::oval_session_evaluate_id (struct oval_session *session, const char *id, oval_result_t *result)
| Evaluate a specific OVAL Definition.
OSCAP_API int | oval_session::oval_session_evaluate (struct oval_session *session, agent_reporter fn, void *arg)
| Evaluate OVAL Definitions.
OSCAP_API int | oval_session::oval_session_export (struct oval_session *session)
| Export result to a file.
OSCAP_API void | oval_session::oval_session_set_export_system_characteristics (struct oval_session *session, bool export)
| Set exporting of system characteristics in OVAL results.
OSCAP_API void | oval_session::oval_session_set_remote_resources (struct oval_session *session, bool allowed, download_progress_calllback_t callback)
| Set property of remote content.
OSCAP_API void | oval_session::oval_session_configure_remote_resources (struct oval_session *session, bool allowed, const char *local_files, download_progress_calllback_t callback)
| Set property of remote content.
OSCAP_API void | oval_session::oval_session_free (struct oval_session *session)
| Destructor of an oval_session.

## Detailed Description

OVAL Session

This is a high level API for OVAL Definition content evaluation, collection of OVAL System Characteristics and analysing of OVAL Definitions and collected OVAL System Characteristics.

## Function Documentation

## oval_session_configure_remote_resources()

OSCAP_API void oval_session_configure_remote_resources | ( | struct oval_session * | session,
|  | bool | allowed,
|  | const char * | local_files,
|  | download_progress_calllback_t | callback )

Set property of remote content.

Parameters

  session | an oval_session
  allowed | Whether is download of remote resources allowed in this session (defaults to false)
  local_files | Allows to use a locally downloaded copy of the remote resources. Contains a path to a directory where the files are stored (defaults to NULL).
  callback | used to notify user about download proceeds. This might be safely set to NULL – ignoring user notification.

## oval_session_evaluate()

OSCAP_API int oval_session_evaluate | ( | struct oval_session * | session,
|  | agent_reporter | fn,
|  | void * | arg )

Evaluate OVAL Definitions.

Optionally you can set a callback function which will be called upon single evaluation. Use oval_result_definition_get_id to get the ID of the evaluated OVAL Definion and oval_result_definition_get_result, oval_result_get_text to get a text representation of the result.

Parameters

  session | an oval_session
  fn | a callback function
  arg | an optional argument for your callback function

Return values

  0 | on success
  1 | on an internal error (use oscap_err_desc or oscap_err_get_full_error to get more details)

## oval_session_evaluate_id()

OSCAP_API int oval_session_evaluate_id | ( | struct oval_session * | session,
|  | const char * | id,
|  | oval_result_t * | result )

Evaluate a specific OVAL Definition.

The result of the evaluation will be written into the result argument. You can convert it into a string representation with oval_result_get_text.

Parameters

  session | an oval_session
  id | id of an OVAL Definition
  result | variable to write the result into

Return values

  0 | on success
  1 | on an internal error (use oscap_err_desc or oscap_err_get_full_error to get more details)

## oval_session_export()

OSCAP_API int oval_session_export | ( | struct oval_session * | session | ) |

Export result to a file.

Results can be represented as OVAL System Characteristics if analyse has been done or OVAL Results if evaluation or collect has been done. If there aren't any filenames set or no operation was performed then this function has no effect.

Alse see: oval_session_set_results_export oval_session_set_report_export

Parameters

  session | an oval_session

Return values

  0 | on success
  1 | on an internal error (use oscap_err_desc or oscap_err_get_full_error to get more details)

## oval_session_free()

OSCAP_API void oval_session_free | ( | struct oval_session * | session | ) |

Destructor of an oval_session.

Parameters

  session | an oval_session to destroy

## oval_session_load()

OSCAP_API int oval_session_load | ( | struct oval_session * | session | ) |

Load OVAL Definitions and bind OVAL Variables to it if provided.

Validation if performed automatically if you've set it with oval_session_set_validation. if the validation failed then the function will print information about what line in what file isn't valid and why not.

Parameters

  session | an oval_session

Return values

  0 | on success
  1 | on an internal error (use oscap_err_desc or oscap_err_get_full_error to get more details)

## oval_session_new()

OSCAP_API struct oval_session * oval_session_new | ( | const char * | filename | ) |

Costructor of an oval_session.

It attempts to recognize a type of the filename which has to be a source datastream or OVAL Definitions.

Parameters

  filename | a path to an OVAL or source datastream file

Returns
  a newly created oval_session

Return values

  NULL | in case of an error (use oscap_err_desc or oscap_err_get_full_error to get more details)

## oval_session_set_component_id()

OSCAP_API void oval_session_set_component_id | ( | struct oval_session * | session,
|  | const char * | id )

Set ID of a particular OVAL component if there are two OVALs in one source datastream.

If the ID has been already set then it will be overwritten.

Parameters

  session | an oval_session
  id | an id of a definition

## oval_session_set_datastream_id()

OSCAP_API void oval_session_set_datastream_id | ( | struct oval_session * | session,
|  | const char * | id )

Set ID of a specific OVAL Definition in an source datastream.

If the ID has been already set then it will be overwritten. In case where there are two OVALs in one datastream use oval_session_set_component_id.

Parameters

  session | an oval_session
  id | an id of a definition

## oval_session_set_directives()

OSCAP_API void oval_session_set_directives | ( | struct oval_session * | session,
|  | const char * | filename )

Set OVAL Directives.

If a filename has been already set then it will be overwritten. If you pass NULL as filename argument then the currently set variables will be freed. Validation of the format will be perforemed when the oval_session_load is called.

Parameters

  session | an oval_session
  filename | a path to an OVAL Directives file

## oval_session_set_export_system_characteristics()

OSCAP_API void oval_session_set_export_system_characteristics | ( | struct oval_session * | session,
|  | bool | export )

Set exporting of system characteristics in OVAL results.

Parameters

  session | an oval_session
  export | false values indicated no system_characteristics in OVAL Results

## oval_session_set_remote_resources()

OSCAP_API void oval_session_set_remote_resources | ( | struct oval_session * | session,
|  | bool | allowed,
|  | download_progress_calllback_t | callback )

Set property of remote content.

Parameters

  session | an oval_session
  allowed | Whether is download of remote resources allowed in this session (defaults to false)
  callback | used to notify user about download proceeds. This might be safely set to NULL – ignoring user notification.

## oval_session_set_report_export()

OSCAP_API void oval_session_set_report_export | ( | struct oval_session * | session,
|  | const char * | filename )

Set a name of the file that the the OVAL Results, converted to HTML format, will be written into.

If the file's name has been already set for the current session then it will be overwritten.

Parameters

  session | an oval_session
  filename | a path to a new file

## oval_session_set_results_export()

OSCAP_API void oval_session_set_results_export | ( | struct oval_session * | session,
|  | const char * | filename )

Set a name of the file that the the OVAL Results will be written into.

If the file's name has been already set for the current session then it will be overwritten.

Parameters

  session | an oval_session
  filename | a path to a new file

## oval_session_set_validation()

OSCAP_API void oval_session_set_validation | ( | struct oval_session * | session,
|  | bool | validate,
|  | bool | full_validation )

Set XSD validation level.

Parameters

  session | an oval_session
  validate | false value indicates to skip any XSD validation
  full_validation | true value indicates that every possible step will be validated by XSD

## oval_session_set_variables()

OSCAP_API void oval_session_set_variables | ( | struct oval_session * | session,
|  | const char * | filename )

Set OVAL Variables.

If a filename has been already set then it will be overwritten. If you pass NULL as filename argument then the currently set variables will be freed. Validation of the format will be perforemed when the oval_session_load is called.

Parameters

  session | an oval_session
  filename | a path to an OVAL Variables file

## oval_session_set_xml_reporter()

OSCAP_API void oval_session_set_xml_reporter | ( | struct oval_session * | session,
|  | xml_reporter | fn )

Set XML validation reporter.

This function is called when there is something invalid in input/output XML file.

Parameters

  session | an oval_session
  fn | pointer to XML reporter function