yumapro  20.10-12
YumaPro SDK
agt_ycontrol.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 #ifdef WITH_YCONTROL
13 #ifndef _H_agt_ycontrol
14 #define _H_agt_ycontrol
15 
16 /* FILE: agt_ycontrol.h
17 *********************************************************************
18 * *
19 * P U R P O S E *
20 * *
21 *********************************************************************/
22 
29 /*********************************************************************
30 * *
31 * C H A N G E H I S T O R Y *
32 * *
33 *********************************************************************
34 
35 date init comment
36 ----------------------------------------------------------------------
37 10-apr-14 abb Begun
38 
39 */
40 
41 #ifndef _H_agt_rpc
42 #include "agt_rpc.h"
43 #endif
44 
45 #ifndef _H_ses
46 #include "ses.h"
47 #endif
48 
49 #ifndef _H_status
50 #include "status.h"
51 #endif
52 
53 #ifndef _H_xml_util
54 #include "xml_util.h"
55 #endif
56 
57 #ifndef _H_xmlns
58 #include "xmlns.h"
59 #endif
60 
61 #ifndef _H_ycontrol_types
62 #include "ycontrol_types.h"
63 #endif
64 
65 #ifdef __cplusplus
66 extern "C" {
67 #endif
68 
69 
83 #define AGT_YCONTROL_MAX_SERVICES 4
84 
85 
86 /********************************************************************
87 * *
88 * T Y P E S *
89 * *
90 *********************************************************************/
91 
92 
108 typedef status_t
109  (*agt_ycontrol_service_fn_t) (ses_cb_t *scb,
110  ycontrol_msgtype_t msgtype,
111  uint32 msgid,
112  const xmlChar *subsys_id,
113  ycontrol_msgbody_t msgbody_type,
114  val_value_t *msgbody,
115  boolean *scb_valid);
116 
117 
118 
126 typedef void
127  (*agt_ycontrol_subsys_gone_fn_t) (const xmlChar *subsys_id);
128 
129 
130 
132 typedef struct agt_ycontrol_cb_t_ {
134  dlq_hdr_t qhdr;
135 
137  xmlChar *service_name;
138 
141 
144 } agt_ycontrol_cb_t;
145 
146 
150 typedef struct agt_ycontrol_subsys_t_ {
152  dlq_hdr_t qhdr;
153 
155  xmlChar *subsys_id;
156 
159 
162 
165 
168 } agt_ycontrol_subsys_t;
169 
170 
171 /********************************************************************
172 * *
173 * F U N C T I O N S *
174 * *
175 *********************************************************************/
176 
177 
186 extern status_t
187  agt_ycontrol_init1 (void);
188 
189 
198 extern status_t
199  agt_ycontrol_init2 (void);
200 
201 
207 extern void
208  agt_ycontrol_cleanup (void);
209 
210 
219 extern boolean
220  agt_ycontrol_dispatch (ses_cb_t *scb,
221  xml_node_t *top);
222 
223 
242 extern status_t
243  agt_ycontrol_send_payload (ses_cb_t *scb,
244  const xmlChar *service_id,
245  uint32 *msgid,
246  ycontrol_msgtype_t msgtype,
247  val_value_t *service_payload,
248  boolean with_ywattrs);
249 
250 
251 
274 extern status_t
275  agt_ycontrol_send_callback (ses_cb_t *scb,
276  const xmlChar *service_id,
277  uint32 *msgid,
278  ycontrol_msgtype_t msgtype,
279  boolean with_ywattrs,
280  obj_template_t *service_obj,
281  agt_rpc_data_cb_t data_cbfn,
282  rpc_msg_t *rpcmsg);
283 
284 
295 extern status_t
296  agt_ycontrol_send_error (ses_cb_t *scb,
297  const xmlChar *service_id,
298  uint32 msgid,
299  status_t res,
300  const xmlChar *errstr);
301 
302 
311 extern status_t
312  agt_ycontrol_send_ok (ses_cb_t *scb,
313  const xmlChar *service_id,
314  uint32 msgid);
315 
316 
326 extern status_t
327  agt_ycontrol_send_event (const xmlChar *service_id,
328  val_value_t *service_payload,
329  boolean with_ywattrs);
330 
331 
332 
344 extern status_t
345  agt_ycontrol_send_event_subsys (const xmlChar *service_id,
346  val_value_t *service_payload,
347  boolean with_ywattrs,
348  const xmlChar *subsys_id);
349 
350 
351 
361 extern status_t
362  agt_ycontrol_register_service (const xmlChar *service_name,
363  agt_ycontrol_service_fn_t service_fn);
364 
365 
376 extern status_t
377  agt_ycontrol_register_service_ex (const xmlChar *service_name,
378  agt_ycontrol_service_fn_t service_fn,
379  agt_ycontrol_subsys_gone_fn_t subsys_gone_fn);
380 
381 
387 extern void
388  agt_ycontrol_unregister_service (const xmlChar *service_name);
389 
390 
398 extern status_t
399  agt_ycontrol_add_subsys (ses_id_t subsys_sid,
400  const xmlChar *subsys_id);
401 
402 
415 extern void
417  const xmlChar *subsys_id);
418 
419 
425 extern obj_template_t *
426  agt_ycontrol_get_obj (void);
427 
428 
435 extern ses_cb_t *
436  agt_ycontrol_get_scb (const xmlChar *subsys_id);
437 
438 
445 extern void
447 
448 
454 extern boolean
456 
457 
463 extern status_t
465 
466 
472 extern boolean
474 
475 
482 extern const xmlChar *
484 
485 
489 #ifdef __cplusplus
490 } /* end extern 'C' */
491 #endif
492 
493 #endif /* _H_agt_ycontrol */
494 #endif // WITH_YCONTROL
AGT_YCONTROL_MOD
#define AGT_YCONTROL_MOD
YANG module used for subsystem message transport.
Definition: agt.h:424
agt_ycontrol_add_subsys
status_t agt_ycontrol_add_subsys(ses_id_t subsys_sid, const xmlChar *subsys_id)
Add a subsystem connection to the ycontrol manager.
Definition: agt_ycontrol.c:1815
ses.h
NETCONF Session Common definitions module.
log_info_append
void void void void void void log_info_append(const char *fstr,...) __attribute__((format(printf
Append to a LOG_DEBUG_INFO log entry.
agt_ycontrol_send_event
status_t agt_ycontrol_send_event(const xmlChar *service_id, val_value_t *service_payload, boolean with_ywattrs)
Send a server event to all the active subsystems.
Definition: agt_ycontrol.c:1573
agt_cap.h
NETCONF Server capabilities handler.
ses_finish_msg
void ses_finish_msg(ses_cb_t *scb)
Finish an outbound message on the specified session.
Definition: ses.c:3013
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
YCONTROL_MSG_SERVER_REQUEST
@ YCONTROL_MSG_SERVER_REQUEST
server-request sent from server to subsystem
Definition: ycontrol_types.h:72
ycontrol_msg_cmn_new_ok
status_t ycontrol_msg_cmn_new_ok(obj_template_t *msgobj, val_value_t **ret_ok)
Create a new YControl OK response message.
Definition: ycontrol_msg_cmn.c:477
agt_ycontrol_service_fn_t
status_t(* agt_ycontrol_service_fn_t)(ses_cb_t *scb, ycontrol_msgtype_t msgtype, uint32 msgid, const xmlChar *subsys_id, ycontrol_msgbody_t msgbody_type, val_value_t *msgbody, boolean *scb_valid)
Callback template for YControl services: message handler.
Definition: agt_ycontrol.h:109
agt_ses.h
Server Session Management.
agt_util.h
Utility Functions for NCX Server method routines.
xml_strdup
xmlChar * xml_strdup(const xmlChar *copyFrom)
String duplicate for xmlChar.
Definition: xml_util.c:1553
agt_ycontrol_send_callback
status_t agt_ycontrol_send_callback(ses_cb_t *scb, const xmlChar *service_id, uint32 *msgid, ycontrol_msgtype_t msgtype, boolean with_ywattrs, obj_template_t *service_obj, agt_rpc_data_cb_t data_cbfn, rpc_msg_t *rpcmsg)
Send the subsystem <ycontrol> message to the sevice manager on the specified session,...
Definition: agt_ycontrol.c:1405
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
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.
agt_ycontrol_cb_t_
control block for 1 registered service handler
Definition: agt_ycontrol.h:132
val.h
Value Node Basic Support.
xml_util.h
XML Utilities.
VAL_UINT32
#define VAL_UINT32(V)
Access the value as an uint32 ONLY if NCX_BT_UINT32.
Definition: val.h:497
agt_ycontrol_subsys_t_::qhdr
dlq_hdr_t qhdr
queue header
Definition: agt_ycontrol.h:152
agt_ycontrol_cb_t_::service_name
xmlChar * service_name
service name
Definition: agt_ycontrol.h:137
agt_rpc.h
NETCONF protocol remote procedure call server-side definitions.
agt_ycontrol_subsys_t_
control block for connected 1 subsystem; used to send event messages to the subsystem
Definition: agt_ycontrol.h:150
agt_ycontrol_drop_session
void agt_ycontrol_drop_session(ses_id_t sid)
Notify the agt_ycontrol module that a YControl session has been closed and needs to be cleaned up.
Definition: agt_ycontrol.c:1971
YCONTROL_MSGBODY_ERROR
@ YCONTROL_MSGBODY_ERROR
error message
Definition: ycontrol_types.h:96
ycontrol_msg_cmn_get_msgtype
const xmlChar * ycontrol_msg_cmn_get_msgtype(ycontrol_msgtype_t msgtype)
Get the string for the message type enumeration.
Definition: ycontrol_msg_cmn.c:75
xml_wr.h
XML Write functions.
YCONTROL_MSG_SUBSYS_REQUEST
@ YCONTROL_MSG_SUBSYS_REQUEST
subsystem-request sent from subsystem to server
Definition: ycontrol_types.h:81
ERR_TOO_MANY_ENTRIES
@ ERR_TOO_MANY_ENTRIES
012
Definition: status_enum.h:202
agt_ycontrol_unregister_service
void agt_ycontrol_unregister_service(const xmlChar *service_name)
un-register a callback for 1 YControl service type
Definition: agt_ycontrol.c:1785
YCONTROL_MSGBODY_OK
@ YCONTROL_MSGBODY_OK
OK message.
Definition: ycontrol_types.h:90
ERR_NCX_DUP_ENTRY
@ ERR_NCX_DUP_ENTRY
224
Definition: status_enum.h:263
op.h
NETCONF protocol operations.
agt_ycontrol_subsys_t_::subsys_id
xmlChar * subsys_id
subsystem ID from registration
Definition: agt_ycontrol.h:155
YCONTROL_MSGBODY_NONE
@ YCONTROL_MSGBODY_NONE
not set
Definition: ycontrol_types.h:87
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
agt_ycontrol_subsys_t_::session_dropped
boolean session_dropped
session dropped flag
Definition: agt_ycontrol.h:167
ses_id_t
uint32 ses_id_t
Session ID.
Definition: ses.h:306
agt_ycontrol_dispatch
boolean agt_ycontrol_dispatch(ses_cb_t *scb, xml_node_t *top)
Handle an incoming <ycontrol> message from a subsystem.
Definition: agt_ycontrol.c:1190
xml_clean_attrs
void xml_clean_attrs(xml_attrs_t *attrs)
clean an xml_attrs_t variable
Definition: xml_util.c:1243
agt_ycontrol_subsys_t_::service_id
xmlChar * service_id[AGT_YCONTROL_MAX_SERVICES]
multiple services can be registered for each subsystem
Definition: agt_ycontrol.h:158
log_info
void void void void void log_info(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_INFO log entry.
ycontrol_msg_cmn_new_payload
status_t ycontrol_msg_cmn_new_payload(obj_template_t *msgobj, val_value_t **ret_payload)
Create a new payload value for the message object.
Definition: ycontrol_msg_cmn.c:338
ycontrol_msg_cmn_reuse
status_t ycontrol_msg_cmn_reuse(val_value_t *msgval, uint32 msgid, ycontrol_msgtype_t msgtype, const xmlChar *server_id, const xmlChar *subsys_id, const xmlChar *service_id)
Reuse a message value struct and replace only changing fields.
Definition: ycontrol_msg_cmn.c:265
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_ycontrol_send_ok
status_t agt_ycontrol_send_ok(ses_cb_t *scb, const xmlChar *service_id, uint32 msgid)
Send a ycontrol OK message.
Definition: agt_ycontrol.c:1518
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_ycontrol_get_scb
ses_cb_t * agt_ycontrol_get_scb(const xmlChar *subsys_id)
Get the session control block for the specified subsys ID.
Definition: agt_ycontrol.c:1944
xmlns_ywattrs_id
xmlns_id_t xmlns_ywattrs_id(void)
Get the ID for the YumaWorks attributes namespace or 0 if it doesn't exist.
Definition: xmlns.c:1090
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
SES_MY_USERNAME
#define SES_MY_USERNAME(S)
get username
Definition: ses.h:111
agt_ycontrol_register_service_ex
status_t agt_ycontrol_register_service_ex(const xmlChar *service_name, agt_ycontrol_service_fn_t service_fn, agt_ycontrol_subsys_gone_fn_t subsys_gone_fn)
Register a YControl service layer (extended)
Definition: agt_ycontrol.c:1746
val_dump_value
void val_dump_value(val_value_t *val, int32 startindent, 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:5688
xml_init_attrs
void xml_init_attrs(xml_attrs_t *attrs)
initialize an xml_attrs_t variable
Definition: xml_util.c:745
agt_ycontrol_any_subsys_active
boolean agt_ycontrol_any_subsys_active(void)
Check if there are any subsystems active.
Definition: agt_ycontrol.c:1994
agt_ycontrol_cb_t_::service_fn
agt_ycontrol_service_fn_t service_fn
received message callback function
Definition: agt_ycontrol.h:140
agt_ycontrol_get_subsys_id
const xmlChar * agt_ycontrol_get_subsys_id(ses_id_t sid)
Get the subsystem-id for the session ID.
Definition: agt_ycontrol.c:2068
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
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_ycontrol_send_error
status_t agt_ycontrol_send_error(ses_cb_t *scb, const xmlChar *service_id, uint32 msgid, status_t res, const xmlChar *errstr)
Send a ycontrol error message.
Definition: agt_ycontrol.c:1455
ALL_SERVICES
#define ALL_SERVICES
YControl string for event to the YControl layer itself.
Definition: ncxconst.h:589
ncx_find_object
obj_template_t * ncx_find_object(ncx_module_t *mod, const xmlChar *objname)
Find a top level module object.
Definition: ncx.c:4345
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
log_warn
void void void log_warn(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_WARN log entry.
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
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
agt_ycontrol_register_service
status_t agt_ycontrol_register_service(const xmlChar *service_name, agt_ycontrol_service_fn_t service_fn)
Register a YControl service layer.
Definition: agt_ycontrol.c:1722
json_wr.h
JSON Write functions.
ERR_NCX_INVALID_VALUE
@ ERR_NCX_INVALID_VALUE
258
Definition: status_enum.h:299
json_wr_full_check_val
status_t json_wr_full_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)
generate entire val_value_t *w/filter)
Definition: json_wr.c:2622
ERR_INTERNAL_MEM
@ ERR_INTERNAL_MEM
003
Definition: status_enum.h:193
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
ERR_INTERNAL_PTR
@ ERR_INTERNAL_PTR
002
Definition: status_enum.h:192
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.
agt_ycontrol_init_was_done
boolean agt_ycontrol_init_was_done(void)
Return TRUE if this module has been initialized.
Definition: agt_ycontrol.c:2051
agt_ycontrol_send_event_subsys
status_t agt_ycontrol_send_event_subsys(const xmlChar *service_id, val_value_t *service_payload, boolean with_ywattrs, const xmlChar *subsys_id)
Send a server event to a specific subsystem or all subsystems.
Definition: agt_ycontrol.c:1602
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
ycontrol_msg_cmn_get_msgtype_enum
ycontrol_msgtype_t ycontrol_msg_cmn_get_msgtype_enum(val_value_t *msgval, status_t *res)
Get the message type enumeration from the message.
Definition: ycontrol_msg_cmn.c:114
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
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_stop_msg_mode
void ses_stop_msg_mode(ses_cb_t *scb)
Set the message output mode to inactive.
Definition: ses.c:2950
ses_is_gnmi_session
boolean ses_is_gnmi_session(ses_cb_t *scb)
Check if the specified session is a gNMI session.
Definition: ses.c:4765
agt.h
Multi-Protocol Network Management Server.
NCX_PROTO_YCONTROL
@ NCX_PROTO_YCONTROL
YumaPro Internal Control 1.0.
Definition: ncxtypes.h:787
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
NCX_DC_STATE
@ NCX_DC_STATE
state or statistics
Definition: ncxtypes.h:193
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
ERR_NCX_OPERATION_NOT_SUPPORTED
@ ERR_NCX_OPERATION_NOT_SUPPORTED
273
Definition: status_enum.h:314
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
YCONTROL_MSG_SERVER_RESPONSE
@ YCONTROL_MSG_SERVER_RESPONSE
server-response sent from server to subsystem
Definition: ycontrol_types.h:75
agt_val_parse.h
XML Parameter Value Parser Module.
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
agt_ycontrol_remove_subsys
void agt_ycontrol_remove_subsys(ses_id_t sid, const xmlChar *subsys_id)
Remove a subsystem connection to the ycontrol manager because the connection was closed or shutting d...
Definition: agt_ycontrol.c:1871
agt_ycontrol_cb_t_::subsys_gone_fn
agt_ycontrol_subsys_gone_fn_t subsys_gone_fn
subsystem gone callback function
Definition: agt_ycontrol.h:143
YCONTROL_MSG_SERVER_EVENT
@ YCONTROL_MSG_SERVER_EVENT
server-event sent from server to subsystem
Definition: ycontrol_types.h:69
agt_ycontrol_init1
status_t agt_ycontrol_init1(void)
Initialize the agt_ycontrol module (phase 1)
Definition: agt_ycontrol.c:1056
xml_strcmp
int xml_strcmp(const xmlChar *s1, const xmlChar *s2)
String compare for xmlChar.
Definition: xml_util.c:1746
ycontrol_msg_cmn.h
YControl Message Utilities.
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
LOGDEBUG4
#define LOGDEBUG4
Check if at least log-level=debug4.
Definition: log.h:302
log.h
NCX System Logging Manager.
LOGDEBUG
#define LOGDEBUG
Check if at least log-level=debug.
Definition: log.h:287
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
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
agt_ycontrol_subsys_t_::subsys_sid
ses_id_t subsys_sid
session ID of YControl session with this subsystem
Definition: agt_ycontrol.h:161
dlq_empty
#define dlq_empty(listP)
check if queue list is empty
Definition: dlq.h:367
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
agt_ycontrol_subsys_t_::dropped_sid
ses_id_t dropped_sid
internal ID of dropped session ID
Definition: agt_ycontrol.h:164
ycontrol_msg_cmn_new_error
status_t ycontrol_msg_cmn_new_error(obj_template_t *msgobj, status_t res, const xmlChar *errstr, val_value_t **ret_error)
Create a new YControl error response message.
Definition: ycontrol_msg_cmn.c:372
agt_ycontrol_cb_t_::qhdr
dlq_hdr_t qhdr
queue header
Definition: agt_ycontrol.h:134
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
log_debug2_append
void void void void void void void void void void log_debug2_append(const char *fstr,...) __attribute__((format(printf
Append to a LOG_DEBUG_DEBUG2 log entry.
top.h
NCX Common Top Element module.
agt_get_server_id
const xmlChar * agt_get_server_id(void)
Get the server-id string.
Definition: agt.c:4700
cap.h
NETCONF protocol capabilities.
ses_get_out_encoding
ncx_display_mode_t ses_get_out_encoding(ses_cb_t *scb)
Get the output encoding.
Definition: ses.c:4126
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
VAL_OBJ
#define VAL_OBJ(V)
Access the object template.
Definition: val.h:381
ncx.h
YANG module utility functions.
agt_ycontrol_send_payload
status_t agt_ycontrol_send_payload(ses_cb_t *scb, const xmlChar *service_id, uint32 *msgid, ycontrol_msgtype_t msgtype, val_value_t *service_payload, boolean with_ywattrs)
Send the subsystem <ycontrol> message to the sevice manager on the specified session,...
Definition: agt_ycontrol.c:1312
xml_attrs_t
dlq_hdr_t xml_attrs_t
queue of xml_attr_t
Definition: xml_util.h:151
obj.h
Data Object Support.
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
ycontrol_types.h
Some YControl data types.
SES_MY_SID
#define SES_MY_SID(S)
get session-id
Definition: ses.h:105
agt_ycontrol_send_shutdown_event
status_t agt_ycontrol_send_shutdown_event(void)
Send a <shutdown-event> message to all subsystems.
Definition: agt_ycontrol.c:2011
agt_ycontrol.h
Handle the YumaPro Control Protocol <ycontrol> (top-level) element.
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.
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_ycontrol_subsys_gone_fn_t
void(* agt_ycontrol_subsys_gone_fn_t)(const xmlChar *subsys_id)
brief Callback template for YControl services: subsys gone handler
Definition: agt_ycontrol.h:127
agt_ycontrol_cleanup
void agt_ycontrol_cleanup(void)
Cleanup the agt_ycontrol module.
Definition: agt_ycontrol.c:1143
YCONTROL_MSGBODY_PAYLOAD
@ YCONTROL_MSGBODY_PAYLOAD
payload message
Definition: ycontrol_types.h:93
VAL_STR
#define VAL_STR(V)
Access the value as a string ONLY if typ_is_string() is true.
Definition: val.h:464
ycontrol_msg_cmn_new
status_t ycontrol_msg_cmn_new(const xmlChar *server_id, const xmlChar *subsys_id, obj_template_t *msgobj, uint32 msgid, ycontrol_msgtype_t msgtype, const xmlChar *service_id, val_value_t **ret_msgval)
Create a new YControl message.
Definition: ycontrol_msg_cmn.c:153
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
ycontrol_msg_cmn_reuse_error
status_t ycontrol_msg_cmn_reuse_error(val_value_t *error_val, status_t res, const xmlChar *errstr)
Reuse an error message value struct and replace only changing fields.
Definition: ycontrol_msg_cmn.c:440
SET_ERROR
#define SET_ERROR(E)
macro SET_ERROR
Definition: status_enum.h:103
TOP_MODE_SERVER
@ TOP_MODE_SERVER
top server mode
Definition: top.h:119
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
agt_ycontrol_get_obj
obj_template_t * agt_ycontrol_get_obj(void)
Get the ycontrol container object.
Definition: agt_ycontrol.c:1927
agt_ses_free_session
void agt_ses_free_session(ses_cb_t *scb)
Free a real session control block.
Definition: agt_ses.c:870
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.
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
agt_ycontrol_init2
status_t agt_ycontrol_init2(void)
Initialize the agt_ycontrol module (phase 2)
Definition: agt_ycontrol.c:1122
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
AGT_YCONTROL_MAX_SERVICES
#define AGT_YCONTROL_MAX_SERVICES
number of services hard-wired based on defined YumaPro features
Definition: agt_ycontrol.h:83
LOGDEBUG3
#define LOGDEBUG3
Check if at least log-level=debug3.
Definition: log.h:297