22 #include <freerdp/config.h>
27 #include <winpr/crt.h>
28 #include <winpr/assert.h>
29 #include <winpr/stream.h>
31 #include "echo_main.h"
32 #include <freerdp/client/channels.h>
33 #include <freerdp/channels/log.h>
34 #include <freerdp/channels/echo.h>
36 #define TAG CHANNELS_TAG("echo.client")
48 static UINT echo_on_data_received(IWTSVirtualChannelCallback* pChannelCallback,
wStream* data)
51 const BYTE* pBuffer = Stream_ConstPointer(data);
52 const size_t cbSize = Stream_GetRemainingLength(data);
54 WINPR_ASSERT(callback);
55 WINPR_ASSERT(callback->channel);
56 WINPR_ASSERT(callback->channel->Write);
58 if (cbSize > UINT32_MAX)
59 return ERROR_INVALID_PARAMETER;
62 return callback->channel->Write(callback->channel, (ULONG)cbSize, pBuffer, NULL);
70 static UINT echo_on_close(IWTSVirtualChannelCallback* pChannelCallback)
79 static const IWTSVirtualChannelCallback echo_callbacks = { echo_on_data_received, NULL,
80 echo_on_close, NULL };
87 FREERDP_ENTRY_POINT(UINT VCAPITYPE echo_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
89 return freerdp_generic_DVCPluginEntry(pEntryPoints, TAG, ECHO_DVC_CHANNEL_NAME,
91 &echo_callbacks, NULL, NULL);