![]() |
yumapro
25.10-1
YumaPro SDK
|
NETCONF Remote Procedure Call Support. More...

Data Structures | |
| struct | agt_rpc_cbset_t |
| the agt_rpc module stores a set of callbacks for each RPC More... | |
| struct | agt_rpc_subsys_t |
| header for 1 subsystem that has a SIL-SA callback function registered for the RPC method in the agt_rpc_cbset_t struct containing the subsysQ More... | |
Typedefs | |
| typedef status_t(* | agt_rpc_method_t) (ses_cb_t *scb, rpc_msg_t *msg, xml_node_t *methnode) |
| Template for RPC server callbacks. More... | |
| typedef status_t(* | agt_rpc_data_cb_t) (ses_cb_t *scb, rpc_msg_t *msg, uint32 indent) |
| Callback template for RPCs that use an inline callback function instead of generating a malloced val_value_t tree. More... | |
Enumerations | |
| enum | agt_rpc_phase_t { AGT_RPC_PH_VALIDATE , AGT_RPC_PH_INVOKE , AGT_RPC_PH_POST_REPLY , AGT_RPC_PH_PARSE , AGT_RPC_PH_REPLY } |
| There are 3 different callbacks possible in the server processing chain. More... | |
Functions | |
| status_t | agt_rpc_init (void) |
| Initialize the agt_rpc module. More... | |
| void | agt_rpc_cleanup (void) |
| Cleanup the agt_rpc module. More... | |
| void | agt_rpc_support_method (const xmlChar *module, const xmlChar *method_name) |
| mark an RPC method or action as supported within the server More... | |
| void | agt_rpc_unsupport_method (const xmlChar *module, const xmlChar *method_name) |
| mark an RPC method or action as unsupported within the server More... | |
| boolean | agt_rpc_dispatch (ses_cb_t *scb, xml_node_t *top) |
| Dispatch an incoming <rpc> request. More... | |
| status_t | agt_rpc_load_config_file (const xmlChar *filespec, cfg_template_t *cfg, boolean isload, ses_id_t use_sid, dlq_hdr_t *errQ, boolean do_config_change, const rpc_msg_t *reqmsg) |
| Dispatch an internal <load-config> request. More... | |
| val_value_t * | agt_rpc_get_config_file (const xmlChar *filespec, cfg_template_t *targetcfg, ses_id_t use_sid, dlq_hdr_t *errorQ, status_t *res) |
| Dispatch an internal <load-config> request except skip the INVOKE phase and just remove the 'config' node from the input and return it. More... | |
| status_t | agt_rpc_load_config_file_val (const xmlChar *filespec, ses_id_t use_sid, val_value_t **configval, dlq_hdr_t *errorQ) |
| Dispatch an internal <load-config> request used for COPY-CONFIG for URL to Candidate. More... | |
| status_t | agt_rpc_replay_config (void) |
| Dispatch an internal <replay-config> request used for OP_EDITOP_LOAD to load the running from startup and OP_EDITOP_REPLACE to restore running from backup. More... | |
| status_t | agt_rpc_fill_rpc_error (const rpc_err_rec_t *err, val_value_t *rpcerror) |
| Fill one <rpc-error> like element using the specified namespace and name, which may be different than NETCONF. More... | |
| void | agt_rpc_send_error_reply (ses_cb_t *scb, status_t retres) |
| Operation failed or was never attempted. More... | |
| status_t | agt_rpc_send_rpc_error (ses_cb_t *scb, xml_msg_hdr_t *msg, const rpc_err_rec_t *err, int32 indent, boolean isfirst, boolean islast) |
| Send one <rpc-error> element on the specified session. More... | |
| ncx_backptr_t * | agt_rpc_get_first_backptr (void) |
| Get the first backptr to the registered and supported RPC methods on the server. More... | |
| ncx_backptr_t * | agt_rpc_get_next_backptr (ncx_backptr_t *curptr) |
| Get the next backptr to the registered and supported RPC methods on the server. More... | |
| status_t | agt_rpc_check_rpc_invoke (ses_cb_t *scb, rpc_msg_t *msg, obj_template_t *rpcobj) |
| Some RPC node parsed, check if it can be invoked or not. More... | |
| status_t | agt_rpc_parse_rpc_input (ses_cb_t *scb, rpc_msg_t *msg, obj_template_t *rpcobj, xml_node_t *method) |
| RPC received, parse parameters against rpcio for 'input'. More... | |
| status_t | agt_rpc_post_psd_state (ses_cb_t *scb, rpc_msg_t *msg, status_t psdres) |
| Fixup parmset after parse phase. More... | |
| status_t | agt_rpc_invoke_rpc (ses_cb_t *scb, rpc_msg_t *msg, xml_node_t *method_node) |
| Invoke an RPC – need to call following functions first: More... | |
| status_t | agt_rpc_invoke_action (ses_cb_t *scb, rpc_msg_t *msg, xml_node_t *method_node, val_value_t *action_val) |
| Invoke an Action – need to call following functions first: More... | |
| rpc_msg_t * | agt_rpc_new_dummy_msg (void) |
| Create a dummy rpc_msg_t. More... | |
| boolean | agt_rpc_callback_set (obj_template_t *obj) |
| Check if an RPC callback is registered for this object for SIL-SA usage. More... | |
| void | agt_rpc_callback_regdone (obj_template_t *obj) |
| Set the RPC as register done. More... | |
| boolean | agt_rpc_callback_is_regdone (obj_template_t *obj) |
| Set the RPC as register done. More... | |
| status_t | agt_rpc_register_subsys_callback (const xmlChar *subsys_id, const xmlChar *modname, const xmlChar *revision, const xmlChar *rpcname) |
| Register an object specific RPC callback function. More... | |
| void | agt_rpc_unregister_subsys_callback (const xmlChar *subsys_id, const xmlChar *modname, const xmlChar *revision, const xmlChar *rpcname) |
| Unregister an object specific RPC callback function. More... | |
| void | agt_rpc_add_return_val (val_value_t *return_val, rpc_msg_t *msg) |
| Add a return value to the msg. More... | |
| void | agt_rpc_add_return_vals (dlq_hdr_t *return_valQ, rpc_msg_t *msg) |
| Add a Q of return values to the msg. More... | |
| void | agt_rpc_clear_return_data (rpc_msg_t *msg) |
| Clear the return data Q. More... | |
| status_t | agt_rpc_handle_subsys_request (void *sil_sa_cb, ses_cb_t *scb, const xmlChar *modname, const xmlChar *rpcname, val_value_t *rpc_input_val, val_value_t *mpid_val, dlq_hdr_t *return_dataQ) |
| Handles incoming <rpc-request> server request messages from a subsystem. More... | |
| status_t | agt_rpc_handle_subsys_action (void *sil_sa_cb, ses_cb_t *scb, const xmlChar *path, val_value_t *action_input_val, val_value_t *mpid_val, dlq_hdr_t *return_dataQ) |
| Handles incoming <action-request> server request messages. More... | |
| void | agt_rpc_finish_reply (uint32 sid, void *msg) |
| Finish the rpc-reply for a remote operation. More... | |
| void | agt_rpc_reorder_dataQ (rpc_msg_t *msg) |
| Reorder the dataQ. More... | |
| void | agt_rpc_free_subsys (agt_rpc_subsys_t *cb) |
| Clean and free a subsys record. More... | |
| agt_rpc_subsys_t * | agt_rpc_new_subsys (const xmlChar *subsys_id) |
| Malloc and Initialize a subsys record. More... | |
| agt_rpc_subsys_t * | agt_rpc_find_subsys (dlq_hdr_t *subsysQ, const xmlChar *subsys_id) |
| Find a subsystem control block. More... | |
| status_t | agt_rpc_subrpc_dispatch (ses_cb_t *scb, rpc_msg_t *msg, const xmlChar *rpc_module, const xmlChar *rpc_name, val_value_t *rpc_method, const xmlChar *out_filespec) |
| Dispatch an incoming <subrpc-request> request. More... | |
| void | agt_rpc_unload_module (ncx_module_t *mod) |
| Check all the rpc objects from this module and clean any callbacks because the module is being unloaded. More... | |
| status_t | agt_rpc_process_rpc_request (ses_cb_t *scb, rpc_msg_t *msg, val_value_t *action_val, xml_node_t *method, obj_template_t *rpcobj) |
| Setup Action Parent nodes for when/must processing. More... | |
| status_t | agt_rpc_send_malformed_error (ses_cb_t *scb) |
| send a malformed-message error More... | |
NETCONF Remote Procedure Call Support.
Uses the rpc_msg_t struct and other support from the ncxlib.
Callback template for RPCs that use an inline callback function instead of generating a malloced val_value_t tree.
| scb | session control block |
| msg | RPC request in progress |
| indent | start indent amount; ignored if the server is configured not to use PDU indentation |
| typedef status_t(* agt_rpc_method_t) (ses_cb_t *scb, rpc_msg_t *msg, xml_node_t *methnode) |
Template for RPC server callbacks.
The same template is used for all RPC callback phases The callback is expected to validate if needed and then invoke if needed.
| scb | session invoking the RPC |
| msg | message in progress for this <rpc> request the msg->rpc_input value node contains the input (if any). It is a container matching the rpc/input node for the YANG rpc |
| methnode | XML node for the operation, which can be used in error reporting (or ignored) |
| enum agt_rpc_phase_t |
There are 3 different callbacks possible in the server processing chain.
Only AGT_RPC_PH_INVOKE is needed to do any work Validate is needed if parameter checking beyond the YANG constraints, such as checking if a needed lock is available
The engine will check for optional callbacks during RPC processing.
| void agt_rpc_add_return_val | ( | val_value_t * | return_val, |
| rpc_msg_t * | msg | ||
| ) |
Add a return value to the msg.
| return_val | value to add |
| msg | message to add value into |

| void agt_rpc_add_return_vals | ( | dlq_hdr_t * | return_valQ, |
| rpc_msg_t * | msg | ||
| ) |
Add a Q of return values to the msg.
| return_valQ | Q of values to add |
| msg | message to add value into |

| boolean agt_rpc_callback_is_regdone | ( | obj_template_t * | obj | ) |
Set the RPC as register done.
| obj | object to set |

| void agt_rpc_callback_regdone | ( | obj_template_t * | obj | ) |
Set the RPC as register done.
| obj | object to set |

| boolean agt_rpc_callback_set | ( | obj_template_t * | obj | ) |
Check if an RPC callback is registered for this object for SIL-SA usage.
| obj | object to check |

| status_t agt_rpc_check_rpc_invoke | ( | ses_cb_t * | scb, |
| rpc_msg_t * | msg, | ||
| obj_template_t * | rpcobj | ||
| ) |
Some RPC node parsed, check if it can be invoked or not.
| scb | session control block |
| msg | rpc_msg_t in progress |
| rpcobj | RPC object template to use (may be NULL) |


| void agt_rpc_cleanup | ( | void | ) |
Cleanup the agt_rpc module.
Unregister the top-level NETCONF <rpc> element should call once to cleanup RPC server module

| void agt_rpc_clear_return_data | ( | rpc_msg_t * | msg | ) |
Clear the return data Q.
| msg | message to add value into |

| boolean agt_rpc_dispatch | ( | ses_cb_t * | scb, |
| xml_node_t * | top | ||
| ) |
Dispatch an incoming <rpc> request.
called by top.c: This function is registered with top_register_node for the module 'yuma-netconf', top-node 'rpc'
| scb | session control block |
| top | top element descriptor |


| status_t agt_rpc_fill_rpc_error | ( | const rpc_err_rec_t * | err, |
| val_value_t * | rpcerror | ||
| ) |
Fill one <rpc-error> like element using the specified namespace and name, which may be different than NETCONF.
| err | error record to use to fill 'rpcerror' |
| rpcerror | NCX_BT_CONTAINER value struct already initialized. The val_add_child function will use this parm as the parent. This namespace will be used for all child nodes |

| agt_rpc_subsys_t * agt_rpc_find_subsys | ( | dlq_hdr_t * | subsysQ, |
| const xmlChar * | subsys_id | ||
| ) |
Find a subsystem control block.
| subsysQ | Q of subsys records to search |
| subsys_id | subsystem name |

| void agt_rpc_finish_reply | ( | uint32 | sid, |
| void * | msg | ||
| ) |
Finish the rpc-reply for a remote operation.
Used by yp-controller for remote operations
| sid | session ID to send on |
| msg | request message to use for reply |

| void agt_rpc_free_subsys | ( | agt_rpc_subsys_t * | cb | ) |
Clean and free a subsys record.
| cb | subsystem record |
| val_value_t * agt_rpc_get_config_file | ( | const xmlChar * | filespec, |
| cfg_template_t * | targetcfg, | ||
| ses_id_t | use_sid, | ||
| dlq_hdr_t * | errorQ, | ||
| status_t * | res | ||
| ) |
Dispatch an internal <load-config> request except skip the INVOKE phase and just remove the 'config' node from the input and return it.
| filespec | XML config filespec to get | |
| targetcfg | target database to validate against | |
| use_sid | session ID to use for the access control | |
| [out] | errorQ | address of return queue of rpc_err_rec_t structs If any errors, the error structs are transferred to the errorQ (if it is non-NULL). In this case, the caller must free these data structures with ncx/rpc_err_clean_errQ |
| [out] | res | address of return status; *res return status |
| ncx_backptr_t * agt_rpc_get_first_backptr | ( | void | ) |
Get the first backptr to the registered and supported RPC methods on the server.


| ncx_backptr_t * agt_rpc_get_next_backptr | ( | ncx_backptr_t * | curptr | ) |
Get the next backptr to the registered and supported RPC methods on the server.
| curptr | current backptr to use |


| status_t agt_rpc_handle_subsys_action | ( | void * | sil_sa_cb, |
| ses_cb_t * | scb, | ||
| const xmlChar * | path, | ||
| val_value_t * | action_input_val, | ||
| val_value_t * | mpid_val, | ||
| dlq_hdr_t * | return_dataQ | ||
| ) |
Handles incoming <action-request> server request messages.
SIL-SA only! Called from sil-sa/sil_sa.c
| sil_sa_cb | SIl_SA control block cast as void * | |
| scb | session control block of the subsystem | |
| path | instance-identifier of the action | |
| action_input_val | <action> input parameters | |
| mpid_val | optional <mpid> parameter | |
| [out] | return_dataQ | Q to hold val_value_t return values return values may be added |

| status_t agt_rpc_handle_subsys_request | ( | void * | sil_sa_cb, |
| ses_cb_t * | scb, | ||
| const xmlChar * | modname, | ||
| const xmlChar * | rpcname, | ||
| val_value_t * | rpc_input_val, | ||
| val_value_t * | mpid_val, | ||
| dlq_hdr_t * | return_dataQ | ||
| ) |
Handles incoming <rpc-request> server request messages from a subsystem.
SIL-SA only! Called from sil-sa/sil_sa.c
| sil_sa_cb | SIl_SA control block cast as void * | |
| scb | session control block of the subsystem | |
| modname | module name of operation | |
| rpcname | operation name | |
| rpc_input_val | <rpc> input parameters | |
| mpid_val | <mpid> subtree if sent for this request | |
| [out] | return_dataQ | Q to hold val_value_t return values return_dataQ return values may be added |

| status_t agt_rpc_init | ( | void | ) |
Initialize the agt_rpc module.
Adds the agt_rpc_dispatch function as the handler for the NETCONF <rpc> top-level element. should call once to init RPC server module


| status_t agt_rpc_invoke_action | ( | ses_cb_t * | scb, |
| rpc_msg_t * | msg, | ||
| xml_node_t * | method_node, | ||
| val_value_t * | action_val | ||
| ) |
Invoke an Action – need to call following functions first:
| scb | session control block |
| msg | rpc_msg_t in progress |
| method_node | XML node of the <rpc> start tag (NULL if none) |
| action_val | value tree setup for processing; ancestors to this value contain the keys needed for the action callback |

| status_t agt_rpc_invoke_rpc | ( | ses_cb_t * | scb, |
| rpc_msg_t * | msg, | ||
| xml_node_t * | method_node | ||
| ) |
Invoke an RPC – need to call following functions first:
| scb | session control block |
| msg | rpc_msg_t in progress |
| method_node | XML node of the <rpc> start tag (NULL if none) |

| status_t agt_rpc_load_config_file | ( | const xmlChar * | filespec, |
| cfg_template_t * | cfg, | ||
| boolean | isload, | ||
| ses_id_t | use_sid, | ||
| dlq_hdr_t * | errQ, | ||
| boolean | do_config_change, | ||
| const rpc_msg_t * | reqmsg | ||
| ) |
Dispatch an internal <load-config> request.
used for OP_EDITOP_LOAD to load the running from startup and OP_EDITOP_REPLACE to restore running from backup
| filespec | XML config filespec to load |
| cfg | cfg_template_t to fill in |
| isload | TRUE for normal load-config FALSE for restore backup load-config |
| use_sid | session ID to use for the access control |
| errQ | optional Q of rpc_err_rec_t for error reporting |
| do_config_change | TRUE if netconf-config-change events should be generated; FALSE to ignore (e.g., rollback) |
| reqmsg | request message (if any) to copy some message trace data
|


| status_t agt_rpc_load_config_file_val | ( | const xmlChar * | filespec, |
| ses_id_t | use_sid, | ||
| val_value_t ** | configval, | ||
| dlq_hdr_t * | errorQ | ||
| ) |
Dispatch an internal <load-config> request used for COPY-CONFIG for URL to Candidate.
GETS only the value, does not run VALIDATE and does not start txcb
| filespec | XML config filespec to get | |
| use_sid | session ID to use for the access control | |
| [out] | configval | address of return config val *configval malloced and filled in struct representing a "<config>" element or NULL if some error, check errorQ and *res |
| [out] | errorQ | if any errors, the error structs are transferred to the errorQ (if it is non-NULL). In this case, the caller must free these data structures with ncx/rpc_err_clean_errQ |

| rpc_msg_t * agt_rpc_new_dummy_msg | ( | void | ) |
Create a dummy rpc_msg_t.

| agt_rpc_subsys_t * agt_rpc_new_subsys | ( | const xmlChar * | subsys_id | ) |
Malloc and Initialize a subsys record.
| subsys_id | subsystem name |
| status_t agt_rpc_parse_rpc_input | ( | ses_cb_t * | scb, |
| rpc_msg_t * | msg, | ||
| obj_template_t * | rpcobj, | ||
| xml_node_t * | method | ||
| ) |
RPC received, parse parameters against rpcio for 'input'.
| scb | session control block |
| msg | rpc_msg_t in progress |
| rpcobj | RPC object template to use |
| method | method node |


Fixup parmset after parse phase.
Only call if the RPC has an input PS
| scb | session control block |
| msg | rpc_msg_t in progress |
| psdres | result from PSD state |

| status_t agt_rpc_process_rpc_request | ( | ses_cb_t * | scb, |
| rpc_msg_t * | msg, | ||
| val_value_t * | action_val, | ||
| xml_node_t * | method, | ||
| obj_template_t * | rpcobj | ||
| ) |
Setup Action Parent nodes for when/must processing.
| scb | client session control block |
| msg | RPC message in progress |
| action_val | nested YANG action node if this RPC is <action> |
| method | XML node for error reporting (may be NULL) |
| rpcobj | object for the RPC method |


| status_t agt_rpc_register_subsys_callback | ( | const xmlChar * | subsys_id, |
| const xmlChar * | modname, | ||
| const xmlChar * | revision, | ||
| const xmlChar * | rpcname | ||
| ) |
Register an object specific RPC callback function.
| subsys_id | subsystem ID registering the remote callback fn |
| modname | module that defines the target object for the remote callback functions |
| revision | revision date of module (may be NULL) |
| rpcname | name of the RPC method |

| void agt_rpc_reorder_dataQ | ( | rpc_msg_t * | msg | ) |
Reorder the dataQ.
YPW-1432: data from SIL-SA responses will be in alphabetical order because the parent is an anydata and the SIL-SA code can use generic functions like val_make_string. SIL functions can insert data in the queue in the wrong order Need to sort the rpc_dataQ in YANG order Keep all instances of the same object in the same Q order as before
| [in,out] | msg | message to adjust msg->rpc_dataQ could be reordered |


| status_t agt_rpc_replay_config | ( | void | ) |
Dispatch an internal <replay-config> request used for OP_EDITOP_LOAD to load the running from startup and OP_EDITOP_REPLACE to restore running from backup.

Operation failed or was never attempted.
Return an <rpc-reply> with an <rpc-error>
| scb | session control block |
| retres | error number for termination reason |


send a malformed-message error
The message was malformed so send an rpc-error for malformed-message There is no message and no error info to add
| scb | client session control block |


| status_t agt_rpc_send_rpc_error | ( | ses_cb_t * | scb, |
| xml_msg_hdr_t * | msg, | ||
| const rpc_err_rec_t * | err, | ||
| int32 | indent, | ||
| boolean | isfirst, | ||
| boolean | islast | ||
| ) |
Send one <rpc-error> element on the specified session.
| scb | session control block |
| msg | xml_msg_hdr_t in progress |
| err | error record to send |
| indent | starting indent count |
| isfirst | TRUE if first error (JSON only) |
| islast | TRUE if last error (JSON only) |


| status_t agt_rpc_subrpc_dispatch | ( | ses_cb_t * | scb, |
| rpc_msg_t * | msg, | ||
| const xmlChar * | rpc_module, | ||
| const xmlChar * | rpc_name, | ||
| val_value_t * | rpc_method, | ||
| const xmlChar * | out_filespec | ||
| ) |
Dispatch an incoming <subrpc-request> request.
called by agt_db_api.c
| scb | YControl session control block |
| msg | malloced RPC message to use |
| rpc_module | RPC module name or NULL to search for first find |
| rpc_name | name of RPC method to invoke |
| rpc_method | anyxml val_value_t tree representing the input from the DB-API client; if missing then no input |
| out_filespec | name of output file to use for the the XML file containing the response |

| void agt_rpc_support_method | ( | const xmlChar * | module, |
| const xmlChar * | method_name | ||
| ) |
mark an RPC method or action as supported within the server
this is needed for operations dependent on capabilities
| module | module name of RPC method (really module name) |
| method_name | RPC method name |

| void agt_rpc_unload_module | ( | ncx_module_t * | mod | ) |
Check all the rpc objects from this module and clean any callbacks because the module is being unloaded.
| mod | module being removed. This must be a real module not a submodule |

| void agt_rpc_unregister_subsys_callback | ( | const xmlChar * | subsys_id, |
| const xmlChar * | modname, | ||
| const xmlChar * | revision, | ||
| const xmlChar * | rpcname | ||
| ) |
Unregister an object specific RPC callback function.
| subsys_id | subsystem ID registering the remote callback fn |
| modname | module that defines the target object for the remote callback functions |
| revision | revision date of module (may be NULL) |
| rpcname | name of the RPC method |

| void agt_rpc_unsupport_method | ( | const xmlChar * | module, |
| const xmlChar * | method_name | ||
| ) |
mark an RPC method or action as unsupported within the server
this is needed for operations dependent on capabilities
| module | module name of RPC method (really module name) |
| method_name | RPC method name |
