fred-mod-eppd-2.14.1
Functions
Functions for convenient usage of xpath

queries. More...

Functions

static xmlNodePtr xpath_chroot (xmlXPathContextPtr ctx, const char *expr, int index, int *xerr)
 Function changes relative root of xpath context to node described by xpath expression. More...
 
static int xpath_count (xmlXPathContextPtr ctx, const char *expr, int *xerr)
 Sometimes we want to know how many elements satisfying xpath expression are there or just to know if there is any or not. More...
 
static char * xpath_get1 (void *pool, xmlXPathContextPtr ctx, const char *expr, int req, int *xerr)
 A content of element described by xpath expression is returned. More...
 
static void xpath_getn (void *pool, qhead *list, xmlXPathContextPtr ctx, const char *expr, int *xerr)
 List is filled by content of elements described by xpath expression (There may be more elements matching xpath expression). More...
 
static char * xpath_get_attr (void *pool, xmlXPathContextPtr ctx, const char *expr, const char *attr, int req, int *xerr)
 A value of attribute of node described by xpath expression is returned. More...
 
int parse_boolean (char *str)
 Parse a boolean value entered either as a number or as a string (true/false) More...
 

Detailed Description

queries.

Function Documentation

int parse_boolean ( char *  str)

Parse a boolean value entered either as a number or as a string (true/false)

Parameters
strstring to be parsed
Returns
0 or 1

Referenced by parse_create_contact(), parse_ext_enumval_create(), parse_ext_enumval_renew(), and parse_ext_enumval_update().

static xmlNodePtr xpath_chroot ( xmlXPathContextPtr  ctx,
const char *  expr,
int  index,
int *  xerr 
)
static

Function changes relative root of xpath context to node described by xpath expression.

Parameters
ctxXPath context.
exprXPath expression.
indexIndex of node if there are more nodes matching xpath expression, if index is out of range, NULL is returned.
xerrError status of function (must be set to ok upon calling the function).
Returns
The old relative root, which was substituted by new one; or NULL in case of change failure (new node was not found).

References XERR_CONSTR, and XERR_LIBXML.

Referenced by parse_check(), parse_create(), parse_create_contact(), parse_delete(), parse_extension(), parse_info(), parse_renew(), parse_sendAuthInfo(), parse_test(), parse_transfer(), parse_update(), parse_update_contact(), parse_update_domain(), parse_update_keyset(), and parse_update_nsset().

static int xpath_count ( xmlXPathContextPtr  ctx,
const char *  expr,
int *  xerr 
)
static

Sometimes we want to know how many elements satisfying xpath expression are there or just to know if there is any or not.

Parameters
ctxXPath context.
exprXPath expression.
xerrError status of function (must be set to ok upon calling the function).
Returns
Count of elements which satisfy xpath expression.

References XERR_LIBXML.

Referenced by parse_create_contact(), parse_info(), and parse_update_contact().

static char* xpath_get1 ( void *  pool,
xmlXPathContextPtr  ctx,
const char *  expr,
int  req,
int *  xerr 
)
static

A content of element described by xpath expression is returned.

The element must be only one. If req is set, the element is required to exist, otherwise error in xerr is returned. If the element is not required to exist and it is not there, NULL is returned. In case of internal error, xerr is set to appropriate value.

Parameters
poolMemory pool to allocate memory from.
ctxXPath context pointer.
exprXPath expression which describes a xml node.
req1 if element is required to exist, 0 if not.
xerrError status of function (must be set to ok upon calling the function).
Returns
String with content of xml element allocated from pool.

References epp_strdup(), TEXT_CONTENT, XERR_CONSTR, and XERR_LIBXML.

Referenced by parse_command(), parse_create_contact(), parse_create_domain(), parse_create_keyset(), parse_create_nsset(), parse_delete(), parse_ext_enumval_create(), parse_ext_enumval_renew(), parse_ext_enumval_update(), parse_extension(), parse_info(), parse_infoKey(), parse_login(), parse_renew(), parse_sendAuthInfo(), parse_test(), parse_transfer(), parse_update_contact(), parse_update_domain(), parse_update_keyset(), parse_update_nsset(), and read_epp_dnskey().

static char* xpath_get_attr ( void *  pool,
xmlXPathContextPtr  ctx,
const char *  expr,
const char *  attr,
int  req,
int *  xerr 
)
static

A value of attribute of node described by xpath expression is returned.

The resulting node must be only one. If req is set, the node is required to exist and xerr is set to error status if it is not so. If the element is not required to exist and it is not there, NULL is returned. If the element exists but attribute doesn't, NULL is returned. In case of internal error, xerr is set to appropriate error status.

Parameters
poolMemory pool to allocate memory from.
ctxXPath context pointer.
exprXPath expression which describes a xml node.
attrName of attribute.
req1 if element is required to exist, 0 if not.
xerrError status of function (must be set to ok upon calling the function).
Returns
String with content of xml element allocated from pool.

References epp_strdup(), get_attr(), XERR_CONSTR, and XERR_LIBXML.

Referenced by parse_create_contact(), and parse_update_contact().

static void xpath_getn ( void *  pool,
qhead list,
xmlXPathContextPtr  ctx,
const char *  expr,
int *  xerr 
)
static

List is filled by content of elements described by xpath expression (There may be more elements matching xpath expression).

Parameters
poolMemory pool to allocate memory from.
listHead of empty list where the found items will be added.
ctxXPath context pointer.
exprXPath expression which describes a xml node.
xerrError status of function (must be set to ok upon calling the function).
Returns
If succesfull 1, in case of failure 0.

References epp_strdup(), q_add(), TEXT_CONTENT, XERR_ALLOC, and XERR_LIBXML.

Referenced by parse_check(), parse_create_contact(), parse_create_domain(), parse_create_keyset(), parse_create_nsset(), parse_login(), parse_test(), parse_update_contact(), parse_update_domain(), parse_update_keyset(), and parse_update_nsset().