1 /*
2 * Copyright 2012-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 PCMK__CRM_LRMD_EVENTS__H
11 # define PCMK__CRM_LRMD_EVENTS__H
12
13 #include <glib.h> // guint
14 #include <crm/common/results.h> // enum ocf_exitcode
15
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19
20 /**
21 * \file
22 * \brief Resource agent executor events
23 * \ingroup lrmd
24 */
25
26 enum lrmd_callback_event {
27 lrmd_event_register,
28 lrmd_event_unregister,
29 lrmd_event_exec_complete,
30 lrmd_event_disconnect,
31 lrmd_event_connect,
32 lrmd_event_poke,
33 lrmd_event_new_client,
34 };
35
36 typedef struct lrmd_event_data_s {
37 /*! Type of event, register, unregister, call_completed... */
38 enum lrmd_callback_event type;
39
40 /*! The resource this event occurred on. */
41 const char *rsc_id;
42 /*! The action performed, start, stop, monitor... */
43 const char *op_type;
44 /*! The user data passed by caller of exec() API function */
45 const char *user_data;
46
47 /*! The client api call id associated with this event */
48 int call_id;
49
50 /*! The operation's timeout period in ms. */
51 int timeout;
52
53 /*! The operation's recurring interval in ms. */
54 guint interval_ms;
55
56 /*! The operation's start delay value in ms. */
57 int start_delay;
58
59 /*! This operation that just completed is on a deleted rsc. */
60 int rsc_deleted;
61
62 /*! The executed ra return code mapped to OCF */
63 enum ocf_exitcode rc;
64
65 /*! The executor status returned for exec_complete events */
66 int op_status;
67
68 /*! stdout from resource agent operation */
69 const char *output;
70
71 /*! Timestamp of when op ran */
72 unsigned int t_run;
73
74 /*! Timestamp of last rc change */
75 unsigned int t_rcchange;
76
77 /*! Time in length op took to execute */
78 unsigned int exec_time;
79
80 /*! Time in length spent in queue */
81 unsigned int queue_time;
82
83 /*! int connection result. Used for connection and poke events */
84 int connection_rc;
85
86 /* This is a GHashTable containing the
87 * parameters given to the operation */
88 void *params;
89
90 /*! client node name associated with this connection
91 * (used to match actions to the proper client when there are multiple)
92 */
93 const char *remote_nodename;
94
95 /*! exit failure reason string from resource agent operation */
96 const char *exit_reason;
97 } lrmd_event_data_t;
98
99 lrmd_event_data_t *lrmd_new_event(const char *rsc_id, const char *task,
100 guint interval_ms);
101 lrmd_event_data_t *lrmd_copy_event(lrmd_event_data_t *event);
102 void lrmd_free_event(lrmd_event_data_t *event);
103
104 #ifdef __cplusplus
105 }
106 #endif
107
108 #endif // PCMK__CRM_LRMD_EVENTS__H