23 typedef struct pacemakerd_api_private_s {
28 static const char *pacemakerd_state_str[] = {
47 if (pcmk__str_eq(state, pacemakerd_state_str[i],
pcmk__str_none)) {
60 return pacemakerd_state_str[state];
69 struct pacemakerd_api_private_s *
private = NULL;
71 api->
api_data = calloc(1,
sizeof(
struct pacemakerd_api_private_s));
82 private->client_uuid = pcmk__getpid_s();
90 free(((
struct pacemakerd_api_private_s *) data)->client_uuid);
98 struct pacemakerd_api_private_s *
private = NULL;
112 struct pacemakerd_api_private_s *
private = NULL;
128 if (command == NULL) {
140 xmlNode *msg_data = NULL;
144 const char *value = NULL;
145 long long value_ll = 0;
149 crm_debug(
"Unrecognizable pacemakerd message: invalid message type '%s'",
156 crm_debug(
"Unrecognizable pacemakerd message: no reference");
162 if ((value == NULL) || strcmp(value,
CRM_OP_PING)) {
180 reply_data.
data.
ping.last_good = (time_t) value_ll;
217 private->client_uuid);
222 crm_debug(
"Couldn't ping pacemakerd: %s rc=%d",
void(* free_data)(void *api_data)
#define CRM_CHECK(expr, failure_action)
xmlNode * get_message_xml(xmlNode *msg, const char *field)
int(* new_data)(pcmk_ipc_api_t *api)
G_GNUC_INTERNAL pcmk__ipc_methods_t * pcmk__pacemakerd_api_methods(void)
struct pcmk_pacemakerd_api_reply_t::@4::@5 ping
#define XML_PING_ATTR_PACEMAKERDSTATE_INIT
#define XML_PING_ATTR_PACEMAKERDSTATE_WAITPING
void(* dispatch)(pcmk_ipc_api_t *api, xmlNode *msg)
#define XML_PING_ATTR_PACEMAKERDSTATE_STARTINGDAEMONS
enum crm_exit_e crm_exit_t
const char * pcmk_rc_str(int rc)
Get a user-friendly description of a return code.
int crm_element_value_ll(const xmlNode *data, const char *name, long long *dest)
Retrieve the long long integer value of an XML attribute.
G_GNUC_INTERNAL void pcmk__call_ipc_callback(pcmk_ipc_api_t *api, enum pcmk_ipc_event event_type, crm_exit_t status, void *event_data)
struct pacemakerd_api_private_s pacemakerd_api_private_t
enum pcmk_pacemakerd_api_reply reply_type
union pcmk_pacemakerd_api_reply_t::@4 data
#define XML_PING_ATTR_PACEMAKERDSTATE_SHUTDOWNCOMPLETE
#define crm_debug(fmt, args...)
#define XML_PING_ATTR_STATUS
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
enum pcmk_pacemakerd_state pcmk_pacemakerd_api_daemon_state_text2enum(const char *state)
Wrappers for and extensions to libxml2.
#define XML_PING_ATTR_PACEMAKERDSTATE_RUNNING
#define XML_PING_ATTR_PACEMAKERDSTATE_SHUTTINGDOWN
G_GNUC_INTERNAL int pcmk__send_ipc_request(pcmk_ipc_api_t *api, xmlNode *request)
IPC commands for Pacemakerd.
void free_xml(xmlNode *child)
int pcmk_pacemakerd_api_ping(pcmk_ipc_api_t *api, const char *ipc_name)
#define XML_PING_ATTR_SYSFROM
int(* post_connect)(pcmk_ipc_api_t *api)
bool(* reply_expected)(pcmk_ipc_api_t *api, xmlNode *request)
const char * pcmk_pacemakerd_api_daemon_state_enum2text(enum pcmk_pacemakerd_state state)
#define XML_ATTR_REFERENCE
#define XML_ATTR_RESPONSE
IPC interface to Pacemaker daemons.
void(* post_disconnect)(pcmk_ipc_api_t *api)
Daemon's reply to client IPC request.
#define create_request(task, xml_data, host_to, sys_to, sys_from, uuid_from)
#define XML_PING_ATTR_PACEMAKERDSTATE