freerdp-server: remove usage of deprecated custom server-side channel API

This commit is contained in:
Marc-André Moreau 2014-02-16 23:09:21 -05:00
parent 9afddf66ad
commit f3011492d8
5 changed files with 6 additions and 164 deletions

View File

@ -52,8 +52,6 @@ extern "C" {
/**
* WTSVirtualChannelManager functions are FreeRDP extensions to the API.
*/
FREERDP_API WTSVirtualChannelManager* WTSCreateVirtualChannelManager(freerdp_peer* client);
FREERDP_API void WTSDestroyVirtualChannelManager(WTSVirtualChannelManager* vcm);
FREERDP_API void WTSVirtualChannelManagerGetFileDescriptor(WTSVirtualChannelManager* vcm, void** fds, int* fds_count);
FREERDP_API BOOL WTSVirtualChannelManagerCheckFileDescriptor(WTSVirtualChannelManager* vcm);
@ -61,8 +59,6 @@ FREERDP_API HANDLE WTSVirtualChannelManagerGetEventHandle(WTSVirtualChannelManag
FREERDP_API BOOL WTSVirtualChannelManagerIsChannelJoined(WTSVirtualChannelManager* vcm, const char* name);
FREERDP_API HANDLE WTSVirtualChannelManagerOpenEx(WTSVirtualChannelManager* vcm, LPSTR pVirtualName, DWORD flags);
#ifdef __cplusplus
}
#endif

View File

@ -383,64 +383,6 @@ static int WTSReceiveChannelData(freerdp_peer* client, UINT16 channelId, BYTE* d
return status;
}
WTSVirtualChannelManager* WTSCreateVirtualChannelManager(freerdp_peer* client)
{
WTSVirtualChannelManager* vcm;
vcm = (WTSVirtualChannelManager*) malloc(sizeof(WTSVirtualChannelManager));
if (vcm)
{
ZeroMemory(vcm, sizeof(WTSVirtualChannelManager));
vcm->client = client;
vcm->rdp = client->context->rdp;
vcm->queue = MessageQueue_New(NULL);
vcm->dvc_channel_id_seq = 1;
vcm->dynamicVirtualChannels = ArrayList_New(TRUE);
client->ReceiveChannelData = WTSReceiveChannelData;
}
return vcm;
}
void WTSDestroyVirtualChannelManager(WTSVirtualChannelManager* vcm)
{
int index;
int count;
rdpPeerChannel* channel;
if (vcm)
{
ArrayList_Lock(vcm->dynamicVirtualChannels);
count = ArrayList_Count(vcm->dynamicVirtualChannels);
for (index = 0; index < count; index++)
{
channel = (rdpPeerChannel*) ArrayList_GetItem(vcm->dynamicVirtualChannels, index);
WTSVirtualChannelClose(channel);
}
ArrayList_Unlock(vcm->dynamicVirtualChannels);
ArrayList_Free(vcm->dynamicVirtualChannels);
if (vcm->drdynvc_channel)
{
WTSVirtualChannelClose(vcm->drdynvc_channel);
vcm->drdynvc_channel = NULL;
}
MessageQueue_Free(vcm->queue);
free(vcm);
}
}
void WTSVirtualChannelManagerGetFileDescriptor(WTSVirtualChannelManager* vcm, void** fds, int* fds_count)
{
void* fd;
@ -538,102 +480,6 @@ BOOL WTSVirtualChannelManagerIsChannelJoined(WTSVirtualChannelManager* vcm, cons
return joined;
}
HANDLE WTSVirtualChannelManagerOpenEx(WTSVirtualChannelManager* vcm, LPSTR pVirtualName, DWORD flags)
{
int i;
int len;
wStream* s;
rdpPeerChannel* channel;
freerdp_peer* client = vcm->client;
rdpMcs* mcs = client->context->rdp->mcs;
if ((flags & WTS_CHANNEL_OPTION_DYNAMIC) != 0)
{
for (i = 0; i < mcs->channelCount; i++)
{
if (mcs->channels[i].joined && (strncmp(mcs->channels[i].Name, "drdynvc", 7) == 0))
{
break;
}
}
if (i >= mcs->channelCount)
{
DEBUG_DVC("Dynamic virtual channel not registered.");
SetLastError(ERROR_NOT_FOUND);
return NULL;
}
if (!vcm->drdynvc_channel || (vcm->drdynvc_state != DRDYNVC_STATE_READY))
{
DEBUG_DVC("Dynamic virtual channel not ready.");
SetLastError(ERROR_NOT_READY);
return NULL;
}
channel = (rdpPeerChannel*) malloc(sizeof(rdpPeerChannel));
ZeroMemory(channel, sizeof(rdpPeerChannel));
channel->vcm = vcm;
channel->client = client;
channel->channelType = RDP_PEER_CHANNEL_TYPE_DVC;
channel->receiveData = Stream_New(NULL, client->settings->VirtualChannelChunkSize);
channel->queue = MessageQueue_New(NULL);
channel->channelId = vcm->dvc_channel_id_seq++;
ArrayList_Add(vcm->dynamicVirtualChannels, channel);
s = Stream_New(NULL, 64);
wts_write_drdynvc_create_request(s, channel->channelId, pVirtualName);
WTSVirtualChannelWrite(vcm->drdynvc_channel, (PCHAR) Stream_Buffer(s), Stream_GetPosition(s), NULL);
Stream_Free(s, TRUE);
}
else
{
len = strlen(pVirtualName);
if (len > 8)
{
SetLastError(ERROR_NOT_FOUND);
return NULL;
}
for (i = 0; i < mcs->channelCount; i++)
{
if (mcs->channels[i].joined && (strncmp(mcs->channels[i].Name, pVirtualName, len) == 0))
{
break;
}
}
if (i >= mcs->channelCount)
{
SetLastError(ERROR_NOT_FOUND);
return NULL;
}
channel = (rdpPeerChannel*) mcs->channels[i].handle;
if (!channel)
{
channel = (rdpPeerChannel*) malloc(sizeof(rdpPeerChannel));
ZeroMemory(channel, sizeof(rdpPeerChannel));
channel->vcm = vcm;
channel->client = client;
channel->channelId = mcs->channels[i].ChannelId;
channel->index = i;
channel->channelType = RDP_PEER_CHANNEL_TYPE_SVC;
channel->receiveData = Stream_New(NULL, client->settings->VirtualChannelChunkSize);
channel->queue = MessageQueue_New(NULL);
mcs->channels[i].handle = channel;
}
}
return channel;
}
BOOL FreeRDP_WTSStartRemoteControlSessionW(LPWSTR pTargetServerName, ULONG TargetLogonId, BYTE HotkeyVk, USHORT HotkeyModifiers)
{
return FALSE;

View File

@ -187,7 +187,7 @@ int mf_peer_context_new(freerdp_peer* client, mfPeerContext* context)
context->s = Stream_New(NULL, 0xFFFF);
//#ifdef WITH_SERVER_CHANNELS
context->vcm = WTSCreateVirtualChannelManager(client);
context->vcm = (WTSVirtualChannelManager*) WTSOpenServerA((LPSTR) client->context);
//#endif
mf_info_peer_register(context->info, context);
@ -222,7 +222,7 @@ void mf_peer_context_free(freerdp_peer* client, mfPeerContext* context)
//#endif
//#ifdef WITH_SERVER_CHANNELS
WTSDestroyVirtualChannelManager(context->vcm);
WTSCloseServer((HANDLE) context->vcm);
//#endif
}
}

View File

@ -63,7 +63,7 @@ void test_peer_context_new(freerdp_peer* client, testPeerContext* context)
context->icon_x = -1;
context->icon_y = -1;
context->vcm = WTSCreateVirtualChannelManager(client);
context->vcm = (WTSVirtualChannelManager*) WTSOpenServerA((LPSTR) client->context);
}
void test_peer_context_free(freerdp_peer* client, testPeerContext* context)
@ -93,7 +93,7 @@ void test_peer_context_free(freerdp_peer* client, testPeerContext* context)
if (context->rdpsnd)
rdpsnd_server_context_free(context->rdpsnd);
WTSDestroyVirtualChannelManager(context->vcm);
WTSCloseServer((HANDLE) context->vcm);
}
}

View File

@ -41,7 +41,7 @@
void wf_peer_context_new(freerdp_peer* client, wfPeerContext* context)
{
context->info = wf_info_get_instance();
context->vcm = WTSCreateVirtualChannelManager(client);
context->vcm = (WTSVirtualChannelManager*) WTSOpenServerA((LPSTR) client->context);
wf_info_peer_register(context->info, context);
}
@ -57,7 +57,7 @@ void wf_peer_context_free(freerdp_peer* client, wfPeerContext* context)
wf_rdpsnd_unlock();
}
WTSDestroyVirtualChannelManager(context->vcm);
WTSCloseServer((HANDLE) context->vcm);
}
void wf_peer_init(freerdp_peer* client)