policy_ext.c File Reference
`#include "policy.h"`
`#include "db_error.h"`
`#include "duration.h"`
`#include "log.h"`
`#include <string.h>`

Go to the source code of this file.

## Functions

int | policy_create_from_xml (policy_t *policy, xmlNodePtr policy_node)
int | policy_update_from_xml (policy_t *policy, xmlNodePtr policy_node, int *updated)
policy_key_list_t * | policy_get_policy_keys (const policy_t *policy)

## Function Documentation

## policy_create_from_xml()

int policy_create_from_xml | ( | policy_t * | policy,
|  | xmlNodePtr | policy_node
| ) |  |

Create a policy object from XML.

Parameters

  [in] | policy | a policy_t object being created.
  [in] | policy_node | a xmlNodePtr to the XML for the policy.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1216 of file policy_ext.c.

References DB_ERROR_UNKNOWN.

Referenced by policy_import().

## policy_get_policy_keys()

policy_key_list_t * policy_get_policy_keys | ( | const policy_t * | policy | ) |

Get the policy keys for a policy.

Parameters

  [in] | policy | a policy_t object.

Returns
  a policy_key_list_t pointer or NULL on error.

Definition at line 1241 of file policy_ext.c.

References db_object_connection(), db_value_not_empty(), policy::dbo, policy::id, and policy_key_list_new_get_by_policy_id().

## policy_update_from_xml()

int policy_update_from_xml | ( | policy_t * | policy,
|  | xmlNodePtr | policy_node,
|  | int * | updated
| ) |  |

Update a policy object from XML.

Parameters

  [in] | policy | a policy_t object being updated.
  [in] | policy_node | a xmlNodePtr to the XML for the policy.
  [out] | updated | an integer pointer that will be set to non-zero if any values in the policy was updated.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1227 of file policy_ext.c.

References DB_ERROR_UNKNOWN.

Referenced by policy_import().