Made rdpRdp opaque
This commit is contained in:
parent
097ac0ee13
commit
b4fc0c75ce
@ -40,6 +40,99 @@
|
||||
|
||||
#define TAG FREERDP_TAG("core.gateway.rdg")
|
||||
|
||||
|
||||
/* HTTP channel response fields present flags. */
|
||||
#define HTTP_CHANNEL_RESPONSE_FIELD_CHANNELID 0x1
|
||||
#define HTTP_CHANNEL_RESPONSE_OPTIONAL 0x2
|
||||
#define HTTP_CHANNEL_RESPONSE_FIELD_UDPPORT 0x4
|
||||
|
||||
/* HTTP extended auth. */
|
||||
#define HTTP_EXTENDED_AUTH_NONE 0x0
|
||||
#define HTTP_EXTENDED_AUTH_SC 0x1 /* Smart card authentication. */
|
||||
#define HTTP_EXTENDED_AUTH_PAA 0x02 /* Pluggable authentication. */
|
||||
#define HTTP_EXTENDED_AUTH_SSPI_NTLM 0x04 /* NTLM extended authentication. */
|
||||
|
||||
/* HTTP packet types. */
|
||||
#define PKT_TYPE_HANDSHAKE_REQUEST 0x1
|
||||
#define PKT_TYPE_HANDSHAKE_RESPONSE 0x2
|
||||
#define PKT_TYPE_EXTENDED_AUTH_MSG 0x3
|
||||
#define PKT_TYPE_TUNNEL_CREATE 0x4
|
||||
#define PKT_TYPE_TUNNEL_RESPONSE 0x5
|
||||
#define PKT_TYPE_TUNNEL_AUTH 0x6
|
||||
#define PKT_TYPE_TUNNEL_AUTH_RESPONSE 0x7
|
||||
#define PKT_TYPE_CHANNEL_CREATE 0x8
|
||||
#define PKT_TYPE_CHANNEL_RESPONSE 0x9
|
||||
#define PKT_TYPE_DATA 0xA
|
||||
#define PKT_TYPE_SERVICE_MESSAGE 0xB
|
||||
#define PKT_TYPE_REAUTH_MESSAGE 0xC
|
||||
#define PKT_TYPE_KEEPALIVE 0xD
|
||||
#define PKT_TYPE_CLOSE_CHANNEL 0x10
|
||||
#define PKT_TYPE_CLOSE_CHANNEL_RESPONSE 0x11
|
||||
|
||||
/* HTTP tunnel auth fields present flags. */
|
||||
#define HTTP_TUNNEL_AUTH_FIELD_SOH 0x1
|
||||
|
||||
/* HTTP tunnel auth response fields present flags. */
|
||||
#define HTTP_TUNNEL_AUTH_RESPONSE_FIELD_REDIR_FLAGS 0x1
|
||||
#define HTTP_TUNNEL_AUTH_RESPONSE_FIELD_IDLE_TIMEOUT 0x2
|
||||
#define HTTP_TUNNEL_AUTH_RESPONSE_FIELD_SOH_RESPONSE 0x4
|
||||
|
||||
/* HTTP tunnel packet fields present flags. */
|
||||
#define HTTP_TUNNEL_PACKET_FIELD_PAA_COOKIE 0x1
|
||||
#define HTTP_TUNNEL_PACKET_FIELD_REAUTH 0x2
|
||||
|
||||
/* HTTP tunnel redir flags. */
|
||||
#define HTTP_TUNNEL_REDIR_ENABLE_ALL 0x80000000
|
||||
#define HTTP_TUNNEL_REDIR_DISABLE_ALL 0x40000000
|
||||
#define HTTP_TUNNEL_REDIR_DISABLE_DRIVE 0x1
|
||||
#define HTTP_TUNNEL_REDIR_DISABLE_PRINTER 0x2
|
||||
#define HTTP_TUNNEL_REDIR_DISABLE_PORT 0x4
|
||||
#define HTTP_TUNNEL_REDIR_DISABLE_CLIPBOARD 0x8
|
||||
#define HTTP_TUNNEL_REDIR_DISABLE_PNP 0x10
|
||||
|
||||
/* HTTP tunnel response fields present flags. */
|
||||
#define HTTP_TUNNEL_RESPONSE_FIELD_TUNNEL_ID 0x1
|
||||
#define HTTP_TUNNEL_RESPONSE_FIELD_CAPS 0x2
|
||||
#define HTTP_TUNNEL_RESPONSE_FIELD_SOH_REQ 0x4
|
||||
#define HTTP_TUNNEL_RESPONSE_FIELD_CONSENT_MSG 0x10
|
||||
|
||||
/* HTTP capability type enumeration. */
|
||||
#define HTTP_CAPABILITY_TYPE_QUAR_SOH 0x1
|
||||
#define HTTP_CAPABILITY_IDLE_TIMEOUT 0x2
|
||||
#define HTTP_CAPABILITY_MESSAGING_CONSENT_SIGN 0x4
|
||||
#define HTTP_CAPABILITY_MESSAGING_SERVICE_MSG 0x8
|
||||
#define HTTP_CAPABILITY_REAUTH 0x10
|
||||
#define HTTP_CAPABILITY_UDP_TRANSPORT 0x20
|
||||
|
||||
struct rdp_rdg
|
||||
{
|
||||
rdpContext* context;
|
||||
rdpSettings* settings;
|
||||
BIO* frontBio;
|
||||
rdpTls* tlsIn;
|
||||
rdpTls* tlsOut;
|
||||
rdpNtlm* ntlm;
|
||||
HttpContext* http;
|
||||
CRITICAL_SECTION writeSection;
|
||||
|
||||
UUID guid;
|
||||
|
||||
int state;
|
||||
UINT16 packetRemainingCount;
|
||||
int timeout;
|
||||
UINT16 extAuth;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RDG_CLIENT_STATE_INITIAL,
|
||||
RDG_CLIENT_STATE_HANDSHAKE,
|
||||
RDG_CLIENT_STATE_TUNNEL_CREATE,
|
||||
RDG_CLIENT_STATE_TUNNEL_AUTHORIZE,
|
||||
RDG_CLIENT_STATE_CHANNEL_CREATE,
|
||||
RDG_CLIENT_STATE_OPENED,
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
typedef struct rdg_packet_header
|
||||
@ -1257,19 +1350,22 @@ static BIO_METHOD* BIO_s_rdg(void)
|
||||
return bio_methods;
|
||||
}
|
||||
|
||||
rdpRdg* rdg_new(rdpTransport* transport)
|
||||
rdpRdg* rdg_new(rdpContext* context)
|
||||
{
|
||||
rdpRdg* rdg;
|
||||
RPC_CSTR stringUuid;
|
||||
char bracedUuid[40];
|
||||
RPC_STATUS rpcStatus;
|
||||
assert(transport != NULL);
|
||||
|
||||
if (!context)
|
||||
return NULL;
|
||||
|
||||
rdg = (rdpRdg*) calloc(1, sizeof(rdpRdg));
|
||||
|
||||
if (rdg)
|
||||
{
|
||||
rdg->state = RDG_CLIENT_STATE_INITIAL;
|
||||
rdg->context = transport->context;
|
||||
rdg->context = context;
|
||||
rdg->settings = rdg->context->settings;
|
||||
rdg->extAuth = HTTP_EXTENDED_AUTH_NONE;
|
||||
|
||||
@ -1354,3 +1450,11 @@ void rdg_free(rdpRdg* rdg)
|
||||
DeleteCriticalSection(&rdg->writeSection);
|
||||
free(rdg);
|
||||
}
|
||||
|
||||
BIO* rdg_front_bio(rdpRdg* rdg)
|
||||
{
|
||||
if (!rdg)
|
||||
return NULL;
|
||||
|
||||
return rdg->frontBio;
|
||||
}
|
||||
|
@ -39,105 +39,12 @@ typedef struct rdp_rdg rdpRdg;
|
||||
|
||||
#include "http.h"
|
||||
#include "ntlm.h"
|
||||
#include "../transport.h"
|
||||
|
||||
/* HTTP channel response fields present flags. */
|
||||
#define HTTP_CHANNEL_RESPONSE_FIELD_CHANNELID 0x1
|
||||
#define HTTP_CHANNEL_RESPONSE_OPTIONAL 0x2
|
||||
#define HTTP_CHANNEL_RESPONSE_FIELD_UDPPORT 0x4
|
||||
|
||||
/* HTTP extended auth. */
|
||||
#define HTTP_EXTENDED_AUTH_NONE 0x0
|
||||
#define HTTP_EXTENDED_AUTH_SC 0x1 /* Smart card authentication. */
|
||||
#define HTTP_EXTENDED_AUTH_PAA 0x02 /* Pluggable authentication. */
|
||||
#define HTTP_EXTENDED_AUTH_SSPI_NTLM 0x04 /* NTLM extended authentication. */
|
||||
|
||||
/* HTTP packet types. */
|
||||
#define PKT_TYPE_HANDSHAKE_REQUEST 0x1
|
||||
#define PKT_TYPE_HANDSHAKE_RESPONSE 0x2
|
||||
#define PKT_TYPE_EXTENDED_AUTH_MSG 0x3
|
||||
#define PKT_TYPE_TUNNEL_CREATE 0x4
|
||||
#define PKT_TYPE_TUNNEL_RESPONSE 0x5
|
||||
#define PKT_TYPE_TUNNEL_AUTH 0x6
|
||||
#define PKT_TYPE_TUNNEL_AUTH_RESPONSE 0x7
|
||||
#define PKT_TYPE_CHANNEL_CREATE 0x8
|
||||
#define PKT_TYPE_CHANNEL_RESPONSE 0x9
|
||||
#define PKT_TYPE_DATA 0xA
|
||||
#define PKT_TYPE_SERVICE_MESSAGE 0xB
|
||||
#define PKT_TYPE_REAUTH_MESSAGE 0xC
|
||||
#define PKT_TYPE_KEEPALIVE 0xD
|
||||
#define PKT_TYPE_CLOSE_CHANNEL 0x10
|
||||
#define PKT_TYPE_CLOSE_CHANNEL_RESPONSE 0x11
|
||||
|
||||
/* HTTP tunnel auth fields present flags. */
|
||||
#define HTTP_TUNNEL_AUTH_FIELD_SOH 0x1
|
||||
|
||||
/* HTTP tunnel auth response fields present flags. */
|
||||
#define HTTP_TUNNEL_AUTH_RESPONSE_FIELD_REDIR_FLAGS 0x1
|
||||
#define HTTP_TUNNEL_AUTH_RESPONSE_FIELD_IDLE_TIMEOUT 0x2
|
||||
#define HTTP_TUNNEL_AUTH_RESPONSE_FIELD_SOH_RESPONSE 0x4
|
||||
|
||||
/* HTTP tunnel packet fields present flags. */
|
||||
#define HTTP_TUNNEL_PACKET_FIELD_PAA_COOKIE 0x1
|
||||
#define HTTP_TUNNEL_PACKET_FIELD_REAUTH 0x2
|
||||
|
||||
/* HTTP tunnel redir flags. */
|
||||
#define HTTP_TUNNEL_REDIR_ENABLE_ALL 0x80000000
|
||||
#define HTTP_TUNNEL_REDIR_DISABLE_ALL 0x40000000
|
||||
#define HTTP_TUNNEL_REDIR_DISABLE_DRIVE 0x1
|
||||
#define HTTP_TUNNEL_REDIR_DISABLE_PRINTER 0x2
|
||||
#define HTTP_TUNNEL_REDIR_DISABLE_PORT 0x4
|
||||
#define HTTP_TUNNEL_REDIR_DISABLE_CLIPBOARD 0x8
|
||||
#define HTTP_TUNNEL_REDIR_DISABLE_PNP 0x10
|
||||
|
||||
/* HTTP tunnel response fields present flags. */
|
||||
#define HTTP_TUNNEL_RESPONSE_FIELD_TUNNEL_ID 0x1
|
||||
#define HTTP_TUNNEL_RESPONSE_FIELD_CAPS 0x2
|
||||
#define HTTP_TUNNEL_RESPONSE_FIELD_SOH_REQ 0x4
|
||||
#define HTTP_TUNNEL_RESPONSE_FIELD_CONSENT_MSG 0x10
|
||||
|
||||
/* HTTP capability type enumeration. */
|
||||
#define HTTP_CAPABILITY_TYPE_QUAR_SOH 0x1
|
||||
#define HTTP_CAPABILITY_IDLE_TIMEOUT 0x2
|
||||
#define HTTP_CAPABILITY_MESSAGING_CONSENT_SIGN 0x4
|
||||
#define HTTP_CAPABILITY_MESSAGING_SERVICE_MSG 0x8
|
||||
#define HTTP_CAPABILITY_REAUTH 0x10
|
||||
#define HTTP_CAPABILITY_UDP_TRANSPORT 0x20
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
RDG_CLIENT_STATE_INITIAL,
|
||||
RDG_CLIENT_STATE_HANDSHAKE,
|
||||
RDG_CLIENT_STATE_TUNNEL_CREATE,
|
||||
RDG_CLIENT_STATE_TUNNEL_AUTHORIZE,
|
||||
RDG_CLIENT_STATE_CHANNEL_CREATE,
|
||||
RDG_CLIENT_STATE_OPENED,
|
||||
};
|
||||
|
||||
struct rdp_rdg
|
||||
{
|
||||
rdpContext* context;
|
||||
rdpSettings* settings;
|
||||
BIO* frontBio;
|
||||
rdpTls* tlsIn;
|
||||
rdpTls* tlsOut;
|
||||
rdpNtlm* ntlm;
|
||||
HttpContext* http;
|
||||
CRITICAL_SECTION writeSection;
|
||||
|
||||
UUID guid;
|
||||
|
||||
int state;
|
||||
UINT16 packetRemainingCount;
|
||||
int timeout;
|
||||
UINT16 extAuth;
|
||||
};
|
||||
|
||||
|
||||
FREERDP_LOCAL rdpRdg* rdg_new(rdpTransport* transport);
|
||||
FREERDP_LOCAL rdpRdg* rdg_new(rdpContext* context);
|
||||
FREERDP_LOCAL void rdg_free(rdpRdg* rdg);
|
||||
|
||||
FREERDP_LOCAL BIO* rdg_front_bio(rdpRdg* rdg);
|
||||
|
||||
FREERDP_LOCAL BOOL rdg_connect(rdpRdg* rdg, int timeout, BOOL* rpcFallback);
|
||||
FREERDP_LOCAL DWORD rdg_get_event_handles(rdpRdg* rdg, HANDLE* events,
|
||||
DWORD count);
|
||||
|
@ -369,7 +369,7 @@ BOOL transport_connect(rdpTransport* transport, const char* hostname,
|
||||
{
|
||||
if (!status && settings->GatewayHttpTransport)
|
||||
{
|
||||
transport->rdg = rdg_new(transport);
|
||||
transport->rdg = rdg_new(context);
|
||||
|
||||
if (!transport->rdg)
|
||||
return FALSE;
|
||||
@ -378,7 +378,7 @@ BOOL transport_connect(rdpTransport* transport, const char* hostname,
|
||||
|
||||
if (status)
|
||||
{
|
||||
transport->frontBio = transport->rdg->frontBio;
|
||||
transport->frontBio = rdg_front_bio(transport->rdg);
|
||||
BIO_set_nonblock(transport->frontBio, 0);
|
||||
transport->layer = TRANSPORT_LAYER_TSG;
|
||||
status = TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user