Added functions to set transport io user context

This commit is contained in:
akallabeth 2022-03-16 15:28:24 +01:00 committed by akallabeth
parent f7b6d3be73
commit 102e43baaa
4 changed files with 32 additions and 0 deletions

View File

@ -58,6 +58,10 @@ extern "C"
FREERDP_API const rdpTransportIo* freerdp_get_io_callbacks(rdpContext* context);
FREERDP_API BOOL freerdp_set_io_callbacks(rdpContext* context,
const rdpTransportIo* io_callbacks);
FREERDP_API BOOL freerdp_set_io_callback_context(rdpContext* context, void* usercontext);
FREERDP_API void* freerdp_get_io_callback_context(rdpContext* context);
/* PDU parser.
* incomplete: FALSE if the whole PDU is available, TRUE otherwise
* Return: 0 -> PDU header incomplete

View File

@ -1100,6 +1100,18 @@ BOOL freerdp_set_io_callbacks(rdpContext* context, const rdpTransportIo* io_call
return rdp_set_io_callbacks(context->rdp, io_callbacks);
}
BOOL freerdp_set_io_callback_context(rdpContext* context, void* usercontext)
{
WINPR_ASSERT(context);
return rdp_set_io_callback_context(context->rdp, usercontext);
}
void* freerdp_get_io_callback_context(rdpContext* context)
{
WINPR_ASSERT(context);
return rdp_get_io_callback_context(context->rdp);
}
CONNECTION_STATE freerdp_get_state(const rdpContext* context)
{
WINPR_ASSERT(context);

View File

@ -2043,3 +2043,15 @@ BOOL rdp_set_io_callbacks(rdpRdp* rdp, const rdpTransportIo* io_callbacks)
}
return TRUE;
}
BOOL rdp_set_io_callback_context(rdpRdp* rdp, void* usercontext)
{
WINPR_ASSERT(rdp);
rdp->ioContext = usercontext;
}
void* rdp_get_io_callback_context(rdpRdp* rdp)
{
WINPR_ASSERT(rdp);
return rdp->ioContext;
}

View File

@ -179,6 +179,7 @@ struct rdp_rdp
UINT64 outPackets;
CRITICAL_SECTION critical;
rdpTransportIo* io;
void* ioContext;
};
FREERDP_LOCAL BOOL rdp_read_security_header(wStream* s, UINT16* flags, UINT16* length);
@ -228,6 +229,9 @@ FREERDP_LOCAL void rdp_free(rdpRdp* rdp);
FREERDP_LOCAL const rdpTransportIo* rdp_get_io_callbacks(rdpRdp* rdp);
FREERDP_LOCAL BOOL rdp_set_io_callbacks(rdpRdp* rdp, const rdpTransportIo* io_callbacks);
FREERDP_LOCAL BOOL rdp_set_io_callback_context(rdpRdp* rdp, void* usercontext);
FREERDP_LOCAL void* rdp_get_io_callback_context(rdpRdp* rdp);
#define RDP_TAG FREERDP_TAG("core.rdp")
#ifdef WITH_DEBUG_RDP
#define DEBUG_RDP(...) WLog_DBG(RDP_TAG, __VA_ARGS__)