channels: partial cleanup

This commit is contained in:
Marc-André Moreau 2013-03-29 14:49:09 -04:00
parent c65ee0c2f4
commit f4df4e4b26
6 changed files with 96 additions and 41 deletions

View File

@ -985,6 +985,7 @@ int freerdp_channels_client_load(rdpChannels* channels, rdpSettings* settings, v
ep.pVirtualChannelOpen = MyVirtualChannelOpen;
ep.pVirtualChannelClose = MyVirtualChannelClose;
ep.pVirtualChannelWrite = MyVirtualChannelWrite;
ep.pExtendedData = data;
ep.pVirtualChannelEventPush = MyVirtualChannelEventPush;
@ -1058,17 +1059,23 @@ int freerdp_channels_pre_connect(rdpChannels* channels, freerdp* instance)
{
lchannel_def.options = CHANNEL_OPTION_INITIALIZED |
CHANNEL_OPTION_ENCRYPT_RDP;
strcpy(lchannel_def.name, "rdpdr");
channels->can_call_init = 1;
channels->settings = instance->settings;
WaitForSingleObject(g_mutex_init, INFINITE);
g_init_channels = channels;
MyVirtualChannelInit(&dummy, &lchannel_def, 1,
VIRTUAL_CHANNEL_VERSION_WIN2000, 0);
MyVirtualChannelInit(&dummy, &lchannel_def, 1, VIRTUAL_CHANNEL_VERSION_WIN2000, 0);
g_init_channels = NULL;
ReleaseMutex(g_mutex_init);
channels->can_call_init = 0;
channels->settings = 0;
DEBUG_CHANNELS("registered fake rdpdr for rdpsnd.");
}
@ -1103,7 +1110,7 @@ int freerdp_channels_post_connect(rdpChannels* channels, freerdp* instance)
for (index = 0; index < channels->num_libs_data; index++)
{
llib = channels->libs_data + index;
llib = &channels->libs_data[index];
if (llib->init_event_proc != 0)
llib->init_event_proc(llib->init_handle, CHANNEL_EVENT_CONNECTED, hostname, hostname_len);

View File

@ -270,12 +270,37 @@ static void cliprdr_process_terminate(rdpSvcPlugin* plugin)
free(plugin);
}
/**
* Callback Interface
*/
int cliprdr_monitor_ready(CliprdrClientContext* context)
{
return 0;
}
int cliprdr_format_list(CliprdrClientContext* context)
{
return 0;
}
int cliprdr_data_request(CliprdrClientContext* context)
{
return 0;
}
int cliprdr_data_response(CliprdrClientContext* context)
{
return 0;
}
/* cliprdr is always built-in */
#define VirtualChannelEntry cliprdr_VirtualChannelEntry
int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
{
cliprdrPlugin* _p;
CliprdrClientContext* context;
_p = (cliprdrPlugin*) malloc(sizeof(cliprdrPlugin));
ZeroMemory(_p, sizeof(cliprdrPlugin));
@ -293,6 +318,15 @@ int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
_p->plugin.event_callback = cliprdr_process_event;
_p->plugin.terminate_callback = cliprdr_process_terminate;
context = (CliprdrClientContext*) malloc(sizeof(CliprdrClientContext));
context->MonitorReady = cliprdr_monitor_ready;
context->FormatList = cliprdr_format_list;
context->DataRequest = cliprdr_data_request;
context->DataResponse = cliprdr_data_response;
_p->plugin.channel_entry_points.pInterface = (void*) context;
svc_plugin_init((rdpSvcPlugin*) _p, pEntryPoints);
return 1;

View File

@ -29,9 +29,9 @@
#include <winpr/print.h>
#include <winpr/synch.h>
#include <winpr/thread.h>
#include <winpr/stream.h>
#include <freerdp/codec/dsp.h>
#include <winpr/stream.h>
#include <freerdp/channels/wtsvc.h>
#include <freerdp/server/rdpsnd.h>

View File

@ -291,7 +291,7 @@ static void df_process_channel_event(rdpChannels* channels, freerdp* instance)
break;
default:
fprintf(stderr, "df_process_channel_event: unknown event type %d\n", event->event_type);
fprintf(stderr, "df_process_channel_event: unknown event type %d\n", GetMessageType(event->id));
break;
}

View File

@ -21,9 +21,24 @@
#define FREERDP_CHANNEL_CLIENT_CLIPRDR_H
/**
* Event Types
* Client Interface
*/
typedef struct _cliprdr_client_context CliprdrClientContext;
typedef int (*pcCliprdrMonitorReady)(CliprdrClientContext* context);
typedef int (*pcCliprdrFormatList)(CliprdrClientContext* context);
typedef int (*pcCliprdrDataRequest)(CliprdrClientContext* context);
typedef int (*pcCliprdrDataResponse)(CliprdrClientContext* context);
struct _cliprdr_client_context
{
pcCliprdrMonitorReady MonitorReady;
pcCliprdrFormatList FormatList;
pcCliprdrDataRequest DataRequest;
pcCliprdrDataResponse DataResponse;
};
/**
* Clipboard Formats
*/

View File

@ -42,48 +42,43 @@ typedef struct _CHANNEL_DEF CHANNEL_DEF;
typedef CHANNEL_DEF* PCHANNEL_DEF;
typedef CHANNEL_DEF** PPCHANNEL_DEF;
typedef void (FREERDP_CC * PCHANNEL_INIT_EVENT_FN)(void* pInitHandle,
UINT32 event, void* pData, UINT32 dataLength);
typedef void (FREERDP_CC * PCHANNEL_INIT_EVENT_FN)(void* pInitHandle, UINT32 event, void* pData, UINT32 dataLength);
typedef void (FREERDP_CC * PCHANNEL_OPEN_EVENT_FN)(UINT32 openHandle, UINT32 event,
void* pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags);
typedef void (FREERDP_CC * PCHANNEL_OPEN_EVENT_FN)(UINT32 openHandle,
UINT32 event, void* pData, UINT32 dataLength,
UINT32 totalLength, UINT32 dataFlags);
#define CHANNEL_RC_OK 0
#define CHANNEL_RC_ALREADY_INITIALIZED 1
#define CHANNEL_RC_NOT_INITIALIZED 2
#define CHANNEL_RC_ALREADY_CONNECTED 3
#define CHANNEL_RC_NOT_CONNECTED 4
#define CHANNEL_RC_TOO_MANY_CHANNELS 5
#define CHANNEL_RC_BAD_CHANNEL 6
#define CHANNEL_RC_BAD_CHANNEL_HANDLE 7
#define CHANNEL_RC_NO_BUFFER 8
#define CHANNEL_RC_BAD_INIT_HANDLE 9
#define CHANNEL_RC_NOT_OPEN 10
#define CHANNEL_RC_BAD_PROC 11
#define CHANNEL_RC_NO_MEMORY 12
#define CHANNEL_RC_UNKNOWN_CHANNEL_NAME 13
#define CHANNEL_RC_ALREADY_OPEN 14
#define CHANNEL_RC_NOT_IN_VIRTUALCHANNELENTRY 15
#define CHANNEL_RC_NULL_DATA 16
#define CHANNEL_RC_ZERO_LENGTH 17
#define CHANNEL_RC_OK 0
#define CHANNEL_RC_ALREADY_INITIALIZED 1
#define CHANNEL_RC_NOT_INITIALIZED 2
#define CHANNEL_RC_ALREADY_CONNECTED 3
#define CHANNEL_RC_NOT_CONNECTED 4
#define CHANNEL_RC_TOO_MANY_CHANNELS 5
#define CHANNEL_RC_BAD_CHANNEL 6
#define CHANNEL_RC_BAD_CHANNEL_HANDLE 7
#define CHANNEL_RC_NO_BUFFER 8
#define CHANNEL_RC_BAD_INIT_HANDLE 9
#define CHANNEL_RC_NOT_OPEN 10
#define CHANNEL_RC_BAD_PROC 11
#define CHANNEL_RC_NO_MEMORY 12
#define CHANNEL_RC_UNKNOWN_CHANNEL_NAME 13
#define CHANNEL_RC_ALREADY_OPEN 14
#define CHANNEL_RC_NOT_IN_VIRTUALCHANNELENTRY 15
#define CHANNEL_RC_NULL_DATA 16
#define CHANNEL_RC_ZERO_LENGTH 17
#define VIRTUAL_CHANNEL_VERSION_WIN2000 1
#define VIRTUAL_CHANNEL_VERSION_WIN2000 1
typedef UINT32 (FREERDP_CC * PVIRTUALCHANNELINIT)(void** ppInitHandle, PCHANNEL_DEF pChannel,
int channelCount, UINT32 versionRequested, PCHANNEL_INIT_EVENT_FN pChannelInitEventProc);
typedef UINT32 (FREERDP_CC * PVIRTUALCHANNELOPEN)(void* pInitHandle, UINT32* pOpenHandle,
char* pChannelName, PCHANNEL_OPEN_EVENT_FN pChannelOpenEventProc);
typedef UINT32 (FREERDP_CC * PVIRTUALCHANNELINIT)(void** ppInitHandle,
PCHANNEL_DEF pChannel, int channelCount, UINT32 versionRequested,
PCHANNEL_INIT_EVENT_FN pChannelInitEventProc);
typedef UINT32 (FREERDP_CC * PVIRTUALCHANNELOPEN)(void* pInitHandle,
UINT32* pOpenHandle, char* pChannelName,
PCHANNEL_OPEN_EVENT_FN pChannelOpenEventProc);
typedef UINT32 (FREERDP_CC * PVIRTUALCHANNELCLOSE)(UINT32 openHandle);
typedef UINT32 (FREERDP_CC * PVIRTUALCHANNELWRITE)(UINT32 openHandle,
void* pData, UINT32 dataLength, void* pUserData);
typedef UINT32 (FREERDP_CC * PVIRTUALCHANNELWRITE)(UINT32 openHandle, void* pData, UINT32 dataLength, void* pUserData);
typedef UINT32 (FREERDP_CC * PVIRTUALCHANNELEVENTPUSH)(UINT32 openHandle,
wMessage* event);
typedef UINT32 (FREERDP_CC * PVIRTUALCHANNELEVENTPUSH)(UINT32 openHandle, wMessage* event);
struct _CHANNEL_ENTRY_POINTS
{
@ -107,7 +102,11 @@ struct _CHANNEL_ENTRY_POINTS_EX
PVIRTUALCHANNELOPEN pVirtualChannelOpen;
PVIRTUALCHANNELCLOSE pVirtualChannelClose;
PVIRTUALCHANNELWRITE pVirtualChannelWrite;
void* pExtendedData; /* extended data field to pass initial parameters */
/* Extended Fields */
void* pExtendedData; /* extended initial data */
void* pInterface; /* channel callback interface */
PVIRTUALCHANNELEVENTPUSH pVirtualChannelEventPush;
};
typedef struct _CHANNEL_ENTRY_POINTS_EX CHANNEL_ENTRY_POINTS_EX;