yumapro  20.10-12
YumaPro SDK
ycontrol.h File Reference

YumaPro Subsystem Control Protocol. More...

#include <time.h>
#include <sys/time.h>
#include <xmlstring.h>
#include "ncxtypes.h"
#include "obj.h"
#include "ses.h"
#include "status_enum.h"
#include "val.h"
#include "tstamp.h"
#include "ycontrol_types.h"
Include dependency graph for ycontrol.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ycontrol_service_t_
 callback functions for a service that registers with ycontrol More...
 
struct  ycontrol_profile_t_
 control block for 1 ycontrol manager (only 1 used) More...
 

Macros

#define YCONTROL_DEF_RETRY_INTERVAL   5000
 number of milli-seconds to wait between re-connect retries More...
 
#define YCONTROL_DEF_MAX_RETRIES   5000
 max number of reconnect retries before giving up
 
#define SHUTDOWN_STATE(ST)
 Check if in shutdown state.
 
#define YCONTROL_MAX_SERVICES   2
 this constant needs to be updated as more service types are implemented; currently only sil-sa, database planned
 
#define YCONTROL_MOD   (const xmlChar *)"yumaworks-ycontrol"
 YANG module for YControl protocol.
 
#define YCONTROL_OBJ   (const xmlChar *)"ycontrol"
 container name for YControl protocol
 

Typedefs

typedef status_t(* ycontrol_service_start_t) (void)
 YControl Service Layer Start Callback Function. More...
 
typedef status_t(* ycontrol_service_stop_t) (ses_cb_t *scb)
 YControl Service Layer Stop Callback Function. More...
 
typedef 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. More...
 
typedef void(* ycontrol_service_shutdown_t) (void)
 YControl Service Layer Shutdown Callback Function. More...
 
typedef void(* ycontrol_timer_handler_t) (void)
 YControl Service Layer Timer Handler Function. More...
 

Enumerations

enum  ycontrol_state_t_ {
  YCONTROL_ST_NONE,
  YCONTROL_ST_INIT,
  YCONTROL_ST_CONNECT,
  YCONTROL_ST_CONNECTING,
  YCONTROL_ST_WAIT_CONNECT_RETRY,
  YCONTROL_ST_CONNECTED,
  YCONTROL_ST_SHUTDOWN_REQ,
  YCONTROL_ST_DISCONNECTING,
  YCONTROL_ST_SHUTDOWN,
  YCONTROL_ST_SHUTDOWN_DONE
}
 ycontrol manager connection state enumerations More...
 

Functions

status_t ycontrol_init (int argc, char *argv[], const xmlChar *subsys_id)
 Initialize the YControl library. More...
 
status_t ycontrol_init_ex (int argc, char *argv[], const xmlChar *subsys_id, boolean is_standby)
 Initialize the YControl library. More...
 
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. More...
 
status_t ycontrol_init2 (void)
 Phase 2 initialization. More...
 
status_t ycontrol_init2_ha (const char *server_id, const char *server_addr, uint16 server_port)
 Phase 2 initialization for HA. More...
 
void ycontrol_init2_ha_thd (thd_tcb_t *tcb)
 Setup scb->tcb for ycontrol session. More...
 
void ycontrol_cleanup (void)
 Cleanup ycontrol layer. More...
 
void ycontrol_cleanup_ex (boolean do_ncx_cleanup)
 Cleanup ycontrol layer (extended) More...
 
status_t ycontrol_check_io (void)
 Check for input/output. More...
 
boolean ycontrol_is_ready (void)
 Check if the ycontrol ready is up and ready to be used. More...
 
void ycontrol_request_shutdown (void)
 Request a control message handler shutdown. More...
 
boolean ycontrol_shutdown_requested (void)
 Check if a control message handler shutdown is in progress. More...
 
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. More...
 
void ycontrol_unregister_service (const xmlChar *service_name)
 Unregister a specific service. More...
 
void ycontrol_service_start (void)
 Start the registered services. More...
 
void ycontrol_service_stop (void)
 Stop the registered services. More...
 
obj_template_t * ycontrol_get_service_object (const xmlChar *service_name)
 Get the service object from the payload container. More...
 
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. More...
 
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) More...
 
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) More...
 
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. More...
 
status_t ycontrol_send_ok (const xmlChar *service_id, uint32 *msgid, const xmlChar *txid_str)
 Send a YControl <ok> message. More...
 
boolean ycontrol_dispatch_msg (ses_cb_t *scb)
 Find the appropriate service handler and call it with the incoming message from the server. More...
 
void ycontrol_setup_reconnect (void)
 Setup the YControl profile to reconnect after the retry interval with the incoming message from the server. More...
 
boolean ycontrol_shutdown_now (void)
 Check if the YControl subsystem has shut down because a <shutdown-event> was received from the server. More...
 
void ycontrol_set_timer_handler (ycontrol_timer_handler_t timer_handler)
 Set the timer callback handler. More...
 
void ycontrol_set_retry_interval (int retry_int)
 Set the re-connect retry interval. More...
 
const xmlChar * ycontrol_get_subsys_id (void)
 Get the subsystem ID string. More...
 
void ycontrol_set_retry_limit (uint16 retry_limit)
 Set the re-connect retry limit. More...
 

Detailed Description

YumaPro Subsystem Control Protocol.