mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-16 01:14:26 +09:00
Currently not working are rename and setting of read only attribute and file times. In addition it also adds the ability to staticly link plugins into the binary, so you get one big exe and need no dlls. I have only tested this on windows (only disk plugin so far). I use the following options for cmake for static binary: cmake -DWITH_MONOLITHIC_BUILD=ON -DMSVC_RUNTIME=static -DBUILD_SHARED_LIBS=OFF -DWITH_RDPDR=ON -DOPENSSL_INCLUDE_DIR=\opensslpath\inc32 -DOPENSSL_LIBRARIES="\opensslpath\out32.dbg\ssleay32.lib;d:\path\out32.dbg\libeay32.lib" -G "Visual Studio 9 2008" . Important notice: Openssl need to be compiled with the same static runtime. Currently missing is a switch to link different openssl libraries for debug and release builds.
97 lines
3.3 KiB
C
97 lines
3.3 KiB
C
/**
|
|
* FreeRDP: A Remote Desktop Protocol client.
|
|
* Static Virtual Channel Interface
|
|
*
|
|
* Copyright 2009-2011 Jay Sorg
|
|
* 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.
|
|
*/
|
|
|
|
#ifndef __SVC_PLUGIN_UTILS_H
|
|
#define __SVC_PLUGIN_UTILS_H
|
|
|
|
/* static channel plugin base implementation */
|
|
|
|
#include <freerdp/api.h>
|
|
#include <freerdp/svc.h>
|
|
#include <freerdp/utils/stream.h>
|
|
#include <freerdp/utils/event.h>
|
|
#include <freerdp/utils/debug.h>
|
|
|
|
typedef struct rdp_svc_plugin_private rdpSvcPluginPrivate;
|
|
typedef struct rdp_svc_plugin rdpSvcPlugin;
|
|
|
|
struct rdp_svc_plugin
|
|
{
|
|
CHANNEL_ENTRY_POINTS_EX channel_entry_points;
|
|
CHANNEL_DEF channel_def;
|
|
|
|
int interval_ms;
|
|
|
|
void (*connect_callback)(rdpSvcPlugin* plugin);
|
|
void (*receive_callback)(rdpSvcPlugin* plugin, STREAM* data_in);
|
|
void (*event_callback)(rdpSvcPlugin* plugin, RDP_EVENT* event);
|
|
void (*interval_callback)(rdpSvcPlugin* plugin);
|
|
void (*terminate_callback)(rdpSvcPlugin* plugin);
|
|
|
|
rdpSvcPluginPrivate* priv;
|
|
};
|
|
|
|
FREERDP_API void svc_plugin_init(rdpSvcPlugin* plugin, CHANNEL_ENTRY_POINTS* pEntryPoints);
|
|
FREERDP_API int svc_plugin_send(rdpSvcPlugin* plugin, STREAM* data_out);
|
|
FREERDP_API int svc_plugin_send_event(rdpSvcPlugin* plugin, RDP_EVENT* event);
|
|
|
|
#define svc_plugin_get_data(_p) (RDP_PLUGIN_DATA*)(((rdpSvcPlugin*)_p)->channel_entry_points.pExtendedData)
|
|
|
|
#ifdef WITH_DEBUG_SVC
|
|
#define DEBUG_SVC(fmt, ...) DEBUG_CLASS(SVC, fmt, ## __VA_ARGS__)
|
|
#else
|
|
#define DEBUG_SVC(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
|
|
#endif
|
|
|
|
#ifdef WITH_STATIC_PLUGINS
|
|
#define DEFINE_SVC_PLUGIN_ENTRY(_prefix) int _prefix##_entry(PCHANNEL_ENTRY_POINTS pEntryPoints)
|
|
#define DEFINE_DEV_PLUGIN_ENTRY(_prefix) int _prefix##_entry(PCHANNEL_ENTRY_POINTS pEntryPoints)
|
|
#define REGISTER_SVC_PLUGIN_ENTRY(_prefix) freerdp_register_static_plugin(#_prefix, "VirtualChannelEntry", _prefix##_entry)
|
|
#define REGISTER_DEV_PLUGIN_ENTRY(_prefix) freerdp_register_static_plugin(#_prefix, "DeviceServiceEntry", _prefix##_entry)
|
|
#else
|
|
#define REGISTER_DEV_PLUGIN_ENTRY(_prefix)
|
|
#define REGISTER_SVC_PLUGIN_ENTRY(_prefix)
|
|
#define DEFINE_DEV_PLUGIN_ENTRY(_prefix)
|
|
#define DEFINE_SVC_PLUGIN_ENTRY(_prefix) int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
|
|
#endif
|
|
|
|
#define DEFINE_SVC_PLUGIN(_prefix, _name, _options) \
|
|
\
|
|
DEFINE_SVC_PLUGIN_ENTRY(_prefix) \
|
|
{ \
|
|
_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 */
|