root/include/crm/lrmd_internal.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * Copyright 2015-2023 the Pacemaker project contributors
   3  *
   4  * The version control history for this file may have further details.
   5  *
   6  * This source code is licensed under the GNU Lesser General Public License
   7  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
   8  */
   9 
  10 #ifndef LRMD_INTERNAL__H
  11 #define LRMD_INTERNAL__H
  12 
  13 #include <stdint.h>                     // uint32_t
  14 #include <glib.h>                       // GList, GHashTable, gpointer
  15 #include <libxml/tree.h>                // xmlNode
  16 #include <crm/common/ipc.h>             // crm_ipc_t
  17 #include <crm/common/mainloop.h>        // mainloop_io_t, ipc_client_callbacks
  18 #include <crm/common/output_internal.h> // pcmk__output_t
  19 #include <crm/common/remote_internal.h> // pcmk__remote_t
  20 #include <crm/lrmd.h>           // lrmd_t, lrmd_event_data_t, lrmd_rsc_info_t
  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, const 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, const GList *alert_list,
  28                          const char *node, uint32_t nodeid, const char *state);
  29 int lrmd_send_fencing_alert(lrmd_t *lrmd, const 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, const GList *alert_list,
  33                              const char *node, const 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 int lrmd__metadata_async(const lrmd_rsc_info_t *rsc,
  39                          void (*callback)(int pid,
  40                                           const pcmk__action_result_t *result,
  41                                           void *user_data),
  42                          void *user_data);
  43 
  44 void lrmd__set_result(lrmd_event_data_t *event, enum ocf_exitcode rc,
  45                       int op_status, const char *exit_reason);
  46 
  47 void lrmd__reset_result(lrmd_event_data_t *event);
  48 
  49 time_t lrmd__uptime(lrmd_t *lrmd);
  50 const char *lrmd__node_start_state(lrmd_t *lrmd);
  51 
  52 /* Shared functions for IPC proxy back end */
  53 
  54 typedef struct remote_proxy_s {
  55     char *node_name;
  56     char *session_id;
  57 
  58     gboolean is_local;
  59 
  60     crm_ipc_t *ipc;
  61     mainloop_io_t *source;
  62     uint32_t last_request_id;
  63     lrmd_t *lrm;
  64 
  65 } remote_proxy_t;
  66 
  67 remote_proxy_t *remote_proxy_new(lrmd_t *lrmd,
  68                                  struct ipc_client_callbacks *proxy_callbacks,
  69                                  const char *node_name, const char *session_id,
  70                                  const char *channel);
  71 
  72 int lrmd__validate_remote_settings(lrmd_t *lrmd, GHashTable *hash);
  73 void remote_proxy_cb(lrmd_t *lrmd, const char *node_name, xmlNode *msg);
  74 void remote_proxy_ack_shutdown(lrmd_t *lrmd);
  75 void remote_proxy_nack_shutdown(lrmd_t *lrmd);
  76 
  77 int  remote_proxy_dispatch(const char *buffer, ssize_t length,
  78                            gpointer userdata);
  79 void remote_proxy_disconnected(gpointer data);
  80 void remote_proxy_free(gpointer data);
  81 
  82 void remote_proxy_relay_event(remote_proxy_t *proxy, xmlNode *msg);
  83 void remote_proxy_relay_response(remote_proxy_t *proxy, xmlNode *msg,
  84                                  int msg_id);
  85 
  86 void lrmd__register_messages(pcmk__output_t *out);
  87 
  88 #ifdef HAVE_GNUTLS_GNUTLS_H
  89 int lrmd__init_remote_key(gnutls_datum_t *key);
  90 #endif
  91 
  92 #endif

/* [previous][next][first][last][top][bottom][index][help] */