yumapro  20.10-14
YumaPro SDK
RPC Error Handling

NETCONF RPC Error Handling. More...

Collaboration diagram for RPC Error Handling:

Functions

rpc_err_rec_tagt_rpcerr_gen_error (ncx_layer_t layer, status_t interr, const xml_node_t *errnode, ncx_node_t parmtyp, const void *error_parm, xmlChar *error_path)
 Generate an internal <rpc-error> record for an element (or non-attribute) related error for any layer. More...
 
rpc_err_rec_tagt_rpcerr_gen_error_errinfo (ncx_layer_t layer, status_t interr, const xml_node_t *errnode, ncx_node_t parmtyp, const void *error_parm, xmlChar *error_path, const ncx_errinfo_t *errinfo)
 Generate an internal <rpc-error> record for an element (or non-attribute) related error for any layer. More...
 
rpc_err_rec_tagt_rpcerr_gen_error_ex (ncx_layer_t layer, status_t interr, const xml_node_t *errnode, ncx_node_t parmtyp, const void *error_parm, xmlChar *error_path, const ncx_errinfo_t *errinfo, ncx_node_t nodetyp, void *error_path_raw, boolean is_error)
 Generate an internal <rpc-error> record for an element (or non-attribute) related error for any layer. More...
 
rpc_err_rec_tagt_rpcerr_gen_insert_error (ncx_layer_t layer, status_t interr, val_value_t *errval, xmlChar *error_path)
 Generate an internal <rpc-error> record for an element for an insert operation failed error. More...
 
rpc_err_rec_tagt_rpcerr_gen_unique_error (xml_msg_hdr_t *msghdr, ncx_layer_t layer, status_t interr, const dlq_hdr_t *valuniqueQ, xmlChar *error_path, val_value_t *errval)
 Generate an internal <rpc-error> record for an element for a unique-stmt failed error (data-not-unique) More...
 
rpc_err_rec_tagt_rpcerr_gen_attr_error (ncx_layer_t layer, status_t interr, const xml_attr_t *attr, const xml_node_t *errnode, val_value_t *errnodeval, const xmlChar *badns, xmlChar *error_path)
 Generate an internal <rpc-error> record for an attribute. More...
 
rpc_err_t agt_rpcerr_get_rpcerr (status_t intres)
 Translate the status_t to a rpc_err_t. More...
 
uint32 agt_rpcerr_get_http_status_code (status_t res)
 Translate the rpc_err_t to an HTTP code. More...
 
const xmlChar * agt_rpcerr_get_http_status_string (uint32 status)
 Translate the HTTP status code to an HTTP status line. More...
 
status_t agt_rpcerr_add_user_data (rpc_err_rec_t *err, dlq_hdr_t *dataQ)
 Add data nodes to return in the <error-info> section of an error record. More...
 

Detailed Description

NETCONF RPC Error Handling.

Uses the hacky horrible rpc error interface that cast pointers as void * in order to allow all kinds of data structures to be used to extract error data from. Use APIs carefully!

Function Documentation

◆ agt_rpcerr_add_user_data()

status_t agt_rpcerr_add_user_data ( rpc_err_rec_t err,
dlq_hdr_t *  dataQ 
)

Add data nodes to return in the <error-info> section of an error record.

The data will be moved to the rpc_err_rec_t in individual rpc_err_info_t records

Parameters
errrpc error record to add data into
dataQQ of val_value_t nodes to add
!!! This queue of value nodes will be consumed !!!
Returns
status; ERR_INTERNAL_MEM if malloc-fail

◆ agt_rpcerr_gen_attr_error()

rpc_err_rec_t* agt_rpcerr_gen_attr_error ( ncx_layer_t  layer,
status_t  interr,
const xml_attr_t attr,
const xml_node_t errnode,
val_value_t errnodeval,
const xmlChar *  badns,
xmlChar *  error_path 
)

Generate an internal <rpc-error> record for an attribute.

Parameters
layerprotocol layer where the error occurred
interrinternal error code
if NO_ERR than use the rpcerr only
attrattribute that had the error
errnodeXML node where error occurred
NULL then there is no valid XML node (maybe the error!)
errnodevalvaluse struct for the error node id errnode NULL
NULL if not used
badnsURI string of the namespace that is bad (or NULL)
error_pathmalloced string of the value (or type, etc.) instance ID string in NCX_IFMT_XPATH format; this will be added to the rpc_err_rec_t and freed later
NULL if not available
Returns
pointer to allocated and filled in rpc_err_rec_t struct ready to add to the msg->rpc_errQ
NULL if a record could not be allocated or not enough valid info in the parameters
Here is the call graph for this function:

◆ agt_rpcerr_gen_error()

rpc_err_rec_t* agt_rpcerr_gen_error ( ncx_layer_t  layer,
status_t  interr,
const xml_node_t errnode,
ncx_node_t  parmtyp,
const void *  error_parm,
xmlChar *  error_path 
)

Generate an internal <rpc-error> record for an element (or non-attribute) related error for any layer.

Parameters
layerprotocol layer where the error occurred
interrinternal error code
if NO_ERR than use the rpcerr only
errnodeXML node where error occurred
NULL then there is no valid XML node (maybe the error!)
parmtyptype of node contained in error_parm
error_parmpointer to the extra parameter expected for this type of error.
(void *)pointer to session_id for lock-denied errors
(void *) pointer to the bad-value string to use for some other errors
error_pathmalloced string of the value (or type, etc.) instance ID string in NCX_IFMT_XPATH format; this will be added to the rpc_err_rec_t and freed later
NULL if not available
Returns
pointer to allocated and filled in rpc_err_rec_t struct ready to add to the msg->rpc_errQ
NULL if a record could not be allocated or not enough valid info in the parameters
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_rpcerr_gen_error_errinfo()

rpc_err_rec_t* agt_rpcerr_gen_error_errinfo ( ncx_layer_t  layer,
status_t  interr,
const xml_node_t errnode,
ncx_node_t  parmtyp,
const void *  error_parm,
xmlChar *  error_path,
const ncx_errinfo_t errinfo 
)

Generate an internal <rpc-error> record for an element (or non-attribute) related error for any layer.

Add errinfo.

Parameters
layerprotocol layer where the error occurred
interrinternal error code
if NO_ERR than use the rpcerr only
errnodeXML node where error occurred
NULL then there is no valid XML node (maybe the error!)
parmtyptype of node contained in error_parm
error_parmpointer to the extra parameter expected for this type of error.
(void *)pointer to session_id for lock-denied errors
(void *) pointer to the bad-value string to use for some other errors
error_pathmalloced string of the value (or type, etc.) instance ID string in NCX_IFMT_XPATH format; this will be added to the rpc_err_rec_t and freed later
NULL if not available
errinfoerror info struct to use for whatever fields are set
Returns
pointer to allocated and filled in rpc_err_rec_t struct ready to add to the msg->rpc_errQ
NULL if a record could not be allocated or not enough valid info in the parameters
Here is the call graph for this function:

◆ agt_rpcerr_gen_error_ex()

rpc_err_rec_t* agt_rpcerr_gen_error_ex ( ncx_layer_t  layer,
status_t  interr,
const xml_node_t errnode,
ncx_node_t  parmtyp,
const void *  error_parm,
xmlChar *  error_path,
const ncx_errinfo_t errinfo,
ncx_node_t  nodetyp,
void *  error_path_raw,
boolean  is_error 
)

Generate an internal <rpc-error> record for an element (or non-attribute) related error for any layer.

Add errinfo. Extended.

Parameters
layerprotocol layer where the error occurred
interrinternal error code
if NO_ERR than use the rpcerr only
errnodeXML node where error occurred
NULL then there is no valid XML node (maybe the error!)
parmtyptype of node contained in error_parm
error_parmpointer to the extra parameter expected for this type of error.
(void *)pointer to session_id for lock-denied errors
(void *) pointer to the bad-value string to use for some other errors
error_pathmalloced string of the value (or type, etc.) instance ID string in NCX_IFMT_XPATH format; this will be added to the rpc_err_rec_t and freed later
NULL if not available
errinfoerror info struct to use for whatever fields are set
nodetyptype of node contained in error_path_raw
error_path_rawpointer to the extra parameter expected for this type of error.
is_errorTRUE if error-severity=error; FALSE if it is warning
Returns
pointer to allocated and filled in rpc_err_rec_t struct ready to add to the msg->rpc_errQ
NULL if a record could not be allocated or not enough valid info in the parameters
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_rpcerr_gen_insert_error()

rpc_err_rec_t* agt_rpcerr_gen_insert_error ( ncx_layer_t  layer,
status_t  interr,
val_value_t errval,
xmlChar *  error_path 
)

Generate an internal <rpc-error> record for an element for an insert operation failed error.

Parameters
layerprotocol layer where the error occurred
interrinternal error code
if NO_ERR than use the rpcerr only
errvalpointer to the node with the insert error
error_pathmalloced string of the value (or type, etc.) instance ID string in NCX_IFMT_XPATH format; this will be added to the rpc_err_rec_t and freed later
NULL if not available
Returns
pointer to allocated and filled in rpc_err_rec_t struct ready to add to the msg->rpc_errQ
NULL if a record could not be allocated or not enough valid info in the parameters
Here is the call graph for this function:

◆ agt_rpcerr_gen_unique_error()

rpc_err_rec_t* agt_rpcerr_gen_unique_error ( xml_msg_hdr_t msghdr,
ncx_layer_t  layer,
status_t  interr,
const dlq_hdr_t *  valuniqueQ,
xmlChar *  error_path,
val_value_t errval 
)

Generate an internal <rpc-error> record for an element for a unique-stmt failed error (data-not-unique)

Parameters
msghdrmessage header to use for prefix storage
layerprotocol layer where the error occurred
interrinternal error code
if NO_ERR than use the rpcerr only
valuniqueQQ of val_unique_t structs to use for <non-unique> elements
error_pathmalloced string of the value (or type, etc.) instance ID string in NCX_IFMT_XPATH format; this will be added to the rpc_err_rec_t and freed later
NULL if not available
errvalpointer to the node with the insert error
Returns
pointer to allocated and filled in rpc_err_rec_t struct ready to add to the msg->rpc_errQ
NULL if a record could not be allocated or not enough valid info in the parameters

◆ agt_rpcerr_get_http_status_code()

uint32 agt_rpcerr_get_http_status_code ( status_t  res)

Translate the rpc_err_t to an HTTP code.

Parameters
resreturn status
Returns
numeric code for res
Here is the call graph for this function:

◆ agt_rpcerr_get_http_status_string()

const xmlChar* agt_rpcerr_get_http_status_string ( uint32  status)

Translate the HTTP status code to an HTTP status line.

Parameters
statusHTTP status code to translate
Returns
const pointer to the status line to use

◆ agt_rpcerr_get_rpcerr()

rpc_err_t agt_rpcerr_get_rpcerr ( status_t  intres)

Translate the status_t to a rpc_err_t.

Parameters
intresinternal status_t error code
Returns
rpc error id for the specified internal error id
Here is the caller graph for this function: