예제 #1
0
/*---------------------------------------------------------------------------*/
int xio_server_on_nexus_event(void *observer, void *sender, int event,
			      void *_event_data)
{
	struct xio_session	*session = (struct xio_session *)observer;
	struct xio_nexus	*nexus	= (struct xio_nexus *)sender;
	int			retval  = 0;
	union xio_nexus_event_data *event_data = (union xio_nexus_event_data *)
							_event_data;

	switch (event) {
	case XIO_NEXUS_EVENT_NEW_MESSAGE:
/*
		TRACE_LOG("session: [notification] - new message. " \
			 "session:%p, nexus:%p\n", observer, sender);

*/		xio_on_new_message(session, nexus, event_data);
		break;
	case XIO_NEXUS_EVENT_SEND_COMPLETION:
/*		TRACE_LOG("session: [notification] - send_completion. " \
			 "session:%p, nexus:%p\n", observer, sender);
*/
		xio_on_send_completion(session, nexus, event_data);
		break;
	case XIO_NEXUS_EVENT_DIRECT_RDMA_COMPLETION:
		xio_on_rdma_direct_comp(session, nexus, event_data);
		break;
	case XIO_NEXUS_EVENT_ASSIGN_IN_BUF:
/*		TRACE_LOG("session: [notification] - assign in buf. " \
			 "session:%p, nexus:%p\n", observer, sender);
*/
		xio_on_assign_in_buf(session, nexus, event_data);
		break;
	case XIO_NEXUS_EVENT_CANCEL_REQUEST:
		DEBUG_LOG("session: [notification] - cancel request. " \
			 "session:%p, nexus:%p\n", observer, sender);
		xio_on_cancel_request(session, nexus, event_data);
		break;
	case XIO_NEXUS_EVENT_CANCEL_RESPONSE:
		DEBUG_LOG("session: [notification] - cancel response. " \
			 "session:%p, nexus:%p\n", observer, sender);
		xio_on_cancel_response(session, nexus, event_data);
		break;
	case XIO_NEXUS_EVENT_ESTABLISHED:
		DEBUG_LOG("session: [notification] - connection established. " \
			 "session:%p, nexus:%p\n", observer, sender);
		xio_on_server_nexus_established(session, nexus, event_data);
		break;
	case XIO_NEXUS_EVENT_DISCONNECTED:
		DEBUG_LOG("session: [notification] - connection disconnected" \
			 " session:%p, nexus:%p\n", observer, sender);
		xio_on_nexus_disconnected(session, nexus, event_data);
		break;
	case XIO_NEXUS_EVENT_RECONNECTED:
		DEBUG_LOG("session: [notification] - connection reconnected" \
			 " session:%p, nexus:%p\n", observer, sender);
		xio_on_nexus_reconnected(session, nexus);
		break;
	case XIO_NEXUS_EVENT_CLOSED:
		DEBUG_LOG("session: [notification] - connection closed. " \
			 "session:%p, nexus:%p\n", observer, sender);
		xio_on_nexus_closed(session, nexus, event_data);
		break;
	case XIO_NEXUS_EVENT_ERROR:
		DEBUG_LOG("session: [notification] - connection error. " \
			 "session:%p, nexus:%p\n", observer, sender);
		xio_on_nexus_error(session, nexus, event_data);
		break;
	case XIO_NEXUS_EVENT_MESSAGE_ERROR:
		DEBUG_LOG("session: [notification] - nexus message error. " \
			 "session:%p, nexus:%p\n", observer, sender);
		xio_on_nexus_message_error(session, nexus, event_data);
		break;
	default:
		DEBUG_LOG("session: [notification] - unexpected event. " \
			 "event:%d, session:%p, nexus:%p\n",
			 event, observer, sender);
		xio_on_nexus_error(session, nexus, event_data);
		break;
	}

	return retval;
}
/*---------------------------------------------------------------------------*/
int xio_on_conn_event_server(void *observer, void *sender, int event,
			     void *event_data)
{
	struct xio_session	*session = observer;
	struct xio_conn	*conn	= sender;
	int			retval  = 0;


	switch (event) {
	case XIO_CONN_EVENT_NEW_MESSAGE:
/*
		TRACE_LOG("session: [notification] - new message. " \
			 "session:%p, conn:%p\n", observer, sender);

*/		xio_on_new_message(session, conn, event_data);
		break;
	case XIO_CONN_EVENT_SEND_COMPLETION:
/*		TRACE_LOG("session: [notification] - send_completion. " \
			 "session:%p, conn:%p\n", observer, sender);
*/
		xio_on_send_completion(session, conn, event_data);
		break;
	case XIO_CONN_EVENT_ASSIGN_IN_BUF:
/*		TRACE_LOG("session: [notification] - assign in buf. " \
			 "session:%p, conn:%p\n", observer, sender);
*/
		xio_on_assign_in_buf(session, conn, event_data);
		break;
	case XIO_CONN_EVENT_CANCEL_REQUEST:
		DEBUG_LOG("session: [notification] - cancel request. " \
			 "session:%p, conn:%p\n", observer, sender);
		xio_on_cancel_request(session, conn, event_data);
		break;
	case XIO_CONN_EVENT_CANCEL_RESPONSE:
		DEBUG_LOG("session: [notification] - cancel response. " \
			 "session:%p, conn:%p\n", observer, sender);
		xio_on_cancel_response(session, conn, event_data);
		break;
	case XIO_CONN_EVENT_ESTABLISHED:
		DEBUG_LOG("session: [notification] - connection established. " \
			 "session:%p, conn:%p\n", observer, sender);
		xio_on_server_conn_established(session, conn, event_data);
		break;
	case XIO_CONN_EVENT_DISCONNECTED:
		DEBUG_LOG("session: [notification] - connection disconnected" \
			 " session:%p, conn:%p\n", observer, sender);
		xio_on_conn_disconnected(session, conn, event_data);
		break;
	case XIO_CONN_EVENT_CLOSED:
		DEBUG_LOG("session: [notification] - connection closed. " \
			 "session:%p, conn:%p\n", observer, sender);
		xio_on_conn_closed(session, conn, event_data);
		break;
	case XIO_CONN_EVENT_ERROR:
		DEBUG_LOG("session: [notification] - connection error. " \
			 "session:%p, conn:%p\n", observer, sender);
		xio_on_conn_error(session, conn, event_data);
		break;
	case XIO_CONN_EVENT_MESSAGE_ERROR:
		DEBUG_LOG("session: [notification] - conn message error. " \
			 "session:%p, conn:%p\n", observer, sender);
		xio_on_conn_message_error(session, conn, event_data);
		break;
	default:
		DEBUG_LOG("session: [notification] - unexpected event. " \
			 "event:%d, session:%p, conn:%p\n",
			 event, observer, sender);
		xio_on_conn_error(session, conn, event_data);
		break;
	}

	return retval;
}