|
Packit Service |
b1ea74 |
/**
|
|
Packit Service |
b1ea74 |
* FreeRDP: A Remote Desktop Protocol Implementation
|
|
Packit Service |
b1ea74 |
* FreeRDP Proxy Server
|
|
Packit Service |
b1ea74 |
*
|
|
Packit Service |
b1ea74 |
* Copyright 2019 Kobi Mizrachi <kmizrachi18@gmail.com>
|
|
Packit Service |
b1ea74 |
*
|
|
Packit Service |
b1ea74 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
Packit Service |
b1ea74 |
* you may not use this file except in compliance with the License.
|
|
Packit Service |
b1ea74 |
* You may obtain a copy of the License at
|
|
Packit Service |
b1ea74 |
*
|
|
Packit Service |
b1ea74 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
Packit Service |
b1ea74 |
*
|
|
Packit Service |
b1ea74 |
* Unless required by applicable law or agreed to in writing, software
|
|
Packit Service |
b1ea74 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
Packit Service |
b1ea74 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
Packit Service |
b1ea74 |
* See the License for the specific language governing permissions and
|
|
Packit Service |
b1ea74 |
* limitations under the License.
|
|
Packit Service |
b1ea74 |
*/
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
#include <freerdp/server/disp.h>
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
#include "pf_disp.h"
|
|
Packit Service |
b1ea74 |
#include "pf_log.h"
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
#define TAG PROXY_TAG("disp")
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
BOOL pf_server_disp_init(pServerContext* ps)
|
|
Packit Service |
b1ea74 |
{
|
|
Packit Service |
b1ea74 |
DispServerContext* disp;
|
|
Packit Service |
b1ea74 |
disp = ps->disp = disp_server_context_new(ps->vcm);
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
if (!disp)
|
|
Packit Service |
b1ea74 |
{
|
|
Packit Service |
b1ea74 |
return FALSE;
|
|
Packit Service |
b1ea74 |
}
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
disp->rdpcontext = (rdpContext*)ps;
|
|
Packit Service |
b1ea74 |
return TRUE;
|
|
Packit Service |
b1ea74 |
}
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
static UINT pf_disp_monitor_layout(DispServerContext* context,
|
|
Packit Service |
b1ea74 |
const DISPLAY_CONTROL_MONITOR_LAYOUT_PDU* pdu)
|
|
Packit Service |
b1ea74 |
{
|
|
Packit Service |
b1ea74 |
proxyData* pdata = (proxyData*)context->custom;
|
|
Packit Service |
b1ea74 |
DispClientContext* client = (DispClientContext*)pdata->pc->disp;
|
|
Packit Service |
b1ea74 |
WLog_DBG(TAG, __FUNCTION__);
|
|
Packit Service |
b1ea74 |
return client->SendMonitorLayout(client, pdu->NumMonitors, pdu->Monitors);
|
|
Packit Service |
b1ea74 |
}
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
static UINT pf_disp_on_caps_control(DispClientContext* context, UINT32 MaxNumMonitors,
|
|
Packit Service |
b1ea74 |
UINT32 MaxMonitorAreaFactorA, UINT32 MaxMonitorAreaFactorB)
|
|
Packit Service |
b1ea74 |
{
|
|
Packit Service |
b1ea74 |
proxyData* pdata = (proxyData*)context->custom;
|
|
Packit Service |
b1ea74 |
DispServerContext* server = (DispServerContext*)pdata->ps->disp;
|
|
Packit Service |
b1ea74 |
WLog_DBG(TAG, __FUNCTION__);
|
|
Packit Service |
b1ea74 |
/* Update caps of proxy's disp server */
|
|
Packit Service |
b1ea74 |
server->MaxMonitorAreaFactorA = MaxMonitorAreaFactorA;
|
|
Packit Service |
b1ea74 |
server->MaxMonitorAreaFactorB = MaxMonitorAreaFactorB;
|
|
Packit Service |
b1ea74 |
server->MaxNumMonitors = MaxNumMonitors;
|
|
Packit Service |
b1ea74 |
/* Send CapsControl to client */
|
|
Packit Service |
b1ea74 |
return server->DisplayControlCaps(server);
|
|
Packit Service |
b1ea74 |
}
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
void pf_disp_register_callbacks(DispClientContext* client, DispServerContext* server,
|
|
Packit Service |
b1ea74 |
proxyData* pdata)
|
|
Packit Service |
b1ea74 |
{
|
|
Packit Service |
b1ea74 |
client->custom = (void*)pdata;
|
|
Packit Service |
b1ea74 |
server->custom = (void*)pdata;
|
|
Packit Service |
b1ea74 |
/* client receives from server, forward using disp server to original client */
|
|
Packit Service |
b1ea74 |
client->DisplayControlCaps = pf_disp_on_caps_control;
|
|
Packit Service |
b1ea74 |
/* server receives from client, forward to target server using disp client */
|
|
Packit Service |
b1ea74 |
server->DispMonitorLayout = pf_disp_monitor_layout;
|
|
Packit Service |
b1ea74 |
}
|