2011-07-19 10:07:15 +04:00
|
|
|
/**
|
2012-10-09 07:02:04 +04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2011-07-19 10:07:15 +04:00
|
|
|
* Dynamic Virtual Channel
|
|
|
|
*
|
|
|
|
* Copyright 2010-2011 Vic Lee
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2012-08-15 01:09:01 +04:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2011-07-19 10:07:15 +04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2012-08-15 01:09:01 +04:00
|
|
|
|
2012-10-09 04:26:11 +04:00
|
|
|
#include <winpr/crt.h>
|
|
|
|
|
2011-07-19 10:07:15 +04:00
|
|
|
#include <freerdp/constants.h>
|
2013-03-22 00:45:25 +04:00
|
|
|
#include <winpr/stream.h>
|
2012-11-22 06:22:06 +04:00
|
|
|
#include <freerdp/utils/svc_plugin.h>
|
2011-07-19 10:07:15 +04:00
|
|
|
|
|
|
|
#include "dvcman.h"
|
|
|
|
#include "drdynvc_types.h"
|
|
|
|
#include "drdynvc_main.h"
|
|
|
|
|
2012-11-20 07:31:15 +04:00
|
|
|
#define CREATE_REQUEST_PDU 0x01
|
|
|
|
#define DATA_FIRST_PDU 0x02
|
|
|
|
#define DATA_PDU 0x03
|
|
|
|
#define CLOSE_REQUEST_PDU 0x04
|
|
|
|
#define CAPABILITY_REQUEST_PDU 0x05
|
2011-07-19 10:07:15 +04:00
|
|
|
|
|
|
|
struct drdynvc_plugin
|
|
|
|
{
|
|
|
|
rdpSvcPlugin plugin;
|
|
|
|
|
|
|
|
int version;
|
|
|
|
int PriorityCharge0;
|
|
|
|
int PriorityCharge1;
|
|
|
|
int PriorityCharge2;
|
|
|
|
int PriorityCharge3;
|
2012-04-25 22:27:38 +04:00
|
|
|
int channel_error;
|
2011-07-19 10:07:15 +04:00
|
|
|
|
|
|
|
IWTSVirtualChannelManager* channel_mgr;
|
|
|
|
};
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static int drdynvc_write_variable_uint(wStream* stream, UINT32 val)
|
2011-07-19 10:07:15 +04:00
|
|
|
{
|
|
|
|
int cb;
|
|
|
|
|
|
|
|
if (val <= 0xFF)
|
|
|
|
{
|
|
|
|
cb = 0;
|
2012-10-09 11:01:37 +04:00
|
|
|
stream_write_BYTE(stream, val);
|
2011-07-19 10:07:15 +04:00
|
|
|
}
|
|
|
|
else if (val <= 0xFFFF)
|
|
|
|
{
|
|
|
|
cb = 1;
|
2012-10-09 11:01:37 +04:00
|
|
|
stream_write_UINT16(stream, val);
|
2011-07-19 10:07:15 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-04-25 22:27:38 +04:00
|
|
|
cb = 2;
|
2012-10-09 11:26:39 +04:00
|
|
|
stream_write_UINT32(stream, val);
|
2011-07-19 10:07:15 +04:00
|
|
|
}
|
2012-11-20 07:31:15 +04:00
|
|
|
|
2011-07-19 10:07:15 +04:00
|
|
|
return cb;
|
|
|
|
}
|
|
|
|
|
2012-10-09 11:26:39 +04:00
|
|
|
int drdynvc_write_data(drdynvcPlugin* drdynvc, UINT32 ChannelId, BYTE* data, UINT32 data_size)
|
2011-07-19 10:07:15 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* data_out;
|
2012-10-09 11:26:39 +04:00
|
|
|
UINT32 pos = 0;
|
|
|
|
UINT32 cbChId;
|
|
|
|
UINT32 cbLen;
|
|
|
|
UINT32 chunk_len;
|
2011-07-19 10:07:15 +04:00
|
|
|
int error;
|
|
|
|
|
|
|
|
DEBUG_DVC("ChannelId=%d size=%d", ChannelId, data_size);
|
|
|
|
|
2012-04-25 22:27:38 +04:00
|
|
|
if (drdynvc->channel_error != CHANNEL_RC_OK)
|
|
|
|
return 1;
|
|
|
|
|
2011-07-19 10:07:15 +04:00
|
|
|
data_out = stream_new(CHANNEL_CHUNK_LENGTH);
|
|
|
|
stream_set_pos(data_out, 1);
|
|
|
|
cbChId = drdynvc_write_variable_uint(data_out, ChannelId);
|
|
|
|
|
2012-11-20 07:31:15 +04:00
|
|
|
if (data_size == 0)
|
2012-04-25 22:26:35 +04:00
|
|
|
{
|
|
|
|
pos = stream_get_pos(data_out);
|
|
|
|
stream_set_pos(data_out, 0);
|
2012-10-09 11:01:37 +04:00
|
|
|
stream_write_BYTE(data_out, 0x40 | cbChId);
|
2012-04-25 22:26:35 +04:00
|
|
|
stream_set_pos(data_out, pos);
|
2012-11-20 07:31:15 +04:00
|
|
|
error = svc_plugin_send((rdpSvcPlugin*) drdynvc, data_out);
|
2012-04-25 22:26:35 +04:00
|
|
|
}
|
|
|
|
else if (data_size <= CHANNEL_CHUNK_LENGTH - pos)
|
2011-07-19 10:07:15 +04:00
|
|
|
{
|
|
|
|
pos = stream_get_pos(data_out);
|
|
|
|
stream_set_pos(data_out, 0);
|
2012-10-09 11:01:37 +04:00
|
|
|
stream_write_BYTE(data_out, 0x30 | cbChId);
|
2011-07-19 10:07:15 +04:00
|
|
|
stream_set_pos(data_out, pos);
|
|
|
|
stream_write(data_out, data, data_size);
|
2012-11-20 07:31:15 +04:00
|
|
|
error = svc_plugin_send((rdpSvcPlugin*) drdynvc, data_out);
|
2011-07-19 10:07:15 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Fragment the data */
|
|
|
|
cbLen = drdynvc_write_variable_uint(data_out, data_size);
|
|
|
|
pos = stream_get_pos(data_out);
|
|
|
|
stream_set_pos(data_out, 0);
|
2012-10-09 11:01:37 +04:00
|
|
|
stream_write_BYTE(data_out, 0x20 | cbChId | (cbLen << 2));
|
2011-07-19 10:07:15 +04:00
|
|
|
stream_set_pos(data_out, pos);
|
|
|
|
chunk_len = CHANNEL_CHUNK_LENGTH - pos;
|
|
|
|
stream_write(data_out, data, chunk_len);
|
|
|
|
data += chunk_len;
|
|
|
|
data_size -= chunk_len;
|
2012-11-20 07:31:15 +04:00
|
|
|
error = svc_plugin_send((rdpSvcPlugin*) drdynvc, data_out);
|
2011-07-19 10:07:15 +04:00
|
|
|
|
|
|
|
while (error == CHANNEL_RC_OK && data_size > 0)
|
|
|
|
{
|
|
|
|
data_out = stream_new(CHANNEL_CHUNK_LENGTH);
|
|
|
|
stream_set_pos(data_out, 1);
|
|
|
|
cbChId = drdynvc_write_variable_uint(data_out, ChannelId);
|
|
|
|
|
|
|
|
pos = stream_get_pos(data_out);
|
|
|
|
stream_set_pos(data_out, 0);
|
2012-10-09 11:01:37 +04:00
|
|
|
stream_write_BYTE(data_out, 0x30 | cbChId);
|
2011-07-19 10:07:15 +04:00
|
|
|
stream_set_pos(data_out, pos);
|
|
|
|
|
|
|
|
chunk_len = data_size;
|
|
|
|
if (chunk_len > CHANNEL_CHUNK_LENGTH - pos)
|
|
|
|
chunk_len = CHANNEL_CHUNK_LENGTH - pos;
|
|
|
|
stream_write(data_out, data, chunk_len);
|
|
|
|
data += chunk_len;
|
|
|
|
data_size -= chunk_len;
|
|
|
|
error = svc_plugin_send((rdpSvcPlugin*)drdynvc, data_out);
|
|
|
|
}
|
|
|
|
}
|
2012-11-20 07:31:15 +04:00
|
|
|
|
2011-07-19 10:07:15 +04:00
|
|
|
if (error != CHANNEL_RC_OK)
|
|
|
|
{
|
2012-04-25 22:27:38 +04:00
|
|
|
drdynvc->channel_error = error;
|
2011-07-19 10:07:15 +04:00
|
|
|
DEBUG_WARN("VirtualChannelWrite failed %d", error);
|
|
|
|
return 1;
|
|
|
|
}
|
2012-11-20 07:31:15 +04:00
|
|
|
|
2011-07-19 10:07:15 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-03-29 05:13:56 +04:00
|
|
|
int drdynvc_push_event(drdynvcPlugin* drdynvc, wMessage* event)
|
2011-07-19 10:07:15 +04:00
|
|
|
{
|
|
|
|
int error;
|
|
|
|
|
2012-11-20 07:31:15 +04:00
|
|
|
error = svc_plugin_send_event((rdpSvcPlugin*) drdynvc, event);
|
|
|
|
|
2011-07-19 10:07:15 +04:00
|
|
|
if (error != CHANNEL_RC_OK)
|
|
|
|
{
|
|
|
|
DEBUG_WARN("pVirtualChannelEventPush failed %d", error);
|
|
|
|
return 1;
|
|
|
|
}
|
2012-11-20 07:31:15 +04:00
|
|
|
|
2011-07-19 10:07:15 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static int drdynvc_process_capability_request(drdynvcPlugin* drdynvc, int Sp, int cbChId, wStream* s)
|
2011-07-19 10:07:15 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* data_out;
|
2011-07-19 10:07:15 +04:00
|
|
|
int error;
|
|
|
|
|
|
|
|
DEBUG_DVC("Sp=%d cbChId=%d", Sp, cbChId);
|
2011-09-19 18:53:00 +04:00
|
|
|
stream_seek(s, 1); /* pad */
|
2012-10-09 11:01:37 +04:00
|
|
|
stream_read_UINT16(s, drdynvc->version);
|
2012-11-20 07:31:15 +04:00
|
|
|
|
2011-07-19 10:07:15 +04:00
|
|
|
if (drdynvc->version == 2)
|
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
stream_read_UINT16(s, drdynvc->PriorityCharge0);
|
|
|
|
stream_read_UINT16(s, drdynvc->PriorityCharge1);
|
|
|
|
stream_read_UINT16(s, drdynvc->PriorityCharge2);
|
|
|
|
stream_read_UINT16(s, drdynvc->PriorityCharge3);
|
2011-07-19 10:07:15 +04:00
|
|
|
}
|
2012-11-20 07:31:15 +04:00
|
|
|
|
2011-07-19 10:07:15 +04:00
|
|
|
data_out = stream_new(4);
|
2012-10-09 11:01:37 +04:00
|
|
|
stream_write_UINT16(data_out, 0x0050); /* Cmd+Sp+cbChId+Pad. Note: MSTSC sends 0x005c */
|
|
|
|
stream_write_UINT16(data_out, drdynvc->version);
|
2012-11-20 07:31:15 +04:00
|
|
|
error = svc_plugin_send((rdpSvcPlugin*) drdynvc, data_out);
|
|
|
|
|
2011-07-19 10:07:15 +04:00
|
|
|
if (error != CHANNEL_RC_OK)
|
|
|
|
{
|
|
|
|
DEBUG_WARN("VirtualChannelWrite failed %d", error);
|
|
|
|
return 1;
|
|
|
|
}
|
2012-11-20 07:31:15 +04:00
|
|
|
|
2012-04-25 22:27:38 +04:00
|
|
|
drdynvc->channel_error = error;
|
|
|
|
|
2011-07-19 10:07:15 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static UINT32 drdynvc_read_variable_uint(wStream* stream, int cbLen)
|
2011-07-19 10:07:15 +04:00
|
|
|
{
|
2012-10-09 11:26:39 +04:00
|
|
|
UINT32 val;
|
2011-07-19 10:07:15 +04:00
|
|
|
|
|
|
|
switch (cbLen)
|
|
|
|
{
|
|
|
|
case 0:
|
2012-10-09 11:01:37 +04:00
|
|
|
stream_read_BYTE(stream, val);
|
2011-07-19 10:07:15 +04:00
|
|
|
break;
|
2012-11-20 07:31:15 +04:00
|
|
|
|
2011-07-19 10:07:15 +04:00
|
|
|
case 1:
|
2012-10-09 11:01:37 +04:00
|
|
|
stream_read_UINT16(stream, val);
|
2011-07-19 10:07:15 +04:00
|
|
|
break;
|
2012-11-20 07:31:15 +04:00
|
|
|
|
2011-07-19 10:07:15 +04:00
|
|
|
default:
|
2012-10-09 11:26:39 +04:00
|
|
|
stream_read_UINT32(stream, val);
|
2011-07-19 10:07:15 +04:00
|
|
|
break;
|
|
|
|
}
|
2012-11-20 07:31:15 +04:00
|
|
|
|
2011-07-19 10:07:15 +04:00
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static int drdynvc_process_create_request(drdynvcPlugin* drdynvc, int Sp, int cbChId, wStream* s)
|
2011-07-19 10:07:15 +04:00
|
|
|
{
|
|
|
|
int pos;
|
|
|
|
int error;
|
2012-10-09 11:26:39 +04:00
|
|
|
UINT32 ChannelId;
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* data_out;
|
2011-07-19 10:07:15 +04:00
|
|
|
|
2011-09-19 18:53:00 +04:00
|
|
|
ChannelId = drdynvc_read_variable_uint(s, cbChId);
|
|
|
|
pos = stream_get_pos(s);
|
|
|
|
DEBUG_DVC("ChannelId=%d ChannelName=%s", ChannelId, stream_get_tail(s));
|
2011-07-19 10:07:15 +04:00
|
|
|
|
2012-11-20 07:31:15 +04:00
|
|
|
error = dvcman_create_channel(drdynvc->channel_mgr, ChannelId, (char*) stream_get_tail(s));
|
2011-07-19 10:07:15 +04:00
|
|
|
|
|
|
|
data_out = stream_new(pos + 4);
|
2012-10-09 11:01:37 +04:00
|
|
|
stream_write_BYTE(data_out, 0x10 | cbChId);
|
2011-09-19 18:53:00 +04:00
|
|
|
stream_set_pos(s, 1);
|
|
|
|
stream_copy(data_out, s, pos - 1);
|
2011-07-19 10:07:15 +04:00
|
|
|
|
|
|
|
if (error == 0)
|
|
|
|
{
|
|
|
|
DEBUG_DVC("channel created");
|
2012-10-09 11:26:39 +04:00
|
|
|
stream_write_UINT32(data_out, 0);
|
2011-07-19 10:07:15 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DEBUG_DVC("no listener");
|
2012-10-09 11:26:39 +04:00
|
|
|
stream_write_UINT32(data_out, (UINT32)(-1));
|
2011-07-19 10:07:15 +04:00
|
|
|
}
|
|
|
|
|
2012-11-20 07:31:15 +04:00
|
|
|
error = svc_plugin_send((rdpSvcPlugin*) drdynvc, data_out);
|
|
|
|
|
2011-07-19 10:07:15 +04:00
|
|
|
if (error != CHANNEL_RC_OK)
|
|
|
|
{
|
|
|
|
DEBUG_WARN("VirtualChannelWrite failed %d", error);
|
|
|
|
return 1;
|
|
|
|
}
|
2012-11-20 07:31:15 +04:00
|
|
|
|
2011-07-19 10:07:15 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static int drdynvc_process_data_first(drdynvcPlugin* drdynvc, int Sp, int cbChId, wStream* s)
|
2011-07-19 10:07:15 +04:00
|
|
|
{
|
|
|
|
int error;
|
2012-11-20 07:31:15 +04:00
|
|
|
UINT32 Length;
|
|
|
|
UINT32 ChannelId;
|
2011-07-19 10:07:15 +04:00
|
|
|
|
2011-09-19 18:53:00 +04:00
|
|
|
ChannelId = drdynvc_read_variable_uint(s, cbChId);
|
|
|
|
Length = drdynvc_read_variable_uint(s, Sp);
|
2011-07-19 10:07:15 +04:00
|
|
|
DEBUG_DVC("ChannelId=%d Length=%d", ChannelId, Length);
|
|
|
|
|
|
|
|
error = dvcman_receive_channel_data_first(drdynvc->channel_mgr, ChannelId, Length);
|
2012-11-20 07:31:15 +04:00
|
|
|
|
2011-07-19 10:07:15 +04:00
|
|
|
if (error)
|
|
|
|
return error;
|
|
|
|
|
|
|
|
return dvcman_receive_channel_data(drdynvc->channel_mgr, ChannelId,
|
2011-09-19 18:53:00 +04:00
|
|
|
stream_get_tail(s), stream_get_left(s));
|
2011-07-19 10:07:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static int drdynvc_process_data(drdynvcPlugin* drdynvc, int Sp, int cbChId, wStream* s)
|
2011-07-19 10:07:15 +04:00
|
|
|
{
|
2012-10-09 11:26:39 +04:00
|
|
|
UINT32 ChannelId;
|
2011-07-19 10:07:15 +04:00
|
|
|
|
2011-09-19 18:53:00 +04:00
|
|
|
ChannelId = drdynvc_read_variable_uint(s, cbChId);
|
2011-07-19 10:07:15 +04:00
|
|
|
DEBUG_DVC("ChannelId=%d", ChannelId);
|
|
|
|
|
|
|
|
return dvcman_receive_channel_data(drdynvc->channel_mgr, ChannelId,
|
2011-09-19 18:53:00 +04:00
|
|
|
stream_get_tail(s), stream_get_left(s));
|
2011-07-19 10:07:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static int drdynvc_process_close_request(drdynvcPlugin* drdynvc, int Sp, int cbChId, wStream* s)
|
2011-07-19 10:07:15 +04:00
|
|
|
{
|
2012-10-09 11:26:39 +04:00
|
|
|
UINT32 ChannelId;
|
2011-07-19 10:07:15 +04:00
|
|
|
|
2011-09-19 18:53:00 +04:00
|
|
|
ChannelId = drdynvc_read_variable_uint(s, cbChId);
|
2011-07-19 10:07:15 +04:00
|
|
|
DEBUG_DVC("ChannelId=%d", ChannelId);
|
|
|
|
dvcman_close_channel(drdynvc->channel_mgr, ChannelId);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static void drdynvc_process_receive(rdpSvcPlugin* plugin, wStream* s)
|
2011-07-19 10:07:15 +04:00
|
|
|
{
|
|
|
|
int value;
|
|
|
|
int Cmd;
|
|
|
|
int Sp;
|
|
|
|
int cbChId;
|
2012-11-20 07:31:15 +04:00
|
|
|
drdynvcPlugin* drdynvc = (drdynvcPlugin*) plugin;
|
2011-07-19 10:07:15 +04:00
|
|
|
|
2012-10-09 11:01:37 +04:00
|
|
|
stream_read_BYTE(s, value);
|
2011-07-19 10:07:15 +04:00
|
|
|
Cmd = (value & 0xf0) >> 4;
|
|
|
|
Sp = (value & 0x0c) >> 2;
|
|
|
|
cbChId = (value & 0x03) >> 0;
|
2011-09-19 18:53:00 +04:00
|
|
|
|
|
|
|
DEBUG_DVC("Cmd=0x%x", Cmd);
|
2011-07-19 10:07:15 +04:00
|
|
|
|
|
|
|
switch (Cmd)
|
|
|
|
{
|
|
|
|
case CAPABILITY_REQUEST_PDU:
|
2011-09-19 18:53:00 +04:00
|
|
|
drdynvc_process_capability_request(drdynvc, Sp, cbChId, s);
|
2011-07-19 10:07:15 +04:00
|
|
|
break;
|
|
|
|
case CREATE_REQUEST_PDU:
|
2011-09-19 18:53:00 +04:00
|
|
|
drdynvc_process_create_request(drdynvc, Sp, cbChId, s);
|
2011-07-19 10:07:15 +04:00
|
|
|
break;
|
|
|
|
case DATA_FIRST_PDU:
|
2011-09-19 18:53:00 +04:00
|
|
|
drdynvc_process_data_first(drdynvc, Sp, cbChId, s);
|
2011-07-19 10:07:15 +04:00
|
|
|
break;
|
|
|
|
case DATA_PDU:
|
2011-09-19 18:53:00 +04:00
|
|
|
drdynvc_process_data(drdynvc, Sp, cbChId, s);
|
2011-07-19 10:07:15 +04:00
|
|
|
break;
|
|
|
|
case CLOSE_REQUEST_PDU:
|
2011-09-19 18:53:00 +04:00
|
|
|
drdynvc_process_close_request(drdynvc, Sp, cbChId, s);
|
2011-07-19 10:07:15 +04:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
DEBUG_WARN("unknown drdynvc cmd 0x%x", Cmd);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-09-19 18:53:00 +04:00
|
|
|
stream_free(s);
|
2011-07-19 10:07:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void drdynvc_process_connect(rdpSvcPlugin* plugin)
|
|
|
|
{
|
2012-11-20 07:31:15 +04:00
|
|
|
int index;
|
|
|
|
ADDIN_ARGV* args;
|
|
|
|
rdpSettings* settings;
|
2011-07-19 10:07:15 +04:00
|
|
|
drdynvcPlugin* drdynvc = (drdynvcPlugin*)plugin;
|
|
|
|
|
|
|
|
DEBUG_DVC("connecting");
|
|
|
|
|
|
|
|
drdynvc->channel_mgr = dvcman_new(drdynvc);
|
2012-04-25 22:27:38 +04:00
|
|
|
drdynvc->channel_error = 0;
|
2012-11-20 07:31:15 +04:00
|
|
|
|
|
|
|
settings = (rdpSettings*) ((rdpSvcPlugin*) plugin)->channel_entry_points.pExtendedData;
|
|
|
|
|
|
|
|
for (index = 0; index < settings->DynamicChannelCount; index++)
|
|
|
|
{
|
|
|
|
args = settings->DynamicChannelArray[index];
|
|
|
|
dvcman_load_addin(drdynvc->channel_mgr, args);
|
|
|
|
}
|
|
|
|
|
2011-07-19 10:07:15 +04:00
|
|
|
dvcman_init(drdynvc->channel_mgr);
|
|
|
|
}
|
|
|
|
|
2013-03-29 05:13:56 +04:00
|
|
|
static void drdynvc_process_event(rdpSvcPlugin* plugin, wMessage* event)
|
2011-07-19 10:07:15 +04:00
|
|
|
{
|
|
|
|
freerdp_event_free(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void drdynvc_process_terminate(rdpSvcPlugin* plugin)
|
|
|
|
{
|
2012-11-20 07:31:15 +04:00
|
|
|
drdynvcPlugin* drdynvc = (drdynvcPlugin*) plugin;
|
2011-07-19 10:07:15 +04:00
|
|
|
|
|
|
|
DEBUG_DVC("terminating");
|
|
|
|
|
|
|
|
if (drdynvc->channel_mgr != NULL)
|
|
|
|
dvcman_free(drdynvc->channel_mgr);
|
2012-10-09 04:26:11 +04:00
|
|
|
|
2012-10-09 07:21:26 +04:00
|
|
|
free(drdynvc);
|
2011-07-19 10:07:15 +04:00
|
|
|
}
|
|
|
|
|
2012-10-09 06:48:17 +04:00
|
|
|
/* drdynvc is always built-in */
|
2012-10-09 04:26:11 +04:00
|
|
|
#define VirtualChannelEntry drdynvc_VirtualChannelEntry
|
|
|
|
|
2012-11-01 07:04:31 +04:00
|
|
|
int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
|
2012-10-09 04:26:11 +04:00
|
|
|
{
|
|
|
|
drdynvcPlugin* _p;
|
|
|
|
|
|
|
|
_p = (drdynvcPlugin*) malloc(sizeof(drdynvcPlugin));
|
|
|
|
ZeroMemory(_p, sizeof(drdynvcPlugin));
|
|
|
|
|
|
|
|
_p->plugin.channel_def.options =
|
|
|
|
CHANNEL_OPTION_INITIALIZED |
|
|
|
|
CHANNEL_OPTION_ENCRYPT_RDP |
|
|
|
|
CHANNEL_OPTION_COMPRESS_RDP;
|
|
|
|
|
|
|
|
strcpy(_p->plugin.channel_def.name, "drdynvc");
|
|
|
|
|
|
|
|
_p->plugin.connect_callback = drdynvc_process_connect;
|
|
|
|
_p->plugin.receive_callback = drdynvc_process_receive;
|
|
|
|
_p->plugin.event_callback = drdynvc_process_event;
|
|
|
|
_p->plugin.terminate_callback = drdynvc_process_terminate;
|
|
|
|
|
|
|
|
svc_plugin_init((rdpSvcPlugin*) _p, pEntryPoints);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|