stored_msg, NULL, XML_ATTR_HOSTFROM,  TRUE);
stored_msg, NULL, XML_ATTR_HOSTFROM,  FALSE);
handle_message(xmlNodePtr stored_msg){	enum crmd_fsa_input next_input = I_NULL;	const char *sys_to   = get_xml_attr(		stored_msg, NULL, XML_ATTR_SYSTO,     TRUE);	const char *sys_from = get_xml_attr(		stored_msg, NULL, XML_ATTR_SYSFROM,   TRUE);	const char *host_from= get_xml_attr(		stored_msg, NULL, XML_ATTR_HOSTFROM,  TRUE);	const char *msg_ref  = get_xml_attr(		stored_msg, NULL, XML_ATTR_REFERENCE, TRUE);	const char *type     = get_xml_attr(		stored_msg, NULL, XML_ATTR_MSGTYPE,   TRUE);		const char *op       = get_xml_attr(		stored_msg, XML_TAG_OPTIONS, XML_ATTR_OP, TRUE);//	xml_message_debug(stored_msg, "Processing message");	crm_debug("Received %s %s in state %s",		  op, type, fsa_state2string(fsa_state));		if(type == NULL || op == NULL) {		crm_err("Ignoring message (type=%s), (op=%s)",		       type, op);		xml_message_debug(stored_msg, "Bad message");			} else if(strcmp(type, XML_ATTR_REQUEST) == 0){		if(strcmp(op, CRM_OP_HBEAT) == 0) {			next_input = I_DC_HEARTBEAT;		} else if(strcmp(op, CRM_OP_VOTE) == 0) {			next_input = I_ELECTION;						} else if(AM_I_DC && strcmp(op, CRM_OP_TEABORT) == 0) {			next_input = I_PE_CALC;						} else if(AM_I_DC			  && strcmp(op, CRM_OP_TECOMPLETE) == 0) {			if(fsa_state == S_TRANSITION_ENGINE) {				next_input = I_SUCCESS;/* silently ignore? probably means the TE is signaling OK too early			} else {				crm_warn(				       "Op %s is only valid in state %s (%s)",				       op,				       fsa_state2string(S_TRANSITION_ENGINE),				       fsa_state2string(fsa_state));*/			}							} else if(strcmp(op, CRM_OP_WELCOME) == 0) {			next_input = I_WELCOME;						} else if(strcmp(op, "init_shutdown") == 0) {			next_input = I_SHUTDOWN;						} else if(strcmp(op, CRM_OP_SHUTDOWN_REQ) == 0) {			/* create cib fragment and add to message */			/* handle here to avoid potential version issues			 *   where the shutdown message/proceedure may have			 *   been changed in later versions.			 *			 * This way the DC is always in control of the shutdown			 */			xmlNodePtr frag = NULL;			time_t now = time(NULL);			char *now_s = crm_itoa((int)now);			xmlNodePtr node_state =				create_xml_node(NULL, XML_CIB_TAG_STATE);			crm_info("Creating shutdown request for %s",			       host_from);						set_xml_property_copy(				node_state, XML_ATTR_ID, host_from);			set_xml_property_copy(				node_state, XML_CIB_ATTR_SHUTDOWN,  now_s);			set_xml_property_copy(				node_state,				XML_CIB_ATTR_EXPSTATE,				CRMD_STATE_INACTIVE);			frag = create_cib_fragment(node_state, NULL);			xmlAddChild(stored_msg, frag);			free_xml(node_state);			crm_free(now_s);						next_input = I_CIB_OP;						} else if(strcmp(op, CRM_OP_SHUTDOWN) == 0) {			next_input = I_TERMINATE;					} else if(strcmp(op, "debug_inc") == 0) {			int level = get_crm_log_level();			set_crm_log_level(level+1);			crm_info("Debug set to %d (was %d)",				 get_crm_log_level(), level);		} else if(strcmp(op, "debug_dec") == 0) {			int level = get_crm_log_level();			set_crm_log_level(level-1);			crm_info("Debug set to %d (was %d)",				 get_crm_log_level(), level);					} else if(strcmp(op, CRM_OP_ANNOUNCE) == 0) {			next_input = I_NODE_JOIN;					} else if(strcmp(op, CRM_OP_REPLACE) == 0			|| strcmp(op, CRM_OP_QUERY) == 0			|| strcmp(op, CRM_OP_ERASE) == 0) {			next_input = I_CIB_OP;			fprintf(router_strm, "Message result: CIB Op\n");		} else if(AM_I_DC			  && (strcmp(op, CRM_OP_CREATE) == 0			      || strcmp(op, CRM_OP_UPDATE) == 0			      || strcmp(op, CRM_OP_DELETE) == 0)) {			/* updates should only be performed on the DC */			next_input = I_CIB_OP;						} else if(strcmp(op, CRM_OP_PING) == 0) {			/* eventually do some stuff to figure out			 * if we /are/ ok			 */			xmlNodePtr ping =				createPingAnswerFragment(sys_to, "ok");			set_xml_property_copy(ping, "crmd_state",					      fsa_state2string(fsa_state));			xmlNodePtr wrapper = create_reply(stored_msg, ping);			relay_message(wrapper, TRUE);			free_xml(wrapper);						} else {			crm_err("Unexpected request (op=%s) sent to the %s",				op, AM_I_DC?"DC":"CRMd");		}			} else if(strcmp(type, XML_ATTR_RESPONSE) == 0) {		if(strcmp(op, CRM_OP_WELCOME) == 0) {			next_input = I_WELCOME_ACK;						} else if(AM_I_DC			  && strcmp(op, CRM_OP_PECALC) == 0) {			if(fsa_state == S_POLICY_ENGINE			   && safe_str_eq(msg_ref, fsa_pe_ref)) {				next_input = I_SUCCESS;			} else if(fsa_state != S_POLICY_ENGINE) {				crm_err("Reply to %s is only valid in state %s",					op, fsa_state2string(S_POLICY_ENGINE));							} else {				crm_verbose("Skipping superceeded reply from %s",					  sys_from);			}					} else if(strcmp(op, CRM_OP_VOTE) == 0			  || strcmp(op, CRM_OP_HBEAT) == 0			  || strcmp(op, CRM_OP_WELCOME) == 0			  || strcmp(op, CRM_OP_SHUTDOWN_REQ) == 0			  || strcmp(op, CRM_OP_SHUTDOWN) == 0			  || strcmp(op, CRM_OP_ANNOUNCE) == 0) {			next_input = I_NULL;					} else if(strcmp(op, CRM_OP_CREATE) == 0			  || strcmp(op, CRM_OP_UPDATE) == 0			  || strcmp(op, CRM_OP_DELETE) == 0			  || strcmp(op, CRM_OP_REPLACE) == 0			  || strcmp(op, CRM_OP_ERASE) == 0) {						/* perhaps we should do somethign with these replies,			 * especially check that the actions passed			 *//* 			fprintf(router_strm, "Message result: CIB Reply\n"); */		} else {			crm_err("Unexpected response (op=%s) sent to the %s",				op, AM_I_DC?"DC":"CRMd");			next_input = I_NULL;		}	} else {		crm_err("Unexpected message type %s", type);				}/* 	crm_verbose("%s: Next input is %s", __FUNCTION__, *//* 		   fsa_input2string(next_input)); */				return next_input;		}