2 * FreeRDP: A Remote Desktop Protocol client.
3 * Static Virtual Channel Interface
5 * Copyright 2009-2011 Jay Sorg
6 * Copyright 2010-2011 Vic Lee
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
21 #ifndef __SVC_PLUGIN_UTILS_H
22 #define __SVC_PLUGIN_UTILS_H
24 /* static channel plugin base implementation */
26 #include <freerdp/api.h>
27 #include <freerdp/svc.h>
28 #include <freerdp/utils/stream.h>
29 #include <freerdp/utils/event.h>
30 #include <freerdp/utils/debug.h>
32 typedef struct rdp_svc_plugin_private rdpSvcPluginPrivate;
33 typedef struct rdp_svc_plugin rdpSvcPlugin;
37 CHANNEL_ENTRY_POINTS_EX channel_entry_points;
38 CHANNEL_DEF channel_def;
42 void (*connect_callback)(rdpSvcPlugin* plugin);
43 void (*receive_callback)(rdpSvcPlugin* plugin, STREAM* data_in);
44 void (*event_callback)(rdpSvcPlugin* plugin, RDP_EVENT* event);
45 void (*interval_callback)(rdpSvcPlugin* plugin);
46 void (*terminate_callback)(rdpSvcPlugin* plugin);
48 rdpSvcPluginPrivate* priv;
51 FREERDP_API void svc_plugin_init(rdpSvcPlugin* plugin, CHANNEL_ENTRY_POINTS* pEntryPoints);
52 FREERDP_API int svc_plugin_send(rdpSvcPlugin* plugin, STREAM* data_out);
53 FREERDP_API int svc_plugin_send_event(rdpSvcPlugin* plugin, RDP_EVENT* event);
55 #define svc_plugin_get_data(_p) (RDP_PLUGIN_DATA*)(((rdpSvcPlugin*)_p)->channel_entry_points.pExtendedData)
58 #define DEBUG_SVC(fmt, ...) DEBUG_CLASS(SVC, fmt, ## __VA_ARGS__)
60 #define DEBUG_SVC(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
63 #define DEFINE_SVC_PLUGIN(_prefix, _name, _options) \
65 int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints) \
67 _prefix##Plugin* _p; \
69 _p = xnew(_prefix##Plugin); \
71 _p->plugin.channel_def.options = _options; \
72 strcpy(_p->plugin.channel_def.name, _name); \
74 _p->plugin.connect_callback = _prefix##_process_connect; \
75 _p->plugin.receive_callback = _prefix##_process_receive; \
76 _p->plugin.event_callback = _prefix##_process_event; \
77 _p->plugin.terminate_callback = _prefix##_process_terminate; \
79 svc_plugin_init((rdpSvcPlugin*)_p, pEntryPoints); \
84 #endif /* __SVC_PLUGIN_UTILS_H */