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