Added common client channel handling

This commit is contained in:
akallabeth 2022-01-19 11:05:41 +01:00 committed by akallabeth
parent b85333bb9e
commit 4ca5078027
2 changed files with 139 additions and 0 deletions

View File

@ -33,6 +33,29 @@
#include <freerdp/client/cmdline.h>
#include <freerdp/client/channels.h>
#if defined(CHANNEL_AINPUT_CLIENT)
#include <freerdp/client/ainput.h>
#include <freerdp/channels/ainput.h>
#endif
#if defined(CHANNEL_VIDEO_CLIENT)
#include <freerdp/client/video.h>
#include <freerdp/channels/video.h>
#include <freerdp/gdi/video.h>
#endif
#if defined(CHANNEL_RDPGFX_CLIENT)
#include <freerdp/client/rdpgfx.h>
#include <freerdp/channels/rdpgfx.h>
#include <freerdp/gdi/gfx.h>
#endif
#if defined(CHANNEL_GEOMETRY_CLIENT)
#include <freerdp/client/geometry.h>
#include <freerdp/channels/geometry.h>
#include <freerdp/gdi/video.h>
#endif
#include <freerdp/log.h>
#define TAG CLIENT_TAG("common")
@ -903,3 +926,93 @@ int freerdp_client_common_stop(rdpContext* context)
return 0;
}
void freerdp_client_OnChannelConnectedEventHandler(void* context,
const ChannelConnectedEventArgs* e)
{
rdpClientContext* cctx = (rdpClientContext*)context;
WINPR_ASSERT(cctx);
WINPR_ASSERT(e);
if (0)
{
}
#if defined(CHANNEL_AINPUT_CLIENT)
else if (strcmp(e->name, AINPUT_DVC_CHANNEL_NAME) == 0)
cctx->ainput = (AInputClientContext*)e->pInterface;
#endif
#if defined(CHANNEL_RDPEI_CLIENT)
else if (strcmp(e->name, RDPEI_DVC_CHANNEL_NAME) == 0)
{
cctx->rdpei = (RdpeiClientContext*)e->pInterface;
}
#endif
#if defined(CHANNEL_RDPGFX_CLIENT)
else if (strcmp(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
{
gdi_graphics_pipeline_init(cctx->context.gdi, (RdpgfxClientContext*)e->pInterface);
}
#endif
#if defined(CHANNEL_GEOMETRY_CLIENT)
else if (strcmp(e->name, GEOMETRY_DVC_CHANNEL_NAME) == 0)
{
gdi_video_geometry_init(cctx->context.gdi, (GeometryClientContext*)e->pInterface);
}
#endif
#if defined(CHANNEL_VIDEO_CLIENT)
else if (strcmp(e->name, VIDEO_CONTROL_DVC_CHANNEL_NAME) == 0)
{
gdi_video_control_init(cctx->context.gdi, (VideoClientContext*)e->pInterface);
}
else if (strcmp(e->name, VIDEO_DATA_DVC_CHANNEL_NAME) == 0)
{
gdi_video_data_init(cctx->context.gdi, (VideoClientContext*)e->pInterface);
}
#endif
}
void freerdp_client_OnChannelDisconnectedEventHandler(void* context,
const ChannelDisconnectedEventArgs* e)
{
rdpClientContext* cctx = (rdpClientContext*)context;
WINPR_ASSERT(cctx);
WINPR_ASSERT(e);
if (0)
{
}
#if defined(CHANNEL_AINPUT_CLIENT)
else if (strcmp(e->name, AINPUT_DVC_CHANNEL_NAME) == 0)
cctx->ainput = NULL;
#endif
#if defined(CHANNEL_RDPEI_CLIENT)
else if (strcmp(e->name, RDPEI_DVC_CHANNEL_NAME) == 0)
{
cctx->rdpei = NULL;
}
#endif
#if defined(CHANNEL_RDPGFX_CLIENT)
else if (strcmp(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
{
gdi_graphics_pipeline_uninit(cctx->context.gdi, (RdpgfxClientContext*)e->pInterface);
}
#endif
#if defined(CHANNEL_GEOMETRY_CLIENT)
else if (strcmp(e->name, GEOMETRY_DVC_CHANNEL_NAME) == 0)
{
gdi_video_geometry_uninit(cctx->context.gdi, (GeometryClientContext*)e->pInterface);
}
#endif
#if defined(CHANNEL_VIDEO_CLIENT)
else if (strcmp(e->name, VIDEO_CONTROL_DVC_CHANNEL_NAME) == 0)
{
gdi_video_control_uninit(cctx->context.gdi, (VideoClientContext*)e->pInterface);
}
else if (strcmp(e->name, VIDEO_DATA_DVC_CHANNEL_NAME) == 0)
{
gdi_video_data_uninit(cctx->context.gdi, (VideoClientContext*)e->pInterface);
}
#endif
}

View File

@ -20,8 +20,20 @@
#ifndef FREERDP_CLIENT_H
#define FREERDP_CLIENT_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <freerdp/api.h>
#include <freerdp/freerdp.h>
#include <freerdp/event.h>
#if defined(CHANNEL_AINPUT_CLIENT)
#include <freerdp/client/ainput.h>
#endif
#if defined(CHANNEL_RDPEI_CLIENT)
#include <freerdp/client/rdpei.h>
#endif
#ifdef __cplusplus
extern "C"
@ -70,6 +82,13 @@ extern "C"
{
rdpContext context;
HANDLE thread;
#if defined(CHANNEL_AINPUT_CLIENT)
AInputClientContext* ainput;
#endif
#if defined(CHANNEL_RDPEI_CLIENT)
RdpeiClientContext* rdpei;
#endif
};
/* Common client functions */
@ -101,6 +120,13 @@ extern "C"
FREERDP_API BOOL client_cli_authenticate_ex(freerdp* instance, char** username, char** password,
char** domain, rdp_auth_reason reason);
FREERDP_API void
freerdp_client_OnChannelConnectedEventHandler(void* context,
const ChannelConnectedEventArgs* e);
FREERDP_API void
freerdp_client_OnChannelDisconnectedEventHandler(void* context,
const ChannelDisconnectedEventArgs* e);
#if defined(WITH_FREERDP_DEPRECATED)
FREERDP_API WINPR_DEPRECATED_VAR("Use client_cli_authenticate_ex",
BOOL client_cli_authenticate(freerdp* instance,