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;
147 if (pcmk__str_eq((
const char *) reply->name,
"ack",
pcmk__str_casei)) {
148 long long int ack_status = 0;
155 crm_debug(
"Unrecognizable pacemakerd message: invalid message type '%s'",
162 crm_debug(
"Unrecognizable pacemakerd message: no reference");
181 reply_data.
data.
ping.last_good = (time_t) value_ll;
215 do_pacemakerd_api_call(
pcmk_ipc_api_t *api,
const char *ipc_name,
const char *task)
229 pcmk__ipc_sys_name(ipc_name,
"client"),
230 private->client_uuid);
235 crm_debug(
"Couldn't send request to pacemakerd: %s rc=%d",
249 return do_pacemakerd_api_call(api, ipc_name,
CRM_OP_PING);
255 return do_pacemakerd_api_call(api, ipc_name,
CRM_OP_QUIT);
xmlNode * get_message_xml(xmlNode *msg, const char *field)
int pcmk_pacemakerd_api_ping(pcmk_ipc_api_t *api, const char *ipc_name)
Could not determine status.
struct pcmk_pacemakerd_api_reply_t::@4::@5 ping
#define XML_PING_ATTR_PACEMAKERDSTATE_INIT
#define XML_PING_ATTR_PACEMAKERDSTATE_WAITPING
#define XML_PING_ATTR_PACEMAKERDSTATE_STARTINGDAEMONS
enum crm_exit_e crm_exit_t
struct pcmk_pacemakerd_api_reply_t::@4::@6 shutdown
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
int pcmk__scan_ll(const char *text, long long *result, long long default_value)
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.
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(* post_connect)(pcmk_ipc_api_t *api)
bool pcmk__str_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
#define XML_PING_ATTR_SYSFROM
pcmk__ipc_methods_t * pcmk__pacemakerd_api_methods()
int(* new_data)(pcmk_ipc_api_t *api)
int pcmk_pacemakerd_api_shutdown(pcmk_ipc_api_t *api, const char *ipc_name)
enum pcmk_pacemakerd_state pcmk_pacemakerd_api_daemon_state_text2enum(const char *state)
const char * pcmk_pacemakerd_api_daemon_state_enum2text(enum pcmk_pacemakerd_state state)
bool(* dispatch)(pcmk_ipc_api_t *api, xmlNode *msg)
#define XML_ATTR_REFERENCE
void(* free_data)(void *api_data)
#define XML_ATTR_RESPONSE
#define XML_LRM_ATTR_OPSTATUS
bool(* reply_expected)(pcmk_ipc_api_t *api, xmlNode *request)
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