1
2
3
4
5
6
7
8
9
10 #ifndef PCMK__CRM_LRMD_INTERNAL__H
11 #define PCMK__CRM_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/common/results_internal.h>
21 #include <crm/lrmd.h>
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
43 int lrmd__metadata_async(const lrmd_rsc_info_t *rsc,
44 void (*callback)(int pid,
45 const pcmk__action_result_t *result,
46 void *user_data),
47 void *user_data);
48
49 void lrmd__set_result(lrmd_event_data_t *event, enum ocf_exitcode rc,
50 int op_status, const char *exit_reason);
51
52 void lrmd__reset_result(lrmd_event_data_t *event);
53
54 time_t lrmd__uptime(lrmd_t *lrmd);
55 const char *lrmd__node_start_state(lrmd_t *lrmd);
56
57
58
59 typedef struct remote_proxy_s {
60 char *node_name;
61 char *session_id;
62
63 gboolean is_local;
64
65 crm_ipc_t *ipc;
66 mainloop_io_t *source;
67 uint32_t last_request_id;
68 lrmd_t *lrm;
69
70 } remote_proxy_t;
71
72 remote_proxy_t *remote_proxy_new(lrmd_t *lrmd,
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);
79 void remote_proxy_ack_shutdown(lrmd_t *lrmd);
80 void remote_proxy_nack_shutdown(lrmd_t *lrmd);
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
91 void lrmd__register_messages(pcmk__output_t *out);
92
93 int lrmd__init_remote_key(gnutls_datum_t *key);
94
95 #ifdef __cplusplus
96 }
97 #endif
98
99 #endif