yumapro  20.10-12
YumaPro SDK
agt_rpc.h File Reference

NETCONF protocol remote procedure call server-side definitions. More...

#include "cfg.h"
#include "rpc.h"
#include "rpc_err.h"
#include "ses.h"
#include "status_enum.h"
#include "xml_util.h"
Include dependency graph for agt_rpc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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...
 

Macros

#define AGT_RPC_NUM_CALLBACK_PHASES   3
 this constant is for the number of callback slots allocated in a 'cbset', and only includes the RPC phases that allow callback functions Change from all phases to save memory for 2 pointers that were never used
 

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...
 
status_t agt_rpc_register_method (const xmlChar *module, const xmlChar *method_name, agt_rpc_phase_t phase, agt_rpc_method_t method)
 add callback for 1 phase of RPC processing 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...
 
void agt_rpc_unregister_method (const xmlChar *module, const xmlChar *method_name)
 remove the callback functions for all phases of RPC or Action processing for the specified RPC method or action 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)
 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_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 *rpcname)
 Register an object specific RPC callback function. More...
 
void agt_rpc_unregister_subsys_callback (const xmlChar *subsys_id, const xmlChar *modname, 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, 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, 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...
 

Detailed Description

NETCONF protocol remote procedure call server-side definitions.