예제 #1
0
파일: rdp.c 프로젝트: cocoon/NeutrinoRDP
static tbool rdp_recv_callback(rdpTransport* transport, STREAM* s, void* extra)
{
	rdpRdp* rdp = (rdpRdp*) extra;

	LLOGLN(10, ("rdp_recv_callback: state %d", rdp->state));
	switch (rdp->state)
	{
		case CONNECTION_STATE_NEGO:
			if (!rdp_client_connect_mcs_connect_response(rdp, s))
				return false;
			break;

		case CONNECTION_STATE_MCS_ATTACH_USER:
			if (!rdp_client_connect_mcs_attach_user_confirm(rdp, s))
				return false;
			break;

		case CONNECTION_STATE_MCS_CHANNEL_JOIN:
			if (!rdp_client_connect_mcs_channel_join_confirm(rdp, s))
				return false;
			break;

		case CONNECTION_STATE_LICENSE:
			if (!rdp_client_connect_license(rdp, s))
				return false;
			break;

		case CONNECTION_STATE_CAPABILITY:
			if (!rdp_client_connect_demand_active(rdp, s))
			{
				LLOGLN(0, ("rdp_client_connect_demand_active failed"));
				return false;
			}
			break;

		case CONNECTION_STATE_FINALIZATION:
			if (!rdp_recv_pdu(rdp, s))
				return false;
			if (rdp->finalize_sc_pdus == FINALIZE_SC_COMPLETE)
				rdp->state = CONNECTION_STATE_ACTIVE;
			break;

		case CONNECTION_STATE_ACTIVE:
			if (!rdp_recv_pdu(rdp, s))
				return false;
			break;

		default:
			LLOGLN(0, ("Invalid state %d", rdp->state));
			return false;
	}

	return true;
}
예제 #2
0
파일: rdp.c 프로젝트: chenkaigithub/FreeRDP
static int rdp_recv_callback(rdpTransport* transport, wStream* s, void* extra)
{
	int status = 0;
	rdpRdp* rdp = (rdpRdp*) extra;

	switch (rdp->state)
	{
		case CONNECTION_STATE_NEGO:
			if (!rdp_client_connect_mcs_connect_response(rdp, s))
				status = -1;
			break;

		case CONNECTION_STATE_MCS_ATTACH_USER:
			if (!rdp_client_connect_mcs_attach_user_confirm(rdp, s))
				status = -1;
			break;

		case CONNECTION_STATE_MCS_CHANNEL_JOIN:
			if (!rdp_client_connect_mcs_channel_join_confirm(rdp, s))
				status = -1;
			break;

		case CONNECTION_STATE_LICENSE:
			if (!rdp_client_connect_license(rdp, s))
				status = -1;
			break;

		case CONNECTION_STATE_CAPABILITY:
			if (!rdp_client_connect_demand_active(rdp, s))
				status = -1;
			break;

		case CONNECTION_STATE_FINALIZATION:
			status = rdp_recv_pdu(rdp, s);
			if ((status >= 0) && (rdp->finalize_sc_pdus == FINALIZE_SC_COMPLETE))
				rdp->state = CONNECTION_STATE_ACTIVE;
			break;

		case CONNECTION_STATE_ACTIVE:
			status = rdp_recv_pdu(rdp, s);
			break;

		default:
			fprintf(stderr, "Invalid state %d\n", rdp->state);
			status = -1;
			break;
	}

	return status;
}
예제 #3
0
파일: rdp.c 프로젝트: ydal/FreeRDP
static boolean rdp_recv_callback(rdpTransport* transport, STREAM* s, void* extra)
{
	rdpRdp* rdp = (rdpRdp*) extra;

	switch (rdp->state)
	{
		case CONNECTION_STATE_NEGO:
			if (!rdp_client_connect_mcs_connect_response(rdp, s))
				return false;
			break;

		case CONNECTION_STATE_MCS_ATTACH_USER:
			if (!rdp_client_connect_mcs_attach_user_confirm(rdp, s))
				return false;
			break;

		case CONNECTION_STATE_MCS_CHANNEL_JOIN:
			if (!rdp_client_connect_mcs_channel_join_confirm(rdp, s))
				return false;
			break;

		case CONNECTION_STATE_LICENSE:
			if (!rdp_client_connect_license(rdp, s))
				return false;
			break;

		case CONNECTION_STATE_CAPABILITY:
			if (!rdp_client_connect_demand_active(rdp, s))
			{
				printf("rdp_client_connect_demand_active failed\n");
				return false;
			}
			break;

		case CONNECTION_STATE_ACTIVE:
			if (!rdp_recv_pdu(rdp, s))
				return false;
			break;

		default:
			printf("Invalid state %d\n", rdp->state);
			return false;
	}

	return true;
}
예제 #4
0
파일: rdp.c 프로젝트: JozLes77/FreeRDP
static int rdp_recv_callback(rdpTransport* transport, wStream* s, void* extra)
{
    int status = 0;
    rdpRdp* rdp = (rdpRdp*) extra;

    /*
     * At any point in the connection sequence between when all
     * MCS channels have been joined and when the RDP connection
     * enters the active state, an auto-detect PDU can be received
     * on the MCS message channel.
     */
    if ((rdp->state > CONNECTION_STATE_MCS_CHANNEL_JOIN) &&
            (rdp->state < CONNECTION_STATE_ACTIVE))
    {
        if (rdp_client_connect_auto_detect(rdp, s))
            return 0;
    }

    switch (rdp->state)
    {
    case CONNECTION_STATE_NEGO:
        if (!rdp_client_connect_mcs_connect_response(rdp, s))
            status = -1;
        break;

    case CONNECTION_STATE_MCS_ATTACH_USER:
        if (!rdp_client_connect_mcs_attach_user_confirm(rdp, s))
            status = -1;
        break;

    case CONNECTION_STATE_MCS_CHANNEL_JOIN:
        if (!rdp_client_connect_mcs_channel_join_confirm(rdp, s))
            status = -1;
        break;

    case CONNECTION_STATE_LICENSING:
        status = rdp_client_connect_license(rdp, s);
        break;

    case CONNECTION_STATE_CAPABILITIES_EXCHANGE:
        status = rdp_client_connect_demand_active(rdp, s);
        break;

    case CONNECTION_STATE_FINALIZATION:
        status = rdp_recv_pdu(rdp, s);

        if ((status >= 0) && (rdp->finalize_sc_pdus == FINALIZE_SC_COMPLETE))
            rdp_client_transition_to_state(rdp, CONNECTION_STATE_ACTIVE);
        break;

    case CONNECTION_STATE_ACTIVE:
        status = rdp_recv_pdu(rdp, s);
        break;

    default:
        DEBUG_WARN( "Invalid state %d\n", rdp->state);
        status = -1;
        break;
    }

    return status;
}