dax.h File Reference

Main include file for libddl-access. More...

#include "ddl/dtypes.h"
#include "ddl/access-pub.h"
#include "junoscript/allocadup.h"
#include "dax_priv.h"

Defines

#define DAX_CHANGED_DELETED   (DAX_CHANGED|DAX_DELETED)
#define DAX_MAX_QUERY_DEPTH   30
 Maximum number of objects in database query.
#define DAX_QUERY_OK   0
 Query return OK.
#define DAX_QUERY_INVALID   -1
 Query was invalid.
#define DAX_QUERY_ABORT   -2
 Query aborted.
#define DAX_WALK_OK   DAX_QUERY_OK
 Walk return Ok.
#define DAX_WALK_ABORT   DAX_QUERY_ABORT
 Walk aborted.
#define DAX_NUM_OF(x)   ((sizeof(x))/(sizeof(x[0])))
#define DAX_GET_STRINGA_BY_NAME(pop, nm, s)   (s && dax_get_string_by_name(pop, nm, s) && (*s = ALLOCADUP(*s)))
 Gets a string value given a parent object and an attribute name.
#define DAX_GET_STRINGA_BY_AID(pop, aid, s)   (s && dax_get_string_by_aid(pop, aid, s) && (*s = ALLOCADUP(*s)))
 Gets a string value given a parent object and an attribute id.
#define DAX_GET_STRINGA_BY_DAP(dap, s)   (dax_get_string_by_dap(dap, s) && (*s = ALLOCADUPX(*s)))
 Gets a string value given an ddl_access_attribute_t pointer This MACRO allocates the string data on the stack using alloca.
#define DAX_GET_STRINGA_BY_DWD(dwd, var, attr, s)   (s && dax_get_string_by_dap(dwd, var, attr, s) && (*s = ALLOCADUP(*s)))
 Gets a string value given an dax_walk_data_p, the name of the variable in query, and an attribute name.

Typedefs

typedef dax_walk_data_s dax_walk_data_t
typedef int(* dax_walk_callback_t )(dax_walk_data_t *dwd, ddl_handle_t *dop, int action, void *data)
 Prototype for dax_walk_list/dax_query callback.

Enumerations

enum  dax_fetch_flag_t { DAX_NONE = 0, DAX_CHANGED = (1 << 0), DAX_DELETED = (1 << 1) }
 Flags used in dax_get_<type> functions. More...
enum  dax_walk_flag_t {
  DAX_WALK_NONE = 0, DAX_WALK_UNCHANGED = (1 << 0), DAX_WALK_CHANGED = (1 << 1), DAX_WALK_DELETED = (1 << 2),
  DAX_WALK_DELTA = (DAX_WALK_CHANGED | DAX_WALK_DELETED), DAX_WALK_CONFIGURED = (DAX_WALK_UNCHANGED | DAX_WALK_CHANGED), DAX_WALK_RECURSIVE = (1 << 3), DAX_WALK_ALL_OBJECTS = (1 << 4),
  DAX_WALK_ALL = 0xFF
}
 Flags used to control walking of lists. More...
enum  dax_list_action_t {
  DAX_ITEM_UNCHANGED = 1, DAX_ITEM_CHANGED = 2, DAX_ITEM_DELETE = 3, DAX_ITEM_DELETE_ALL = 4,
  DAX_ITEM_OPEN = 5, DAX_ITEM_CLOSE = 6
}
 Actions, used in list calbacks. More...

Functions

const char * dax_open_db (const char *fname, const char *dae_name, const char *pkg_name, uint seqnum, int check_only)
 Opens the configuration database.
const char * dax_open_db_with_flags (const char *fname, const char *dae_name, const char *pkg_name, uint seqnum, int check_only, uint8_t das_flags)
 Opens the configuration database.
const char * dax_close_db (void)
 Closes the database after performing internal checks.
u_int32_t dax_check_sequence (u_int32_t last)
 Returns the latest commit sequence number to the daemon.
int dax_daemon_not_configured (const char *name)
 Reads the configuration database and determines whether the daemon has been disabled because it is not configured.
void dax_error (ddl_handle_t *dop, const char *fmt,...)
 Issues an error message formatted with the path to the object that caused the error.
void dax_error_by_name (ddl_handle_t *dop, const char *nm, const char *fmt,...)
 Issues an error message formatted with the path to the name of the attribute that caused the error.
void dax_error_by_aid (ddl_handle_t *dop, ddl_attrid_t aid, const char *fmt,...)
 Issues a formatted error with the path to the attribute ID.
void dax_errorv (ddl_handle_t *dop, const char *fmt, va_list vap)
void dax_errorv_by_name (ddl_handle_t *dop, const char *nm, const char *fmt, va_list vap)
void dax_errorv_by_aid (ddl_handle_t *dop, ddl_attrid_t aid, const char *fmt, va_list vap)
char * dax_get_object_path (ddl_handle_t *dop, char *buf, size_t bufsiz)
 Returns the path to an object.
ddl_boolean_t dax_get_object_by_path (ddl_handle_t *root, const char *path[], ddl_handle_t **dop, ddl_boolean_t flags)
 Gets an object, given a root and a path.
ddl_boolean_t dax_is_changed (ddl_handle_t *dop)
 Determines whether the object or one of its children has changed.
ddl_boolean_t dax_is_attribute (ddl_handle_t *dop)
 Determines if a object is an attribute type.
ddl_boolean_t dax_is_element (ddl_handle_t *dop)
 Determines if a object is an element type.
ddl_boolean_t dax_is_object (ddl_handle_t *dop)
 Determines if a object is an object type.
ddl_boolean_t dax_is_container (ddl_handle_t *dop)
 Determines if a object is a container type.
ddl_boolean_t dax_get_name (ddl_handle_t *dop, const char **name)
 Gets the name of an object or attribute.
ddl_boolean_t dax_get_object_by_name (ddl_handle_t *pop, const char *attr_name, ddl_handle_t **r_dop, ddl_boolean_t flags)
 Gets an object, given a parent object pointer and an attribute name.
ddl_boolean_t dax_get_int_by_name (ddl_handle_t *pop, const char *name, int *val)
 Gets an integer value, given a parent object pointer and an attribute name.
ddl_boolean_t dax_get_uint_by_name (ddl_handle_t *pop, const char *name, uint *val)
 Gets an unsigned integer value, given a parent object pointer and an attribute name.
ddl_boolean_t dax_get_sbyte_by_name (ddl_handle_t *pop, const char *nm, char *val)
 Gets a signed byte value, given a parent object pointer and an attribute name.
ddl_boolean_t dax_get_short_by_name (ddl_handle_t *pop, const char *nm, short *val)
 Gets a signed short value, given a parent object pointer and an attribute name.
ddl_boolean_t dax_get_int64_by_name (ddl_handle_t *pop, const char *nm, int64_t *val)
 Gets a 64-bit integer value, given a parent object pointer and an attribute name.
ddl_boolean_t dax_get_ubyte_by_name (ddl_handle_t *pop, const char *nm, u_char *val)
 Gets an unsigned byte value, given a parent object pointer and an attribute name.
ddl_boolean_t dax_get_ushort_by_name (ddl_handle_t *pop, const char *nm, u_short *val)
 Gets an unsigned short value, given a parent object pointer and an attribute name.
ddl_boolean_t dax_get_uint64_by_name (ddl_handle_t *pop, const char *nm, u_int64_t *val)
 Gets an unsigned 64-bit integer value, given a parent object pointer and an attribute name.
ddl_boolean_t dax_get_string_by_name (ddl_handle_t *pop, const char *nm, char **val)
 Gets a string, given a parent object pointer and an attribute name.
ddl_boolean_t dax_get_stringr_by_name (ddl_handle_t *pop, const char *nm, char *val, size_t val_sz)
 Retrieves a string into a buffer, given a parent object pointer and an attribute name.
ddl_boolean_t dax_get_time_by_name (ddl_handle_t *pop, const char *nm, time_t *val)
 Gets a time_t value, given a parent object pointer and an attribute name.
ddl_boolean_t dax_get_toggle_by_name (ddl_handle_t *pop, const char *nm, char *val)
 Gets a toggle value, given a parent object pointer and an attribute name.
ddl_boolean_t dax_get_ipaddr_by_name (ddl_handle_t *pop, const char *nm, int *val_family, void *val_addr, const size_t addr_sz)
 Gets an IP address, given a parent object pointer and an attribute name.
ddl_boolean_t dax_get_ipprefix_by_name (ddl_handle_t *pop, const char *nm, int *val_family, void *val_addr, const size_t addr_sz, size_t *val_prefix_len)
 Gets an IP prefix, given a parent object pointer and an attribute name.
ddl_boolean_t dax_get_ipv4prefix_by_name (ddl_handle_t *pop, const char *nm, in_addr_t *addr, in_addr_t *mask)
 Gets an IPv4 prefix, given a parent object pointer and an attribute name.
ddl_boolean_t dax_get_ipv4prefixonly_by_name (ddl_handle_t *pop, const char *nm, in_addr_t *addr, in_addr_t *mask)
 Gets an IPv4 prefix, given a parent object pointer and an attribute name.
ddl_boolean_t dax_get_ipv4prefixmandatory_by_name (ddl_handle_t *pop, const char *nm, in_addr_t *addr, in_addr_t *mask)
 Gets an IPv4 prefix, given a parent object pointer and an attribute name.
ddl_boolean_t dax_get_delim_addr_by_name (ddl_handle_t *pop, const char *nm, u_char *val_addr, size_t addr_sz, const char base)
 Gets an delimited address, given a parent object pointer and an attribute name.
ddl_boolean_t dax_is_changed_by_name (ddl_handle_t *pop, const char *name)
 Returns whether an object was changed, given a parent object pointer and an attribute name.
ddl_boolean_t dax_is_configured_by_name (ddl_handle_t *pop, const char *name)
 Returns whether an object is configured, given a parent object pointer and an attribute name.
ddl_boolean_t dax_get_object_by_aid (ddl_handle_t *pop, ddl_attrid_t aid, ddl_handle_t **r_dop, ddl_boolean_t flags)
 Gets an object, given a parent object pointer and an attribute ID.
ddl_boolean_t dax_get_int_by_aid (ddl_handle_t *pop, ddl_attrid_t aid, int *val)
 Gets an integer value, given a parent object pointer and an attribute ID.
ddl_boolean_t dax_get_uint_by_aid (ddl_handle_t *pop, ddl_attrid_t aid, uint *val)
 Gets an unsigned integer value, given a parent object pointer and an attribute ID.
ddl_boolean_t dax_get_ulong_by_aid (ddl_handle_t *pop, ddl_attrid_t aid, unsigned long *val)
 Gets an unsigned long value, given a parent object pointer and an attribute ID.
ddl_boolean_t dax_get_sbyte_by_aid (ddl_handle_t *pop, ddl_attrid_t aid, char *val)
 Gets a signed byte, given a parent object pointer and an attribute ID.
ddl_boolean_t dax_get_short_by_aid (ddl_handle_t *pop, ddl_attrid_t aid, short *val)
 Gets a signed short value, given a parent object pointer and an attribute ID.
ddl_boolean_t dax_get_int64_by_aid (ddl_handle_t *pop, ddl_attrid_t aid, int64_t *val)
 Gets a signed 64-bit integer value, given a parent object pointer and an attribute ID.
ddl_boolean_t dax_get_ubyte_by_aid (ddl_handle_t *pop, ddl_attrid_t aid, u_char *val)
 Gets an unsigned byte, given a parent object pointer pointer and an attribute ID.
ddl_boolean_t dax_get_ushort_by_aid (ddl_handle_t *pop, ddl_attrid_t aid, u_short *val)
 Gets an unsigned short value, given a parent object pointer and an attribute ID.
ddl_boolean_t dax_get_uint64_by_aid (ddl_handle_t *pop, ddl_attrid_t aid, u_int64_t *val)
 Gets an unsigned 64-bit integer value, given a parent object pointer and an attribute ID.
ddl_boolean_t dax_get_string_by_aid (ddl_handle_t *pop, ddl_attrid_t aid, char **val)
 Gets a string, given a parent object pointer and an attribute ID (this version is not reentrant.
ddl_boolean_t dax_get_stringr_by_aid (ddl_handle_t *pop, ddl_attrid_t aid, char *val, size_t val_sz)
 Gets a string, given a parent object pointer and an attribute ID (this version is reentrant.
ddl_boolean_t dax_get_time_by_aid (ddl_handle_t *pop, ddl_attrid_t aid, time_t *val)
 Gets a time_t value, given a parent object pointer and an attribute ID.
ddl_boolean_t dax_get_toggle_by_aid (ddl_handle_t *pop, ddl_attrid_t aid, char *val)
 Gets a toggle value, given a parent object and an attribute ID.
ddl_boolean_t dax_get_ipaddr_by_aid (ddl_handle_t *pop, ddl_attrid_t aid, int *val_family, void *val_addr, const size_t addr_sz)
 Gets an IP address, given a parent object pointer and an attribute ID.
ddl_boolean_t dax_get_ipprefix_by_aid (ddl_handle_t *pop, ddl_attrid_t aid, int *val_family, void *val_addr, const size_t addr_sz, size_t *val_prefix_len)
 Gets an IP prefix, given a parent object pointer and an attribute ID.
ddl_boolean_t dax_get_ipv4prefix_by_aid (ddl_handle_t *pop, ddl_attrid_t aid, in_addr_t *addr, in_addr_t *mask)
 Gets an IPv4 prefix value, given a parent object pointer and an attribute ID.
ddl_boolean_t dax_get_ipv4prefixonly_by_aid (ddl_handle_t *pop, ddl_attrid_t aid, in_addr_t *addr, in_addr_t *mask)
 Gets an IPv4 prefix value, given a parent object pointer and an attribute ID.
ddl_boolean_t dax_get_ipv4prefixmandatory_by_aid (ddl_handle_t *pop, ddl_attrid_t aid, in_addr_t *addr, in_addr_t *mask)
 Gets an IPv4 prefix value, given a parent object pointer and an attribute ID.
ddl_boolean_t dax_get_delim_addr_by_aid (ddl_handle_t *pop, ddl_attrid_t aid, u_char *val_addr, size_t addr_sz, const char base)
 Gets an delimited address, given a parent object pointer and an attribute ID.
ddl_boolean_t dax_is_changed_by_aid (ddl_handle_t *pop, ddl_attrid_t aid)
 Returns whether the object pointed to by a parent object pointer and an attribute ID was changed.
ddl_boolean_t dax_is_configured_by_aid (ddl_handle_t *pop, ddl_attrid_t aid)
 Returns whether the object pointed to by a parent object pointer and an attribute ID is configured.
ddl_boolean_t dax_get_object_by_dwd (dax_walk_data_t *dwd, const char *val_name, const char *attr_name, ddl_handle_t **r_dop, ddl_boolean_t flags)
 Gets an object, given a dwd, a query variable name, and an attribute name.
ddl_boolean_t dax_get_int_by_dwd (dax_walk_data_t *dwd, const char *val_name, const char *attr_name, int *val)
 Gets a signed integer value, given a dwd, a query variable name, and an attribute name.
ddl_boolean_t dax_get_uint_by_dwd (dax_walk_data_t *dwd, const char *val_name, const char *attr_name, uint *val)
 Gets an unsigned integer value, given a dwd, a query variable name, and an attribute name.
ddl_boolean_t dax_get_sbyte_by_dwd (dax_walk_data_t *dwd, const char *val_name, const char *attr_name, char *val)
 Gets a signed byte value, given a pointer to the data found by a query, a query variable name, and an attribute name.
ddl_boolean_t dax_get_short_by_dwd (dax_walk_data_t *dwd, const char *val_name, const char *attr_name, short *val)
 Gets a signed short value, given a pointer to the data found by a query, a query variable name, and an attribute name.
ddl_boolean_t dax_get_int64_by_dwd (dax_walk_data_t *dwd, const char *val_name, const char *attr_name, int64_t *val)
 Gets a 64-bit integer, given a dwd, a query variable name, and an attribute name.
ddl_boolean_t dax_get_ubyte_by_dwd (dax_walk_data_t *dwd, const char *val_name, const char *attr_name, u_char *val)
 Gets an unsigned byte value, given a dwd, a query variable name, and an attribute name.
ddl_boolean_t dax_get_ushort_by_dwd (dax_walk_data_t *dwd, const char *val_name, const char *attr_name, u_short *val)
 Gets an unsigned short value, given a dwd, a query variable name, * and an attribute name.
ddl_boolean_t dax_get_uint64_by_dwd (dax_walk_data_t *dwd, const char *val_name, const char *attr_name, u_int64_t *val)
 Gets an unsigned 64-bit integer value, given a dwd, a query variable name, and an attribute name.
ddl_boolean_t dax_get_string_by_dwd (dax_walk_data_t *dwd, const char *val_name, const char *attr_name, char **val)
 Gets a string value, given a dwd, a query variable name, and an attribute name (this version is not reentrant.
ddl_boolean_t dax_get_stringr_by_dwd (dax_walk_data_t *dwd, const char *val_name, const char *attr_name, char *val, size_t val_sz)
 Gets a string, given a dwd, a query variable name, and an attribute name (this version is reentrant).
ddl_boolean_t dax_get_time_by_dwd (dax_walk_data_t *dwd, const char *val_name, const char *attr_name, time_t *val)
 Gets a time_t value, given a dwd, a query variable name, and an attribute name.
ddl_boolean_t dax_get_toggle_by_dwd (dax_walk_data_t *dwd, const char *val_name, const char *attr_name, char *val)
 Gets a toogle value, given a dwd, a query variable name, and an attribute name.
ddl_boolean_t dax_get_ipaddr_by_dwd (dax_walk_data_t *dwd, const char *val_name, const char *attr_name, int *val_family, void *val_addr, const size_t addr_sz)
 Gets an IP address, given a dwd, a query variable name, and an attribute name.
ddl_boolean_t dax_get_ipprefix_by_dwd (dax_walk_data_t *dwd, const char *val_name, const char *attr_name, int *val_family, void *val_addr, const size_t addr_sz, size_t *val_prefix_len)
 Gets an IP prefix, given a pointer to the data found by a query, a query variable name, and an attribute name.
ddl_boolean_t dax_get_ipv4prefix_by_dwd (dax_walk_data_t *dwd, const char *val_name, const char *attr_name, in_addr_t *addr, in_addr_t *mask)
 Gets an IPv4 prefix, given a dwd, a query variable name, and an attribute name.
ddl_boolean_t dax_get_ipv4prefixonly_by_dwd (dax_walk_data_t *dwd, const char *val_name, const char *attr_name, in_addr_t *addr, in_addr_t *mask)
 Gets an IPv4 prefix, given a dwd, a query variable name, and an attribute name.
ddl_boolean_t dax_get_ipv4prefixmandatory_by_dwd (dax_walk_data_t *dwd, const char *val_name, const char *attr_name, in_addr_t *addr, in_addr_t *mask)
 Gets an IPv4 prefix, given a dwd, a query variable name, and an attribute name.
ddl_boolean_t dax_get_delim_addr_by_dwd (dax_walk_data_t *dwd, const char *val_name, const char *attr_name, u_char *val_addr, size_t addr_sz, const char base)
 Gets an delimited address, given a parent object pointer and an opaque pointer.
ddl_boolean_t dax_get_object_by_dwd_var (dax_walk_data_t *dwd, const char *var_name, ddl_handle_t **val, ddl_boolean_t changed)
 Returns the object associated with a query variable name.
ddl_boolean_t dax_get_stringr_by_dwd_ident (dax_walk_data_t *dwd, const char *var, int indx, char *buf, size_t bufsz)
 Retrieves the deleted identifier from a dax_query() or dax_walk_list() callback.
ddl_boolean_t dax_get_parent_by_dwd (dax_walk_data_t *dwd, ddl_handle_t *dop, ddl_handle_t **parent)
 Retrieve the parent object of dop from dwd in a dax_walk_object() callback.
ddl_boolean_t dax_get_stringr_by_ident (ddl_object_t *dop, int n, char *buf, size_t bufsz)
 Retrieves the specified identifier for an element.
void dax_release_object (ddl_handle_t **dop)
 Releases the memory associated with an object.
void dax_make_ref (ddl_handle_t *dop)
 Bumps reference count for an object.
ddl_boolean_t dax_visit_container (ddl_handle_t *dop, ddl_handle_t **cop)
 Iterates through a container object.
int dax_query (ddl_handle_t *root, const char *query, dax_walk_flag_t flags, dax_walk_callback_t cb, void *cb_data)
 Searches the configuration database as specified by a query string.
int dax_query_by_path (ddl_handle_t *dop, const char **query, dax_walk_flag_t flags, dax_walk_callback_t cb, void *cb_data)
 Performs the same function as dax_query(), but takes an array of paths instead of a query string.
ddl_boolean_t dax_get_query_dop (dax_walk_data_t *dwd, const char *name, ddl_handle_t **dop)
 Retrieves the variables from a query.
int dax_walk_list (ddl_handle_t *dop, dax_walk_flag_t flags, dax_walk_callback_t func, void *caller_data)
 Traverses a container (list) object.
ddl_handle_t * dax_get_parent (ddl_handle_t *object)
 Returns the parent of an object.
void dax_init_dap (ddl_access_attribute_t *dap)
 Initialize the ddl_access_attribute_t structure.
void dax_release_dap (ddl_access_attribute_t *dap)
 Release the ddl_access_attribute_t structure.


Detailed Description

Main include file for libddl-access.


Define Documentation

#define DAX_GET_STRINGA_BY_AID pop,
aid,
 )     (s && dax_get_string_by_aid(pop, aid, s) && (*s = ALLOCADUP(*s)))
 

Gets a string value given a parent object and an attribute id.

This MACRO allocates the string data on the stack using alloca.

Parameters:
pop - parent object
aid - attribute id
s - pointer to string
Returns:
TRUE - if string is found.

FALSE - string not found.

#define DAX_GET_STRINGA_BY_DAP dap,
 )     (dax_get_string_by_dap(dap, s) && (*s = ALLOCADUPX(*s)))
 

Gets a string value given an ddl_access_attribute_t pointer This MACRO allocates the string data on the stack using alloca.

Parameters:
dap - ddl_access_attribute_t pointer
s - pointer to string
Returns:
TRUE - if string is found.

FALSE - string not found.

#define DAX_GET_STRINGA_BY_DWD dwd,
var,
attr,
 )     (s && dax_get_string_by_dap(dwd, var, attr, s) && (*s = ALLOCADUP(*s)))
 

Gets a string value given an dax_walk_data_p, the name of the variable in query, and an attribute name.

This is typically call from a dax_query() callback. The dwd, is the opaque data structure passed into the query callback.

This MACRO allocates the string data on the stack using alloca.

Parameters:
dwd - dax_walk_data_p, an opaque type
var - variable name, defined in query
attr - name of attribute under the 'variable-name'
s - pointer to string
Returns:
TRUE - if string is found.

FALSE - string not found.

#define DAX_GET_STRINGA_BY_NAME pop,
nm,
 )     (s && dax_get_string_by_name(pop, nm, s) && (*s = ALLOCADUP(*s)))
 

Gets a string value given a parent object and an attribute name.

This MACRO allocates the string data on the stack using alloca.

Parameters:
pop - parent object
nm - attribute name
s - pointer to string
Returns:
TRUE - if string is found.

FALSE - string not found.


Typedef Documentation

typedef int(* dax_walk_callback_t)(dax_walk_data_t *dwd, ddl_handle_t *dop, int action, void *data)
 

Prototype for dax_walk_list/dax_query callback.

Parameters:
[in] dwd Opaque pointer to the structure that holds the data.
[in] dop Pointer to the last item in the query.
[in] action Action used, of type dax_list_action_t.
[in] data Points to the user data received by the callback.
Returns:
One of:
  • DAX_QUERY_OK The query can proceed.
  • DAX_QUERY_ABORT The query aborts or is finished.


Enumeration Type Documentation

enum dax_fetch_flag_t
 

Flags used in dax_get_<type> functions.

Enumerator:
DAX_CHANGED  Object modified.
DAX_DELETED  Object deleted.

enum dax_list_action_t
 

Actions, used in list calbacks.

Enumerator:
DAX_ITEM_UNCHANGED  Specified item was unchanged.
DAX_ITEM_CHANGED  Specified item was changed or added.
DAX_ITEM_DELETE  Specified item was deleted.
DAX_ITEM_DELETE_ALL  All members of list were deleted.
DAX_ITEM_OPEN  Entering object/set.
DAX_ITEM_CLOSE  Exiting object/set.

enum dax_walk_flag_t
 

Flags used to control walking of lists.

Enumerator:
DAX_WALK_UNCHANGED  To walk unchanged configuration objects.
DAX_WALK_CHANGED  To walk changed configuration objects.
DAX_WALK_DELETED  To walk deleted configuration objects.
DAX_WALK_DELTA  To walk changed and deleted configuration objects.
DAX_WALK_CONFIGURED  To walk changed and unchanged configuration objects.
DAX_WALK_RECURSIVE  Only used for dax_walk_object.
DAX_WALK_ALL_OBJECTS  Only used for dax_walk_object.


Function Documentation

u_int32_t dax_check_sequence u_int32_t  last  ) 
 

Returns the latest commit sequence number to the daemon.

The dax_check_sequence() function returns the latest commit sequence number to the daemon.

Daemons use change bits to avoid rereading the entire database. However, a daemon cannot use change bits if the daemon becomes out of sync with the database. If the sequence numbers are off, any DAX function that tracks change bits see the bits set to TRUE. The dax_check_sequence() function returns a change counter that allows daemons to handle this situation.

For example, suppose two commits occur that change the database and both affect the daemon. The daemon does not handle the second SIGHUP until a third commit has occurred, which has modified the database change bits.

This function returns the current value of your daemon's commit sequence number. You use this number as the value of last the next time you call the function.

Note that the first time your daemon calls this function, the sequence number passed in is '0'. This tells the access routines to mark EVERYTHING as changed. Which is correct for a daemon that is just coming up into existance w/o any state.

Parameters:
[in] last The sequence number of the last call to dax_check_sequence().
Returns:
The sequence number of the last commit.

const char* dax_close_db void   ) 
 

Closes the database after performing internal checks.

The dax_close_db() function closes the database after performing internal checks.

Returns:
NULL on success, otherwise a pointer to an error message.

int dax_daemon_not_configured const char *  name  ) 
 

Reads the configuration database and determines whether the daemon has been disabled because it is not configured.

The dax_daemon_not_configured() function reads the configuration database and determines whether the daemon has been disabled because it is not configured.

A daemon is expected to exit when it receives a SIGTERM from the operating system. In some cases, the daemon is immediately started up again, so JUNOS leaves the daemon's kernel state intact. In others, the daemon is no longer configured, so it will not restart. In that case, it is necessary for the daemon to clean up any state from the kernel.

The dax_daemon_not_configured() function is designed for use in SIGTERM handlers to determine whether this cleanup is necessary. If it is, the daemon must clear the kernel state before being stopped.

Note:
The junos_daemon_init() function performs this verification, so you will rarely need to use this function.
Parameters:
name The name of the daemon to check.
Returns:
TRUE The daemon has been disabled because it is not configured.

void dax_error ddl_handle_t *  dop,
const char *  fmt,
  ...
 

Issues an error message formatted with the path to the object that caused the error.

The dax_error() function issues an error message formatted with the path to the object that caused the error.

Parameters:
[in] dop A pointer to the object that caused the error.
[in] fmt A format string.

void dax_error_by_aid ddl_handle_t *  dop,
ddl_attrid_t  aid,
const char *  fmt,
  ...
 

Issues a formatted error with the path to the attribute ID.

The dax_error_by_aid() function issues an error message formatted with the path to the attribute ID of the attribute that caused the error.

Parameters:
dop A pointer to the object to which the attribute belongs.
aid The attribute ID of the attribute; this parameter can be INVALID_ATTRID.
fmt A format string.

void dax_error_by_name ddl_handle_t *  dop,
const char *  name,
const char *  fmt,
  ...
 

Issues an error message formatted with the path to the name of the attribute that caused the error.

Parameters:
dop A pointer to the object to which the attribute belongs.
name The name of the attribute; this parameter can be NULL.
fmt A format string.

ddl_boolean_t dax_get_delim_addr_by_aid ddl_handle_t *  pop,
ddl_attrid_t  aid,
u_char *  val_addr,
size_t  addr_sz,
const char  base
 

Gets an delimited address, given a parent object pointer and an attribute ID.

The address is in delimited format.

The dax_get_delim_addr_by_aid() function returns the delimited address,given a parent object pointer and an attribute ID. Given that the delimited address can be of different lengths, the address retrieved is saved in the u_char pointer.

Parameters:
[in] pop A pointer to the parent object.
[in] aid The attribute ID of the attribute under the parent object.
[out] val_addr A pointer to the returned delimited address.
[in] addr_sz The size of the address.
[in] base decimal 'd' or hexadecimal 'x'
Returns:
TRUE The delimited address was found.

FALSE The delimited address was not found.

ddl_boolean_t dax_get_delim_addr_by_dwd dax_walk_data_t *  dwd,
const char *  var_name,
const char *  attr_name,
u_char *  val_addr,
size_t  addr_sz,
const char  base
 

Gets an delimited address, given a parent object pointer and an opaque pointer.

The address is in delimited format.

The dax_get_delim_addr_by_dwd() function returns the delimited address,given a parent object pointer and an opaque pointer. Given that the delimited address can be of different lengths, the address retrieved is saved in the u_char pointer.

Parameters:
[in] pop A pointer to the parent object.
[in] dwd An opaque pointer that was passed to the callback associated with dax_query().
[out] val_addr A pointer to the returned delimited address.
[in] addr_sz The size of the address.
[in] base decimal 'd' or hexadecimal 'x'
Returns:
TRUE The delimited address was found.

FALSE The delimited address was not found.

ddl_boolean_t dax_get_delim_addr_by_name ddl_handle_t *  pop,
const char *  name,
u_char *  val_addr,
size_t  addr_sz,
const char  base
 

Gets an delimited address, given a parent object pointer and an attribute name.

The address is in delimited format.

The dax_get_delim_addr_by_name() function returns the delimited address,given a parent object pointer and an attribute name. Given that the delimited address can be of different lengths, the address retrieved is saved in the u_char pointer.

Parameters:
[in] pop A pointer to the parent object.
[in] name The attribute name.
[out] val_addr A pointer to the returned delimited address.
[in] addr_sz The size of the address.
[in] base decimal 'd' or hexadecimal 'x'
Returns:
TRUE The delimited address was found.

FALSE The delimited address was not found.

ddl_boolean_t dax_get_int64_by_aid ddl_handle_t *  pop,
ddl_attrid_t  aid,
int64_t *  val
 

Gets a signed 64-bit integer value, given a parent object pointer and an attribute ID.

The dax_get_int64_by_aid() function gets a signed 64-bit integer value, given a parent object pointer and an attribute ID.

Parameters:
[in] pop A pointer to the parent object.
[in] aid The attribute ID.
[out] val A pointer to returned signed 64-bit integer.
Returns:
TRUE The signed 64-bit integer was found.

FALSE The signed 64-bit integer was not found.

ddl_boolean_t dax_get_int64_by_dwd dax_walk_data_t *  dwd,
const char *  var_name,
const char *  attr_name,
int64_t *  val
 

Gets a 64-bit integer, given a dwd, a query variable name, and an attribute name.

The dax_get_int64_by_dwd() function returns a 64-bit integer value, given a dwd, a query variable name, and an attribute name.

Parameters:
[in] dwd An opaque pointer that was passed to the callback associated with dax_query().
[in] var_name The name of the variable that contains the query string passed to dax_query().
[in] attr_name The name of the attribute under the object that was retrieved by the var_name query.
[out] val A pointer to the returned signed 64-bit integer.
Returns:
TRUE The signed 64-bit integer was found.

FALSE The signed 64-bit integer was not found.

See also:
dax_query()

ddl_boolean_t dax_get_int64_by_name ddl_handle_t *  pop,
const char *  name,
int64_t *  val
 

Gets a 64-bit integer value, given a parent object pointer and an attribute name.

The dax_get_int64_by_name() function returns a 64-bit integer value, given a parent object pointer and an attribute name.

Parameters:
[in] pop A pointer to the parent object.
[in] name The attribute name.
[out] val A pointer to the returned 64-bit integer value.
Returns:
TRUE The 64-bit integer was found.

FALSE The 64-bit integer was not found.

ddl_boolean_t dax_get_int_by_aid ddl_handle_t *  pop,
ddl_attrid_t  aid,
int *  val
 

Gets an integer value, given a parent object pointer and an attribute ID.

The dax_get_int_by_aid() function gets a signed integer value, given a parent object pointer and an attribute ID.

Parameters:
[in] pop A pointer to the parent object.
[in] aid The attribute ID.
[out] val A pointer to the returned signed integer.
Returns:
TRUE The integer was found.

FALSE The integer was not found.

ddl_boolean_t dax_get_int_by_dwd dax_walk_data_t *  dwd,
const char *  var_name,
const char *  attr_name,
int *  val
 

Gets a signed integer value, given a dwd, a query variable name, and an attribute name.

The dax_get_int_by_dwd() function returns a signed integer value, given a dwd, a query variable name, and an attribute name.

Parameters:
[in] dwd An opaque pointer that was passed to the callback associated with dax_query().
[in] var_name The name of the variable that contains the query string passed to dax_query().
[in] attr_name The name of the attribute under the object that was retrieved by the var_name query.
[out] val A pointer to the returned signed integer value.
Returns:
TRUE The signed integer was found.

FALSE The signed integer was not found.

See also:
dax_query()

ddl_boolean_t dax_get_int_by_name ddl_handle_t *  pop,
const char *  name,
int *  val
 

Gets an integer value, given a parent object pointer and an attribute name.

The dax_get_int_by_name() function returns an integer value, given a parent object pointer and an attribute name.

Parameters:
[in] pop A pointer to the parent object.
[in] name The attribute name.
[out] val A pointer to the returned signed integer.
Returns:
TRUE The integer value was found.

FALSE The integer value was not found.

ddl_boolean_t dax_get_ipaddr_by_aid ddl_handle_t *  pop,
ddl_attrid_t  aid,
int *  val_af,
void *  val_addr,
const size_t  addr_sz
 

Gets an IP address, given a parent object pointer and an attribute ID.

The dax_get_ipaddr_by_aid() function gets an IP address, given a parent object pointer and an attribute ID. The returned IP address is in network-byte order.

Parameters:
[in] pop A pointer to the parent object.
[in] aid The attribute ID of the attribute under the parent object.
[out] val_af A pointer to the returned address family (AF_INET, AF_INET6).
[out] val_addr A pointer to the returned IP address. Returned in network-byte order.
[in] addr_sz The size of the address.
Returns:
TRUE The IP address was found.

FALSE The IP address was not found.

ddl_boolean_t dax_get_ipaddr_by_dwd dax_walk_data_t *  dwd,
const char *  var_name,
const char *  attr_name,
int *  val_family,
void *  val_addr,
const size_t  addr_sz
 

Gets an IP address, given a dwd, a query variable name, and an attribute name.

The dax_get_ipaddr_by_dwd() function returns an IP address, given a dwd, a query variable name, and an attribute name. The returned address in network-byte order.

Parameters:
[in] dwd An opaque pointer that was passed to the callback associated with dax_query().
[in] var_name The name of the variable that contains the query string passed to dax_query().
[in] attr_name The name of the attribute under the object that was retrieved by the var_name query.
[in] attr_name The name of the attribute under the object that was retrieved by the var_name query.
[out] val_family The address family (AF_INET, AF_INET6).
[out] val_addr A pointer to the returned IP address. Returned in network-byte order.
[out] addr_sz The size of the val_addr address.
Returns:
TRUE The IP address was found.

FALSE The IP address was not found.

See also:
dax_query()

ddl_boolean_t dax_get_ipaddr_by_name ddl_handle_t *  pop,
const char *  name,
int *  val_family,
void *  val_addr,
const size_t  addr_sz
 

Gets an IP address, given a parent object pointer and an attribute name.

The dax_get_ipaddr_by_name() function returns an IP address, given a parent object pointer and an attribute name. The returned address is in network-byte order.

Parameters:
[in] pop A pointer to the parent object.
[in] name The attribute name.
[out] val_family A pointer to the returned address family (AF_INET, AF_INET6).
[out] val_addr A pointer to the returned IP address. Returned in network-byte order.
[in] addr_sz The size of the address.
Returns:
TRUE The IP address was found.

FALSE The IP address was not found.

ddl_boolean_t dax_get_ipprefix_by_aid ddl_handle_t *  pop,
ddl_attrid_t  aid,
int *  val_af,
void *  val_addr,
const size_t  addr_sz,
size_t *  val_pfx_len
 

Gets an IP prefix, given a parent object pointer and an attribute ID.

The dax_get_ipprefix_by_aid() function gets an IP prefix, given a parent object pointer and an attribute ID. The returned IP prefix is in network-byte order.

Note:
If the object you are fetching is an IPv4 prefix, the function dax_get_ipv4prefix_by_aid() is more efficient.
Parameters:
[in] pop A pointer to the parent object.
[in] aid The attribute ID of the attribute under the parent object.
[out] val_af A pointer to the returned address family (AF_INET, AF_INET6).
[out] val_addr A pointer to a returned sockaddr structure.
[in] addr_sz The size of val_addr.
[out] val_pfx_len A pointer to the returned length of the prefix. The pointer can be NULL.
Returns:
TRUE The IP prefix was found.

FALSE The IP prefix was not found.

ddl_boolean_t dax_get_ipprefix_by_dwd dax_walk_data_t *  dwd,
const char *  var_name,
const char *  attr_name,
int *  val_af,
void *  val_addr,
const size_t  addr_sz,
size_t *  val_pfx_len
 

Gets an IP prefix, given a pointer to the data found by a query, a query variable name, and an attribute name.

The dax_get_ipprefix_by_dwd() function returns an IP prefix, given a dwd, a query variable name, and an attribute name. The returned prefix is in network-byte order.

Note:
If the object you are fetching is an IPv4 prefix, the function dax_get_ipv4prefix_by_dwd() is more efficient.
Parameters:
[in] dwd An opaque pointer that was passed to the callback associated with dax_query().
[in] var_name The name of the variable that contains the query string passed to dax_query().
[in] attr_name The name of the attribute under the object that was retrieved by the var_name query.
[out] val_af The address family (AF_INET, AF_INET6).
[out] val_addr A pointer to the returned sockaddr structure. Returned in network-byte order.
[out] addr_sz The size of the val_addr address.
[out] val_pfx_len The length of the prefix. The value can be 0.

ddl_boolean_t dax_get_ipprefix_by_name ddl_handle_t *  pop,
const char *  name,
int *  val_af,
void *  val_addr,
const size_t  addr_sz,
size_t *  val_pfx_len
 

Gets an IP prefix, given a parent object pointer and an attribute name.

Note:
If the object you are fetching is an IPv4 prefix, the function dax_get_ipv4prefix_by_name() is more efficient.
The dax_get_ipprefix_by_name() function returns an IP prefix, given a parent object pointer and an attribute name. The returned prefix is in network-byte order.

Parameters:
[in] pop A pointer to the parent object.
[in] name The attribute name.
[out] val_af A pointer to the returned address family (AF_INET, AF_INET6).
[out] val_addr A pointer to the returned sockaddr structure. Returned in network-byte order.
[in] addr_sz The size of the address structure.
[out] val_pfx_len The length of the prefix. The value can be NULL.
Returns:
TRUE The IP prefix was found.

FALSE The IP prefix was not found.

ddl_boolean_t dax_get_ipv4prefix_by_aid ddl_handle_t *  pop,
ddl_attrid_t  aid,
in_addr_t *  addr,
in_addr_t *  mask
 

Gets an IPv4 prefix value, given a parent object pointer and an attribute ID.

The dax_get_ipv4prefix_by_aid() function gets an IPv4 prefix value, given a parent object pointer and an attribute ID. The returned prefix is in network-byte order.

This access function can be used for objects of type ipv4prefix. This access function can not be used for objects of type ipv4prefix-only or ipv4prefix-mandatory. For ipv4prefix-only use dax_get_ipv4prefixonly_by_aid For ipv4prefix-mandatory use dax_get_ipv4prefixmandatory_by_aid

Parameters:
[in] pop A pointer to the parent object.
[in] aid The attribute ID of the attribute under the parent object.
[out] addr A pointer to the returned address. Returned in network-byte order.
[out] mask A pointer to the returned mask.
Returns:
TRUE The IPv4 prefix value was found.

FALSE The IPv4 prefix value was not found.

ddl_boolean_t dax_get_ipv4prefix_by_dwd dax_walk_data_t *  dwd,
const char *  var_name,
const char *  attr_name,
in_addr_t *  addr,
in_addr_t *  mask
 

Gets an IPv4 prefix, given a dwd, a query variable name, and an attribute name.

The dax_get_ipv4prefix_by_dwd() function returns an IPv4 prefix, given a dwd, a query variable name, and an attribute name. The returned prefix is in network-byte order.

This access function can be used for objects of type ipv4prefix. This access function can not be used for objects of type ipv4prefix-only or ipv4prefix-mandatory. For ipv4prefix-only use dax_get_ipv4prefixonly_by_dwd For ipv4prefix-mandatory use dax_get_ipv4prefixmandatory_by_dwd

Parameters:
[in] dwd An opaque pointer that was passed to the callback associated with dax_query().
[in] var_name The name of the variable that contains the query string passed to dax_query().
[in] attr_name The name of the attribute under the object that was retrieved by the var_name query.
[out] addr A pointer to the returned address. Returned in network-byte order.
[out] mask A pointer to the returned mask.
Returns:
TRUE The IPv4 prefix was found.

FALSE The IPv4 prefix was not found.

ddl_boolean_t dax_get_ipv4prefix_by_name ddl_handle_t *  pop,
const char *  name,
in_addr_t *  addr,
in_addr_t *  mask
 

Gets an IPv4 prefix, given a parent object pointer and an attribute name.

The dax_get_ipv4prefix_by_name() function returns an IPv4 prefix, given a parent object pointer and an attribute name. The returned prefix is in network-byte order.

This access function can be used for objects of type ipv4prefix. This access function can not be used for objects of type ipv4prefix-only or ipv4prefix-mandatory. For ipv4prefix-only use dax_get_ipv4prefixonly_by_name For ipv4prefix-mandatory use dax_get_ipv4prefixmandatory_by_name

Parameters:
[in] pop A pointer to the parent object.
[in] name The attribute name.
[out] addr A pointer to the returned address. Returned in network-byte order.
[out] mask A pointer to the returned mask.
Returns:
TRUE The IPv4 prefix was found.

FALSE The IPv4 prefix was not found.

ddl_boolean_t dax_get_ipv4prefixmandatory_by_aid ddl_handle_t *  pop,
ddl_attrid_t  aid,
in_addr_t *  addr,
in_addr_t *  mask
 

Gets an IPv4 prefix value, given a parent object pointer and an attribute ID.

The dax_get_ipv4prefixmandatory_by_aid() function gets an IPv4 prefix value, given a parent object pointer and an attribute ID. The returned prefix is in network-byte order.

This access function can be used for objects of type ipv4prefix-mandatory. This access function can not be used for objects of type ipv4prefix-only or ipv4prefix. For ipv4prefix-only use dax_get_ipv4prefixonly_by_aid For ipv4prefix use dax_get_ipv4prefix_by_aid

Parameters:
[in] pop A pointer to the parent object.
[in] aid The attribute ID of the attribute under the parent object.
[out] addr A pointer to the returned address. Returned in network-byte order.
[out] mask A pointer to the returned mask.
Returns:
TRUE The IPv4 prefix value was found.

FALSE The IPv4 prefix value was not found.

ddl_boolean_t dax_get_ipv4prefixmandatory_by_dwd dax_walk_data_t *  dwd,
const char *  var_name,
const char *  attr_name,
in_addr_t *  addr,
in_addr_t *  mask
 

Gets an IPv4 prefix, given a dwd, a query variable name, and an attribute name.

The dax_get_ipv4prefixmandatory_by_dwd() function returns an IPv4 prefix, given a dwd, a query variable name, and an attribute name. The returned prefix is in network-byte order.

This access function can be used for objects of type ipv4prefix-mandatory. This access function can not be used for objects of type ipv4prefix or ipv4prefix-only. For ipv4prefix use dax_get_ipv4prefix_by_dwd For ipv4prefix-only use dax_get_ipv4prefixonly_by_dwd

Parameters:
[in] dwd An opaque pointer that was passed to the callback associated with dax_query().
[in] var_name The name of the variable that contains the query string passed to dax_query().
[in] attr_name The name of the attribute under the object that was retrieved by the var_name query.
[out] addr A pointer to the returned address. Returned in network-byte order.
[out] mask A pointer to the returned mask.
Returns:
TRUE The IPv4 prefix was found.

FALSE The IPv4 prefix was not found.

ddl_boolean_t dax_get_ipv4prefixmandatory_by_name ddl_handle_t *  pop,
const char *  name,
in_addr_t *  addr,
in_addr_t *  mask
 

Gets an IPv4 prefix, given a parent object pointer and an attribute name.

The dax_get_ipv4prefixmandatory_by_name() function returns an IPv4 prefix, given a parent object pointer and an attribute name. The returned prefix is in network-byte order.

This access function can be used for objects of type ipv4prefix-mandatory. This access function can not be used for objects of type ipv4prefix or ipv4prefix-only. For ipv4prefix use dax_get_ipv4prefix_by_name For ipv4prefix-only use dax_get_ipv4prefixonly_by_name

Parameters:
[in] pop A pointer to the parent object.
[in] name The attribute name.
[out] addr A pointer to the returned address. Returned in network-byte order.
[out] mask A pointer to the returned mask.
Returns:
TRUE The IPv4 prefix was found.

FALSE The IPv4 prefix was not found.

ddl_boolean_t dax_get_ipv4prefixonly_by_aid ddl_handle_t *  pop,
ddl_attrid_t  aid,
in_addr_t *  addr,
in_addr_t *  mask
 

Gets an IPv4 prefix value, given a parent object pointer and an attribute ID.

The dax_get_ipv4prefixonly_by_aid() function gets an IPv4 prefix value, given a parent object pointer and an attribute ID. The returned prefix is in network-byte order.

This access function can be used for objects of type ipv4prefix-only. This access function can not be used for objects of type ipv4prefix or ipv4prefix-mandatory. For ipv4prefix use dax_get_ipv4prefix_by_aid For ipv4prefix-mandatory use dax_get_ipv4prefixmandatory_by_aid

Parameters:
[in] pop A pointer to the parent object.
[in] aid The attribute ID of the attribute under the parent object.
[out] addr A pointer to the returned address. Returned in network-byte order.
[out] mask A pointer to the returned mask.
Returns:
TRUE The IPv4 prefix value was found.

FALSE The IPv4 prefix value was not found.

ddl_boolean_t dax_get_ipv4prefixonly_by_dwd dax_walk_data_t *  dwd,
const char *  var_name,
const char *  attr_name,
in_addr_t *  addr,
in_addr_t *  mask
 

Gets an IPv4 prefix, given a dwd, a query variable name, and an attribute name.

The dax_get_ipv4prefixonly_by_dwd() function returns an IPv4 prefix, given a dwd, a query variable name, and an attribute name. The returned prefix is in network-byte order.

This access function can be used for objects of type ipv4prefix-only. This access function can not be used for objects of type ipv4prefix or ipv4prefix-mandatory. For ipv4prefix use dax_get_ipv4prefix_by_dwd For ipv4prefix-mandatory use dax_get_ipv4prefixmandatory_by_dwd

Parameters:
[in] dwd An opaque pointer that was passed to the callback associated with dax_query().
[in] var_name The name of the variable that contains the query string passed to dax_query().
[in] attr_name The name of the attribute under the object that was retrieved by the var_name query.
[out] addr A pointer to the returned address. Returned in network-byte order.
[out] mask A pointer to the returned mask.
Returns:
TRUE The IPv4 prefix was found.

FALSE The IPv4 prefix was not found.

ddl_boolean_t dax_get_ipv4prefixonly_by_name ddl_handle_t *  pop,
const char *  name,
in_addr_t *  addr,
in_addr_t *  mask
 

Gets an IPv4 prefix, given a parent object pointer and an attribute name.

The dax_get_ipv4prefixonly_by_name() function returns an IPv4 prefix, given a parent object pointer and an attribute name. The returned prefix is in network-byte order.

This access function can be used for objects of type ipv4prefix-only. This access function can not be used for objects of type ipv4prefix or ipv4prefix-mandatory. For ipv4prefix use dax_get_ipv4prefix_by_name For ipv4prefix-mandatory use dax_get_ipv4prefixmandatory_by_name

Parameters:
[in] pop A pointer to the parent object.
[in] name The attribute name.
[out] addr A pointer to the returned address. Returned in network-byte order.
[out] mask A pointer to the returned mask.
Returns:
TRUE The IPv4 prefix was found.

FALSE The IPv4 prefix was not found.

ddl_boolean_t dax_get_name ddl_handle_t *  dop,
const char **  name
 

Gets the name of an object or attribute.

The dax_get_name() function, given a DDL attribute pointer (dap), returns a pointer to a string that contains the name of an object or attribute.

Parameters:
[in] dop The object pointer.
[in] name A pointer to the buffer that receives the name.
Returns:
TRUE The name was found.

FALSE The name was not found.

ddl_boolean_t dax_get_object_by_aid ddl_handle_t *  pop,
ddl_attrid_t  aid,
ddl_handle_t **  val,
ddl_boolean_t  changed
 

Gets an object, given a parent object pointer and an attribute ID.

The dax_get_object_by_aid() function returns a pointer to an object, given a parent object pointer and an attribute ID.

Note:
If the function succeeds (returns TRUE), you must release the returned object pointer by calling dax_release_object().
Parameters:
[in] pop A pointer to the parent object.
[in] aid The attribute ID under the parent object.
[out] val A pointer to the returned object pointer.
[in] changed An input value of TRUE indicates that the function should return TRUE only if the object's change bit is set. The change bit is set only if one if the object's descendants has been modified, deleted, or inserted.
Returns:
TRUE The object was found. If the input parameter changed is TRUE, the function returns TRUE only if the object is changed.

FALSE The object was not found; or if the input parameter changed was TRUE, the object may have been found but was unchanged.

ddl_boolean_t dax_get_object_by_dwd dax_walk_data_t *  dwd,
const char *  var_name,
const char *  attr_name,
ddl_handle_t **  val,
ddl_boolean_t  changed
 

Gets an object, given a dwd, a query variable name, and an attribute name.

The dax_get_object_by_dwd() function returns a pointer to an object, given a pointer (dwd) to the data found by a query, a query variable name, and an attribute name.

Note:
You must release the returned object (pointed to by dop) by calling dax_release_object().
Parameters:
[in] dwd An opaque pointer that was passed to the callback associated with dax_query().
[in] var_name The name of the variable that contains the query string passed to dax_query().
[in] attr_name The name of the attribute under the object that was retrieved by the var_name query.
[out] val A pointer to the returned object pointer.
[in] changed An input value of TRUE indicates that the function should return TRUE only if the object's change bit is set. The change bit is set only if one if the object's descendants has been modified, deleted, or inserted.
Returns:
TRUE The object was found. If changed is TRUE, the object's change bit is set.

FALSE The object was not found or was not changed.

See also:
dax_query()

ddl_boolean_t dax_get_object_by_dwd_var dax_walk_data_t *  dwd,
const char *  var_name,
ddl_handle_t **  val,
ddl_boolean_t  changed
 

Returns the object associated with a query variable name.

The dax_get_object_by_dwd_var() function returns the object associated with a query variable name.

Note:
You must release the returned object (pointed to by val) by calling dax_release_object().
Parameters:
[in] dwd An opaque pointer that was passed to the callback associated with dax_query().
[in] var_name The name of the variable that contains the query string passed to dax_query().
[out] val A pointer to the returned object pointer.
[in] changed An input value of TRUE indicates that the function should return TRUE only if the object's change bit is set. The change bit is set only if one if the object's descendants has been modified, deleted, or inserted.
Returns:
TRUE The object was found. If changed is TRUE, the object's change bit is set.

FALSE The object was not found, or the object was not changed.

See also:
dax_query()

ddl_boolean_t dax_get_object_by_name ddl_handle_t *  pop,
const char *  name,
ddl_handle_t **  val,
ddl_boolean_t  changed
 

Gets an object, given a parent object pointer and an attribute name.

The dax_get_object_by_name() function returns a pointer to an object, given a pointer to the parent object and the name of an attribute of the parent object.

Note:
If a call to this function succeeds (returns TRUE), you must release the returned object pointer by calling dax_release_object().
Parameters:
[in] pop A pointer to the parent object.
[in] name The attribute name of the attribute under the parent object.
[out] val A pointer to the returned object pointer.
[in] changed An input value of TRUE indicates that the function should return TRUE only if the object's change bit is set. The change bit is set only if one if the object's descendants has been modified, deleted, or inserted.
Returns:
TRUE The object was found. If the input parameter changed is TRUE, the function returns TRUE only if the object is changed.

FALSE The object was not found; or if the input parameter changed was TRUE, the object may have been found but was unchanged.

ddl_boolean_t dax_get_object_by_path ddl_handle_t *  root,
const char *  path[],
ddl_handle_t **  r_dop,
ddl_boolean_t  changed
 

Gets an object, given a root and a path.

The dax_get_object_by_path() function gets an object, given a root object at which to start the trace and a path to the desired object.

Note:
If a call to this function succeeds (returns TRUE), you must release the returned object pointer by calling dax_release_object().
Parameters:
[in] root The root object for the trace path; you typically pass NULL to start from the base of the configuration hierarchy.
[in] path A null-terminated array of strings containing the path to the desired object.
[out] r_dop This pointer is set to the found object, regardless of whether or not the object was changed.
[in] changed An input value of TRUE indicates that the function should return TRUE only if the object has its change bit set. The change bit is set only if one of the object's descendants has been modified, deleted, or inserted.
Returns:
TRUE The object was found. If the input parameter changed is TRUE, the function returns TRUE only if the object is changed.

FALSE The object was not found; or if the input parameter changed was TRUE, the object may have been found but was unchanged.

char* dax_get_object_path ddl_handle_t *  dop,
char *  buf,
size_t  bufsiz
 

Returns the path to an object.

The dax_get_object_path() function returns the path to an object.

Parameters:
[in] dop A pointer to the object of interest.
[in] buf A pointer to a buffer to store the returned path.
[in] bufsiz The size of the buffer.
Returns:
If successful, a pointer to the object's buffer.

NULL if unsuccessful.

ddl_handle_t* dax_get_parent ddl_handle_t *  object  ) 
 

Returns the parent of an object.

The dax_get_parent() function returns the parent of an object.

Parameters:
[in] object The object for which to return the parent.
Returns:
A pointer to the parent object.
Note:
You must release the returned object by calling dax_release_object().
See also:
dax_release_object()

ddl_boolean_t dax_get_parent_by_dwd dax_walk_data_t *  dwd,
ddl_handle_t *  dop,
ddl_handle_t **  parent
 

Retrieve the parent object of dop from dwd in a dax_walk_object() callback.

The dax_get_parent_by_dwd() function retrieves the parent dop from a dax_walk_object() callback.

This API does same function as dax_get_parent(). But dax_get_parent() can traverse up the groups hierarchy which daemons shouldn't read. This API takes care of this issue.

Parameters:
[in] dwd An opaque pointer that was passed to the callback associated with dax_walk_object() and is passed internally to dax_walk_* functions.
[in] dop The object for which to return the parent.
[out] parent A pointer to hold the parent dop.
Returns:
TRUE if the parent is found; FALSE otherwise.

ddl_boolean_t dax_get_query_dop dax_walk_data_t *  dwd,
const char *  name,
ddl_handle_t **  dop
 

Retrieves the variables from a query.

The dax_get_query_dop() function retrieves the dop for each variable that was defined in a query string with $unit.

Parameters:
[in] dwd An opaque pointer that was returned to the callback associated with dax_query().
[in] name The name of the query variable defined in the query string with $UNIT.
[out] dop A pointer to the returned object pointer.
Note:
You must release the returned object (pointed to by dop) by calling dax_release_object().
Returns:
TRUE The variable was found and allocated to dop.

FALSE The variable was not found; dop is unmodified.

ddl_boolean_t dax_get_sbyte_by_aid ddl_handle_t *  pop,
ddl_attrid_t  aid,
char *  val
 

Gets a signed byte, given a parent object pointer and an attribute ID.

The dax_get_sbyte_by_aid() function gets a signed byte, given a parent object pointer and an attribute ID.

Parameters:
[in] pop A pointer to the parent object.
[in] aid The attribute ID.
[out] val A pointer to the returned signed byte.
Returns:
TRUE The signed byte was found.

FALSE The signed byte was not found.

ddl_boolean_t dax_get_sbyte_by_dwd dax_walk_data_t *  dwd,
const char *  var_name,
const char *  attr_name,
char *  val
 

Gets a signed byte value, given a pointer to the data found by a query, a query variable name, and an attribute name.

The dax_get_sbyte_by_dwd() function returns a signed byte value, given a dwd, a query variable name, and an attribute name.

Parameters:
[in] dwd An opaque pointer that was passed to the callback associated with dax_query().
[in] var_name The name of the variable that contains the query string passed to dax_query().
[in] attr_name The name of the attribute under the object that was retrieved by the var_name query.
[out] val A pointer to the returned signed byte value.
Returns:
TRUE The signed byte value was found.

FALSE The signed byte value was not found.

See also:
dax_query()

ddl_boolean_t dax_get_sbyte_by_name ddl_handle_t *  pop,
const char *  name,
char *  val
 

Gets a signed byte value, given a parent object pointer and an attribute name.

The dax_get_sbyte_by_name() function returns a signed byte value, given a parent object pointer and an attribute name.

Parameters:
[in] pop A pointer to the parent object.
[in] name The attribute name.
[out] val A pointer to the returned signed byte.
Returns:
TRUE The signed byte value was found.

FALSE The signed byte value was not found.

ddl_boolean_t dax_get_short_by_aid ddl_handle_t *  pop,
ddl_attrid_t  aid,
short *  val
 

Gets a signed short value, given a parent object pointer and an attribute ID.

The dax_get_short_by_aid() function gets a signed short value, given a parent object pointer and an attribute ID.

Parameters:
[in] pop A pointer to the parent object.
[in] aid The attribute ID.
[out] val A pointer to the returned signed short.
Returns:
TRUE The signed short was found.

FALSE The signed short was not found.

ddl_boolean_t dax_get_short_by_dwd dax_walk_data_t *  dwd,
const char *  var_name,
const char *  attr_name,
short *  val
 

Gets a signed short value, given a pointer to the data found by a query, a query variable name, and an attribute name.

The dax_get_short_by_dwd() function returns a signed short value, given a dwd, a query variable name, and an attribute name.

Parameters:
[in] dwd An opaque pointer that was passed to the callback associated with dax_query().
[in] var_name The name of the variable that contains the query string passed to dax_query().
[in] attr_name The name of the attribute under the object that was retrieved by the var_name query.
[out] val A pointer to the returned signed short value.
Returns:
TRUE The signed short value was found.

FALSE The signed short value was not found.

See also:
dax_query()

ddl_boolean_t dax_get_short_by_name ddl_handle_t *  pop,
const char *  name,
short *  val
 

Gets a signed short value, given a parent object pointer and an attribute name.

The dax_get_short_by_name() function returns a short value, given a parent object pointer and an attribute name.

Parameters:
[in] pop A pointer to the parent object.
[in] name The attribute name.
[out] val A pointer to the returned signed short value.
Returns:
TRUE The signed short value was found.

FALSE The signed short value was not found.

ddl_boolean_t dax_get_string_by_aid ddl_handle_t *  pop,
ddl_attrid_t  aid,
char **  val
 

Gets a string, given a parent object pointer and an attribute ID (this version is not reentrant.

)

The dax_get_string_by_aid() function gets a string, given a parent object pointer and an attribute ID.

This function returns a pointer to a static data buffer that is good only until the next call to a dax_get_ function. Provide your own buffer if you want something more persistant.

Parameters:
[in] pop A pointer to the parent object.
[in] aid The attribute ID.
[in] val A pointer to a buffer containing the string.
Returns:
TRUE The string was found.

FALSE The string was not found.

See also:
dax_get_stringr_by_aid(), DAX_GET_STRINGA_BY_AID()

ddl_boolean_t dax_get_string_by_dwd dax_walk_data_t *  dwd,
const char *  var_name,
const char *  attr_name,
char **  val
 

Gets a string value, given a dwd, a query variable name, and an attribute name (this version is not reentrant.

)

The dax_get_string_by_dwd() function returns a string, given a pointer to the data found by a query, a query variable name, and an attribute name.

This function returns a pointer to a static data buffer that is good only until the next call to a dax_get_ function. Provide your own buffer if you want something more persistant.

Parameters:
[in] dwd An opaque pointer that was passed to the callback associated with dax_query().
[in] var_name The name of the variable that contains the query string passed to dax_query().
[in] attr_name The name of the attribute under the object that was retrieved by the var_name query.
[in] val A pointer to a buffer that receives the string value.
Returns:
TRUE The string was found.

FALSE The string was not found.

See also:
dax_query()

dax_get_stringr_by_dwd(), DAX_GET_STRINGA_BY_DWD()

ddl_boolean_t dax_get_string_by_name ddl_handle_t *  pop,
const char *  name,
char **  val
 

Gets a string, given a parent object pointer and an attribute name.

(This function is not reentrant.)

The dax_get_string_by_name() function returns a string value, given a parent object pointer and an attribute name.

This function returns a pointer to a static data buffer that is good only until the next call to a dax_get function. Provide your own buffer if you want something more persistant.

Parameters:
[in] pop A pointer to the parent object.
[in] name The attribute name.
[out] val A pointer to the buffer that receives the string value.
Returns:
TRUE The string was found.

FALSE The string was not found.

See also:
dax_get_stringr_by_name(), DAX_GET_STRINGA_BY_NAME()

ddl_boolean_t dax_get_stringr_by_aid ddl_handle_t *  pop,
ddl_attrid_t  aid,
char *  val,
const size_t  val_sz
 

Gets a string, given a parent object pointer and an attribute ID (this version is reentrant.

)

The dax_get_stringr_by_aid() function gets a string, given a parent object pointer and an attribute ID.

This function requires a buffer from the caller. It is reentrant.

Parameters:
[in] pop A pointer to the parent object.
[in] aid The attribute ID.
[in] val A pointer to a buffer to receive the string value.
[in] val_sz The size of the buffer.
Returns:
TRUE The string was found.

FALSE The string was not found.

See also:
dax_get_string_by_aid(), DAX_GET_STRINGA_BY_AID()

ddl_boolean_t dax_get_stringr_by_dwd dax_walk_data_t *  dwd,
const char *  var_name,
const char *  attr_name,
char *  val,
size_t  val_sz
 

Gets a string, given a dwd, a query variable name, and an attribute name (this version is reentrant).

The dax_get_stringr_by_dwd() function returns a string, given a pointer to the data found by a query, a query variable name, and an attribute name.

This function requires a buffer from the caller. It is reentrant.

Parameters:
[in] dwd An opaque pointer that was passed to the callback associated with dax_query().
[in] var_name The name of the variable that contains the query string passed to dax_query().
[in] attr_name The name of the attribute under the object that was retrieved by the var_name query.
[in] val A pointer to a buffer that receives the string value.
[in] val_sz The size of the buffer.
Returns:
TRUE The object was found.

FALSE The object was not found.

See also:
dax_get_string_by_dwd() DAX_GET_STRINGA_BY_DWD()dax_query()

ddl_boolean_t dax_get_stringr_by_dwd_ident dax_walk_data_t *  dwd,
const char *  var,
int  indx,
char *  buf,
size_t  bufsz
 

Retrieves the deleted identifier from a dax_query() or dax_walk_list() callback.

The dax_get_stringr_by_dwd_ident() function retrieves the deleted identifier from a dax_query() or dax_walk_list() callback.

If this function is called from a dax_query() callback, it is used to retrieve the identifier for the variables in the query. For example, in the query:

         query = "interfaces $if unit $unit"

$if represents the interface name and $unit represents the unit number. If the element is a multi-ident, you can specify the identifier number using indx.

If this function is called from a dax_walk_list() callback, the variable name is set to NULL.

Parameters:
[in] dwd An opaque pointer that was passed to the callback associated with dax_query() and is passed internally to dax_walk functions.
[in] var The name of the variable to fetch, or NULL if the function was called from dax_walk_list().
[in] indx The index of the identifier to return (usually 0).
[in] buf A pointer to a buffer to hold the identifier string.
[in] bufsz The size of the buffer.
Returns:
TRUE The identifier was found.

ddl_boolean_t dax_get_stringr_by_ident ddl_object_t *  dop,
int  n,
char *  buf,
size_t  bufsz
 

Retrieves the specified identifier for an element.

The dax_get_stringr_by_ident() function gets the specified identifier for an element. This function can be useful for elements that have multiple identifiers.

Parameters:
[in] dop A pointer to the element.
[in] n The identifer number, usually 0 for single identifier elements.
[in] buf A pointer to a character buffer to receive the identifier; the identifier is converted to a string.
[in] bufsz The size of the character buffer.
Returns:
TRUE The identifier was found; buf is set to the identifier string.

FALSE The identifier was not found, or dop does not point to an element.

ddl_boolean_t dax_get_stringr_by_name ddl_handle_t *  pop,
const char *  name,
char *  val,
size_t  val_sz
 

Retrieves a string into a buffer, given a parent object pointer and an attribute name.

The dax_get_string_by_name() function returns a string, given a parent object pointer and an attribute name.

This call requires a buffer from the caller. It is reentrant.

Parameters:
[in] pop A pointer to the parent object.
[in] name The attribute name.
[out] val A pointer to the buffer that receives the string value.
[in] val_sz The size of the string buffer.
Returns:
TRUE The string was found.

FALSE The string was not found.

See also:
dax_get_string_by_name(), DAX_GET_STRINGA_BY_NAME()

ddl_boolean_t dax_get_time_by_aid ddl_handle_t *  pop,
ddl_attrid_t  aid,
time_t *  val
 

Gets a time_t value, given a parent object pointer and an attribute ID.

The dax_get_time_by_aid() function gets a time_t value, given a parent object pointer and an attribute ID.

Parameters:
[in] pop A pointer to the parent object.
[in] aid The attribute ID.
[out] val A pointer to the returned time_t value.
Returns:
TRUE The time_t value was found.

FALSE The time_t value was not found.

ddl_boolean_t dax_get_time_by_dwd dax_walk_data_t *  dwd,
const char *  var_name,
const char *  attr_name,
time_t *  val
 

Gets a time_t value, given a dwd, a query variable name, and an attribute name.

The dax_get_time_by_dwd() function returns a time_t value, given a dwd, a query variable name, and an attribute name.

Parameters:
[in] dwd An opaque pointer that was passed to the callback associated with dax_query().
[in] var_name The name of the variable that contains the query string passed to dax_query().
[in] attr_name The name of the attribute under the object that was retrieved by the var_name query.
[out] val A pointer to the returned time_t value.
Returns:
TRUE The object was found.

FALSE The object was not found.

See also:
dax_query()

ddl_boolean_t dax_get_time_by_name ddl_handle_t *  pop,
const char *  name,
time_t *  val
 

Gets a time_t value, given a parent object pointer and an attribute name.

The dax_get_time_by_name() function returns a time_t value, given a parent object pointer and an attribute name.

Parameters:
[in] pop A pointer to the parent object.
[in] name The attribute name.
[out] val A pointer to the returned time_t value.
Returns:
TRUE The time_t value was found.

FALSE The time_t value was not found.

ddl_boolean_t dax_get_toggle_by_aid ddl_handle_t *  pop,
ddl_attrid_t  aid,
char *  val
 

Gets a toggle value, given a parent object and an attribute ID.

The dax_get_toggle_by_aid() function returns a toggle value, given a parent object pointer and an attribute ID. The toggle value is set only if the object is found the configuration. The toggle value is not modified if dax_get_toggle_by_name() returns FALSE.

Note that a toggle can have three states. 1. unconfigured 2. configured to TRUE 'foo' 3. configured to FALSE 'no-foo'

Parameters:
[in] pop A pointer to the parent object.
[in] aid The attribute ID.
[out] val A pointer to the returned toggle value
Returns:
TRUE The toggle value was found.

FALSE The toggle value was not found.

ddl_boolean_t dax_get_toggle_by_dwd dax_walk_data_t *  dwd,
const char *  var_name,
const char *  attr_name,
char *  val
 

Gets a toogle value, given a dwd, a query variable name, and an attribute name.

The toggle value is set only if the object is found the configuration. The toggle value is not modified if dax_get_toggle_by_dwd() returns FALSE.

Note that a toggle can have three states. 1. unconfigured 2. configured to TRUE 'foo' 3. configured to FALSE 'no-foo'

Parameters:
[in] dwd An opaque pointer that was passed to the callback associated with dax_query().
[in] var_name The name of the variable that contains the query string passed to dax_query().
[in] attr_name The name of the attribute under the object that was retrieved by the var_name query.
[out] val A pointer to the buffer that receives the toggle value.
Returns:
TRUE The toggle value was found.

FALSE The toggle value was not found.

See also:
dax_query()

ddl_boolean_t dax_get_toggle_by_name ddl_handle_t *  pop,
const char *  name,
char *  val
 

Gets a toggle value, given a parent object pointer and an attribute name.

The dax_get_toggle_by_name() function returns a toggle value, given a parent object pointer and an attribute name. The toggle value is set only if the object is found the configuration. The toggle value is not modified if dax_get_toggle_by_name() returns FALSE.

Note that a toggle can have three states. 1. unconfigured 2. configured to TRUE 'foo' 3. configured to FALSE 'no-foo'

Parameters:
[in] pop A pointer to the parent object.
[in] name The attribute name.
[out] val A pointer to the returned toggle value.
Returns:
TRUE The toggle value was found.

FALSE The toggle value was not found.

ddl_boolean_t dax_get_ubyte_by_aid ddl_handle_t *  pop,
ddl_attrid_t  aid,
u_char *  val
 

Gets an unsigned byte, given a parent object pointer pointer and an attribute ID.

The dax_get_ubyte_by_aid() function gets an unsigned byte value, given a parent object pointer and an attribute ID.

Parameters:
[in] pop A pointer to the parent object.
[in] aid The attribute ID.
[out] val A pointer to the returned unsigned byte.
Returns:
TRUE The unsigned byte was found.

FALSE The unsigned byte was not found.

ddl_boolean_t dax_get_ubyte_by_dwd dax_walk_data_t *  dwd,
const char *  var_name,
const char *  attr_name,
u_char *  val
 

Gets an unsigned byte value, given a dwd, a query variable name, and an attribute name.

The dax_get_ubyte_by_dwd() function returns an unsigned byte value, given a dwd, a query variable name, and an attribute name.

Parameters:
[in] dwd An opaque pointer that was passed to the callback associated with dax_query().
[in] var_name The name of the variable that contains the query string passed to dax_query().
[in] attr_name The name of the attribute under the object that was retrieved by the var_name query.
[out] val A pointer to the returned unsigned byte value.
Returns:
TRUE The unsigned byte value was found.

FALSE The unsigned byte value was not found.

See also:
dax_query()

ddl_boolean_t dax_get_ubyte_by_name ddl_handle_t *  pop,
const char *  name,
u_char *  val
 

Gets an unsigned byte value, given a parent object pointer and an attribute name.

The dax_get_ubyte_by_name() function returns an unsigned byte value, given a parent object pointer and an attribute name.

Parameters:
[in] pop A pointer to the parent object.
[in] name The attribute name.
[out] val A pointer to the returned unsigned byte value.
Returns:
TRUE The unsigned byte value was found.

FALSE The unsigned byte value was not found.

ddl_boolean_t dax_get_uint64_by_aid ddl_handle_t *  pop,
ddl_attrid_t  aid,
u_int64_t *  val
 

Gets an unsigned 64-bit integer value, given a parent object pointer and an attribute ID.

The dax_get_uint64_by_aid() function gets an unsigned 64-bit integer value, given a parent object pointer and an attribute ID.

Parameters:
[in] pop A pointer to the parent object.
[in] aid The attribute ID.
[out] val A pointer to the returned unsigned 64-bit integer.
Returns:
TRUE The unsigned 64-bit integer value was found.

FALSE The unsigned 64-bit integer value was not found.

ddl_boolean_t dax_get_uint64_by_dwd dax_walk_data_t *  dwd,
const char *  var_name,
const char *  attr_name,
u_int64_t *  val
 

Gets an unsigned 64-bit integer value, given a dwd, a query variable name, and an attribute name.

The dax_get_uint64_by_dwd() function returns an unsigned 64-bit integer value, given a dwd, a query variable name, and an attribute name.

Parameters:
[in] dwd An opaque pointer that was passed to the callback associated with dax_query().
[in] var_name The name of the variable that contains the query string passed to dax_query().
[in] attr_name The name of the attribute under the object that was retrieved by the var_name query.
[out] val A pointer to the returned unsigned 64-bit integer value.
Returns:
TRUE The unsigned 64-bit integer value was found.

FALSE The unsigned 64-bit integer value not found.

See also:
dax_query()

ddl_boolean_t dax_get_uint64_by_name ddl_handle_t *  pop,
const char *  name,
u_int64_t *  val
 

Gets an unsigned 64-bit integer value, given a parent object pointer and an attribute name.

The dax_get_uint64_by_name() function returns an unsigned 64-bit integer value, given a parent object pointer and an attribute name.

Parameters:
[in] pop A pointer to the parent object.
[in] name The attribute name.
[out] val A pointer to the returned unsigned 64-bit integer value.
Returns:
TRUE The unsigned 64-bit integer value was found.

FALSE The unsigned 64-bit integer value was not found.

ddl_boolean_t dax_get_uint_by_aid ddl_handle_t *  pop,
ddl_attrid_t  aid,
uint *  val
 

Gets an unsigned integer value, given a parent object pointer and an attribute ID.

The dax_get_uint_by_aid() function gets an unsigned integer value, given a parent object pointer and an attribute ID.

Parameters:
[in] pop A pointer to the parent object.
[in] aid The attribute ID.
[out] val A pointer to the returned unsigned integer.
Returns:
TRUE The unsigned integer value was found.

FALSE The unsigned integer value was not found.

ddl_boolean_t dax_get_uint_by_dwd dax_walk_data_t *  dwd,
const char *  var_name,
const char *  attr_name,
uint *  val
 

Gets an unsigned integer value, given a dwd, a query variable name, and an attribute name.

The dax_get_int64_by_dwd() function returns an unsigned 64-bit integer value, given a dwd, a query variable name, and an attribute name.

Parameters:
[in] dwd An opaque pointer that was passed to the callback associated with dax_query().
[in] var_name The name of the variable that contains the query string passed to dax_query().
[in] attr_name The name of the attribute under the object that was retrieved by the var_name query.
[out] val A pointer to the returned unsigned integer value.
Returns:
TRUE The unsigned integer value was found.

FALSE The unsigned integer value was not found.

See also:
dax_query()

ddl_boolean_t dax_get_uint_by_name ddl_handle_t *  pop,
const char *  name,
uint *  val
 

Gets an unsigned integer value, given a parent object pointer and an attribute name.

The dax_get_uint_by_name() function returns an unsigned integer value, given a parent object pointer and an attribute name.

Parameters:
[in] pop A pointer to the parent object.
[in] name The attribute name.
[out] val A pointer to the returned unsigned integer value.
Returns:
TRUE The unsigned integer value was found.

FALSE The unsigned integer value was not found.

ddl_boolean_t dax_get_ulong_by_aid ddl_handle_t *  pop,
ddl_attrid_t  aid,
unsigned long *  val
 

Gets an unsigned long value, given a parent object pointer and an attribute ID.

The dax_get_long_by_aid() function gets an unsigned long value, given a parent object pointer and an attribute ID.

Parameters:
[in] pop A pointer to the parent object.
[in] aid The attribute ID.
[out] val A pointer to the returned unsigned long value.
Returns:
TRUE The unsigned long value was found.

FALSE The unsigned long value was not found.

ddl_boolean_t dax_get_ushort_by_aid ddl_handle_t *  pop,
ddl_attrid_t  aid,
u_short *  val
 

Gets an unsigned short value, given a parent object pointer and an attribute ID.

The dax_get_ushort_by_aid() function gets an unsigned short value, given a parent object pointer and an attribute ID.

Parameters:
[in] pop A pointer to the parent object.
[in] aid The attribute ID.
[out] val A pointer to the returned unsigned short value.
Returns:
TRUE The unsigned short value was found.

FALSE The unsigned short value was not found.

ddl_boolean_t dax_get_ushort_by_dwd dax_walk_data_t *  dwd,
const char *  var_name,
const char *  attr_name,
u_short *  val
 

Gets an unsigned short value, given a dwd, a query variable name, * and an attribute name.

The dax_get_ushort_by_dwd() function returns an unsigned short value, given a dwd, a query variable name, and an attribute name.

Parameters:
[in] dwd An opaque pointer that was passed to the callback associated with dax_query().
[in] var_name The name of the variable that contains the query string passed to dax_query().
[in] attr_name The name of the attribute under the object that was retrieved by the var_name query.
[out] val A pointer to the returned unsigned short value.
Returns:
TRUE The unsigned short value was found.

FALSE The unsigned short value was not found.

See also:
dax_query()

ddl_boolean_t dax_get_ushort_by_name ddl_handle_t *  pop,
const char *  name,
u_short *  val
 

Gets an unsigned short value, given a parent object pointer and an attribute name.

The dax_get_ushort_by_name() function returns an unsigned short value, given a parent object pointer and an attribute name.

Parameters:
[in] pop A pointer to the parent object.
[in] name The attribute name.
[out] val A pointer to the returned unsigned short value.
Returns:
TRUE The unsigned short value was found.

FALSE The unsigned short value was not found.

void dax_init_dap ddl_access_attribute_t *  dap  ) 
 

Initialize the ddl_access_attribute_t structure.

The dax_init_dap() function initialize the da_aid and da_pkg fields

ddl_boolean_t dax_is_attribute ddl_handle_t *  dop  ) 
 

Determines if a object is an attribute type.

The dax_is_attribute() function determines if the object is of type 'attribute'

Parameters:
[in] dop A pointer to the target object.
Returns:
TRUE The object is an attribute, it contains data like a string or integer.

FALSE The object is not an attribute.

ddl_boolean_t dax_is_changed ddl_handle_t *  dop  ) 
 

Determines whether the object or one of its children has changed.

The dax_is_changed() function determines whether the object or one of its children has changed.

Parameters:
[in] dop A pointer to the target object.
Returns:
TRUE The object has changed.

FALSE The object has not changed.

ddl_boolean_t dax_is_changed_by_aid ddl_handle_t *  pop,
ddl_attrid_t  aid
 

Returns whether the object pointed to by a parent object pointer and an attribute ID was changed.

The dax_is_changed_by_aid() function returns whether the object pointed to by a parent object pointer and an attribute ID was changed.

Parameters:
[in] pop A pointer to the parent object.
[in] aid The attribute ID.
Returns:
TRUE The object was changed.

FALSE The object was not changed.

ddl_boolean_t dax_is_changed_by_name ddl_handle_t *  pop,
const char *  name
 

Returns whether an object was changed, given a parent object pointer and an attribute name.

The dax_is_changed_by_name() function returns whether an object was changed, given a parent object pointer and an attribute name.

Parameters:
[in] pop A pointer to the parent object.
[in] name The attribute name.
Returns:
TRUE The object was changed.

FALSE The object was not changed.

ddl_boolean_t dax_is_configured_by_aid ddl_handle_t *  pop,
ddl_attrid_t  aid
 

Returns whether the object pointed to by a parent object pointer and an attribute ID is configured.

The dax_is_configured_by_aid() function returns whether the object pointed to by a parent object pointer and an attribute ID is configured.

Parameters:
[in] pop A pointer to the parent object.
[in] aid The attribute ID.
Returns:
TRUE The object is configured.

FALSE The object is not configured.

ddl_boolean_t dax_is_configured_by_name ddl_handle_t *  pop,
const char *  name
 

Returns whether an object is configured, given a parent object pointer and an attribute name.

The dax_is_configured_by_name() function returns whether an object is configured, given a parent object pointer and an attribute name.

Parameters:
[in] pop A pointer to the parent object.
[in] name The attribute name.
Returns:
TRUE The object is configured.

FALSE The object is not configured.

ddl_boolean_t dax_is_container ddl_handle_t *  dop  ) 
 

Determines if a object is a container type.

The dax_is_container() function determines if the object is of type 'container/list'

Parameters:
[in] dop A pointer to the target object.
Returns:
TRUE The object is a container.

FALSE The object is not a container.

ddl_boolean_t dax_is_element ddl_handle_t *  dop  ) 
 

Determines if a object is an element type.

The dax_is_element() function determines if the object is of type 'element'

Parameters:
[in] dop A pointer to the target object.
Returns:
TRUE The object is an element.

FALSE The object is not an element.

ddl_boolean_t dax_is_object ddl_handle_t *  dop  ) 
 

Determines if a object is an object type.

The dax_is_object() function determines if the object is of type 'object'

Parameters:
[in] dop A pointer to the target object.
Returns:
TRUE The object is an object, it contains a collection of objects and or attributes.

FALSE The object is not an object type.

void dax_make_ref ddl_handle_t *  dop  ) 
 

Bumps reference count for an object.

The dax_make_ref() function increments reference count associated with an object.

Parameters:
[in] dop A pointer to the object.

const char* dax_open_db const char *  filename,
const char *  daemon_name,
const char *  pkg_name,
uint  seqnum,
int  check_only
 

Opens the configuration database.

The dax_open_db() function maps the read-only memory segments of the configuration database and the schema file and performs initialization as required by the library.

The package name is the value of PACKAGE_NAME in the file package_name_sequence.h, generated by the DDL compiler. You specify the package name in the ddl/input/input.mk file with the statement:

     INPUT_FEATURES+=<i>package_name</i>

The output of the DDL compiler is in the file:

      obj-i386/juniper/lib/ddl/feature

The sequence number is used to ensure that the version of the daemon matches the configuration database. To find the sequence number for passing to this function, look in the file:

      obj-i386/juniper/lib/ddl/feature/<i>package_name</i>_sequence.h

Parameters:
[in] filename The name of the configuration database; you typically pass NULL to find the default.
[in] daemon_name The daemon name of the caller (e.g., DNAME_RPD).
[in] pkg_name The package name.
[in] seqnum The sequence number.
[in] check_only TRUE if the daemon wants only to check the candidate configuration database. FALSE if the daemon wants the committed database.
Returns:
NULL on success, otherwise a pointer to an error message.
See also:
dax_close_db()

const char* dax_open_db_with_flags const char *  filename,
const char *  daemon_name,
const char *  pkg_name,
uint  seqnum,
int  check_only,
uint8_t  das_flags
 

Opens the configuration database.

Same as dax_open_db with one additional param - das_flags.

Parameters:
[in] filename The name of the configuration database; you typically pass NULL to find the default.
[in] daemon_name The daemon name of the caller (e.g., DNAME_RPD).
[in] pkg_name The package name.
[in] seqnum The sequence number.
[in] check_only TRUE if the daemon wants only to check the candidate configuration database. FALSE if the daemon wants the committed database.
[in] das_flags Controlling flags. Currently it supports one flag to skip sequence number check at commit check time. Without this flag, at commit check time, all objects appears to be changed.
Returns:
NULL on success, otherwise a pointer to an error message.
See also:
dax_close_db()

int dax_query ddl_handle_t *  root,
const char *  query,
dax_walk_flag_t  flags,
dax_walk_callback_t  cb,
void *  cb_data
 

Searches the configuration database as specified by a query string.

The dax_query() function searches the configuration database; that is, it walks the leaf nodes of the configuration tree according to search criteria specified by a query string.

Each query token can be a keyword, an attribute value, or an identifier. Variable names start with a dollar sign ($) and have no significance to the query's function. You use the same name to reference objects in the configuration.

Container objects can be specified with a dollar sign, which is replaced with the actual object pointer (dop) as the system traverses the configuration tree.

The last item in the query should be an object, so that you can access the attributes of the object using the dax_get_type_by_name functions. To access attributes further up in the hierarchy, you can use the dax_get_type_by_dwd() functions.

For example:

If the query string is "logical-systems $lr-name interfaces $if unit <*>", then the callback function can retrieve the interface's description attribute value using:

      dax_get_object_by_dwd(dwd, "$if", "description", &des, 0);

The callback can retrieve the device name using:

      char ifd_buf[IFNAMELEN];

      dax_get_stringr_by_dwd_ident(dwd, "$if", 0, ifd_buf, sizeof(ifd_buf));

Parameters:
[in] root The root of the query. Specify NULL to start the query at the top of the configuration tree.
[in] query The query string.
[in] flags Specifies which attributes to look for. Specify one of: DAX_WALK_UNCHANGED, DAX_WALK_CHANGED, DAX_WALK_DELETED, DAX_WALK_DELTA, DAX_WALK_CONFIGURED, or DAX_WALK_ALL.
[in] cb An application-provided callback function that is called once for every terminal object or attribute specified in the query.
[in] cb_data Caller data, to give your callback some context.
Returns:
One of:
  • DAX_QUERY_OK
  • DAX_QUERY_INVALID The query string is invalid.
  • DAX_QUERY_ABORT The query was aborted by the callback.
See also:
dwd_get_stringr_by_ident

int dax_query_by_path ddl_handle_t *  root,
const char **  path,
dax_walk_flag_t  flags,
dax_walk_callback_t  cb,
void *  cb_data
 

Performs the same function as dax_query(), but takes an array of paths instead of a query string.

The dax_query_by_path() function searches the configuration database according to a list of paths. This function performs the same actions as dax_query(), but takes an array of paths instead of a query string.

Parameters:
[in] root The root of the query. Specify NULL to start the query at the top of the configuration tree.
[in] path A pointer to an array of character strings that specify paths.
[in] flags Specifies which attributes to look for. Specify one of: DAX_WALK_UNCHANGED, DAX_WALK_CHANGED, DAX_WALK_DELETED, DAX_WALK_DELTA, DAX_WALK_CONFIGURED, or DAX_WALK_ALL.
[in] cb A callback you supply. The prototype is described under prototype. Your callback is called once for every terminal object or attribute specified in your query.
[in] cb_data Caller data, to give your callback some context.
Returns:
One of:
  • DAX_QUERY_OK
  • DAX_QUERY_INVALID The query string is invalid.
  • DAX_QUERY_ABORT The query was aborted by the callback.

void dax_release_object ddl_handle_t **  dop  ) 
 

Releases the memory associated with an object.

The dax_release_object() function releases the memory associated with an object.

This function is called to release any pointer of type ddl_handle_t returned by any DAX function that retrieves an object. The pointer is set to NULL after releasing the object.

Parameters:
[in] dop A pointer to the object pointer to release.

ddl_boolean_t dax_visit_container ddl_handle_t *  dop,
ddl_handle_t **  cop
 

Iterates through a container object.

The dax_visit_container() function iterates through a container object.

Parameters:
[in] dop A pointer to the container object whose elements are to be visited.
[out] cop A pointer to the returned object pointer; initialize this variable to NULL.
Example:
      cop = NULL
      while (dax_visit_container(dop, &cop)) {
          if (dax_get_int_by_name(cop, "my-int", &myint))
              ...
          }
      }
      dax_release_object(&cop);

Note:
If you break out of the while loop before dax_visit_container() returns FALSE, you must release the returned object pointer by calling dax_release_object(). Do not release cop inside the while loop. The dax_visit_container() function automatically performs the release when it fetches the next cop.
Returns:
TRUE cop points to an element in the container.

FALSE There are no more elements to visit.

int dax_walk_list ddl_handle_t *  dop,
dax_walk_flag_t  flags,
dax_walk_callback_t  func,
void *  caller_data
 

Traverses a container (list) object.

The dax_walk_list() function traverses a container (list) object.

Parameters:
dop A pointer to the object to traverse.
flags Flags that specify the type of traversal; one of:
  • DAX_WALK_CONFIGURED - Walk configuerd items (changed or not)
  • DAX_WALK_DELETED - Walk deleted items
  • DAX_WALK_UNCHANGED - Walk unchanged items
  • DAX_WALK_CHANGED - Walk changed items
  • DAX_WALK_DELTA - Walk both deleted and changed items
  • DAX_WALK_ALL - Walk all items
func Callback function to call for each element that was deleted, changed, or just traversed.
caller_data Data to associate with the callback.
See also:
dax_walk_callback_t

dax_query

Note:
If flags is set to DAX_WALK_CONFIGURED, this function walks only existing items in the list, regardless of the changed bit. It does not walk deleted items. You can use this setting to rebuild a list from scratch without history.

If dop is NULL and DAX_WALK_DELETED is set, JUNOS sends the callback function a DAX_ITEM_DELETE_ALL action. Otherwise, an error is returned.

Returns:
DAX_WALK_OK The traversal was successful.

DAX_WALK_ABORT The traversal had an error. dop is NULL and DAX_WALK_DELETED is not set.


2007-2009 Juniper Networks, Inc. All rights reserved. The information contained herein is confidential information of Juniper Networks, Inc., and may not be used, disclosed, distributed, modified, or copied without the prior written consent of Juniper Networks, Inc. in an express license. This information is subject to change by Juniper Networks, Inc. Juniper Networks, the Juniper Networks logo, and JUNOS are registered trademarks of Juniper Networks, Inc. in the United States and other countries. All other trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners.
Generated on Sun May 30 20:23:19 2010 for libddl-access by Doxygen 1.4.5