Merge pull request #20 from llyzs/svc

Trivial svc updates
This commit is contained in:
Otavio Salvador 2011-07-15 09:46:18 -07:00
commit 3f9a8521b8
4 changed files with 28 additions and 43 deletions

View File

@ -87,7 +87,7 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* data_in, uint32
cb_event->formats = (uint32*)xmalloc(sizeof(uint32) * num_formats); cb_event->formats = (uint32*)xmalloc(sizeof(uint32) * num_formats);
cb_event->num_formats = 0; cb_event->num_formats = 0;
if (num_formats * 36 != dataLen) if (num_formats * 36 != dataLen)
DEBUG_WARN("dataLen %d not devided by 36!"); DEBUG_WARN("dataLen %d not devided by 36!", dataLen);
for (i = 0; i < num_formats; i++) for (i = 0; i < num_formats; i++)
{ {
stream_read_uint32(data_in, format); stream_read_uint32(data_in, format);

View File

@ -170,24 +170,6 @@ static void cliprdr_process_terminate(rdpSvcPlugin* plugin)
xfree(plugin); xfree(plugin);
} }
int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints) DEFINE_SVC_PLUGIN(cliprdr, "cliprdr",
{ CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP |
cliprdrPlugin* cliprdr; CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL)
cliprdr = (cliprdrPlugin*)xmalloc(sizeof(cliprdrPlugin));
memset(cliprdr, 0, sizeof(cliprdrPlugin));
cliprdr->plugin.channel_def.options = CHANNEL_OPTION_INITIALIZED |
CHANNEL_OPTION_ENCRYPT_RDP | CHANNEL_OPTION_COMPRESS_RDP |
CHANNEL_OPTION_SHOW_PROTOCOL;
strcpy(cliprdr->plugin.channel_def.name, "cliprdr");
cliprdr->plugin.connect_callback = cliprdr_process_connect;
cliprdr->plugin.receive_callback = cliprdr_process_receive;
cliprdr->plugin.event_callback = cliprdr_process_event;
cliprdr->plugin.terminate_callback = cliprdr_process_terminate;
svc_plugin_init((rdpSvcPlugin*)cliprdr, pEntryPoints);
return 1;
}

View File

@ -64,24 +64,6 @@ static void rdpdbg_process_terminate(rdpSvcPlugin* plugin)
xfree(plugin); xfree(plugin);
} }
int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints) DEFINE_SVC_PLUGIN(rdpdbg, "rdpdbg",
{ CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP |
rdpdbgPlugin* rdpdbg; CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL)
rdpdbg = (rdpdbgPlugin*)xmalloc(sizeof(rdpdbgPlugin));
memset(rdpdbg, 0, sizeof(rdpdbgPlugin));
rdpdbg->plugin.channel_def.options = CHANNEL_OPTION_INITIALIZED |
CHANNEL_OPTION_ENCRYPT_RDP | CHANNEL_OPTION_COMPRESS_RDP |
CHANNEL_OPTION_SHOW_PROTOCOL;
strcpy(rdpdbg->plugin.channel_def.name, "rdpdbg");
rdpdbg->plugin.connect_callback = rdpdbg_process_connect;
rdpdbg->plugin.receive_callback = rdpdbg_process_receive;
rdpdbg->plugin.event_callback = rdpdbg_process_event;
rdpdbg->plugin.terminate_callback = rdpdbg_process_terminate;
svc_plugin_init((rdpSvcPlugin*)rdpdbg, pEntryPoints);
return 1;
}

View File

@ -53,4 +53,25 @@ int svc_plugin_send_event(rdpSvcPlugin* plugin, FRDP_EVENT* event);
#define DEBUG_SVC(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__) #define DEBUG_SVC(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
#endif #endif
#define DEFINE_SVC_PLUGIN(_prefix, _name, _options) \
\
int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints) \
{ \
_prefix##Plugin* _p; \
\
_p = xnew(_prefix##Plugin); \
\
_p->plugin.channel_def.options = _options; \
strcpy(_p->plugin.channel_def.name, _name); \
\
_p->plugin.connect_callback = _prefix##_process_connect; \
_p->plugin.receive_callback = _prefix##_process_receive; \
_p->plugin.event_callback = _prefix##_process_event; \
_p->plugin.terminate_callback = _prefix##_process_terminate; \
\
svc_plugin_init((rdpSvcPlugin*)_p, pEntryPoints); \
\
return 1; \
}
#endif /* __SVC_PLUGIN_UTILS_H */ #endif /* __SVC_PLUGIN_UTILS_H */