} else if(strcmp(op, CRM_OP_JOIN_REQUEST) == 0) { next_input = I_JOIN_REQUEST;  } else if(strcmp(op, CRM_OP_JOIN_CONFIRM) == 0) { next_input = I_JOIN_RESULT;
handle_request(ha_msg_input_t *stored_msg){	HA_Message *msg = NULL;	enum crmd_fsa_input next_input = I_NULL;	const char *op        = cl_get_string(stored_msg->msg, F_CRM_TASK);	const char *sys_to    = cl_get_string(stored_msg->msg, F_CRM_SYS_TO);	const char *host_from = cl_get_string(stored_msg->msg, F_CRM_HOST_FROM);	crm_verbose("Received %s in state %s", op, fsa_state2string(fsa_state));		if(op == NULL) {		crm_err("Bad message");		crm_log_message(LOG_ERR, stored_msg->msg);		/*========== common actions ==========*/	} else if(strcmp(op, CRM_OP_NOOP) == 0) {		crm_debug("no-op from %s", crm_str(host_from));	} else if(strcmp(op, CRM_OP_VOTE) == 0) {		/* count the vote and decide what to do after that */		register_fsa_input_w_actions(			C_HA_MESSAGE, I_NULL, stored_msg, A_ELECTION_COUNT);		/* Sometimes we _must_ go into S_ELECTION */		if(fsa_state == S_HALT) {			crm_debug("Forcing an election from S_HALT");			next_input = I_ELECTION;#if 0		} else if(AM_I_DC) {		/* This is the old way of doing things but what is gained? */			next_input = I_ELECTION;#endif		}			} else if(strcmp(op, CRM_OP_LOCAL_SHUTDOWN) == 0) {				crm_shutdown(SIGTERM);		/*next_input = I_SHUTDOWN; */		next_input = I_NULL;				} else if(strcmp(op, CRM_OP_PING) == 0) {		/* eventually do some stuff to figure out		 * if we /are/ ok		 */		crm_data_t *ping = createPingAnswerFragment(sys_to, "ok");		set_xml_property_copy(ping, "crmd_state",				      fsa_state2string(fsa_state));				msg = create_reply(stored_msg->msg, ping);				if(relay_message(msg, TRUE) == FALSE) {			crm_msg_del(msg);		}				/* probably better to do this via signals on the		 * local node		 */	} else if(strcmp(op, CRM_OP_DEBUG_UP) == 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_DEBUG_DOWN) == 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_WELCOME) == 0) {		next_input = I_JOIN_OFFER;					} else if(strcmp(op, CRM_OP_JOINACK) == 0) {		next_input = I_JOIN_RESULT;		/* this functionality should only be enabled if this is a development build */	} else if(CRM_DEV_BUILD && strcmp(op, CRM_OP_DIE) == 0/*constant condition*/) {		crm_warn("Test-only code: Killing the CRM without mercy");		crm_warn("Inhibiting respawns");		exit(100);				/*========== (NOT_DC)-Only Actions ==========*/	} else if(AM_I_DC == FALSE){		gboolean dc_match = safe_str_eq(host_from, fsa_our_dc);		if(dc_match || fsa_our_dc == NULL) {			if(strcmp(op, CRM_OP_HBEAT) == 0) {				crm_devel("Received DC heartbeat from %s",					  host_from);				next_input = I_DC_HEARTBEAT;							} else if(fsa_our_dc == NULL) {				crm_warn("CRMd discarding request: %s"					" (DC: %s, from: %s)",					op, crm_str(fsa_our_dc), host_from);				crm_warn("Ignored Request");				crm_log_message(LOG_WARNING, stored_msg->msg);							} else if(strcmp(op, CRM_OP_SHUTDOWN) == 0) {				next_input = I_TERMINATE;							} else {				crm_err("CRMd didnt expect request: %s", op);				crm_log_message(LOG_ERR, stored_msg->msg);			}					} else {			crm_warn("Discarding %s op from %s", op, host_from);		}		/*========== DC-Only Actions ==========*/	} else if(AM_I_DC){		if(safe_str_eq(op, CRM_OP_TEABORT)) {			if(fsa_state == S_POLICY_ENGINE			   || fsa_state == S_TRANSITION_ENGINE			   || fsa_state == S_IDLE) {				next_input = I_PE_CALC;			} else {					crm_debug("Filtering %s op in state %s",					 op, fsa_state2string(fsa_state));			}						} else if(safe_str_eq(op, CRM_OP_TETIMEOUT)) {			if(fsa_state == S_TRANSITION_ENGINE			   || fsa_state == S_POLICY_ENGINE) {				next_input = I_PE_CALC;			} else if(fsa_state == S_IDLE) {				crm_err("Transition timed out in S_IDLE");				next_input = I_PE_CALC;							} else {					crm_err("Filtering %s op in state %s",					 op, fsa_state2string(fsa_state));			}		} else if(strcmp(op, CRM_OP_TECOMPLETE) == 0) { 			if(fsa_state == S_TRANSITION_ENGINE) {				next_input = I_TE_SUCCESS; 			} else {				crm_err("Filtering %s op in state %s",					 op, fsa_state2string(fsa_state));			}		} else if(strcmp(op, CRM_OP_ANNOUNCE) == 0) {			next_input = I_NODE_JOIN;					} else if(strcmp(op, CRM_OP_SHUTDOWN) == 0) {			gboolean dc_match = safe_str_eq(host_from, fsa_our_dc);			if(dc_match) {				crm_err("We didnt ask to be shut down yet our"					" TE is telling us too."					" Better get out now!");				next_input = I_TERMINATE;			} else if(is_set(fsa_input_register, R_SHUTDOWN)) {				crm_err("We asked to be shut down, "					" are still the DC, yet another node"					" is askin us to shutdown!");				next_input = I_TERMINATE;						} else if(fsa_state != S_STOPPING) {				crm_err("Another node is asking us to shutdown"					" but we think we're ok.");				next_input = I_ELECTION;						}					} else if(strcmp(op, CRM_OP_SHUTDOWN_REQ) == 0) {			/* a slave wants to shut down */			/* create cib fragment and add to message */			next_input = handle_shutdown_request(stored_msg->msg);					} else {			crm_err("Unexpected request (%s) sent to the DC", op);			crm_log_message(LOG_ERR, stored_msg->msg);		}			}	return next_input;}