server: proxy: prepare for exporting gfx capture to a module
This commit is contained in:
parent
715c3f293a
commit
7d48a587d2
@ -55,10 +55,13 @@ static proxyPlugin demo_plugin = {
|
||||
plugin_desc, /* description */
|
||||
demo_plugin_unload, /* PluginUnload */
|
||||
NULL, /* ClientPreConnect */
|
||||
NULL, /* ClientPostConnect */
|
||||
NULL, /* ClientLoginFailure */
|
||||
NULL, /* ClientEndPaint */
|
||||
NULL, /* ServerPostConnect */
|
||||
NULL, /* ServerChannelsInit */
|
||||
NULL, /* ServerChannelsFree */
|
||||
NULL, /* ServerSessionEnd */
|
||||
demo_filter_keyboard_event, /* KeyboardEvent */
|
||||
NULL, /* MouseEvent */
|
||||
NULL, /* ClientChannelData */
|
||||
|
@ -48,10 +48,13 @@ typedef struct proxy_plugin
|
||||
|
||||
/* proxy hooks. a module can set these function pointers to register hooks */
|
||||
proxyHookFn ClientPreConnect;
|
||||
proxyHookFn ClientPostConnect;
|
||||
proxyHookFn ClientLoginFailure;
|
||||
proxyHookFn ClientEndPaint;
|
||||
proxyHookFn ServerPostConnect;
|
||||
proxyHookFn ServerChannelsInit;
|
||||
proxyHookFn ServerChannelsFree;
|
||||
proxyHookFn ServerSessionEnd;
|
||||
|
||||
/* proxy filters. a module can set these function pointers to register filters */
|
||||
proxyFilterFn KeyboardEvent;
|
||||
|
@ -298,6 +298,9 @@ static BOOL pf_client_post_connect(freerdp* instance)
|
||||
ps = (rdpContext*)pc->pdata->ps;
|
||||
config = pc->pdata->config;
|
||||
|
||||
if (!pf_modules_run_hook(HOOK_TYPE_CLIENT_POST_CONNECT, pc->pdata))
|
||||
return FALSE;
|
||||
|
||||
if (config->SessionCapture)
|
||||
{
|
||||
if (!pf_capture_create_session_directory(pc))
|
||||
|
@ -47,8 +47,8 @@ static const char* FILTER_TYPE_STRINGS[] = {
|
||||
};
|
||||
|
||||
static const char* HOOK_TYPE_STRINGS[] = {
|
||||
"CLIENT_PRE_CONNECT", "CLIENT_LOGIN_FAILURE", "SERVER_POST_CONNECT",
|
||||
"SERVER_CHANNELS_INIT", "SERVER_CHANNELS_FREE",
|
||||
"CLIENT_PRE_CONNECT", "CLIENT_POST_CONNECT", "CLIENT_LOGIN_FAILURE", "CLIENT_END_PAINT",
|
||||
"SERVER_POST_CONNECT", "SERVER_CHANNELS_INIT", "SERVER_CHANNELS_FREE", "SERVER_SESSION_END",
|
||||
};
|
||||
|
||||
static const char* pf_modules_get_filter_type_string(PF_FILTER_TYPE result)
|
||||
@ -89,10 +89,18 @@ BOOL pf_modules_run_hook(PF_HOOK_TYPE type, proxyData* pdata)
|
||||
IFCALLRET(plugin->ClientPreConnect, ok, pdata);
|
||||
break;
|
||||
|
||||
case HOOK_TYPE_CLIENT_POST_CONNECT:
|
||||
IFCALLRET(plugin->ClientPostConnect, ok, pdata);
|
||||
break;
|
||||
|
||||
case HOOK_TYPE_CLIENT_LOGIN_FAILURE:
|
||||
IFCALLRET(plugin->ClientLoginFailure, ok, pdata);
|
||||
break;
|
||||
|
||||
case HOOK_TYPE_CLIENT_END_PAINT:
|
||||
IFCALLRET(plugin->ClientEndPaint, ok, pdata);
|
||||
break;
|
||||
|
||||
case HOOK_TYPE_SERVER_POST_CONNECT:
|
||||
IFCALLRET(plugin->ServerPostConnect, ok, pdata);
|
||||
break;
|
||||
@ -105,6 +113,10 @@ BOOL pf_modules_run_hook(PF_HOOK_TYPE type, proxyData* pdata)
|
||||
IFCALLRET(plugin->ServerChannelsFree, ok, pdata);
|
||||
break;
|
||||
|
||||
case HOOK_TYPE_SERVER_SESSION_END:
|
||||
IFCALLRET(plugin->ServerSessionEnd, ok, pdata);
|
||||
break;
|
||||
|
||||
default:
|
||||
WLog_ERR(TAG, "invalid hook called");
|
||||
}
|
||||
|
@ -41,11 +41,14 @@ typedef enum _PF_HOOK_TYPE PF_HOOK_TYPE;
|
||||
enum _PF_HOOK_TYPE
|
||||
{
|
||||
HOOK_TYPE_CLIENT_PRE_CONNECT,
|
||||
HOOK_TYPE_CLIENT_POST_CONNECT,
|
||||
HOOK_TYPE_CLIENT_LOGIN_FAILURE,
|
||||
HOOK_TYPE_CLIENT_END_PAINT,
|
||||
|
||||
HOOK_TYPE_SERVER_POST_CONNECT,
|
||||
HOOK_TYPE_SERVER_CHANNELS_INIT,
|
||||
HOOK_TYPE_SERVER_CHANNELS_FREE,
|
||||
HOOK_TYPE_SERVER_SESSION_END,
|
||||
|
||||
HOOK_LAST
|
||||
};
|
||||
|
@ -420,6 +420,7 @@ fail:
|
||||
LOG_INFO(TAG, ps, "starting shutdown of connection");
|
||||
LOG_INFO(TAG, ps, "stopping proxy's client");
|
||||
freerdp_client_stop(pc);
|
||||
pf_modules_run_hook(HOOK_TYPE_SERVER_SESSION_END, pdata);
|
||||
LOG_INFO(TAG, ps, "freeing server's channels");
|
||||
pf_server_channels_free(ps);
|
||||
LOG_INFO(TAG, ps, "freeing proxy data");
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <winpr/image.h>
|
||||
#include <winpr/sysinfo.h>
|
||||
|
||||
#include "pf_modules.h"
|
||||
#include "pf_update.h"
|
||||
#include "pf_capture.h"
|
||||
#include "pf_context.h"
|
||||
@ -78,6 +79,9 @@ static BOOL pf_client_end_paint(rdpContext* context)
|
||||
if (!ps->update->EndPaint(ps))
|
||||
return FALSE;
|
||||
|
||||
if (!pf_modules_run_hook(HOOK_TYPE_CLIENT_END_PAINT, pdata))
|
||||
return FALSE;
|
||||
|
||||
if (!pdata->config->SessionCapture)
|
||||
return TRUE;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user