1 /* 2 * Copyright 2012-2021 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 PACEMAKER_EXECD__H 11 # define PACEMAKER_EXECD__H 12 13 # include <glib.h> 14 # include <crm/common/ipc_internal.h> 15 # include <crm/lrmd.h> 16 # include <crm/stonith-ng.h> 17 18 # ifdef HAVE_GNUTLS_GNUTLS_H 19 # undef KEYFILE 20 # include <gnutls/gnutls.h> 21 # endif 22 23 extern GHashTable *rsc_list; 24 25 typedef struct lrmd_rsc_s { 26 char *rsc_id; 27 char *class; 28 char *provider; 29 char *type; 30 31 int call_opts; 32 33 /* NEVER dereference this pointer, 34 * It simply exists as a switch to let us know 35 * when the currently active operation has completed */ 36 void *active; 37 38 /* Operations in this list 39 * have not been executed yet. */ 40 GList *pending_ops; 41 /* Operations in this list are recurring operations 42 * that have been handed off from the pending ops list. */ 43 GList *recurring_ops; 44 45 int st_probe_rc; // What value should be returned for a probe if stonith 46 47 crm_trigger_t *work; 48 } lrmd_rsc_t; 49 50 # ifdef HAVE_GNUTLS_GNUTLS_H 51 // in remoted_tls.c 52 int lrmd_init_remote_tls_server(void); 53 void lrmd_tls_server_destroy(void); 54 # endif 55 56 int lrmd_server_send_reply(pcmk__client_t *client, uint32_t id, xmlNode *reply); 57 58 int lrmd_server_send_notify(pcmk__client_t *client, xmlNode *msg); 59 60 void notify_of_new_client(pcmk__client_t *new_client); 61 62 void process_lrmd_message(pcmk__client_t *client, uint32_t id, 63 xmlNode *request); 64 65 void free_rsc(gpointer data); 66 67 void handle_shutdown_ack(void); 68 69 void handle_shutdown_nack(void); 70 71 void lrmd_client_destroy(pcmk__client_t *client); 72 73 void client_disconnect_cleanup(const char *client_id); 74 75 /*! 76 * \brief Don't worry about freeing this connection. It is 77 * taken care of after mainloop exits by the main() function. 78 */ 79 stonith_t *get_stonith_connection(void); 80 81 /*! 82 * \brief This is a callback that tells the lrmd 83 * the current stonith connection has gone away. This allows 84 * us to timeout any pending stonith commands 85 */ 86 void stonith_connection_failed(void); 87 88 #ifdef PCMK__COMPILE_REMOTE 89 void ipc_proxy_init(void); 90 void ipc_proxy_cleanup(void); 91 void ipc_proxy_add_provider(pcmk__client_t *client); 92 void ipc_proxy_remove_provider(pcmk__client_t *client); 93 void ipc_proxy_forward_client(pcmk__client_t *client, xmlNode *xml); 94 pcmk__client_t *ipc_proxy_get_provider(void); 95 int ipc_proxy_shutdown_req(pcmk__client_t *ipc_proxy); 96 void remoted_spawn_pidone(int argc, char **argv, char **envp); 97 #endif 98 99 int process_lrmd_alert_exec(pcmk__client_t *client, uint32_t id, 100 xmlNode *request); 101 void lrmd_drain_alerts(GMainLoop *mloop); 102 103 #endif // PACEMAKER_EXECD__H 104