MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / node_mcp_dispatch

Function node_mcp_dispatch

tools/crm_node.c:564–595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

562# include <corosync/quorum.h>
563# include <corosync/cpg.h>
564static int
565node_mcp_dispatch(const char *buffer, ssize_t length, gpointer userdata)
566{
567 xmlNode *msg = string2xml(buffer);
568
569 if (msg) {
570 xmlNode *node = NULL;
571
572 crm_log_xml_trace(msg, "message");
573
574 for (node = __xml_first_child(msg); node != NULL; node = __xml_next(node)) {
575 const char *uname = crm_element_value(node, "uname");
576 if (command == 'l') {
577 int id = 0;
578 crm_element_value_int(node, "id", &id);
579 fprintf(stdout, "%u %s\n", id, uname);
580
581 } else if (command == 'p') {
582 fprintf(stdout, "%s ", uname);
583 }
584 }
585 free_xml(msg);
586
587 if (command == 'p') {
588 fprintf(stdout, "\n");
589 }
590
591 crm_exit(0);
592 }
593
594 return 0;
595}
596
597static void
598node_mcp_destroy(gpointer user_data)

Callers

nothing calls this directly

Calls 7

string2xmlFunction · 0.85
__xml_first_childFunction · 0.85
__xml_nextFunction · 0.85
crm_element_valueFunction · 0.85
crm_element_value_intFunction · 0.85
free_xmlFunction · 0.85
crm_exitFunction · 0.85

Tested by

no test coverage detected