yumapro  20.10-12
YumaPro SDK
agt_rpc.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008 - 2012, Andy Bierman, All Rights Reserved.
3  * Copyright (c) 2012 - 2021, YumaWorks, Inc., All Rights Reserved.
4  *
5  * Unless required by applicable law or agreed to in writing,
6  * software distributed under the License is distributed on an
7  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8  * KIND, either express or implied. See the License for the
9  * specific language governing permissions and limitations
10  * under the License.
11  */
12 #ifndef _H_agt_rpc
13 #define _H_agt_rpc
14 /* FILE: agt_rpc.h
15 *********************************************************************
16 * *
17 * P U R P O S E *
18 * *
19 *********************************************************************/
20 
27 /*********************************************************************
28 * *
29 * C H A N G E H I S T O R Y *
30 * *
31 *********************************************************************
32 
33 date init comment
34 ----------------------------------------------------------------------
35 30-apr-05 abb Begun.
36 */
37 
38 #ifndef _H_cfg
39 #include "cfg.h"
40 #endif
41 
42 #ifndef _H_rpc
43 #include "rpc.h"
44 #endif
45 
46 #ifndef _H_rpc_err
47 #include "rpc_err.h"
48 #endif
49 
50 #ifndef _H_ses
51 #include "ses.h"
52 #endif
53 
54 #ifndef _H_status_enum
55 #include "status_enum.h"
56 #endif
57 
58 #ifndef _H_xml_util
59 #include "xml_util.h"
60 #endif
61 
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65 
77 /********************************************************************
78 * *
79 * C O N S T A N T S *
80 * *
81 *********************************************************************/
82 
89 #define AGT_RPC_NUM_CALLBACK_PHASES 3
90 
91 /********************************************************************
92 * *
93 * T Y P E S *
94 * *
95 *********************************************************************/
96 
109 typedef enum agt_rpc_phase_t_ {
112 
115 
118 
121 
124 } agt_rpc_phase_t;
125 
126 
146 typedef status_t
147  (*agt_rpc_method_t) (ses_cb_t *scb,
148  rpc_msg_t *msg,
149  xml_node_t *methnode);
150 
151 
153 typedef struct agt_rpc_cbset_t_ {
156 
158  boolean regdone;
159 
160 #ifdef WITH_YCONTROL
161  dlq_hdr_t subsysQ;
162 #endif
163 
164 } agt_rpc_cbset_t;
165 
166 
177 typedef status_t
178  (*agt_rpc_data_cb_t) (ses_cb_t *scb,
179  rpc_msg_t *msg,
180  uint32 indent);
181 
182 
187 typedef struct agt_rpc_subsys_t_ {
189  dlq_hdr_t qhdr;
190 
192  const xmlChar *subsys_id;
193 
195  status_t res;
196 } agt_rpc_subsys_t;
197 
198 
199 /********************************************************************
200 * *
201 * F U N C T I O N S *
202 * *
203 *********************************************************************/
204 
205 
215 extern status_t
216  agt_rpc_init (void);
217 
218 
225 extern void
226  agt_rpc_cleanup (void);
227 
228 
238 extern status_t
239  agt_rpc_register_method (const xmlChar *module,
240  const xmlChar *method_name,
241  agt_rpc_phase_t phase,
242  agt_rpc_method_t method);
243 
244 
253 extern void
254  agt_rpc_support_method (const xmlChar *module,
255  const xmlChar *method_name);
256 
257 
266 extern void
267  agt_rpc_unsupport_method (const xmlChar *module,
268  const xmlChar *method_name);
269 
270 
278 extern void
279  agt_rpc_unregister_method (const xmlChar *module,
280  const xmlChar *method_name);
281 
282 
295 extern boolean
296  agt_rpc_dispatch (ses_cb_t *scb,
297  xml_node_t *top);
298 
299 
323 extern status_t
324  agt_rpc_load_config_file (const xmlChar *filespec,
325  cfg_template_t *cfg,
326  boolean isload,
327  ses_id_t use_sid,
328  dlq_hdr_t *errQ);
329 
330 
356 extern val_value_t *
357  agt_rpc_get_config_file (const xmlChar *filespec,
358  cfg_template_t *targetcfg,
359  ses_id_t use_sid,
360  dlq_hdr_t *errorQ,
361  status_t *res);
362 
363 
381 extern status_t
382  agt_rpc_replay_config (void);
383 
384 
397 extern status_t
398  agt_rpc_fill_rpc_error (const rpc_err_rec_t *err,
399  val_value_t *rpcerror);
400 
401 
410 extern void
411  agt_rpc_send_error_reply (ses_cb_t *scb,
412  status_t retres);
413 
414 
426 extern status_t
427  agt_rpc_send_rpc_error (ses_cb_t *scb,
428  xml_msg_hdr_t *msg,
429  const rpc_err_rec_t *err,
430  int32 indent,
431  boolean isfirst,
432  boolean islast);
433 
434 
441 extern ncx_backptr_t *
443 
444 
452 extern ncx_backptr_t *
453  agt_rpc_get_next_backptr (ncx_backptr_t *curptr);
454 
455 
464 extern status_t
465  agt_rpc_check_rpc_invoke (ses_cb_t *scb,
466  rpc_msg_t *msg,
467  obj_template_t *rpcobj);
468 
469 
479 extern status_t
480  agt_rpc_parse_rpc_input (ses_cb_t *scb,
481  rpc_msg_t *msg,
482  obj_template_t *rpcobj,
483  xml_node_t *method);
484 
485 
496 extern status_t
497  agt_rpc_post_psd_state (ses_cb_t *scb,
498  rpc_msg_t *msg,
499  status_t psdres);
500 
501 
514 extern status_t
515  agt_rpc_invoke_rpc (ses_cb_t *scb,
516  rpc_msg_t *msg,
517  xml_node_t *method_node);
518 
519 
534 extern status_t
535  agt_rpc_invoke_action (ses_cb_t *scb,
536  rpc_msg_t *msg,
537  xml_node_t *method_node,
538  val_value_t *action_val);
539 
540 
546 extern rpc_msg_t *
547  agt_rpc_new_dummy_msg (void);
548 
549 
557 extern boolean
558  agt_rpc_callback_set (obj_template_t *obj);
559 
560 
566 extern void
567  agt_rpc_callback_regdone (obj_template_t *obj);
568 
569 
576 extern boolean
577  agt_rpc_callback_is_regdone (obj_template_t *obj);
578 
579 
580 #ifdef WITH_YCONTROL
581 
590 extern status_t
591  agt_rpc_register_subsys_callback (const xmlChar *subsys_id,
592  const xmlChar *modname,
593  const xmlChar *rpcname);
594 
595 
604 extern void
605  agt_rpc_unregister_subsys_callback (const xmlChar *subsys_id,
606  const xmlChar *modname,
607  const xmlChar *rpcname);
608 
609 #endif // WITH_YCONTROL
610 
611 
618 extern void
619  agt_rpc_add_return_val (val_value_t *return_val,
620  rpc_msg_t *msg);
621 
622 
629 extern void
630  agt_rpc_add_return_vals (dlq_hdr_t *return_valQ,
631  rpc_msg_t *msg);
632 
633 
639 extern void
640  agt_rpc_clear_return_data (rpc_msg_t *msg);
641 
642 
643 #ifdef WITH_YCONTROL
644 
659 extern status_t
660  agt_rpc_handle_subsys_request (void *sil_sa_cb,
661  ses_cb_t *scb,
662  const xmlChar *modname,
663  const xmlChar *rpcname,
664  val_value_t *rpc_input_val,
665  dlq_hdr_t *return_dataQ);
666 
667 
681 extern status_t
682  agt_rpc_handle_subsys_action (void *sil_sa_cb,
683  ses_cb_t *scb,
684  const xmlChar *path,
685  val_value_t *action_input_val,
686  dlq_hdr_t *return_dataQ);
687 #endif // WITH_YCONTROL
688 
689 
698 extern void
699  agt_rpc_finish_reply (uint32 sid,
700  void *msg);
701 
702 
716 extern void
717  agt_rpc_reorder_dataQ (rpc_msg_t *msg);
718 
719 
720 #ifdef WITH_YCONTROL
721 
726 extern void
727  agt_rpc_free_subsys (agt_rpc_subsys_t *cb);
728 
729 
736 extern agt_rpc_subsys_t *
737  agt_rpc_new_subsys (const xmlChar *subsys_id);
738 
739 
747 extern agt_rpc_subsys_t *
748  agt_rpc_find_subsys (dlq_hdr_t *subsysQ,
749  const xmlChar *subsys_id);
750 
751 
768 extern status_t
769  agt_rpc_subrpc_dispatch (ses_cb_t *scb,
770  rpc_msg_t *msg,
771  const xmlChar *rpc_module,
772  const xmlChar *rpc_name,
773  val_value_t *rpc_method,
774  const xmlChar *out_filespec);
775 
776 #endif // WITH_YCONTROL
777 
778 
786 extern void
787  agt_rpc_unload_module (ncx_module_t *mod);
788 
789 
792 #ifdef __cplusplus
793 } /* end extern 'C' */
794 #endif
795 
796 #endif /* _H_agt_rpc */
agt_rpc_find_subsys
agt_rpc_subsys_t * agt_rpc_find_subsys(dlq_hdr_t *subsysQ, const xmlChar *subsys_id)
Find a subsystem control block.
Definition: agt_rpc.c:4874
agt_action_is_action
boolean agt_action_is_action(obj_template_t *rpcobj)
Check if the specified node is the action.
Definition: agt_action.c:256
xml_msg_finish_prefix_map
status_t xml_msg_finish_prefix_map(xml_msg_hdr_t *msg, xml_attrs_t *attrs)
Finish the queue of xmlns_pmap_t records for the current message.
Definition: xml_msg.c:884
ses.h
NETCONF Session Common definitions module.
ERR_NCX_SKIPPED
@ ERR_NCX_SKIPPED
2001
Definition: status_enum.h:551
xml_strlen
uint32 xml_strlen(const xmlChar *str)
Get the String len for xmlChar.
Definition: xml_util.c:1406
SES_TR_OTHER
@ SES_TR_OTHER
other
Definition: ses.h:393
agt_rpc_fill_rpc_error
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...
Definition: agt_rpc.c:3501
agt_sil_walk_rpc_results
status_t agt_sil_walk_rpc_results(const xmlChar *txid_str, agt_sil_rpc_walker_fn_t rpc_walker_fn, dlq_hdr_t *saveQ)
Walk the RPC transaction results.
Definition: agt_sil.c:9063
NCX_NT_STRING
@ NCX_NT_STRING
xmlChar *, error only
Definition: ncxtypes.h:279
DUMP_VAL_LOG
@ DUMP_VAL_LOG
dump val to main log
Definition: val.h:777
agt_action_parse_input
status_t agt_action_parse_input(ses_cb_t *scb, rpc_msg_t *msg, xml_node_t *method, obj_template_t *rpcobj, val_value_t **action_val)
RPC "<action>" received, parse parameters against anydata 'action'.
Definition: agt_action.c:412
ERR_NCX_TIMEOUT
@ ERR_NCX_TIMEOUT
368
Definition: status_enum.h:411
cfg.h
agt_rpc_new_subsys
agt_rpc_subsys_t * agt_rpc_new_subsys(const xmlChar *subsys_id)
Malloc and Initialize a subsys record.
Definition: agt_rpc.c:4852
NCX_BT_INT32
@ NCX_BT_INT32
int32
Definition: ncxtypes.h:209
ERR_NCX_WRONG_NODETYP
@ ERR_NCX_WRONG_NODETYP
282
Definition: status_enum.h:325
dlq_block_enque
void dlq_block_enque(dlq_hdrT *srcP, dlq_hdrT *dstP)
add all the queue entries in the srcP queue list to the end of the dstP queue list
Definition: dlq.c:731
RPC_RPYTYP_NONE
@ RPC_RPYTYP_NONE
not set
Definition: rpc.h:173
val_move_children
void val_move_children(val_value_t *srcval, val_value_t *destval)
Move all the child nodes from src to dest Source and dest must both be containers!
Definition: val.c:12651
ses_finish_msg
void ses_finish_msg(ses_cb_t *scb)
Finish an outbound message on the specified session.
Definition: ses.c:3013
agt_rpc_cbset_t_::subsysQ
dlq_hdr_t subsysQ
Q of agt_rpc_subsys_t.
Definition: agt_rpc.h:161
xml_msg_clean_hdr
void xml_msg_clean_hdr(xml_msg_hdr_t *msg)
Clean all the memory used by the specified xml_msg_hdr_t but do not free the struct itself.
Definition: xml_msg.c:438
NCX_BT_BINARY
@ NCX_BT_BINARY
binary (base64)
Definition: ncxtypes.h:218
agt_ses.h
Server Session Management.
agt_util.h
Utility Functions for NCX Server method routines.
ses_new_indent_count
int32 ses_new_indent_count(boolean indent_in, int32 indent, int32 indent_amount)
Get the new indent count from the current and indent_amount.
Definition: ses.c:4148
SES_SET_CUR_RPC_MSG
#define SES_SET_CUR_RPC_MSG(S, MSG)
set the current RPC message
Definition: ses.h:144
agt_rpc_register_method
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
Definition: agt_rpc.c:2557
OP_EDITOP_REPLACE
@ OP_EDITOP_REPLACE
edit op is replace
Definition: op.h:125
agt_rpc_finish_reply
void agt_rpc_finish_reply(uint32 sid, void *msg)
Finish the rpc-reply for a remote operation.
Definition: agt_rpc.c:4731
agt_rpc_invoke_rpc
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:
Definition: agt_rpc.c:3986
OP_EDITOP_NONE
@ OP_EDITOP_NONE
not set
Definition: op.h:123
xml_strdup
xmlChar * xml_strdup(const xmlChar *copyFrom)
String duplicate for xmlChar.
Definition: xml_util.c:1553
ncx_warning_enabled
boolean ncx_warning_enabled(status_t res)
Check if a specific status_t code is enabled.
Definition: ncx.c:9394
AGT_TX_TYPE_RPC
@ AGT_TX_TYPE_RPC
DB-API RPC transaction.
Definition: agt.h:667
xml_clean_node
void xml_clean_node(xml_node_t *node)
Clean an xml_node_t struct.
Definition: xml_util.c:266
ncx_find_backptr
ncx_backptr_t * ncx_find_backptr(const dlq_hdr_t *que, void *node)
Find the specified back pointer struct.
Definition: ncx.c:11609
agt_output_end_container
void agt_output_end_container(ses_cb_t *scb, xml_msg_hdr_t *mhdr, xmlns_id_t node_nsid, const xmlChar *node_name, int32 indent)
Output an end container node.
Definition: agt_util.c:5408
val_find_child
val_value_t * val_find_child(const val_value_t *parent, const xmlChar *modname, const xmlChar *childname)
Find the first instance of the specified child node.
Definition: val.c:8560
agt_val_clean_cached_results
void agt_val_clean_cached_results(void)
Clean cached results.
Definition: agt_val.c:14004
xml_msg_add_ncid_to_prefix_map
status_t xml_msg_add_ncid_to_prefix_map(xml_msg_hdr_t *msg, xml_attrs_t *attrs, xmlns_id_t ncid)
Add an ncid or ncxid to a prefix map.
Definition: xml_msg.c:1182
ses_start_msg_mode
void ses_start_msg_mode(ses_cb_t *scb)
Set the message output mode to active.
Definition: ses.c:2932
ERR_NCX_DEF_NOT_FOUND
@ ERR_NCX_DEF_NOT_FOUND
250
Definition: status_enum.h:289
SES_ST_IDLE
@ SES_ST_IDLE
adble to accept requests
Definition: ses.h:358
log_error
void log_error(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_ERROR log entry.
NCX_LAYER_NONE
@ NCX_LAYER_NONE
not set
Definition: ncxtypes.h:343
obj_is_rpc
boolean obj_is_rpc(const obj_template_t *obj)
Check if the object is an RPC method.
Definition: obj.c:13983
obj_is_supported
boolean obj_is_supported(obj_template_t *obj)
Check an RPC node to check if it is supported or not It could be disabled at run-time without removin...
Definition: obj.c:16762
ERR_NCX_UNKNOWN_ELEMENT
@ ERR_NCX_UNKNOWN_ELEMENT
265
Definition: status_enum.h:306
NCX_BT_BOOLEAN
@ NCX_BT_BOOLEAN
boolean
Definition: ncxtypes.h:206
xml_msg_check_xmlns_attr
status_t xml_msg_check_xmlns_attr(xml_msg_hdr_t *msg, xmlns_id_t nsid, const xmlChar *badns, xml_attrs_t *attrs)
Check the default NS and the prefix map in the msg;.
Definition: xml_msg.c:954
agt_rpc_send_error_reply
void agt_rpc_send_error_reply(ses_cb_t *scb, status_t retres)
Operation failed or was never attempted.
Definition: agt_rpc.c:3633
val.h
Value Node Basic Support.
ncx_get_layer
const xmlChar * ncx_get_layer(ncx_layer_t layer)
Translate ncx_layer_t enum to a string.
Definition: ncx.c:6806
NCX_BT_INSTANCE_ID
@ NCX_BT_INSTANCE_ID
instance-identifier
Definition: ncxtypes.h:219
agt_ncxserver_run_ycontrol
status_t agt_ncxserver_run_ycontrol(boolean ycontrol, const xmlChar *txid_str)
IO server loop for the ncxserver socket.
Definition: agt_ncxserver.c:3469
xml_util.h
XML Utilities.
json_wr_simval_line
void json_wr_simval_line(ses_cb_t *scb, xml_msg_hdr_t *msg, xmlns_id_t nsid, const xmlChar *namestr, const xmlChar *valstr, ncx_btype_t btyp, int32 startindent, boolean isfirst)
generate 1 line for a simple value within a container or array
Definition: json_wr.c:1861
NCX_BT_IDREF
@ NCX_BT_IDREF
identityref
Definition: ncxtypes.h:222
rpc_err_dump_errors
void rpc_err_dump_errors(const rpc_msg_t *msg, log_debug_t lvl)
Dump the error messages in the RPC message error Q.
Definition: rpc_err.c:488
NCX_BT_INTERN
@ NCX_BT_INTERN
not a real type, string buffer for contents
Definition: ncxtypes.h:231
AGT_RPC_PH_PARSE
@ AGT_RPC_PH_PARSE
(1) NO CB FOR THIS STATE
Definition: agt_rpc.h:124
agt_rpc.h
NETCONF protocol remote procedure call server-side definitions.
agt_rpc_replay_config
status_t agt_rpc_replay_config(void)
Dispatch an internal <replay-config> request used for OP_EDITOP_LOAD to load the running from startup...
Definition: agt_rpc.c:3386
AGT_RPC_PH_VALIDATE
@ AGT_RPC_PH_VALIDATE
(2) cb after the input is parsed
Definition: agt_rpc.h:115
status_enum.h
global error status code enumerations
NCX_LAYER_OPERATION
@ NCX_LAYER_OPERATION
protocol operation layer
Definition: ncxtypes.h:346
cfg_rwlock_init_req_locks
status_t cfg_rwlock_init_req_locks(thd_tcb_t *tcb)
Initialize TCB multiple lock structure.
Definition: cfg.c:638
ncx_clean_backptrQ
void ncx_clean_backptrQ(dlq_hdr_t *backptrQ)
Clean an entire Q of ncx_backptr_t structs.
Definition: ncx.c:11470
NCX_BT_LEAFREF
@ NCX_BT_LEAFREF
leafref (needs special processing)
Definition: ncxtypes.h:221
log_debug3
void void void void void void void void void void void log_debug3(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG3 log entry.
agt_action.h
NETCONF Server YANG action handler.
agt_rpc_subsys_t_
header for 1 subsystem that has a SIL-SA callback function registered for the RPC method in the agt_r...
Definition: agt_rpc.h:187
xml_wr.h
XML Write functions.
obj_next_child_deep
obj_template_t * obj_next_child_deep(obj_template_t *obj)
Get the next child object if the specified object has any children.
Definition: obj.c:7138
ncx_num.h
NCX Module Library Number Utility Functions.
RPC_RPYTYP_OK
@ RPC_RPYTYP_OK
reply is ok
Definition: rpc.h:174
agt_rpc_dispatch
boolean agt_rpc_dispatch(ses_cb_t *scb, xml_node_t *top)
Dispatch an incoming <rpc> request.
Definition: agt_rpc.c:2810
agt_ncxserver.h
NCX Server Transport and IO Library.
agt_rpc_register_subsys_callback
status_t agt_rpc_register_subsys_callback(const xmlChar *subsys_id, const xmlChar *modname, const xmlChar *rpcname)
Register an object specific RPC callback function.
Definition: agt_rpc.c:4190
XML_MSG_CLR_WITH_GET2
#define XML_MSG_CLR_WITH_GET2(M)
Clear flag that GET2 mode requested.
Definition: xml_msg.h:234
ERR_NCX_INVALID_FRAMING
@ ERR_NCX_INVALID_FRAMING
378
Definition: status_enum.h:421
ncx_next_backptr
ncx_backptr_t * ncx_next_backptr(ncx_backptr_t *curptr)
Get next back pointer struct.
Definition: ncx.c:11545
agt_sys_send_sysConfigChange
void agt_sys_send_sysConfigChange(const ses_cb_t *scb, dlq_hdr_t *auditrecQ)
Queue the Config Change notification.
Definition: agt_sys.c:1355
val_add_defaults
status_t val_add_defaults(val_value_t *val, boolean scriptmode)
Add defaults to an initialized complex value.
Definition: val_util.c:2692
agt_rpc_add_return_val
void agt_rpc_add_return_val(val_value_t *return_val, rpc_msg_t *msg)
Add a return value to the msg.
Definition: agt_rpc.c:4350
agt_xml.h
NETCONF Server XML Reader interface.
NCX_BT_ANYDATA
@ NCX_BT_ANYDATA
YANG 1.1 anydata.
Definition: ncxtypes.h:229
RPC_DATA_YANG
@ RPC_DATA_YANG
STD is used by YANG rpc or action stmts; no extra <data> container will be added to the <rpc-reply> c...
Definition: rpc.h:167
agt_set_factory_restart
void agt_set_factory_restart(void)
Set the flag so the server will restart with the factory config.
Definition: agt.c:5036
VAL_NAME
#define VAL_NAME(V)
Access the value name.
Definition: val.h:399
ncxconst.h
Contains NCX constants.
ncxmod.h
NCX Module Load Manager.
NCX_PROTO_YUMA_YANGAPI
@ NCX_PROTO_YUMA_YANGAPI
YumaPro YANG-API 1.0.
Definition: ncxtypes.h:785
agt_action_find_node
val_value_t * agt_action_find_node(val_value_t *val)
Find the nested node that is an action.
Definition: agt_action.c:730
agt_rpc_get_config_file
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' ...
Definition: agt_rpc.c:3344
agt_rpc_callback_regdone
void agt_rpc_callback_regdone(obj_template_t *obj)
Set the RPC as register done.
Definition: agt_rpc.c:4125
agt_rpc_subsys_t_::res
status_t res
subsystem status
Definition: agt_rpc.h:195
ses_set_file_override
status_t ses_set_file_override(ses_cb_t *scb, const xmlChar *filespec)
Setup the session in file write override mode.
Definition: ses.c:4881
NCX_DC_CONFIG
@ NCX_DC_CONFIG
persistent config
Definition: ncxtypes.h:192
xml_wr_begin_elem
void xml_wr_begin_elem(ses_cb_t *scb, xml_msg_hdr_t *msg, xmlns_id_t parent_nsid, xmlns_id_t nsid, const xmlChar *elname, int32 indent)
Write a start XML tag to the specified session without attributes.
Definition: xml_wr.c:3040
ses_id_t
uint32 ses_id_t
Session ID.
Definition: ses.h:306
xml_clean_attrs
void xml_clean_attrs(xml_attrs_t *attrs)
clean an xml_attrs_t variable
Definition: xml_util.c:1243
ncx_mod_has_rpcs
boolean ncx_mod_has_rpcs(ncx_module_t *mod)
Check if the module has any RPC operation definitions.
Definition: ncx.c:10937
agt_cb.h
NETCONF Server Data Model callback handler.
NCX_BT_UINT8
@ NCX_BT_UINT8
uint8
Definition: ncxtypes.h:211
ses_putchar
void ses_putchar(ses_cb_t *scb, uint32 ch)
Write one char to the session, without any translation.
Definition: ses.c:2353
obj_is_action
boolean obj_is_action(const obj_template_t *obj)
Check if the object is a YANG 1.1 action.
Definition: obj.c:14028
dlq_insertAhead
void dlq_insertAhead(void *newP, void *nodeP)
insert the new queue entry before the current entry
Definition: dlq.c:447
log_info
void void void void void log_info(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_INFO log entry.
xmlns_id_t
uint16 xmlns_id_t
integer handle for registered namespaces
Definition: xmlns.h:89
AGT_RPC_PH_REPLY
@ AGT_RPC_PH_REPLY
(4) NO CB FOR THIS STATE
Definition: agt_rpc.h:127
xml_get_reader_from_filespec
status_t xml_get_reader_from_filespec(const char *filespec, xmlTextReaderPtr *reader)
Get a new xmlTextReader for parsing a debug test file.
Definition: xml_util.c:341
agt_record_error
void agt_record_error(ses_cb_t *scb, xml_msg_hdr_t *msghdr, ncx_layer_t layer, status_t res, const xml_node_t *xmlnode, ncx_node_t parmtyp, const void *error_info, ncx_node_t nodetyp, void *error_path)
Generate an rpc_err_rec_t and save it in the msg.
Definition: agt_util.c:1942
NCX_LAYER_RPC
@ NCX_LAYER_RPC
RPC operation layer.
Definition: ncxtypes.h:345
val_remove_child
void val_remove_child(val_value_t *child)
Remove a child value node from its parent value node.
Definition: val.c:8316
agt_rpc_unregister_method
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...
Definition: agt_rpc.c:2759
ERR_NCX_MISSING_PARM
@ ERR_NCX_MISSING_PARM
233
Definition: status_enum.h:272
agt_rpc_cleanup
void agt_rpc_cleanup(void)
Cleanup the agt_rpc module.
Definition: agt_rpc.c:2531
log_debug2
void void void void void void void void void log_debug2(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG2 log entry.
agt_val.h
NETCONF Server database callback handler.
xml_msg_gen_xmlns_attrs
status_t xml_msg_gen_xmlns_attrs(xml_msg_hdr_t *msg, xml_attrs_t *attrs, boolean addncx)
Generate any xmlns directives in the top-level attribute Q.
Definition: xml_msg.c:1034
rpc_err_any_errors
boolean rpc_err_any_errors(const rpc_msg_t *msg)
Check if there are any errors in the RPC message error Q.
Definition: rpc_err.c:577
agt_in_maintenance_mode
boolean agt_in_maintenance_mode(void)
Return true if in mainenance mode now.
Definition: agt.c:5184
obj_is_exclusive_rpc
boolean obj_is_exclusive_rpc(const obj_template_t *obj)
Check if this object has the OBJ_FL_EXCLUSIVE_WRITE bit set.
Definition: obj.c:16925
NCX_BT_ENUM
@ NCX_BT_ENUM
enumeration
Definition: ncxtypes.h:204
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
agt_rpc_cbset_t_::regdone
boolean regdone
registration done flag
Definition: agt_rpc.h:158
NCX_PROTO_RESTCONF
@ NCX_PROTO_RESTCONF
IETF RESTCONF.
Definition: ncxtypes.h:788
NC_MODULE
#define NC_MODULE
Internal NETCONF YANG module.
Definition: ncxconst.h:71
NCX_BT_UINT64
@ NCX_BT_UINT64
uint64
Definition: ncxtypes.h:214
AGT_EVAL_REQUEST_LIMIT
#define AGT_EVAL_REQUEST_LIMIT
max.
Definition: agt.h:499
ERR_NCX_MOD_NOT_FOUND
@ ERR_NCX_MOD_NOT_FOUND
236
Definition: status_enum.h:275
agt_rpc_unregister_subsys_callback
void agt_rpc_unregister_subsys_callback(const xmlChar *subsys_id, const xmlChar *modname, const xmlChar *rpcname)
Unregister an object specific RPC callback function.
Definition: agt_rpc.c:4271
agt_audit.h
NETCONF protocol audit log support.
xml_init_attrs
void xml_init_attrs(xml_attrs_t *attrs)
initialize an xml_attrs_t variable
Definition: xml_util.c:745
val_get_nsid
xmlns_id_t val_get_nsid(const val_value_t *val)
Get the namespace ID for the specified value node.
Definition: val.c:12277
log_debug4
void void void void void void void void void void void void void log_debug4(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG4 log entry.
obj_get_name
const xmlChar * obj_get_name(const obj_template_t *obj)
Get the name field for this obj.
Definition: obj.c:10511
agt_rpc_init
status_t agt_rpc_init(void)
Initialize the agt_rpc module.
Definition: agt_rpc.c:2496
ERR_NCX_OPERATION_FAILED
@ ERR_NCX_OPERATION_FAILED
274
Definition: status_enum.h:315
obj_get_child_count
uint32 obj_get_child_count(const obj_template_t *obj)
Get the number of child nodes the object has.
Definition: obj.c:12914
cfg_rwlock_release_all_locks
status_t cfg_rwlock_release_all_locks(thd_tcb_t *tcb)
Release all RWLOCKs recorded in TCB lock state structure.
Definition: cfg.c:675
ses_message_indent_count
int32 ses_message_indent_count(const ses_cb_t *scb)
Get the message indent count for this session.
Definition: ses.c:2822
agt_sil.h
SIL Transaction APIs.
LOGDEBUG2
#define LOGDEBUG2
Check if at least log-level=debug2.
Definition: log.h:292
dlq_createSQue
void dlq_createSQue(dlq_hdrT *queAddr)
create a static queue header
Definition: dlq.c:177
cfg_clear_running_dirty_flag
void cfg_clear_running_dirty_flag(void)
Clear the running dirty flag when it is saved to NV-storage or loaded into running from startup.
Definition: cfg.c:2024
log_warn
void void void log_warn(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_WARN log entry.
ERR_INTERNAL_VAL
@ ERR_INTERNAL_VAL
004
Definition: status_enum.h:194
ERR_NCX_MAINTENANCE_MODE
@ ERR_NCX_MAINTENANCE_MODE
420
Definition: status_enum.h:463
agt_rpc_parse_rpc_input
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'.
Definition: agt_rpc.c:3877
agt_rpc_invoke_action
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:
Definition: agt_rpc.c:4027
heapchk.h
Internal Heap Checking Utilities.
LOG_DEBUG_WARN
@ LOG_DEBUG_WARN
all errors + warnings
Definition: log.h:391
ses_get_total_stats
ses_total_stats_t * ses_get_total_stats(void)
Get a r/w pointer to the the session totals stats.
Definition: ses.c:3560
dlq_remove
void dlq_remove(void *nodeP)
remove the queue entry from its queue list entry MUST have been enqueued somehow before this function...
Definition: dlq.c:519
agt_record_attr_error
void agt_record_attr_error(ses_cb_t *scb, xml_msg_hdr_t *msghdr, ncx_layer_t layer, status_t res, const xml_attr_t *xmlattr, const xml_node_t *xmlnode, const xmlChar *badns, ncx_node_t nodetyp, void *errnode)
Generate an rpc_err_rec_t and save it in the msg.
Definition: agt_util.c:2162
val_child_add
status_t val_child_add(val_value_t *child, val_value_t *parent)
Add a child value node to a parent value node.
Definition: val_child.c:1542
val_util.h
Value Node Utilities.
json_wr.h
JSON Write functions.
agt_cb_run_command_complete
void agt_cb_run_command_complete(ses_cb_t *scb, rpc_msg_t *msg, const xmlChar *command_modname, const xmlChar *command_name)
Run Command Complete callbacks.
Definition: agt_cb.c:4373
agt_val_instance_check
status_t agt_val_instance_check(ses_cb_t *scb, xml_msg_hdr_t *msg, val_value_t *valset, val_value_t *valroot, ncx_layer_t layer)
Check for the proper number of object instances for the specified value struct.
Definition: agt_val.c:12799
agt_ses_set_dummy_session_acm
status_t agt_ses_set_dummy_session_acm(ses_cb_t *dummy_session, ses_id_t use_sid)
Set the session ID and username of the user that will be responsible for the rollback if needed.
Definition: agt_ses.c:576
NCX_BT_INT64
@ NCX_BT_INT64
int64
Definition: ncxtypes.h:210
ERR_NCX_INVALID_VALUE
@ ERR_NCX_INVALID_VALUE
258
Definition: status_enum.h:299
agt_cfg_txid_in_progress
ncx_transaction_id_t agt_cfg_txid_in_progress(ncx_cfg_t cfgid)
Return the ID of the current transaction ID in progress.
Definition: agt_cfg.c:1479
OP_ERROP_CONTINUE
@ OP_ERROP_CONTINUE
continue-on-error
Definition: op.h:176
rpc_err_get_severity
const xmlChar * rpc_err_get_severity(rpc_err_sev_t sev)
Translate an rpc_err_sev_t to a string.
Definition: rpc_err.c:520
NCX_BT_EMPTY
@ NCX_BT_EMPTY
empty
Definition: ncxtypes.h:205
SES_OUT_BYTES
#define SES_OUT_BYTES(S)
get session out bytes
Definition: ses.h:120
NCX_BT_UINT16
@ NCX_BT_UINT16
uint16
Definition: ncxtypes.h:212
rpc.h
NETCONF protocol remote procedure call common definitions.
agt_audit_handle_rpc_summary
void agt_audit_handle_rpc_summary(ses_cb_t *scb, rpc_msg_t *msg)
Create and store an rpc-summary event audit record, if needed.
Definition: agt_audit.c:746
agt_ses_request_close
boolean agt_ses_request_close(ses_cb_t *scb, ses_id_t killedby, ses_term_reason_t termreason)
Start the close of the specified session.
Definition: agt_ses.c:1056
agt_rpc_support_method
void agt_rpc_support_method(const xmlChar *module, const xmlChar *method_name)
mark an RPC method or action as supported within the server
Definition: agt_rpc.c:2637
agt_sil_end_rpc_transaction
void agt_sil_end_rpc_transaction(const xmlChar *txid_str)
End an RPC transaction.
Definition: agt_sil.c:9481
ERR_INTERNAL_MEM
@ ERR_INTERNAL_MEM
003
Definition: status_enum.h:193
ses_is_dbapi_system_session
boolean ses_is_dbapi_system_session(ses_cb_t *scb)
Check if the specified session is a DB-API control session for system edits.
Definition: ses.c:4478
agt_rpc_unload_module
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 unload...
Definition: agt_rpc.c:5141
NCX_DISPLAY_MODE_XML_NONS
@ NCX_DISPLAY_MODE_XML_NONS
XML display mode without any prefixes (not compliant XML!)
Definition: ncxtypes.h:463
SES_TYP_DUMMY
@ SES_TYP_DUMMY
internal session for rollback, etc.
Definition: ses.h:321
agt_rpc_send_rpc_error
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.
Definition: agt_rpc.c:3747
SES_TR_DROPPED
@ SES_TR_DROPPED
dropped by remote peer
Definition: ses.h:391
val_child.h
Value Node Child Access Support.
xml_wr_end_elem
void xml_wr_end_elem(ses_cb_t *scb, xml_msg_hdr_t *msg, xmlns_id_t nsid, const xmlChar *elname, int32 indent)
Write an end tag to the specified session.
Definition: xml_wr.c:3114
ERR_INTERNAL_INIT_SEQ
@ ERR_INTERNAL_INIT_SEQ
007
Definition: status_enum.h:197
get_error_string
const char * get_error_string(status_t res)
Get the error message for a specific internal error.
Definition: status.c:239
obj_rpc_has_input
boolean obj_rpc_has_input(obj_template_t *obj)
Check if the RPC object has any real input children.
Definition: obj.c:14956
ERR_INTERNAL_PTR
@ ERR_INTERNAL_PTR
002
Definition: status_enum.h:192
ERR_NCX_MISSING_ATTRIBUTE
@ ERR_NCX_MISSING_ATTRIBUTE
260
Definition: status_enum.h:301
ERR_NCX_NO_XPATH_CHILD
@ ERR_NCX_NO_XPATH_CHILD
1032
Definition: status_enum.h:521
AGT_RPC_NUM_CALLBACK_PHASES
#define AGT_RPC_NUM_CALLBACK_PHASES
this constant is for the number of callback slots allocated in a 'cbset', and only includes the RPC p...
Definition: agt_rpc.h:89
log_debug
void void void void void void void log_debug(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG log entry.
rpc_err_free_record
void rpc_err_free_record(rpc_err_rec_t *err)
Clean and free an rpc_err_rec_t struct.
Definition: rpc_err.c:346
xmlns_get_ns_prefix
const xmlChar * xmlns_get_ns_prefix(xmlns_id_t ns_id)
Get the prefix for the specified namespace.
Definition: xmlns.c:669
dlq_count
unsigned int dlq_count(const dlq_hdrT *listP)
get the number of queue entries in the listP queue list
Definition: dlq.c:994
NCX_CFGID_RUNNING
@ NCX_CFGID_RUNNING
running datastore (no value for not set!)
Definition: ncxtypes.h:384
yangconst.h
Contains YANG constants separated to prevent H file include loops.
ses_is_system_session
boolean ses_is_system_session(ses_cb_t *scb)
Check if the specified session is an internal system session.
Definition: ses.c:4441
xml_wr_full_val
void xml_wr_full_val(ses_cb_t *scb, xml_msg_hdr_t *msg, val_value_t *val, int32 indent)
Generate entire val_value_t.
Definition: xml_wr.c:3650
xml_find_attr_q
xml_attr_t * xml_find_attr_q(xml_attrs_t *attrs, xmlns_id_t nsid, const xmlChar *attrname)
Find an attribute in a Q.
Definition: xml_util.c:1324
xml_msg_build_prefix_map
status_t xml_msg_build_prefix_map(xml_msg_hdr_t *msg, xml_attrs_t *attrs, boolean addncid, boolean addncxid)
Build a queue of xmlns_pmap_t records for the current message.
Definition: xml_msg.c:839
NCX_LAYER_TRANSPORT
@ NCX_LAYER_TRANSPORT
transport layer
Definition: ncxtypes.h:344
YANG_K_ACTION
#define YANG_K_ACTION
YANG keyword/YIN element names.
Definition: yangconst.h:108
LOGINFO
#define LOGINFO
Check if at least log-level=info.
Definition: log.h:279
dlq_nextEntry
#define dlq_nextEntry(nodeP)
get the next queue entry after the current entry
Definition: dlq.h:265
ses_withdef
ncx_withdefaults_t ses_withdef(const ses_cb_t *scb)
Get the with-defaults value for this session.
Definition: ses.c:3461
ses_stop_msg_mode
void ses_stop_msg_mode(ses_cb_t *scb)
Set the message output mode to inactive.
Definition: ses.c:2950
SES_IN_ENCODING
#define SES_IN_ENCODING(S)
get the inbound message encoding
Definition: ses.h:129
ncx_get_gen_root
obj_template_t * ncx_get_gen_root(void)
Get the object template for the NCX generic root container.
Definition: ncx.c:6720
agt_make_leaf
val_value_t * agt_make_leaf(obj_template_t *parentobj, const xmlChar *leafname, const xmlChar *leafstrval, status_t *res)
make a string val_value_t struct for a specified leaf or leaf-list
Definition: agt_util.c:3683
agt_op_ok_for_maintenance_mode
boolean agt_op_ok_for_maintenance_mode(const obj_template_t *rpcobj)
Check if the operation is OK for maintenance mode.
Definition: agt_util.c:6753
json_wr_end_array
void json_wr_end_array(ses_cb_t *scb, xml_msg_hdr_t *msg, int32 startindent)
generate end of a JSON array
Definition: json_wr.c:1829
val_merge_return_vals
void val_merge_return_vals(dlq_hdr_t *srcQ, dlq_hdr_t *dstQ)
Merge return values into a dest Q Remove duplicates.
Definition: val_util.c:7781
obj_find_template
obj_template_t * obj_find_template(dlq_hdr_t *que, const xmlChar *modname, const xmlChar *objname)
Find an object with the specified name.
Definition: obj.c:5678
val_dump_value_max
void val_dump_value_max(val_value_t *val, int32 startindent, int32 indent_amount, val_dumpvalue_mode_t dumpmode, ncx_display_mode_t display_mode, boolean with_meta, boolean configonly, log_debug_t lvl)
Printf the specified val_value_t struct to the logfile, or stdout if none set Uses conf file format (...
Definition: val.c:5859
agt_sil_start_rpc_transaction
status_t agt_sil_start_rpc_transaction(ses_cb_t *client_scb, rpc_msg_t *msg, obj_template_t *obj, val_value_t *actionval, const xmlChar **txid_str)
Start an RPC transaction.
Definition: agt_sil.c:9233
agt_rpc_cbset_t_
the agt_rpc module stores a set of callbacks for each RPC
Definition: agt_rpc.h:153
agt_restcmn.h
Common function for RESTCONF and YANG-API protocols.
agt_val_parse_nc
status_t agt_val_parse_nc(ses_cb_t *scb, xml_msg_hdr_t *msg, obj_template_t *obj, const xml_node_t *startnode, ncx_data_class_t parentdc, val_value_t *retval)
Parse NETCONF PDU sub-contents into value fields.
Definition: agt_val_parse.c:118
ERR_NCX_NOT_FOUND
@ ERR_NCX_NOT_FOUND
225
Definition: status_enum.h:264
ERR_XML_READER_NULLVAL
@ ERR_XML_READER_NULLVAL
216
Definition: status_enum.h:255
xml_wr_qname_elem
void xml_wr_qname_elem(ses_cb_t *scb, xml_msg_hdr_t *msg, xmlns_id_t val_nsid, const xmlChar *str, xmlns_id_t parent_nsid, xmlns_id_t nsid, const xmlChar *elname, const dlq_hdr_t *attrQ, boolean isattrq, int32 indent, boolean isdefault)
Write a start tag, QName string content, and an end tag to the specified session.
Definition: xml_wr.c:3287
ses_clear_file_override
void ses_clear_file_override(ses_cb_t *scb)
Cleanup the session in file write override mode Does not delete the file, just closes it!
Definition: ses.c:4915
json_wr_start_array
void json_wr_start_array(ses_cb_t *scb, xml_msg_hdr_t *msg, int32 startindent)
generate start of a JSON array
Definition: json_wr.c:1668
NCX_BT_UNION
@ NCX_BT_UNION
union (needs special processing)
Definition: ncxtypes.h:220
xml_wr_begin_elem_ex
void xml_wr_begin_elem_ex(ses_cb_t *scb, xml_msg_hdr_t *msg, xmlns_id_t parent_nsid, xmlns_id_t nsid, const xmlChar *elname, const dlq_hdr_t *attrQ, boolean isattrq, int32 indent, boolean empty)
Write a start or empty XML tag to the specified session.
Definition: xml_wr.c:3001
obj_rpc_has_output
boolean obj_rpc_has_output(obj_template_t *obj)
Check if the RPC object has any real output children.
Definition: obj.c:14967
ERR_NCX_OPERATION_NOT_SUPPORTED
@ ERR_NCX_OPERATION_NOT_SUPPORTED
273
Definition: status_enum.h:314
NCX_MAX_NUMLEN
#define NCX_MAX_NUMLEN
max number len to use for static buffer allocation only
Definition: ncxconst.h:136
xml_msg_init_hdr
void xml_msg_init_hdr(xml_msg_hdr_t *msg)
Initialize a new xml_msg_hdr_t struct.
Definition: xml_msg.c:393
xml_msg.h
XML and JSON Message send and receive support.
agt_rpc_get_first_backptr
ncx_backptr_t * agt_rpc_get_first_backptr(void)
Get the first backptr to the registered and supported RPC methods on the server.
Definition: agt_rpc.c:3787
ncx_first_backptr
ncx_backptr_t * ncx_first_backptr(dlq_hdr_t *que)
Get first back pointer struct.
Definition: ncx.c:11513
xml_wr_string_elem
void xml_wr_string_elem(ses_cb_t *scb, xml_msg_hdr_t *msg, const xmlChar *str, xmlns_id_t parent_nsid, xmlns_id_t nsid, const xmlChar *elname, const dlq_hdr_t *attrQ, boolean isattrq, int32 indent)
Write a start tag, simple string content, and an end tag to the specified session.
Definition: xml_wr.c:3235
ncx_sprintf_num
status_t ncx_sprintf_num(xmlChar *buff, const ncx_num_t *num, ncx_btype_t btyp, uint32 *len)
Sprintf a ncx_num_t contents.
Definition: ncx_num.c:2357
ncx_find_rpc
obj_template_t * ncx_find_rpc(const ncx_module_t *mod, const xmlChar *rpcname)
Check if a rpc_template_t in the mod->rpcQ.
Definition: ncx.c:3775
agt_acm_clear_msg_cache
void agt_acm_clear_msg_cache(xml_msg_hdr_t *msg)
Clear an agt_acm_cache_t struct attached to the specified message.
Definition: agt_acm.c:734
agt_val_parse.h
XML Parameter Value Parser Module.
AGT_RPC_PH_POST_REPLY
@ AGT_RPC_PH_POST_REPLY
(5) cb after the reply is generated
Definition: agt_rpc.h:121
obj_get_mod_name
const xmlChar * obj_get_mod_name(const obj_template_t *obj)
Get the module name for this object.
Definition: obj.c:12176
obj_get_datadefQ
dlq_hdr_t * obj_get_datadefQ(obj_template_t *obj)
Get the datadefQ (or caseQ) if this object has one.
Definition: obj.c:11455
typ_is_simple
boolean typ_is_simple(ncx_btype_t btyp)
Check if this is a simple data type.
Definition: typ.c:3107
NCX_BT_ANY
@ NCX_BT_ANY
anyxml
Definition: ncxtypes.h:202
SES_IS_DUMMY
#define SES_IS_DUMMY(S)
test if this is a dummy session
Definition: ses.h:135
NCX_BT_SLIST
@ NCX_BT_SLIST
ncx:xsdlist extension (internal, deprecated)
Definition: ncxtypes.h:223
ses_indent
void ses_indent(ses_cb_t *scb, int32 indent)
Write the proper newline + indentation to the specified session.
Definition: ses.c:2768
ncx_get_next_object
obj_template_t * ncx_get_next_object(ncx_module_t *mod, obj_template_t *curobj)
Get the next object in the specified module.
Definition: ncx.c:5048
obj_find_child
obj_template_t * obj_find_child(obj_template_t *obj, const xmlChar *modname, const xmlChar *objname)
Find a child object with the specified Qname.
Definition: obj.c:6116
NCX_NT_OBJ
@ NCX_NT_OBJ
obj_template_t
Definition: ncxtypes.h:277
tstamp_datetime
void tstamp_datetime(xmlChar *buff)
Set the current date and time in an XML dateTime string format.
Definition: tstamp.c:160
agt_xml_consume_node
status_t agt_xml_consume_node(ses_cb_t *scb, xml_node_t *node, ncx_layer_t layer, xml_msg_hdr_t *msghdr)
Consume an XML node from libxml2.
Definition: agt_xml.c:141
agt_cfg_free_transaction
void agt_cfg_free_transaction(agt_cfg_transaction_t *txcb)
Clean and free a agt_cfg_transaction_t struct.
Definition: agt_cfg.c:1278
xml_strcmp
int xml_strcmp(const xmlChar *s1, const xmlChar *s2)
String compare for xmlChar.
Definition: xml_util.c:1746
val_get_next_child
val_value_t * val_get_next_child(const val_value_t *curchild)
Get the next child node.
Definition: val.c:8496
agt_rpc_handle_subsys_action
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.
Definition: agt_rpc.c:4568
OP_EDITOP_LOAD
@ OP_EDITOP_LOAD
load, internal enum
Definition: op.h:128
agt_rpc_new_dummy_msg
rpc_msg_t * agt_rpc_new_dummy_msg(void)
Create a dummy rpc_msg_t.
Definition: agt_rpc.c:4060
LOGDEBUG4
#define LOGDEBUG4
Check if at least log-level=debug4.
Definition: log.h:302
log.h
NCX System Logging Manager.
AGT_RPC_PH_INVOKE
@ AGT_RPC_PH_INVOKE
(3) cb to invoke the requested method
Definition: agt_rpc.h:118
AGT_ACTION_MOD
#define AGT_ACTION_MOD
YANG attributes module name.
Definition: agt.h:436
agt_sys.h
NETCONF system.yang DM module support.
agt_rpc_cbset_t_::acb
agt_rpc_method_t acb[AGT_RPC_NUM_CALLBACK_PHASES]
callback for each phase
Definition: agt_rpc.h:155
xmlns_nc_id
xmlns_id_t xmlns_nc_id(void)
Get the ID for the NETCONF namespace or 0 if it doesn't exist.
Definition: xmlns.c:880
agt_cli.h
NETCONF Server Command Line Interface handler.
ncx_remove_backptr
void ncx_remove_backptr(ncx_backptr_t *ptr)
Remove the specified backptr for deletion.
Definition: ncx.c:11592
rpc_new_msg
rpc_msg_t * rpc_new_msg(void)
Malloc and initialize a new rpc_msg_t struct.
Definition: rpc.c:84
LOGDEBUG
#define LOGDEBUG
Check if at least log-level=debug.
Definition: log.h:287
xml_wr_empty_elem
void xml_wr_empty_elem(ses_cb_t *scb, xml_msg_hdr_t *msg, xmlns_id_t parent_nsid, xmlns_id_t nsid, const xmlChar *elname, int32 indent)
Write an empty XML tag to the specified session without attributes.
Definition: xml_wr.c:3076
ncx_turn_off_warning
status_t ncx_turn_off_warning(status_t res)
Add a warning suppression entry.
Definition: ncx.c:9294
agt_restcmn_get_nsid
xmlns_id_t agt_restcmn_get_nsid(ncx_protocol_t proto)
Get the XML namespace ID for specific proto.
Definition: agt_restcmn.c:6853
xml_find_attr
xml_attr_t * xml_find_attr(xml_node_t *node, xmlns_id_t nsid, const xmlChar *attrname)
Find an attribute.
Definition: xml_util.c:1295
agt_rpc_method_t
status_t(* agt_rpc_method_t)(ses_cb_t *scb, rpc_msg_t *msg, xml_node_t *methnode)
Template for RPC server callbacks.
Definition: agt_rpc.h:147
XML_NT_START
@ XML_NT_START
start-tag of an element
Definition: xml_util.h:192
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...
Definition: agt_rpcerr.c:1390
clear_errors
void clear_errors(void)
Clear the error_stack if it has any errors stored in it.
Definition: status.c:179
xml_move_attrs
void xml_move_attrs(xml_attrs_t *src_attrs, xml_attrs_t *dest_attrs)
Move all the attrs from the src to the dest.
Definition: xml_util.c:1272
agt_rpc_data_cb_t
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_...
Definition: agt_rpc.h:178
rpc_err.h
NETCONF protocol standard error definitions.
XML_MSG_PRUNE_BAD_DATA
#define XML_MSG_PRUNE_BAD_DATA(M)
prune bad data
Definition: xml_msg.h:298
agt_val_rpc_xpath_check
status_t agt_val_rpc_xpath_check(ses_cb_t *scb, rpc_msg_t *rpcmsg, xml_msg_hdr_t *msg, val_value_t *rpcinput, obj_template_t *rpcroot)
Check for any nodes which are present but have false when-stmts associated with the node.
Definition: agt_val.c:12678
agt_rpc_load_config_file
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.
Definition: agt_rpc.c:3278
agt_rpc_callback_is_regdone
boolean agt_rpc_callback_is_regdone(obj_template_t *obj)
Set the RPC as register done.
Definition: agt_rpc.c:4154
NCX_BT_BITS
@ NCX_BT_BITS
bits
Definition: ncxtypes.h:203
agt_rpc_unsupport_method
void agt_rpc_unsupport_method(const xmlChar *module, const xmlChar *method_name)
mark an RPC method or action as unsupported within the server
Definition: agt_rpc.c:2683
agt_cfg.h
Manage Server configuration edit transactions.
NCX_BT_FLOAT64
@ NCX_BT_FLOAT64
hidden: just for XPath
Definition: ncxtypes.h:216
val_clean_valQ
void val_clean_valQ(dlq_hdr_t *valQ)
Clean a queue of val_value_t.
Definition: val.c:13911
NCX_BT_UINT32
@ NCX_BT_UINT32
uint32
Definition: ncxtypes.h:213
dlq_deque
void * dlq_deque(dlq_hdrT *listP)
remove the first queue node from the queue list
Definition: dlq.c:286
val_get_first_child
val_value_t * val_get_first_child(const val_value_t *parent)
Get the first child node.
Definition: val.c:8477
NCX_NT_NONE
@ NCX_NT_NONE
not set
Definition: ncxtypes.h:273
dlq_empty
#define dlq_empty(listP)
check if queue list is empty
Definition: dlq.h:367
agt_acm.h
NETCONF Server Access Control Entry Points.
xml_add_attr
status_t xml_add_attr(xml_attrs_t *attrs, xmlns_id_t ns_id, const xmlChar *attr_name, const xmlChar *attr_val)
add an attribute to an attribute list
Definition: xml_util.c:820
xml_docdone
boolean xml_docdone(xmlTextReaderPtr reader)
check if the input is completed for a given PDU
Definition: xml_util.c:636
val_has_children
boolean val_has_children(const val_value_t *val)
Determine if there are any child nodes for this val.
Definition: val.c:13719
xml_strcpy
uint32 xml_strcpy(xmlChar *copyTo, const xmlChar *copyFrom)
String copy for xmlChar.
Definition: xml_util.c:1486
top_unregister_node
void top_unregister_node(const xmlChar *owner, const xmlChar *elname, top_mode_t topmode)
Remove a top entry handler function.
Definition: top.c:265
rpc_free_msg
void rpc_free_msg(rpc_msg_t *msg)
Free all the memory used by the specified rpc_msg_t.
Definition: rpc.c:152
json_wr_start_object
void json_wr_start_object(ses_cb_t *scb, xml_msg_hdr_t *msg, const xmlChar *modname, const xmlChar *name, int32 startindent)
generate start of a JSON object
Definition: json_wr.c:1427
agt_ses_get_session_for_id
ses_cb_t * agt_ses_get_session_for_id(ses_id_t sid)
get the session for the supplied sid
Definition: agt_ses.c:2252
agt_rpc_subsys_t_::qhdr
dlq_hdr_t qhdr
queue header
Definition: agt_rpc.h:189
VAL_TYPE
#define VAL_TYPE(V)
Access the base type : same as VAL_BTYPE.
Definition: val.h:387
agt_get_profile
agt_profile_t * agt_get_profile(void)
Get the server profile struct.
Definition: agt.c:4118
top.h
NCX Common Top Element module.
RPC_DATA_STD
@ RPC_DATA_STD
STD is used by <get> and <get-config> to force a <data> container in the NETCONF namespace.
Definition: rpc.h:162
obj_is_enabled
boolean obj_is_enabled(obj_template_t *obj)
Check any if-feature statement that may cause the specified object to be invisible.
Definition: obj.c:14527
ses_get_out_encoding
ncx_display_mode_t ses_get_out_encoding(ses_cb_t *scb)
Get the output encoding.
Definition: ses.c:4126
agt_rpc_post_psd_state
status_t agt_rpc_post_psd_state(ses_cb_t *scb, rpc_msg_t *msg, status_t psdres)
Fixup parmset after parse phase.
Definition: agt_rpc.c:3955
xml_msg_clean_defns_attr
status_t xml_msg_clean_defns_attr(xml_attrs_t *attrs)
Get rid of an xmlns=foo default attribute.
Definition: xml_msg.c:1133
obj_first_child_deep
obj_template_t * obj_first_child_deep(obj_template_t *obj)
Get the first child object if the specified object has any children.
Definition: obj.c:7084
ERR_XML_READER_EOF
@ ERR_XML_READER_EOF
221
Definition: status_enum.h:260
agt_acm_rpc_allowed
boolean agt_acm_rpc_allowed(xml_msg_hdr_t *msg, const xmlChar *user, const obj_template_t *rpcobj)
Check if the specified user is allowed to invoke an RPC.
Definition: agt_acm.c:296
ncx_get_backptr_node
void * ncx_get_backptr_node(ncx_backptr_t *backptr)
Get the back pointer node pointer.
Definition: ncx.c:11577
agt_timer_get_timenow
void agt_timer_get_timenow(time_t *tnow)
Get the current time using the system or monotonic clock.
Definition: agt_timer.c:457
agt_rpc_reorder_dataQ
void agt_rpc_reorder_dataQ(rpc_msg_t *msg)
Reorder the dataQ.
Definition: agt_rpc.c:4768
dlq_firstEntry
#define dlq_firstEntry(listP)
get the first entry in the queue list
Definition: dlq.h:337
val_new_value
val_value_t * val_new_value(void)
Malloc and initialize the fields in a val_value_t.
Definition: val.c:2697
ERR_NCX_ACCESS_DENIED
@ ERR_NCX_ACCESS_DENIED
267
Definition: status_enum.h:308
VAL_OBJ
#define VAL_OBJ(V)
Access the object template.
Definition: val.h:381
agt_rpc_get_next_backptr
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.
Definition: agt_rpc.c:3804
ncx.h
YANG module utility functions.
agt_rpcerr.h
NETCONF protocol <rpc-error> server-side handler.
LOG_DEBUG_DEBUG
@ LOG_DEBUG_DEBUG
debug level 1
Definition: log.h:394
xml_attrs_t
dlq_hdr_t xml_attrs_t
queue of xml_attr_t
Definition: xml_util.h:151
obj.h
Data Object Support.
agt_advertise_module_needed
boolean agt_advertise_module_needed(const xmlChar *modname)
Check if the module should be advertised or not.
Definition: agt.c:4277
LOG_DEBUG_DEBUG3
@ LOG_DEBUG_DEBUG3
debug level 3
Definition: log.h:396
ncx_turn_on_warning
status_t ncx_turn_on_warning(status_t res)
Remove a warning suppression entry if it exists.
Definition: ncx.c:9313
TSTAMP_MIN_SIZE
#define TSTAMP_MIN_SIZE
normal minimum buffer size for a tstamp buffer
Definition: tstamp.h:67
ses_start_msg
status_t ses_start_msg(ses_cb_t *scb)
Start a new outbound message on the specified session.
Definition: ses.c:2970
SES_MY_SID
#define SES_MY_SID(S)
get session-id
Definition: ses.h:105
agt_rpc_phase_t_
agt_rpc_phase_t_
There are 3 different callbacks possible in the server processing chain.
Definition: agt_rpc.h:109
NCX_DISPLAY_MODE_MODULE
@ NCX_DISPLAY_MODE_MODULE
plain CLI display mode with YANG module names added to nodes
Definition: ncxtypes.h:457
RPC_DATA_NONE
@ RPC_DATA_NONE
not set
Definition: rpc.h:157
ERR_NCX_IN_USE
@ ERR_NCX_IN_USE
match netconf errors (257 - 275)
Definition: status_enum.h:298
val_convert_anyxml_to_real
status_t val_convert_anyxml_to_real(val_value_t *anyxml_val, val_value_t *real_val, val_value_t **error_val)
Convert anydata nodes to match a real template.
Definition: val_util.c:7246
json_wr_end_object
void json_wr_end_object(ses_cb_t *scb, xml_msg_hdr_t *msg, int32 startindent)
generate end of a JSON object
Definition: json_wr.c:1642
agt_rpc_handle_subsys_request
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.
Definition: agt_rpc.c:4418
agt_ses_new_dummy_session
ses_cb_t * agt_ses_new_dummy_session(void)
Create a dummy session control block.
Definition: agt_ses.c:535
val_init_from_template
void val_init_from_template(val_value_t *val, struct obj_template_t_ *obj)
Initialize a value node from its object template.
xml_msg_set_withdef
void xml_msg_set_withdef(xml_msg_hdr_t *msg, ncx_withdefaults_t withdef)
Set the message withdef enum.
Definition: xml_msg.c:1325
NCX_BT_EXTERN
@ NCX_BT_EXTERN
not a real type, points fo file for contents
Definition: ncxtypes.h:230
agt_rpc_free_subsys
void agt_rpc_free_subsys(agt_rpc_subsys_t *cb)
Clean and free a subsys record.
Definition: agt_rpc.c:4834
xpath_find_schema_target_int
status_t xpath_find_schema_target_int(const xmlChar *target, obj_template_t **targobj)
@
Definition: xpath.c:2475
dlq_enque
void dlq_enque(REG void *newP, REG dlq_hdrT *listP)
add a queue node to the end of a queue list Add newP to listP
Definition: dlq.c:246
agt_rpc_subsys_t_::subsys_id
const xmlChar * subsys_id
backptr to agt_sil_state->subsys_id
Definition: agt_rpc.h:192
agt_output_start_container
void agt_output_start_container(ses_cb_t *scb, xml_msg_hdr_t *mhdr, xmlns_id_t parent_nsid, xmlns_id_t node_nsid, const xmlChar *node_name, int32 indent)
Output a start container node.
Definition: agt_util.c:5243
agt_rpc_callback_set
boolean agt_rpc_callback_set(obj_template_t *obj)
Check if an RPC callback is registered for this object for SIL-SA usage.
Definition: agt_rpc.c:4093
json_wr_max_check_val
status_t json_wr_max_check_val(ses_cb_t *scb, xml_msg_hdr_t *msg, xmlns_id_t parent_nsid, val_value_t *val, int32 startindent, val_nodetest_fn_t testfn, boolean isfirst, boolean islast, boolean isfirstchild, boolean isfirstsibling, boolean force_lastsibling, boolean force_lastsib_value, boolean force_array_obj)
generate entire val_value_t *w/filter)
Definition: json_wr.c:1955
agt_timer.h
Handle timer services for the server.
agt_rpc_add_return_vals
void agt_rpc_add_return_vals(dlq_hdr_t *return_valQ, rpc_msg_t *msg)
Add a Q of return values to the msg.
Definition: agt_rpc.c:4371
agt_rpc_check_rpc_invoke
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.
Definition: agt_rpc.c:3824
ncx_find_module
ncx_module_t * ncx_find_module(const xmlChar *modname, const xmlChar *revision)
Find a ncx_module_t in the ncx_sesmodQ.
Definition: ncx.c:3227
SET_ERROR
#define SET_ERROR(E)
macro SET_ERROR
Definition: status_enum.h:103
agt_sil_get_exit_mode
status_t agt_sil_get_exit_mode(const xmlChar *txid_str, agt_tx_type_t tx_type, val_value_t **error_val, xmlChar **error_path)
Get the transaction exit code.
Definition: agt_sil.c:9575
XML_NT_EMPTY
@ XML_NT_EMPTY
standalone empty node
Definition: xml_util.h:191
xml_init_node
void xml_init_node(xml_node_t *node)
Init an xml_node_t struct.
Definition: xml_util.c:229
NEED_EXIT
#define NEED_EXIT(res)
used in parser routines to decide if processing can continue does not return, just evaluates to TRUE ...
Definition: yangconst.h:234
TOP_MODE_SERVER
@ TOP_MODE_SERVER
top server mode
Definition: top.h:119
xmlns_ncx_id
xmlns_id_t xmlns_ncx_id(void)
Get the ID for the NETCONF Extensions namespace or 0 if it doesn't exist.
Definition: xmlns.c:897
NCX_BT_DECIMAL64
@ NCX_BT_DECIMAL64
decimal64
Definition: ncxtypes.h:215
agt_rpc_clear_return_data
void agt_rpc_clear_return_data(rpc_msg_t *msg)
Clear the return data Q.
Definition: agt_rpc.c:4391
NCX_BT_STRING
@ NCX_BT_STRING
string
Definition: ncxtypes.h:217
ncx_find_first_rpc
obj_template_t * ncx_find_first_rpc(const xmlChar *rpcname)
Find the specified RPC Method in any module.
Definition: ncx.c:3805
ERR_NCX_EVAL_LIMIT_REACHED
@ ERR_NCX_EVAL_LIMIT_REACHED
398
Definition: status_enum.h:441
ncx_free_backptr
void ncx_free_backptr(ncx_backptr_t *ptr)
Free an ncx_backptr_t struct.
Definition: ncx.c:11433
agt_rpc_subrpc_dispatch
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.
Definition: agt_rpc.c:4914
top_register_node
status_t top_register_node(const xmlChar *owner, const xmlChar *elname, top_handler_t handler, top_mode_t topmode)
Register a top entry handler function.
Definition: top.c:202
NCX_BT_INT8
@ NCX_BT_INT8
int8
Definition: ncxtypes.h:207
RPC_RPYTYP_ERROR
@ RPC_RPYTYP_ERROR
reply is error
Definition: rpc.h:175
xml_endnode_match
status_t xml_endnode_match(const xml_node_t *startnode, const xml_node_t *endnode)
check if a specific node is the proper endnode match for a given startnode
Definition: xml_util.c:592
ncx_get_first_object
obj_template_t * ncx_get_first_object(ncx_module_t *mod)
Get the first object in the datadefQs for the specified module.
Definition: ncx.c:4957
NCX_DISPLAY_MODE_JSON
@ NCX_DISPLAY_MODE_JSON
JSON (RFC 7951 format)
Definition: ncxtypes.h:466
xmlns.h
XML namespace support.
val_free_value
void val_free_value(val_value_t *val)
Scrub the memory in a val_value_t by freeing all the sub-fields and then freeing the entire struct it...
Definition: val.c:2842
status.h
Global error messages for status code enumerations.
agt_ses_free_dummy_session
void agt_ses_free_dummy_session(ses_cb_t *scb)
Free a dummy session control block.
Definition: agt_ses.c:641
NCX_BT_NONE
@ NCX_BT_NONE
base type not set
Definition: ncxtypes.h:201
print_errors
void print_errors(void)
Dump any entries stored in the error_stack.
Definition: status.c:155
xml_dump_node
void xml_dump_node(const xml_node_t *node, log_debug_t lvl)
Debug function to printf xml_node_t contents.
Definition: xml_util.c:661
NCX_DISPLAY_MODE_XML
@ NCX_DISPLAY_MODE_XML
XML display mode.
Definition: ncxtypes.h:460
log_debug3_append
void void void void void void void void void void void void log_debug3_append(const char *fstr,...) __attribute__((format(printf
Append to a LOG_DEBUG_DEBUG3 log entry.
obj_get_nsid
xmlns_id_t obj_get_nsid(const obj_template_t *obj)
Get the namespace ID for this object.
Definition: obj.c:12395
dlq.h
dlq provides general double-linked list and queue support:
SES_ST_IN_MSG
@ SES_ST_IN_MSG
processing a request
Definition: ses.h:359
ncx_new_backptr
ncx_backptr_t * ncx_new_backptr(void *node)
Malloc and initialize a new ncx_backptr_t struct.
Definition: ncx.c:11412
agt_acm_init_msg_cache
status_t agt_acm_init_msg_cache(ses_cb_t *scb, xml_msg_hdr_t *msg)
Malloc and initialize an agt_acm_cache_t struct and attach it to the incoming message.
Definition: agt_acm.c:686
xmlns_check_deleted_ns
void xmlns_check_deleted_ns(void)
Check if a deleted namespace is pending and free it.
Definition: xmlns.c:1382
LOGDEBUG3
#define LOGDEBUG3
Check if at least log-level=debug3.
Definition: log.h:297
json_wr_start_object_ex
void json_wr_start_object_ex(ses_cb_t *scb, xml_msg_hdr_t *msg, const xmlChar *modname, const xmlChar *name, int32 startindent, boolean startbrace, boolean endbrace)
generate start of a JSON object (extended version)
Definition: json_wr.c:1478
RPC_RPYTYP_DATA
@ RPC_RPYTYP_DATA
reply is data
Definition: rpc.h:176
NCX_BT_INT16
@ NCX_BT_INT16
int16
Definition: ncxtypes.h:208
NCX_DEF_INDENT
#define NCX_DEF_INDENT
default indent amount for nesting XML or other structured output
Definition: ncxconst.h:441