api 110 include/crm/common/ipc.h typedef void (*pcmk_ipc_callback_t)(pcmk_ipc_api_t *api, api 115 include/crm/common/ipc.h int pcmk_new_ipc_api(pcmk_ipc_api_t **api, enum pcmk_ipc_server server); api 117 include/crm/common/ipc.h void pcmk_free_ipc_api(pcmk_ipc_api_t *api); api 119 include/crm/common/ipc.h int pcmk_connect_ipc(pcmk_ipc_api_t *api, enum pcmk_ipc_dispatch dispatch_type); api 121 include/crm/common/ipc.h void pcmk_disconnect_ipc(pcmk_ipc_api_t *api); api 123 include/crm/common/ipc.h int pcmk_poll_ipc(pcmk_ipc_api_t *api, int timeout_ms); api 125 include/crm/common/ipc.h void pcmk_dispatch_ipc(pcmk_ipc_api_t *api); api 127 include/crm/common/ipc.h void pcmk_register_ipc_callback(pcmk_ipc_api_t *api, pcmk_ipc_callback_t cb, api 130 include/crm/common/ipc.h const char *pcmk_ipc_name(pcmk_ipc_api_t *api, bool for_log); api 132 include/crm/common/ipc.h bool pcmk_ipc_is_connected(pcmk_ipc_api_t *api); api 134 include/crm/common/ipc.h int pcmk_ipc_purge_node(pcmk_ipc_api_t *api, const char *node_name, api 90 include/crm/common/ipc_controld.h int pcmk_controld_api_reprobe(pcmk_ipc_api_t *api, const char *target_node, api 92 include/crm/common/ipc_controld.h int pcmk_controld_api_node_info(pcmk_ipc_api_t *api, uint32_t nodeid); api 93 include/crm/common/ipc_controld.h int pcmk_controld_api_fail(pcmk_ipc_api_t *api, const char *target_node, api 97 include/crm/common/ipc_controld.h int pcmk_controld_api_refresh(pcmk_ipc_api_t *api, const char *target_node, api 102 include/crm/common/ipc_controld.h int pcmk_controld_api_ping(pcmk_ipc_api_t *api, const char *node_name); api 103 include/crm/common/ipc_controld.h int pcmk_controld_api_list_nodes(pcmk_ipc_api_t *api); api 104 include/crm/common/ipc_controld.h unsigned int pcmk_controld_api_replies_expected(pcmk_ipc_api_t *api); api 66 include/crm/common/ipc_pacemakerd.h int pcmk_pacemakerd_api_ping(pcmk_ipc_api_t *api, const char *ipc_name); api 67 include/crm/common/ipc_pacemakerd.h int pcmk_pacemakerd_api_shutdown(pcmk_ipc_api_t *api, const char *ipc_name); api 170 lib/common/crmcommon_private.h int (*new_data)(pcmk_ipc_api_t *api); api 194 lib/common/crmcommon_private.h int (*post_connect)(pcmk_ipc_api_t *api); api 205 lib/common/crmcommon_private.h bool (*reply_expected)(pcmk_ipc_api_t *api, xmlNode *request); api 214 lib/common/crmcommon_private.h void (*dispatch)(pcmk_ipc_api_t *api, xmlNode *msg); api 222 lib/common/crmcommon_private.h void (*post_disconnect)(pcmk_ipc_api_t *api); api 248 lib/common/crmcommon_private.h int pcmk__send_ipc_request(pcmk_ipc_api_t *api, xmlNode *request); api 251 lib/common/crmcommon_private.h void pcmk__call_ipc_callback(pcmk_ipc_api_t *api, api 47 lib/common/ipc_client.c pcmk_new_ipc_api(pcmk_ipc_api_t **api, enum pcmk_ipc_server server) api 49 lib/common/ipc_client.c if (api == NULL) { api 53 lib/common/ipc_client.c *api = calloc(1, sizeof(pcmk_ipc_api_t)); api 54 lib/common/ipc_client.c if (*api == NULL) { api 58 lib/common/ipc_client.c (*api)->server = server; api 59 lib/common/ipc_client.c if (pcmk_ipc_name(*api, false) == NULL) { api 60 lib/common/ipc_client.c pcmk_free_ipc_api(*api); api 61 lib/common/ipc_client.c *api = NULL; api 65 lib/common/ipc_client.c (*api)->ipc_size_max = 0; api 73 lib/common/ipc_client.c (*api)->ipc_size_max = 512 * 1024; // 512KB api 77 lib/common/ipc_client.c (*api)->cmds = pcmk__controld_api_methods(); api 87 lib/common/ipc_client.c (*api)->cmds = pcmk__pacemakerd_api_methods(); api 92 lib/common/ipc_client.c (*api)->ipc_size_max = 5 * 1024 * 1024; // 5MB api 95 lib/common/ipc_client.c if ((*api)->cmds == NULL) { api 96 lib/common/ipc_client.c pcmk_free_ipc_api(*api); api 97 lib/common/ipc_client.c *api = NULL; api 101 lib/common/ipc_client.c (*api)->ipc = crm_ipc_new(pcmk_ipc_name(*api, false), api 102 lib/common/ipc_client.c (*api)->ipc_size_max); api 103 lib/common/ipc_client.c if ((*api)->ipc == NULL) { api 104 lib/common/ipc_client.c pcmk_free_ipc_api(*api); api 105 lib/common/ipc_client.c *api = NULL; api 110 lib/common/ipc_client.c if ((*api)->cmds->new_data != NULL) { api 111 lib/common/ipc_client.c if ((*api)->cmds->new_data(*api) != pcmk_rc_ok) { api 112 lib/common/ipc_client.c pcmk_free_ipc_api(*api); api 113 lib/common/ipc_client.c *api = NULL; api 117 lib/common/ipc_client.c crm_trace("Created %s API IPC object", pcmk_ipc_name(*api, true)); api 122 lib/common/ipc_client.c free_daemon_specific_data(pcmk_ipc_api_t *api) api 124 lib/common/ipc_client.c if ((api != NULL) && (api->cmds != NULL)) { api 125 lib/common/ipc_client.c if ((api->cmds->free_data != NULL) && (api->api_data != NULL)) { api 126 lib/common/ipc_client.c api->cmds->free_data(api->api_data); api 127 lib/common/ipc_client.c api->api_data = NULL; api 129 lib/common/ipc_client.c free(api->cmds); api 130 lib/common/ipc_client.c api->cmds = NULL; api 144 lib/common/ipc_client.c pcmk__call_ipc_callback(pcmk_ipc_api_t *api, enum pcmk_ipc_event event_type, api 147 lib/common/ipc_client.c if ((api != NULL) && (api->cb != NULL)) { api 148 lib/common/ipc_client.c api->cb(api, event_type, status, event_data, api->user_data); api 163 lib/common/ipc_client.c pcmk_ipc_api_t *api = user_data; api 165 lib/common/ipc_client.c crm_info("Disconnected from %s IPC API", pcmk_ipc_name(api, true)); api 168 lib/common/ipc_client.c if ((api->cmds != NULL) && (api->cmds->post_disconnect != NULL)) { api 169 lib/common/ipc_client.c api->cmds->post_disconnect(api); api 173 lib/common/ipc_client.c pcmk__call_ipc_callback(api, pcmk_ipc_event_disconnect, CRM_EX_DISCONNECT, api 181 lib/common/ipc_client.c api->ipc = NULL; api 182 lib/common/ipc_client.c api->mainloop_io = NULL; api 184 lib/common/ipc_client.c if (api->free_on_disconnect) { api 188 lib/common/ipc_client.c free_daemon_specific_data(api); api 190 lib/common/ipc_client.c free(api); api 200 lib/common/ipc_client.c pcmk_free_ipc_api(pcmk_ipc_api_t *api) api 204 lib/common/ipc_client.c if (api == NULL) { api 207 lib/common/ipc_client.c crm_debug("Releasing %s IPC API", pcmk_ipc_name(api, true)); api 209 lib/common/ipc_client.c if (api->ipc != NULL) { api 210 lib/common/ipc_client.c if (api->mainloop_io != NULL) { api 220 lib/common/ipc_client.c free_on_disconnect = api->free_on_disconnect = true; api 222 lib/common/ipc_client.c pcmk_disconnect_ipc(api); // Frees api if free_on_disconnect is true api 225 lib/common/ipc_client.c free_daemon_specific_data(api); api 227 lib/common/ipc_client.c free(api); api 241 lib/common/ipc_client.c pcmk_ipc_name(pcmk_ipc_api_t *api, bool for_log) api 243 lib/common/ipc_client.c if (api == NULL) { api 246 lib/common/ipc_client.c switch (api->server) { api 281 lib/common/ipc_client.c pcmk_ipc_is_connected(pcmk_ipc_api_t *api) api 283 lib/common/ipc_client.c return (api != NULL) && crm_ipc_connected(api->ipc); api 297 lib/common/ipc_client.c call_api_dispatch(pcmk_ipc_api_t *api, xmlNode *message) api 300 lib/common/ipc_client.c if ((api->cmds != NULL) && (api->cmds->dispatch != NULL)) { api 301 lib/common/ipc_client.c api->cmds->dispatch(api, message); api 320 lib/common/ipc_client.c pcmk_ipc_api_t *api = user_data; api 323 lib/common/ipc_client.c CRM_CHECK(api != NULL, return 0); api 327 lib/common/ipc_client.c pcmk_ipc_name(api, true)); api 334 lib/common/ipc_client.c pcmk_ipc_name(api, true)); api 337 lib/common/ipc_client.c call_api_dispatch(api, msg); api 361 lib/common/ipc_client.c pcmk_poll_ipc(pcmk_ipc_api_t *api, int timeout_ms) api 366 lib/common/ipc_client.c if ((api == NULL) || (api->dispatch_type != pcmk_ipc_dispatch_poll)) { api 369 lib/common/ipc_client.c pollfd.fd = crm_ipc_get_fd(api->ipc); api 391 lib/common/ipc_client.c pcmk_dispatch_ipc(pcmk_ipc_api_t *api) api 393 lib/common/ipc_client.c if (api == NULL) { api 396 lib/common/ipc_client.c while (crm_ipc_ready(api->ipc) > 0) { api 397 lib/common/ipc_client.c if (crm_ipc_read(api->ipc) > 0) { api 398 lib/common/ipc_client.c dispatch_ipc_data(crm_ipc_buffer(api->ipc), 0, api); api 405 lib/common/ipc_client.c connect_with_main_loop(pcmk_ipc_api_t *api) api 414 lib/common/ipc_client.c rc = pcmk__add_mainloop_ipc(api->ipc, G_PRIORITY_DEFAULT, api, api 415 lib/common/ipc_client.c &callbacks, &(api->mainloop_io)); api 420 lib/common/ipc_client.c pcmk_ipc_name(api, true)); api 429 lib/common/ipc_client.c connect_without_main_loop(pcmk_ipc_api_t *api) api 433 lib/common/ipc_client.c if (!crm_ipc_connect(api->ipc)) { api 435 lib/common/ipc_client.c crm_ipc_close(api->ipc); api 439 lib/common/ipc_client.c pcmk_ipc_name(api, true)); api 452 lib/common/ipc_client.c pcmk_connect_ipc(pcmk_ipc_api_t *api, enum pcmk_ipc_dispatch dispatch_type) api 456 lib/common/ipc_client.c if (api == NULL) { api 461 lib/common/ipc_client.c if (api->ipc == NULL) { api 462 lib/common/ipc_client.c api->ipc = crm_ipc_new(pcmk_ipc_name(api, false), api 463 lib/common/ipc_client.c api->ipc_size_max); api 464 lib/common/ipc_client.c if (api->ipc == NULL) { api 470 lib/common/ipc_client.c if (crm_ipc_connected(api->ipc)) { api 471 lib/common/ipc_client.c crm_trace("Already connected to %s IPC API", pcmk_ipc_name(api, true)); api 475 lib/common/ipc_client.c api->dispatch_type = dispatch_type; api 478 lib/common/ipc_client.c rc = connect_with_main_loop(api); api 483 lib/common/ipc_client.c rc = connect_without_main_loop(api); api 490 lib/common/ipc_client.c if ((api->cmds != NULL) && (api->cmds->post_connect != NULL)) { api 491 lib/common/ipc_client.c rc = api->cmds->post_connect(api); api 493 lib/common/ipc_client.c crm_ipc_close(api->ipc); api 511 lib/common/ipc_client.c pcmk_disconnect_ipc(pcmk_ipc_api_t *api) api 513 lib/common/ipc_client.c if ((api == NULL) || (api->ipc == NULL)) { api 516 lib/common/ipc_client.c switch (api->dispatch_type) { api 519 lib/common/ipc_client.c mainloop_io_t *mainloop_io = api->mainloop_io; api 522 lib/common/ipc_client.c api->mainloop_io = NULL; api 523 lib/common/ipc_client.c api->ipc = NULL; api 533 lib/common/ipc_client.c crm_ipc_t *ipc = api->ipc; api 536 lib/common/ipc_client.c api->ipc = NULL; api 539 lib/common/ipc_client.c api->free_on_disconnect = false; api 542 lib/common/ipc_client.c ipc_post_disconnect(api); api 561 lib/common/ipc_client.c pcmk_register_ipc_callback(pcmk_ipc_api_t *api, pcmk_ipc_callback_t cb, api 564 lib/common/ipc_client.c if (api == NULL) { api 567 lib/common/ipc_client.c api->cb = cb; api 568 lib/common/ipc_client.c api->user_data = user_data; api 584 lib/common/ipc_client.c pcmk__send_ipc_request(pcmk_ipc_api_t *api, xmlNode *request) api 590 lib/common/ipc_client.c if ((api == NULL) || (api->ipc == NULL) || (request == NULL)) { api 596 lib/common/ipc_client.c if ((api->dispatch_type == pcmk_ipc_dispatch_sync) api 597 lib/common/ipc_client.c && (api->cmds != NULL) api 598 lib/common/ipc_client.c && (api->cmds->reply_expected != NULL) api 599 lib/common/ipc_client.c && (api->cmds->reply_expected(api, request))) { api 604 lib/common/ipc_client.c rc = crm_ipc_send(api->ipc, request, flags, 0, &reply); api 614 lib/common/ipc_client.c call_api_dispatch(api, reply); api 643 lib/common/ipc_client.c create_purge_node_request(pcmk_ipc_api_t *api, const char *node_name, api 649 lib/common/ipc_client.c switch (api->server) { api 665 lib/common/ipc_client.c pcmk_ipc_name(api, false), client, NULL); api 692 lib/common/ipc_client.c pcmk_ipc_purge_node(pcmk_ipc_api_t *api, const char *node_name, uint32_t nodeid) api 697 lib/common/ipc_client.c if (api == NULL) { api 704 lib/common/ipc_client.c request = create_purge_node_request(api, node_name, nodeid); api 708 lib/common/ipc_client.c rc = pcmk__send_ipc_request(api, request); api 712 lib/common/ipc_client.c pcmk_ipc_name(api, true), node_name, (unsigned long) nodeid, rc); api 32 lib/common/ipc_controld.c new_data(pcmk_ipc_api_t *api) api 36 lib/common/ipc_controld.c api->api_data = calloc(1, sizeof(struct controld_api_private_s)); api 38 lib/common/ipc_controld.c if (api->api_data == NULL) { api 42 lib/common/ipc_controld.c private = api->api_data; api 68 lib/common/ipc_controld.c post_connect(pcmk_ipc_api_t *api) api 73 lib/common/ipc_controld.c struct controld_api_private_s *private = api->api_data; api 81 lib/common/ipc_controld.c rc = pcmk__send_ipc_request(api, hello); api 85 lib/common/ipc_controld.c pcmk_ipc_name(api, true), pcmk_rc_str(rc), rc); api 87 lib/common/ipc_controld.c crm_debug("Sent IPC hello to %s", pcmk_ipc_name(api, true)); api 146 lib/common/ipc_controld.c reply_expected(pcmk_ipc_api_t *api, xmlNode *request) api 163 lib/common/ipc_controld.c dispatch(pcmk_ipc_api_t *api, xmlNode *reply) api 165 lib/common/ipc_controld.c struct controld_api_private_s *private = api->api_data; api 235 lib/common/ipc_controld.c pcmk__call_ipc_callback(api, pcmk_ipc_event_reply, status, &reply_data); api 270 lib/common/ipc_controld.c create_controller_request(pcmk_ipc_api_t *api, const char *op, api 276 lib/common/ipc_controld.c if (api == NULL) { api 279 lib/common/ipc_controld.c private = api->api_data; api 292 lib/common/ipc_controld.c send_controller_request(pcmk_ipc_api_t *api, xmlNode *request, api 300 lib/common/ipc_controld.c rc = pcmk__send_ipc_request(api, request); api 302 lib/common/ipc_controld.c struct controld_api_private_s *private = api->api_data; api 333 lib/common/ipc_controld.c pcmk_controld_api_reprobe(pcmk_ipc_api_t *api, const char *target_node, api 340 lib/common/ipc_controld.c if (api == NULL) { api 347 lib/common/ipc_controld.c pcmk_ipc_name(api, true), crm_str(target_node), api 350 lib/common/ipc_controld.c request = create_controller_request(api, CRM_OP_REPROBE, router_node, api 352 lib/common/ipc_controld.c rc = send_controller_request(api, request, true); api 368 lib/common/ipc_controld.c pcmk_controld_api_node_info(pcmk_ipc_api_t *api, uint32_t nodeid) api 373 lib/common/ipc_controld.c request = create_controller_request(api, CRM_OP_NODE_INFO, NULL, NULL); api 381 lib/common/ipc_controld.c rc = send_controller_request(api, request, true); api 396 lib/common/ipc_controld.c pcmk_controld_api_ping(pcmk_ipc_api_t *api, const char *node_name) api 401 lib/common/ipc_controld.c request = create_controller_request(api, CRM_OP_PING, node_name, NULL); api 405 lib/common/ipc_controld.c rc = send_controller_request(api, request, true); api 419 lib/common/ipc_controld.c pcmk_controld_api_list_nodes(pcmk_ipc_api_t *api) api 424 lib/common/ipc_controld.c request = create_controller_request(api, PCMK__CONTROLD_CMD_NODES, NULL, api 427 lib/common/ipc_controld.c rc = send_controller_request(api, request, true); api 435 lib/common/ipc_controld.c controller_resource_op(pcmk_ipc_api_t *api, const char *op, api 445 lib/common/ipc_controld.c if (api == NULL) { api 488 lib/common/ipc_controld.c request = create_controller_request(api, op, router_node, msg_data); api 489 lib/common/ipc_controld.c rc = send_controller_request(api, request, true); api 511 lib/common/ipc_controld.c pcmk_controld_api_fail(pcmk_ipc_api_t *api, api 518 lib/common/ipc_controld.c pcmk_ipc_name(api, true), crm_str(rsc_id), crm_str(rsc_long_id), api 520 lib/common/ipc_controld.c return controller_resource_op(api, CRM_OP_LRM_FAIL, target_node, api 542 lib/common/ipc_controld.c pcmk_controld_api_refresh(pcmk_ipc_api_t *api, const char *target_node, api 549 lib/common/ipc_controld.c pcmk_ipc_name(api, true), crm_str(rsc_id), crm_str(rsc_long_id), api 551 lib/common/ipc_controld.c return controller_resource_op(api, CRM_OP_LRM_DELETE, target_node, api 564 lib/common/ipc_controld.c pcmk_controld_api_replies_expected(pcmk_ipc_api_t *api) api 566 lib/common/ipc_controld.c struct controld_api_private_s *private = api->api_data; api 67 lib/common/ipc_pacemakerd.c new_data(pcmk_ipc_api_t *api) api 71 lib/common/ipc_pacemakerd.c api->api_data = calloc(1, sizeof(struct pacemakerd_api_private_s)); api 73 lib/common/ipc_pacemakerd.c if (api->api_data == NULL) { api 77 lib/common/ipc_pacemakerd.c private = api->api_data; api 96 lib/common/ipc_pacemakerd.c post_connect(pcmk_ipc_api_t *api) api 100 lib/common/ipc_pacemakerd.c if (api->api_data == NULL) { api 103 lib/common/ipc_pacemakerd.c private = api->api_data; api 110 lib/common/ipc_pacemakerd.c post_disconnect(pcmk_ipc_api_t *api) api 114 lib/common/ipc_pacemakerd.c if (api->api_data == NULL) { api 117 lib/common/ipc_pacemakerd.c private = api->api_data; api 124 lib/common/ipc_pacemakerd.c reply_expected(pcmk_ipc_api_t *api, xmlNode *request) api 137 lib/common/ipc_pacemakerd.c dispatch(pcmk_ipc_api_t *api, xmlNode *reply) api 192 lib/common/ipc_pacemakerd.c pcmk__call_ipc_callback(api, pcmk_ipc_event_reply, status, &reply_data); api 212 lib/common/ipc_pacemakerd.c do_pacemakerd_api_call(pcmk_ipc_api_t *api, const char *ipc_name, const char *task) api 218 lib/common/ipc_pacemakerd.c CRM_CHECK(api != NULL, return -EINVAL); api 219 lib/common/ipc_pacemakerd.c private = api->api_data; api 227 lib/common/ipc_pacemakerd.c rc = pcmk__send_ipc_request(api, cmd); api 242 lib/common/ipc_pacemakerd.c pcmk_pacemakerd_api_ping(pcmk_ipc_api_t *api, const char *ipc_name) api 244 lib/common/ipc_pacemakerd.c return do_pacemakerd_api_call(api, ipc_name, CRM_OP_PING); api 248 lib/common/ipc_pacemakerd.c pcmk_pacemakerd_api_shutdown(pcmk_ipc_api_t *api, const char *ipc_name) api 250 lib/common/ipc_pacemakerd.c return do_pacemakerd_api_call(api, ipc_name, CRM_OP_QUIT); api 82 lib/pacemaker/pcmk_cluster_queries.c event_done(data_t *data, pcmk_ipc_api_t *api) api 84 lib/pacemaker/pcmk_cluster_queries.c pcmk_disconnect_ipc(api); api 244 lib/pacemaker/pcmk_cluster_queries.c pcmk_ipc_api_t *api = NULL; api 247 lib/pacemaker/pcmk_cluster_queries.c rc = pcmk_new_ipc_api(&api, server); api 248 lib/pacemaker/pcmk_cluster_queries.c if (api == NULL) { api 250 lib/pacemaker/pcmk_cluster_queries.c pcmk_ipc_name(api, true), api 256 lib/pacemaker/pcmk_cluster_queries.c pcmk_register_ipc_callback(api, cb, data); api 258 lib/pacemaker/pcmk_cluster_queries.c rc = pcmk_connect_ipc(api, pcmk_ipc_dispatch_main); api 261 lib/pacemaker/pcmk_cluster_queries.c pcmk_ipc_name(api, true), api 267 lib/pacemaker/pcmk_cluster_queries.c return api; api 257 tools/crm_resource.c controller_event_callback(pcmk_ipc_api_t *api, enum pcmk_ipc_event event_type, api 272 tools/crm_resource.c pcmk_disconnect_ipc(api); api 275 tools/crm_resource.c if ((pcmk_controld_api_replies_expected(api) == 0) api 279 tools/crm_resource.c pcmk_disconnect_ipc(api);