print_xml_formatted(xml_relay_message, "Bad message type, should be crm_message"); crm_err("Ignoring message of type %s", xml_relay_message->name);
crm_xml_err(xml_relay_message, "Bad message type, should be crm_message");
relay_message(xmlNodePtr xml_relay_message, gboolean originated_locally){	int is_for_dc	= 0;	int is_for_dcib	= 0;	int is_for_crm	= 0;	int is_for_cib	= 0;	int is_local    = 0;	gboolean dont_cc= TRUE;	gboolean processing_complete = FALSE;	const char *host_to = xmlGetProp(xml_relay_message,XML_ATTR_HOSTTO);	const char *sys_to  = xmlGetProp(xml_relay_message,XML_ATTR_SYSTO);	crm_debug("Routing message %s",		xmlGetProp(xml_relay_message,XML_ATTR_REFERENCE));		if(xml_relay_message == NULL) {		crm_err("Cannot route empty message");		return TRUE;	}	if(strcmp(CRM_OP_HELLO, xml_relay_message->name) == 0) {		/* quietly ignore */		return TRUE;	}	if(strcmp(XML_MSG_TAG, xml_relay_message->name) != 0) {		print_xml_formatted(xml_relay_message,				  "Bad message type, should be crm_message");		crm_err("Ignoring message of type %s",		       xml_relay_message->name);		return TRUE;	}		if(sys_to == NULL) {		print_xml_formatted(xml_relay_message,				  "Message did not have any value for sys_to");		crm_err("Message did not have any value for %s",		       XML_ATTR_SYSTO);		return TRUE;	}		is_for_dc   = (strcmp(CRM_SYSTEM_DC,   sys_to) == 0);	is_for_dcib = (strcmp(CRM_SYSTEM_DCIB, sys_to) == 0);	is_for_cib  = (strcmp(CRM_SYSTEM_CIB,  sys_to) == 0);	is_for_crm  = (strcmp(CRM_SYSTEM_CRMD, sys_to) == 0);		is_local = 0;	if(host_to == NULL || strlen(host_to) == 0) {		if(is_for_dc)			is_local = 0;		else if(is_for_crm && originated_locally)			is_local = 0;		else			is_local = 1;			} else if(strcmp(fsa_our_uname, host_to) == 0) {		is_local=1;	}	crm_trace("is_local    %d", is_local);	crm_trace("is_for_dcib %d", is_for_dcib);	crm_trace("is_for_dc   %d", is_for_dc);	crm_trace("is_for_crm  %d", is_for_crm);	crm_trace("AM_I_DC     %d", AM_I_DC);	crm_trace("sys_to      %s", sys_to);	crm_trace("host_to     %s", host_to);		if(is_for_dc || is_for_dcib) {		if(AM_I_DC) {			ROUTER_RESULT("Message result: DC/CRMd process");			processing_complete = FALSE; /* more to be done by caller */		} else if(originated_locally) {			ROUTER_RESULT("Message result: External relay to DC");			send_msg_via_ha(xml_relay_message, NULL);			processing_complete = TRUE; 		} else {			ROUTER_RESULT("Message result: Discard, not DC");			processing_complete = TRUE; /* discard */		}			} else if(is_local && (is_for_crm || is_for_cib)) {		ROUTER_RESULT("Message result: CRMd process");		processing_complete = FALSE; /* more to be done by caller */	} else if(is_local) {		if(dont_cc) {			ROUTER_RESULT("Message result: Local relay");		} else {			/* The DC should also get this message */			ROUTER_RESULT("Message result: Local relay with CC");		}		send_msg_via_ipc(xml_relay_message, sys_to);		processing_complete = TRUE & dont_cc;			} else {		if(dont_cc) {			ROUTER_RESULT("Message result: External relay");		} else {			/* The DC should also get this message */			ROUTER_RESULT("Message result: External relay with CC");		}		send_msg_via_ha(xml_relay_message, host_to);		processing_complete = TRUE & dont_cc;	}		return processing_complete;}