CRM_DEV_ASSERT(hb_conn->llc_ops->sendclustermsg( hb_conn, op_request) == HA_OK);  
send_ha_message(hb_conn, op_request, NULL);  
cib_common_callback(	IPC_Channel *channel, gpointer user_data, gboolean privileged){	int rc = cib_ok;	int lpc = 0;	int call_type = 0;	int call_options = 0;	const char *op = NULL;	const char *host = NULL;		HA_Message *op_request = NULL;	HA_Message *op_reply   = NULL;	gboolean needs_processing = FALSE;	cib_client_t *cib_client = user_data;	if(cib_client == NULL) {		crm_err("Receieved call from unknown source. Discarding.");		return FALSE;	}		crm_verbose("Callback for %s on %s channel",		    cib_client->id, cib_client->channel_name);	while(channel->ops->is_message_pending(channel)) {		if (channel->ch_status == IPC_DISCONNECT) {			/* The message which was pending for us is that			 * the IPC status is now IPC_DISCONNECT */			break;		}		op_request = msgfromIPC(channel);		if (op_request == NULL) {			perror("Receive failure:");			break;		}		crm_verbose("Processing IPC message from %s on %s channel",			    cib_client->id, cib_client->channel_name); 		crm_log_message(LOG_MSG, op_request);		crm_log_message_adv(LOG_DEV, "cib.client-in.log", op_request);				lpc++;		rc = cib_ok;				if(HA_OK != ha_msg_add(			   op_request, F_CIB_CLIENTID, cib_client->id)) {			crm_err("Couldnt add F_CIB_CLIENTID to message");			rc = cib_msg_field_add;		}		if(rc == cib_ok) {			ha_msg_value_int(				op_request, F_CIB_CALLOPTS, &call_options);			crm_devel("Call options: %.8lx", (long)call_options);						host = cl_get_string(op_request, F_CIB_HOST);			op = cl_get_string(op_request, F_CIB_OPERATION);			rc = cib_get_operation_id(op_request, &call_type);		}				if(rc == cib_ok		   && cib_server_ops[call_type].needs_privileges		   && privileged == FALSE) {			rc = cib_not_authorized;		}		needs_processing = FALSE;		if(rc != cib_ok) {			/* TODO: construct error reply */			crm_err("Pre-processing of command failed: %s",				cib_error2string(rc));					} else if(host == NULL && cib_is_master			&& !(call_options & cib_scope_local)) { 			crm_devel("Processing master %s op locally", op);			needs_processing = TRUE;		} else if(			(host == NULL && (call_options & cib_scope_local))			  || safe_str_eq(host, cib_our_uname)) { 			crm_devel("Processing %s op locally", op);			needs_processing = TRUE;		} else {			/* send via HA to other nodes */			ha_msg_add(op_request, F_CIB_DELEGATED, cib_our_uname);			crm_log_message(LOG_MSG, op_request);			if(host != NULL) {				crm_devel("Forwarding %s op to %s", op, host);				hb_conn->llc_ops->send_ordered_nodemsg(					hb_conn, op_request, host);			} else {				crm_info("Forwarding %s op to master instance",					 op);				hb_conn->llc_ops->sendclustermsg(					hb_conn, op_request);			}			if(call_options & cib_discard_reply) {				crm_trace("Client not interested in reply");			} else if(call_options & cib_sync_call) {				/* keep track of the request so we can time it				 * out if required				 */				HA_Message *saved = ha_msg_copy(op_request);				crm_devel("Registering delegated call from %s",					  cib_client->id);				cib_client->delegated_calls = g_list_append(					cib_client->delegated_calls, saved);			}			crm_msg_del(op_request);			op_request = NULL;			continue;		}		if(needs_processing) { 			crm_verbose("Processing %s op", op);			rc = cib_process_command(				op_request, &op_reply, privileged);			crm_devel("Performing local processing: op=%s origin=%s/%s,%s (update=%s)",				  op, cib_our_uname, cib_client->id,				  cl_get_string(op_request, F_CIB_CALLID),				  (rc==cib_ok && cib_server_ops[call_type].modifies_cib)?"true":"false"); 			crm_devel("Processing complete");		}						crm_devel("processing response cases");		if(rc != cib_ok) {			crm_err("Input message");			crm_log_message(LOG_ERR, op_request);			crm_err("Output message");			crm_log_message(LOG_ERR, op_reply);			crm_log_message_adv(LOG_ERR, "cib.out.log", op_reply);		}				if(op_reply == NULL) {			crm_trace("No reply is required for op %s", crm_str(op));					} else if(call_options & cib_sync_call) { 			crm_devel("Sending sync reply to %s op", crm_str(op));			crm_log_message(LOG_MSG, op_reply);			if(msg2ipcchan(op_reply, channel) != HA_OK) {				crm_err("Sync reply failed: %s",					cib_error2string(cib_reply_failed));				if(rc == cib_ok) {					rc = cib_reply_failed;				}			}			CRM_DEV_ASSERT(channel->send_queue->current_qlen < channel->send_queue->max_qlen);		} else {			enum cib_errors local_rc = cib_ok;			/* send reply via client's callback channel */ 			crm_devel("Sending async reply %p to %s op",				  op_reply, crm_str(op));			crm_log_message(LOG_MSG, op_reply);			local_rc = send_via_callback_channel(				op_reply, cib_client->callback_id);			if(local_rc != cib_ok) {				crm_err("ASync reply failed: %s",					cib_error2string(local_rc));				if(rc != cib_ok) {					local_rc = cib_reply_failed;				}			}		}				crm_devel("Cleaning up reply");		crm_msg_del(op_reply);		op_reply = NULL;		crm_devel("Processing forward cases");		if(rc == cib_ok		   && cib_server_ops[call_type].modifies_cib		   && !(call_options & cib_scope_local)) {			/* send via HA to other nodes */ 			crm_info("Forwarding %s op to all instances", op);			ha_msg_add(op_request,				   F_CIB_GLOBAL_UPDATE, XML_BOOLEAN_TRUE);			cl_log_message(LOG_DEV, op_request);			CRM_DEV_ASSERT(hb_conn->llc_ops->sendclustermsg(					       hb_conn, op_request) == HA_OK);		} else {			if(call_options & cib_scope_local ) {				crm_devel("Request not broadcast : local scope");			}			if(cib_server_ops[call_type].modifies_cib == FALSE) {				crm_devel("Request not broadcast : R/O call");			}			if(rc != cib_ok) {				crm_devel("Request not broadcast : call failed : %s",					  cib_error2string(rc));			}		}		crm_devel("Cleaning up request");		crm_msg_del(op_request);		op_request = NULL;	}	crm_verbose("Processed %d messages", lpc);    	return cib_process_disconnect(channel, cib_client);}
8182	/local/tlutelli/issta_data/temp/c/2005_temp/2005/8182/047626395d98a8d9f8881564dc1b7df1b6bcd91e/callbacks.c/clean/crm/cib/callbacks.c