if (type == NULL) { cl_log(LOG_ERR, "Cannot create forward, no message type in original message"); FNRET(NULL); } else if (strcmp(XML_MSG_TAG_REQUEST, type) != 0) { cl_log(LOG_ERR, "Cannot create forward, original message was not a request"); FNRET(NULL); }
set_xml_property_copy(forward, XML_ATTR_MSGTYPE, XML_ATTR_REQUEST);   if(host_to != NULL) set_xml_property_copy(forward, XML_ATTR_HOSTTO,   host_to); if(host_from != NULL) set_xml_property_copy(forward, XML_ATTR_HOSTFROM, host_from);  set_xml_property_copy(forward, XML_ATTR_SYSTO,    sys_to); set_xml_property_copy(forward, XML_ATTR_SYSFROM,  sys_from);
create_forward(xmlNodePtr original_request,	       xmlNodePtr xml_response_data,	       const char *sys_to){	const char *message_type = XML_MSG_TAG_REQUEST;	const char *crm_msg_reference = NULL;	const char *host_from = NULL;	const char *host_to   = NULL;	const char *sys_from  = NULL;	const char *type      = NULL;		FNIN();	crm_msg_reference = xmlGetProp(original_request,				       XML_MSG_ATTR_REFERENCE);	host_from = xmlGetProp(original_request, XML_MSG_ATTR_HOSTFROM);	host_to   = xmlGetProp(original_request, XML_MSG_ATTR_HOSTTO);	sys_from  = xmlGetProp(original_request, XML_MSG_ATTR_SYSFROM);	type      = xmlGetProp(original_request, XML_MSG_ATTR_MSGTYPE);		if (type == NULL)	{		cl_log(LOG_ERR,		       "Cannot create forward, no message type in original message");		FNRET(NULL);	}	else if (strcmp(XML_MSG_TAG_REQUEST, type) != 0)	{		cl_log(LOG_ERR,		       "Cannot create forward, original message was not a request");		FNRET(NULL);	}#if 0	CRM_DEBUG("creating forward from...");	CRM_DEBUG2("\t%s", crm_msg_reference);	CRM_DEBUG2("\t%s", host_from);	CRM_DEBUG2("\t%s", host_to);	CRM_DEBUG2("\t%s", sys_from);	CRM_DEBUG2("\t%s", sys_to);	CRM_DEBUG2("\t%s", type);#endif	xmlNodePtr forward = create_xml_node(NULL, XML_MSG_TAG);	// the root_xml_node node	set_xml_property_copy(forward,			      XML_ATTR_VERSION,			      CRM_VERSION);	set_xml_property_copy(forward,			      XML_MSG_ATTR_MSGTYPE,			      message_type);	set_node_tstamp(forward);    	// HOSTTO will be ignored if it is to the DC anyway.	set_xml_property_copy(forward,			      XML_MSG_ATTR_HOSTTO,			      host_to);	set_xml_property_copy(forward,			      XML_MSG_ATTR_HOSTFROM,			      host_from);	set_xml_property_copy(forward,			      XML_MSG_ATTR_SYSTO,			      sys_to);	set_xml_property_copy(forward,			      XML_MSG_ATTR_SYSFROM,			      sys_from);	set_xml_property_copy(forward,			      XML_MSG_ATTR_REFERENCE,			      crm_msg_reference);    	// create a place holder for the eventual data	xmlNodePtr xml_node = create_xml_node(forward, message_type);	CRM_DEBUG("Created forward wrapper...");	xml_message_debug(forward);    	if (xml_response_data != NULL) {		add_node_copy(xml_node, xml_response_data);	}    	FNRET(forward);}