Changed transport IO functions to take rdpContext

This commit is contained in:
akallabeth 2021-09-03 13:02:28 +02:00 committed by akallabeth
parent 32b3f54bb3
commit c2a7a78d94
3 changed files with 16 additions and 10 deletions

View File

@ -55,8 +55,8 @@ extern "C"
};
typedef struct rdp_transport_io rdpTransportIo;
FREERDP_API const rdpTransportIo* freerdp_get_io_callbacks(freerdp* instance);
FREERDP_API BOOL freerdp_set_io_callbacks(freerdp* instance,
FREERDP_API const rdpTransportIo* freerdp_get_io_callbacks(rdpContext* context);
FREERDP_API BOOL freerdp_set_io_callbacks(rdpContext* context,
const rdpTransportIo* io_callbacks);
/* PDU parser.
* incomplete: FALSE if the whole PDU is available, TRUE otherwise
@ -67,6 +67,7 @@ extern "C"
FREERDP_API SSIZE_T transport_parse_pdu(rdpTransport* transport, wStream* s, BOOL* incomplete);
FREERDP_API rdpContext* transport_get_context(rdpTransport* transport);
FREERDP_API rdpTransport* freerdp_get_transport(rdpContext* context);
#ifdef __cplusplus
}

View File

@ -997,18 +997,16 @@ const char* freerdp_nego_get_routing_token(rdpContext* context, DWORD* length)
return (const char*)nego_get_routing_token(context->rdp->nego, length);
}
const rdpTransportIo* freerdp_get_io_callbacks(freerdp* instance)
const rdpTransportIo* freerdp_get_io_callbacks(rdpContext* context)
{
if (!instance || !instance->context)
return NULL;
return rdp_get_io_callbacks(instance->context->rdp);
WINPR_ASSERT(context);
return rdp_get_io_callbacks(context->rdp);
}
BOOL freerdp_set_io_callbacks(freerdp* instance, const rdpTransportIo* io_callbacks)
BOOL freerdp_set_io_callbacks(rdpContext* context, const rdpTransportIo* io_callbacks)
{
if (!instance || !instance->context)
return FALSE;
return rdp_set_io_callbacks(instance->context->rdp, io_callbacks);
WINPR_ASSERT(context);
return rdp_set_io_callbacks(context->rdp, io_callbacks);
}
CONNECTION_STATE freerdp_get_state(rdpContext* context)

View File

@ -1322,3 +1322,10 @@ rdpContext* transport_get_context(rdpTransport* transport)
WINPR_ASSERT(transport);
return transport->context;
}
rdpTransport* freerdp_get_transport(rdpContext* context)
{
WINPR_ASSERT(context);
WINPR_ASSERT(context->rdp);
return context->rdp->transport;
}