yumapro
24.10-1
YumaPro SDK
|
YControl protocol is used by services between the main server and subsystems. More...
Data Structures | |
struct | agt_ycontrol_cb_t |
control block for 1 registered service handler More... | |
struct | agt_ycontrol_subsys_t |
control block for connected 1 subsystem; used to send event messages to the subsystem More... | |
Macros | |
#define | AGT_YCONTROL_MAX_SERVICES 4 |
number of services hard-wired based on defined YumaPro features | |
Typedefs | |
typedef 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. More... | |
typedef void(* | agt_ycontrol_subsys_gone_fn_t) (const xmlChar *subsys_id) |
brief Callback template for YControl services: subsys gone handler More... | |
Functions | |
status_t | agt_ycontrol_init1 (void) |
Initialize the agt_ycontrol module (phase 1) More... | |
status_t | agt_ycontrol_init2 (void) |
Initialize the agt_ycontrol module (phase 2) More... | |
void | agt_ycontrol_cleanup (void) |
Cleanup the agt_ycontrol module. More... | |
boolean | agt_ycontrol_dispatch (ses_cb_t *scb, xml_node_t *top) |
Handle an incoming <ycontrol> message from a subsystem. More... | |
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, using the <payload> variant. More... | |
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, boolean need_filesave) |
Send the subsystem <ycontrol> message to the sevice manager on the specified session, using the <payload> variant. More... | |
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. More... | |
status_t | agt_ycontrol_send_ok (ses_cb_t *scb, const xmlChar *service_id, uint32 msgid) |
Send a ycontrol OK message. More... | |
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. More... | |
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. More... | |
status_t | agt_ycontrol_register_service (const xmlChar *service_name, agt_ycontrol_service_fn_t service_fn) |
Register a YControl service layer. More... | |
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) More... | |
void | agt_ycontrol_unregister_service (const xmlChar *service_name) |
un-register a callback for 1 YControl service type More... | |
status_t | agt_ycontrol_add_subsys (ses_id_t subsys_sid, const xmlChar *subsys_id) |
Add a subsystem connection to the ycontrol manager. More... | |
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 down. More... | |
obj_template_t * | agt_ycontrol_get_obj (void) |
Get the ycontrol container object. More... | |
ses_cb_t * | agt_ycontrol_get_scb (const xmlChar *subsys_id) |
Get the session control block for the specified subsys ID. More... | |
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. More... | |
boolean | agt_ycontrol_any_subsys_active (void) |
Check if there are any subsystems active. More... | |
status_t | agt_ycontrol_send_shutdown_event (void) |
Send a <shutdown-event> message to all subsystems. More... | |
status_t | agt_ycontrol_send_shutdown_event_byservice (const xmlChar *service_id) |
Send a <shutdown-event> message to a specific subsystems. More... | |
boolean | agt_ycontrol_init_was_done (void) |
Return TRUE if this module has been initialized. More... | |
const xmlChar * | agt_ycontrol_get_subsys_id (ses_id_t sid) |
Get the subsystem-id for the session ID. More... | |
YControl protocol is used by services between the main server and subsystems.
Each service registers a unique service name and provides a message receiver callback.
typedef 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.
scb | session control block for YControl session | |
msgtype | message type | |
msgid | message ID | |
subsys_id | subsystem identifier | |
msgbody_type | type of message body (OK, PAYLOAD, ERROR) | |
msgbody | val_value_t representing the message body the service-specific payload node(s) will be child nodes if this is the <payload> container | |
[out] | scb_valid | address of return scb_valid flag *scb_valid TRUE if scb pointer still valid; FALSE if not |
typedef void(* agt_ycontrol_subsys_gone_fn_t) (const xmlChar *subsys_id) |
brief Callback template for YControl services: subsys gone handler
Called by YControl when the subsystem has gone away
subsys_id | subsystem identifier that is gone (dropped, crashed) |
Add a subsystem connection to the ycontrol manager.
subsys_sid | session ID for subsystem connnection |
subsys_id | subsystem ID |
boolean agt_ycontrol_any_subsys_active | ( | void | ) |
Check if there are any subsystems active.
void agt_ycontrol_cleanup | ( | void | ) |
Cleanup the agt_ycontrol module.
Unregister the top-level <ycontrol> element
boolean agt_ycontrol_dispatch | ( | ses_cb_t * | scb, |
xml_node_t * | top | ||
) |
Handle an incoming <ycontrol> message from a subsystem.
scb | session control block |
top | top element descriptor |
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.
sid | session ID that was dropped |
obj_template_t * agt_ycontrol_get_obj | ( | void | ) |
Get the ycontrol container object.
ses_cb_t * agt_ycontrol_get_scb | ( | const xmlChar * | subsys_id | ) |
Get the session control block for the specified subsys ID.
subsys_id | subsystem identifier |
const xmlChar * agt_ycontrol_get_subsys_id | ( | ses_id_t | sid | ) |
Get the subsystem-id for the session ID.
sid | session identifier |
status_t agt_ycontrol_init1 | ( | void | ) |
Initialize the agt_ycontrol module (phase 1)
Initialize module variables and load yumaworks-ycontrol module
status_t agt_ycontrol_init2 | ( | void | ) |
Initialize the agt_ycontrol module (phase 2)
Adds the agt_ycontrol_dispatch function as the handler for the NETCONF <ycontrol> top-level element.
boolean agt_ycontrol_init_was_done | ( | void | ) |
Return TRUE if this module has been initialized.
status_t agt_ycontrol_register_service | ( | const xmlChar * | service_name, |
agt_ycontrol_service_fn_t | service_fn | ||
) |
Register a YControl service layer.
Add message callback for 1 YControl service type
service_name | YControl service name |
service_fn | service message callback function |
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)
Add message callback and subsys_gone callback for 1 YControl service type
service_name | YControl service name |
service_fn | service message callback function |
subsys_gone_fn | subsys dropped callback function (may be NULL) |
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 down.
Subsystems have associated control sessions. Need to use this SID to locate correct subsystem in case there are multiple subsystems with the same ID trying to establish connection with the server.
sid | subsystem's associated SID |
subsys_id | subsystem ID to remove |
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, | ||
boolean | need_filesave | ||
) |
Send the subsystem <ycontrol> message to the sevice manager on the specified session, using the <payload> variant.
The <payload> will be filled in by the callback function
scb | session control block | |
service_id | service sending the message | |
[in,out] | msgid | address of message ID;
|
msgtype | type of YControl message to send; One of:
| |
with_ywattrs | TRUE to add attrs NS to msg hdr; FALSE if not | |
service_obj | object template for the service layer | |
data_cbfn | Callback function to inject data | |
rpcmsg | RPC message holding the state for this data | |
need_filesave | == save to file first flag
|
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.
scb | session control block |
service_id | service_id from request |
msgid | message ID from request |
res | internal status code |
errstr | error message |
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.
service_id | service sending the message |
service_payload | val_value_t tree to add to message payload NULL if not used |
with_ywattrs | TRUE to add attrs NS to msg hdr; FALSE if not |
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.
service_id | service sending the message |
service_payload | val_value_t tree to add to message payload NULL if not used |
with_ywattrs | TRUE to add attrs NS to msg hdr; FALSE if not |
subsys_id | one subsystem to send event to or NULL if all subsystems that match |
Send a ycontrol OK message.
scb | session control block |
service_id | service_id from request |
msgid | message ID from request |
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, using the <payload> variant.
scb | session control block | |
service_id | service sending the message | |
[in,out] | msgid | address of message ID;
|
msgtype | type of YControl message to send; One of:
| |
service_payload | val_value_t tree to add to message payload | |
with_ywattrs | TRUE to add attrs NS to msg hdr; FALSE if not |
status_t agt_ycontrol_send_shutdown_event | ( | void | ) |
Send a <shutdown-event> message to all subsystems.
status_t agt_ycontrol_send_shutdown_event_byservice | ( | const xmlChar * | service_id | ) |
Send a <shutdown-event> message to a specific subsystems.
service_id | service sending the message |
void agt_ycontrol_unregister_service | ( | const xmlChar * | service_name | ) |
un-register a callback for 1 YControl service type
service_name | YControl service name |