pacemaker  3.0.0-d8340737c4
Scalable High-Availability cluster resource manager
lrmd_internal.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2024 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 PCMK__CRM_LRMD_INTERNAL__H
11 #define PCMK__CRM_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/common/results_internal.h> // pcmk__action_result_t
21 #include <crm/lrmd.h> // lrmd_t, lrmd_event_data_t, lrmd_rsc_info_t
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 int lrmd__new(lrmd_t **api, const char *nodename, const char *server, int port);
28 
29 int lrmd_send_attribute_alert(lrmd_t *lrmd, const GList *alert_list,
30  const char *node, uint32_t nodeid,
31  const char *attr_name, const char *attr_value);
32 int lrmd_send_node_alert(lrmd_t *lrmd, const GList *alert_list,
33  const char *node, uint32_t nodeid, const char *state);
34 int lrmd_send_fencing_alert(lrmd_t *lrmd, const GList *alert_list,
35  const char *target, const char *task,
36  const char *desc, int op_rc);
37 int lrmd_send_resource_alert(lrmd_t *lrmd, const GList *alert_list,
38  const char *node, const lrmd_event_data_t *op);
39 
40 int lrmd__remote_send_xml(pcmk__remote_t *session, xmlNode *msg, uint32_t id,
41  const char *msg_type);
42 
44  void (*callback)(int pid,
46  void *user_data),
47  void *user_data);
48 
50  int op_status, const char *exit_reason);
51 
53 
54 time_t lrmd__uptime(lrmd_t *lrmd);
55 const char *lrmd__node_start_state(lrmd_t *lrmd);
56 
57 /* Shared functions for IPC proxy back end */
58 
59 typedef struct remote_proxy_s {
60  char *node_name;
61  char *session_id;
62 
63  gboolean is_local;
64 
67  uint32_t last_request_id;
69 
71 
73  struct ipc_client_callbacks *proxy_callbacks,
74  const char *node_name, const char *session_id,
75  const char *channel);
76 
77 int lrmd__validate_remote_settings(lrmd_t *lrmd, GHashTable *hash);
78 void remote_proxy_cb(lrmd_t *lrmd, const char *node_name, xmlNode *msg);
81 
82 int remote_proxy_dispatch(const char *buffer, ssize_t length,
83  gpointer userdata);
84 void remote_proxy_disconnected(gpointer data);
85 void remote_proxy_free(gpointer data);
86 
87 void remote_proxy_relay_event(remote_proxy_t *proxy, xmlNode *msg);
88 void remote_proxy_relay_response(remote_proxy_t *proxy, xmlNode *msg,
89  int msg_id);
90 
92 
93 int lrmd__init_remote_key(gnutls_datum_t *key);
94 
95 #ifdef __cplusplus
96 }
97 #endif
98 
99 #endif // PCMK__CRM_LRMD_INTERNAL__H
ocf_exitcode
Exit status codes for resource agents.
Definition: results.h:173
char data[0]
Definition: cpg.c:58
void remote_proxy_disconnected(gpointer data)
Definition: proxy_common.c:159
int lrmd__validate_remote_settings(lrmd_t *lrmd, GHashTable *hash)
Definition: lrmd_client.c:982
uint32_t last_request_id
Definition: lrmd_internal.h:67
struct mainloop_io_s mainloop_io_t
Definition: mainloop.h:41
int lrmd__metadata_async(const lrmd_rsc_info_t *rsc, void(*callback)(int pid, const pcmk__action_result_t *result, void *user_data), void *user_data)
Definition: lrmd_client.c:2536
void remote_proxy_relay_event(remote_proxy_t *proxy, xmlNode *msg)
Definition: proxy_common.c:70
Resource agent executor.
int remote_proxy_dispatch(const char *buffer, ssize_t length, gpointer userdata)
Definition: proxy_common.c:130
Wrappers for and extensions to glib mainloop.
Formatted output for pacemaker tools.
uint32_t pid
Definition: cpg.c:49
struct crm_ipc_s crm_ipc_t
Definition: ipc.h:151
const char * lrmd__node_start_state(lrmd_t *lrmd)
Definition: lrmd_client.c:2674
struct remote_proxy_s remote_proxy_t
int lrmd__init_remote_key(gnutls_datum_t *key)
Definition: lrmd_client.c:1323
int lrmd__new(lrmd_t **api, const char *nodename, const char *server, int port)
Definition: lrmd_client.c:2368
void lrmd__reset_result(lrmd_event_data_t *event)
Definition: lrmd_client.c:2638
int lrmd_send_attribute_alert(lrmd_t *lrmd, const GList *alert_list, const char *node, uint32_t nodeid, const char *attr_name, const char *attr_value)
Definition: lrmd_alerts.c:232
time_t lrmd__uptime(lrmd_t *lrmd)
Definition: lrmd_client.c:2662
void lrmd__register_messages(pcmk__output_t *out)
Definition: lrmd_output.c:157
void remote_proxy_cb(lrmd_t *lrmd, const char *node_name, xmlNode *msg)
Definition: proxy_common.c:217
remote_proxy_t * remote_proxy_new(lrmd_t *lrmd, struct ipc_client_callbacks *proxy_callbacks, const char *node_name, const char *session_id, const char *channel)
Definition: proxy_common.c:177
crm_ipc_t * ipc
Definition: lrmd_internal.h:65
const char * target
Definition: pcmk_fence.c:31
int lrmd_send_resource_alert(lrmd_t *lrmd, const GList *alert_list, const char *node, const lrmd_event_data_t *op)
Definition: lrmd_alerts.c:340
int lrmd_send_fencing_alert(lrmd_t *lrmd, const GList *alert_list, const char *target, const char *task, const char *desc, int op_rc)
Definition: lrmd_alerts.c:305
pcmk__action_result_t result
Definition: pcmk_fence.c:37
void lrmd__set_result(lrmd_event_data_t *event, enum ocf_exitcode rc, int op_status, const char *exit_reason)
Definition: lrmd_client.c:2617
void remote_proxy_nack_shutdown(lrmd_t *lrmd)
Definition: proxy_common.c:61
mainloop_io_t * source
Definition: lrmd_internal.h:66
This structure contains everything that makes up a single output formatter.
void remote_proxy_free(gpointer data)
Definition: proxy_common.c:119
void remote_proxy_relay_response(remote_proxy_t *proxy, xmlNode *msg, int msg_id)
Definition: proxy_common.c:88
int lrmd__remote_send_xml(pcmk__remote_t *session, xmlNode *msg, uint32_t id, const char *msg_type)
Definition: lrmd_client.c:667
Definition: lrmd.h:473
IPC interface to Pacemaker daemons.
void remote_proxy_ack_shutdown(lrmd_t *lrmd)
Definition: proxy_common.c:46
gboolean is_local
Definition: lrmd_internal.h:63
int lrmd_send_node_alert(lrmd_t *lrmd, const GList *alert_list, const char *node, uint32_t nodeid, const char *state)
Definition: lrmd_alerts.c:270