1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 #ifndef LRMD_INTERNAL__H
  11 #define LRMD_INTERNAL__H
  12 
  13 #include <stdint.h>                     
  14 #include <glib.h>                       
  15 #include <libxml/tree.h>                
  16 #include <crm/common/ipc.h>             
  17 #include <crm/common/mainloop.h>        
  18 #include <crm/common/output_internal.h> 
  19 #include <crm/common/remote_internal.h> 
  20 #include <crm/lrmd.h>                   
  21 
  22 int lrmd__new(lrmd_t **api, const char *nodename, const char *server, int port);
  23 
  24 int lrmd_send_attribute_alert(lrmd_t *lrmd, GList *alert_list,
  25                               const char *node, uint32_t nodeid,
  26                               const char *attr_name, const char *attr_value);
  27 int lrmd_send_node_alert(lrmd_t *lrmd, GList *alert_list,
  28                          const char *node, uint32_t nodeid, const char *state);
  29 int lrmd_send_fencing_alert(lrmd_t *lrmd, GList *alert_list,
  30                             const char *target, const char *task,
  31                             const char *desc, int op_rc);
  32 int lrmd_send_resource_alert(lrmd_t *lrmd, GList *alert_list,
  33                              const char *node, lrmd_event_data_t *op);
  34 
  35 int lrmd__remote_send_xml(pcmk__remote_t *session, xmlNode *msg, uint32_t id,
  36                           const char *msg_type);
  37 
  38 void lrmd__set_result(lrmd_event_data_t *event, enum ocf_exitcode rc,
  39                       int op_status, const char *exit_reason);
  40 
  41 void lrmd__reset_result(lrmd_event_data_t *event);
  42 
  43 
  44 
  45 typedef struct remote_proxy_s {
  46     char *node_name;
  47     char *session_id;
  48 
  49     gboolean is_local;
  50 
  51     crm_ipc_t *ipc;
  52     mainloop_io_t *source;
  53     uint32_t last_request_id;
  54     lrmd_t *lrm;
  55 
  56 } remote_proxy_t;
  57 
  58 remote_proxy_t *remote_proxy_new(lrmd_t *lrmd,
  59                                  struct ipc_client_callbacks *proxy_callbacks,
  60                                  const char *node_name, const char *session_id,
  61                                  const char *channel);
  62 
  63 int lrmd__validate_remote_settings(lrmd_t *lrmd, GHashTable *hash);
  64 void remote_proxy_cb(lrmd_t *lrmd, const char *node_name, xmlNode *msg);
  65 void remote_proxy_ack_shutdown(lrmd_t *lrmd);
  66 void remote_proxy_nack_shutdown(lrmd_t *lrmd);
  67 
  68 int  remote_proxy_dispatch(const char *buffer, ssize_t length,
  69                            gpointer userdata);
  70 void remote_proxy_disconnected(gpointer data);
  71 void remote_proxy_free(gpointer data);
  72 
  73 void remote_proxy_relay_event(remote_proxy_t *proxy, xmlNode *msg);
  74 void remote_proxy_relay_response(remote_proxy_t *proxy, xmlNode *msg,
  75                                  int msg_id);
  76 
  77 void lrmd__register_messages(pcmk__output_t *out);
  78 
  79 #ifdef HAVE_GNUTLS_GNUTLS_H
  80 int lrmd__init_remote_key(gnutls_datum_t *key);
  81 #endif
  82 
  83 #endif