69#ifndef _H_ycontrol_types
114#define YCONTROL_DEF_RETRY_INTERVAL 5000
117#define YCONTROL_DEF_MAX_RETRIES 5000
120#define SHUTDOWN_STATE(ST) \
121 ((ST) == YCONTROL_ST_SHUTDOWN_REQ || \
122 (ST) == YCONTROL_ST_DISCONNECTING || \
123 (ST) == YCONTROL_ST_SHUTDOWN)
128#define YCONTROL_MAX_SERVICES 2
131#define YCONTROL_MOD (const xmlChar *)"yumaworks-ycontrol"
134#define YCONTROL_OBJ (const xmlChar *)"ycontrol"
193 const xmlChar *server_id,
196 boolean *response_sent);
237typedef enum ycontrol_state_t_ {
271typedef struct ycontrol_service_t_ {
294typedef struct ycontrol_profile_t_ {
334 struct timeval retry_timestamp;
424 const xmlChar *subsys_id);
445 const xmlChar *subsys_id,
469 const xmlChar *subsys_id,
500 const char *server_addr,
718 const xmlChar *txid_str);
744 const xmlChar *txid_str);
765 const xmlChar *error_message,
766 const xmlChar *txid_str);
781 const xmlChar *txid_str);
844extern const xmlChar *
status_t
global error return code
Definition: status_enum.h:210
boolean ycontrol_shutdown_now(void)
Check if the YControl subsystem has shut down because a <shutdown-event> was received from the server...
Definition: ycontrol.c:1467
void ycontrol_cleanup_ex(boolean do_ncx_cleanup)
Cleanup ycontrol layer (extended)
Definition: ycontrol.c:790
void ycontrol_service_stop(void)
Stop the registered services.
Definition: ycontrol.c:1114
status_t ycontrol_send(const xmlChar *service_id, uint32 *msgid, ycontrol_msgtype_t msgtype, val_value_t *service_payload, status_t msg_status)
Send a YControl message.
Definition: ycontrol.c:1178
status_t ycontrol_send_error(const xmlChar *service_id, uint32 *msgid, status_t msg_status, uint32 error_index, const xmlChar *error_message, const xmlChar *txid_str)
Send a YControl <error> message.
Definition: ycontrol.c:1300
void ycontrol_unregister_service(const xmlChar *service_name)
Unregister a specific service.
Definition: ycontrol.c:1059
void ycontrol_request_shutdown(void)
Request a control message handler shutdown.
Definition: ycontrol.c:944
void ycontrol_init2_ha_thd(thd_tcb_t *tcb)
Setup scb->tcb for ycontrol session.
Definition: ycontrol.c:758
status_t ycontrol_init(int argc, char *argv[], const xmlChar *subsys_id)
Initialize the YControl library.
Definition: ycontrol.c:492
status_t ycontrol_register_service2(const xmlChar *service_name, ycontrol_service_start_t service_start, ycontrol_service_stop_t service_stop, ycontrol_service_msg_rcvr_t service_rcvr, ycontrol_service_shutdown_t service_shut, ycontrol_service_reconnect_t service_reconnect)
Register a specific service with the YumaPro control message manager Add a reconnect callback.
Definition: ycontrol.c:1011
void ycontrol_set_retry_interval(int retry_int)
Set the re-connect retry interval.
Definition: ycontrol.c:1500
status_t ycontrol_send_ex(const xmlChar *service_id, uint32 *msgid, ycontrol_msgtype_t msgtype, val_value_t *service_payload, status_t msg_status, const xmlChar *txid_str)
Send a YControl message (extended)
Definition: ycontrol.c:1215
void ycontrol_setup_reconnect(void)
Setup the YControl profile to reconnect after the retry interval with the incoming message from the s...
Definition: ycontrol.c:1442
status_t ycontrol_init2(void)
Phase 2 initialization.
Definition: ycontrol.c:659
const xmlChar * ycontrol_get_subsys_id(void)
Get the subsystem ID string.
Definition: ycontrol.c:1518
status_t ycontrol_init2_ha(const char *server_id, const char *server_addr, uint16 server_port)
Phase 2 initialization for HA.
Definition: ycontrol.c:680
void ycontrol_service_reconnect(void)
Start the main server reconnect for the registered services.
Definition: ycontrol.c:1589
status_t ycontrol_send_ex2(const xmlChar *service_id, uint32 *msgid, ycontrol_msgtype_t msgtype, val_value_t *service_payload, status_t msg_status, boolean with_origin, const xmlChar *txid_str)
Send a YControl message (extended2)
Definition: ycontrol.c:1259
void ycontrol_service_start(void)
Start the registered services.
Definition: ycontrol.c:1083
status_t ycontrol_send_ok(const xmlChar *service_id, uint32 *msgid, const xmlChar *txid_str)
Send a YControl <ok> message.
Definition: ycontrol.c:1335
boolean ycontrol_shutdown_requested(void)
Check if a control message handler shutdown is in progress.
Definition: ycontrol.c:963
status_t ycontrol_check_io(void)
Check for input/output.
Definition: ycontrol.c:847
boolean ycontrol_is_ready(void)
Check if the ycontrol ready is up and ready to be used.
Definition: ycontrol.c:912
obj_template_t * ycontrol_get_service_object(const xmlChar *service_name)
Get the service object from the payload container.
Definition: ycontrol.c:1150
void ycontrol_set_retry_limit(uint16 retry_limit)
Set the re-connect retry limit.
Definition: ycontrol.c:1533
void ycontrol_set_timer_handler(ycontrol_timer_handler_t timer_handler)
Set the timer callback handler.
Definition: ycontrol.c:1483
void ycontrol_cleanup(void)
Cleanup ycontrol layer.
Definition: ycontrol.c:777
status_t ycontrol_register_service(const xmlChar *service_name, ycontrol_service_start_t service_start, ycontrol_service_stop_t service_stop, ycontrol_service_msg_rcvr_t service_rcvr, ycontrol_service_shutdown_t service_shut)
Register a specific service with the YumaPro control message manager.
Definition: ycontrol.c:981
status_t ycontrol_init_ex2(int argc, char *argv[], const xmlChar *subsys_id, boolean is_standby, boolean quiet_mode)
Setup global vars before accepting any requests; extended 2.
Definition: ycontrol.c:552
boolean ycontrol_dispatch_msg(ses_cb_t *scb)
Find the appropriate service handler and call it with the incoming message from the server.
Definition: ycontrol.c:1368
status_t ycontrol_set_server_root(const char *server_root)
Set the server-root when running in Multi-Instance Mode.
Definition: ycontrol.c:1554
status_t ycontrol_init_ex(int argc, char *argv[], const xmlChar *subsys_id, boolean is_standby)
Initialize the YControl library.
Definition: ycontrol.c:520
status_t(* ycontrol_service_start_t)(void)
YControl Service Layer Start Callback Function.
Definition: ycontrol.h:153
ycontrol_msgbody_t
YControl message body types.
Definition: ycontrol_types.h:85
void(* ycontrol_timer_handler_t)(void)
YControl Service Layer Timer Handler Function.
Definition: ycontrol.h:221
void(* ycontrol_service_reconnect_t)(void)
YControl Service Layer Reconnect Callback Function.
Definition: ycontrol.h:233
ycontrol_msgtype_t
ycontrol message type
Definition: ycontrol_types.h:60
ycontrol_state_t
ycontrol manager connection state enumerations
Definition: ycontrol.h:237
void(* ycontrol_service_shutdown_t)(void)
YControl Service Layer Shutdown Callback Function.
Definition: ycontrol.h:210
#define YCONTROL_MAX_SERVICES
this constant needs to be updated as more service types are implemented; currently only sil-sa,...
Definition: ycontrol.h:128
status_t(* ycontrol_service_stop_t)(ses_cb_t *scb)
YControl Service Layer Stop Callback Function.
Definition: ycontrol.h:166
status_t(* ycontrol_service_msg_rcvr_t)(ses_cb_t *scb, ycontrol_msgtype_t msgtype, uint32 msgid, const xmlChar *server_id, ycontrol_msgbody_t msgbody_type, val_value_t *msgbody, boolean *response_sent)
YControl Service Layer Message Receiver Callback Function.
Definition: ycontrol.h:190
@ YCONTROL_ST_NONE
not set
Definition: ycontrol.h:239
@ YCONTROL_ST_CONNECTING
connecting to the server
Definition: ycontrol.h:248
@ YCONTROL_ST_CONNECT
need a socket connection to server
Definition: ycontrol.h:245
@ YCONTROL_ST_SHUTDOWN
in the process of shutting down
Definition: ycontrol.h:263
@ YCONTROL_ST_SHUTDOWN_DONE
shutdown complete
Definition: ycontrol.h:266
@ YCONTROL_ST_WAIT_CONNECT_RETRY
connect failed and waiting for a retry
Definition: ycontrol.h:251
@ YCONTROL_ST_CONNECTED
active state, ready to receive requests and start service layers
Definition: ycontrol.h:254
@ YCONTROL_ST_DISCONNECTING
disconnecting from the server
Definition: ycontrol.h:260
@ YCONTROL_ST_SHUTDOWN_REQ
got an application shutdown request
Definition: ycontrol.h:257
@ YCONTROL_ST_INIT
YControl initializing.
Definition: ycontrol.h:242
YANG module data structures Many internal representations of YANG module constructs.
NETCONF Session Common definitions module.
global error status code enumerations
representation of one module or submodule during and after parsing
Definition: ncxtypes.h:1138
One YANG data-def-stmt.
Definition: obj.h:1229
Session Control Block.
Definition: ses.h:573
Thread control block (TCB)
Definition: thd.h:175
one value to match one type
Definition: val.h:912
control block for 1 ycontrol manager (only 1 used)
Definition: ycontrol.h:294
obj_template_t * ycontrol_obj
YControl message YANG object.
Definition: ycontrol.h:352
val_value_t * ycontrol_txid
cached transaction ID
Definition: ycontrol.h:358
int connect_retries
connect retries done
Definition: ycontrol.h:314
fd_set active_fd_set
socket active FD set
Definition: ycontrol.h:340
fd_set read_fd_set
socket read FD set
Definition: ycontrol.h:343
int connect_retry_interval
number of milliseconds to wait before connect retry
Definition: ycontrol.h:320
val_value_t * ycontrol_payload
cached payload to reload and save time
Definition: ycontrol.h:361
xmlChar * server_id
malloced server ID that this subsystem connected to
Definition: ycontrol.h:300
fd_set write_fd_set
socket write FD set
Definition: ycontrol.h:346
boolean shutdown_requested
flag shutdown requested by the application
Definition: ycontrol.h:323
boolean is_standby
internal flag to identify special subsystem that is a server connecting to another server
Definition: ycontrol.h:328
char * server_root
malloced server root ID used in server Multi-Instance Mode set from the –server-root CLI parameter
Definition: ycontrol.h:305
status_t ycontrol_res
last operation result
Definition: ycontrol.h:311
int connect_max_retries
connect retries allowed
Definition: ycontrol.h:317
ses_cb_t * ycontrol_scb
session control block for connection to server
Definition: ycontrol.h:337
val_value_t * ycontrol_msg
cached message subtree to save time
Definition: ycontrol.h:355
ncx_module_t * ycontrol_mod
parsed and saved YANG module for YControl messages
Definition: ycontrol.h:349
time_t boot_timestamp
timestamp of the connection attempt
Definition: ycontrol.h:331
val_value_t * ycontrol_ok
cached OK message ready to reload and send
Definition: ycontrol.h:364
val_value_t * ycontrol_error
cached error message ready to reload and send
Definition: ycontrol.h:367
ycontrol_timer_handler_t timer_handler
timer callback for periodic checks like reconnect
Definition: ycontrol.h:375
ycontrol_state_t ycontrol_state
current YControl protocol state
Definition: ycontrol.h:308
xmlChar * subsys_id
malloced subsystem ID to use
Definition: ycontrol.h:297
uint32 next_msgid
next message ID, incremented when subsystem initiates the message
Definition: ycontrol.h:372
callback functions for a service that registers with ycontrol
Definition: ycontrol.h:271
ycontrol_service_start_t service_start
service start callback
Definition: ycontrol.h:276
ycontrol_service_stop_t service_stop
service stop callback
Definition: ycontrol.h:279
ycontrol_service_shutdown_t service_shutdown
service shutdown callback
Definition: ycontrol.h:285
xmlChar * service_name
service name (list key)
Definition: ycontrol.h:273
ycontrol_service_reconnect_t service_reconnect
service reconnect callback
Definition: ycontrol.h:288
ycontrol_service_msg_rcvr_t service_msg_rcvr
service message receiver callback
Definition: ycontrol.h:282
Value Node Basic Support.
Some YControl data types.