Milestone 5: deliver embedded RDP sessions and lifecycle hardening

This commit is contained in:
Keith Smith
2026-03-03 18:59:26 -07:00
parent 230a401386
commit 36006bd4aa
2941 changed files with 724359 additions and 77 deletions

View File

@@ -0,0 +1,125 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* AInput Virtual Channel Extension
*
* Copyright 2022 Armin Novak <anovak@thincast.com>
* Copyright 2022 Thincast Technologies GmbH
*
* 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 FREERDP_CHANNEL_AINPUT_SERVER_H
#define FREERDP_CHANNEL_AINPUT_SERVER_H
#include <freerdp/channels/wtsvc.h>
#include <freerdp/channels/ainput.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef enum AINPUT_SERVER_OPEN_RESULT
{
AINPUT_SERVER_OPEN_RESULT_OK = 0,
AINPUT_SERVER_OPEN_RESULT_CLOSED = 1,
AINPUT_SERVER_OPEN_RESULT_NOTSUPPORTED = 2,
AINPUT_SERVER_OPEN_RESULT_ERROR = 3
} AINPUT_SERVER_OPEN_RESULT;
typedef struct s_ainput_server_context ainput_server_context;
typedef BOOL (*psAInputChannelIdAssigned)(ainput_server_context* context, UINT32 channelId);
typedef UINT (*psAInputServerInitialize)(ainput_server_context* context, BOOL externalThread);
typedef UINT (*psAInputServerPoll)(ainput_server_context* context);
typedef BOOL (*psAInputServerChannelHandle)(ainput_server_context* context, HANDLE* handle);
typedef UINT (*psAInputServerOpen)(ainput_server_context* context);
typedef UINT (*psAInputServerClose)(ainput_server_context* context);
typedef BOOL (*psAInputServerIsOpen)(ainput_server_context* context);
typedef UINT (*psAInputServerOpenResult)(ainput_server_context* context,
AINPUT_SERVER_OPEN_RESULT result);
typedef UINT (*psAInputServerMouseEvent)(ainput_server_context* context, UINT64 timestamp,
UINT64 flags, INT32 x, INT32 y);
struct s_ainput_server_context
{
HANDLE vcm;
/* Server self-defined pointer. */
void* data;
/*** APIs called by the server. ***/
/**
* Open the ainput channel.
*/
WINPR_ATTR_NODISCARD psAInputServerOpen Open;
/**
* Optional: Set thread handling.
* When externalThread=TRUE the application is responsible to call
* ainput_server_context_poll periodically to process input events.
*
* Defaults to externalThread=FALSE
*/
WINPR_ATTR_NODISCARD psAInputServerInitialize Initialize;
/**
* @brief Poll When externalThread=TRUE call periodically from your main loop.
* if externalThread=FALSE do not call.
*/
WINPR_ATTR_NODISCARD psAInputServerPoll Poll;
/**
* @brief Poll When externalThread=TRUE call to get a handle to wait for events.
* Will return FALSE until the handle is available.
*/
WINPR_ATTR_NODISCARD psAInputServerChannelHandle ChannelHandle;
/**
* Close the ainput channel.
*/
WINPR_ATTR_NODISCARD psAInputServerClose Close;
/**
* Status of the ainput channel.
*/
WINPR_ATTR_NODISCARD psAInputServerIsOpen IsOpen;
/*** Callbacks registered by the server. ***/
/**
* Receive ainput mouse event PDU.
*/
WINPR_ATTR_NODISCARD psAInputServerMouseEvent MouseEvent;
rdpContext* rdpcontext;
/**
* Callback, when the channel got its id assigned.
*/
WINPR_ATTR_NODISCARD psAInputChannelIdAssigned ChannelIdAssigned;
};
FREERDP_API void ainput_server_context_free(ainput_server_context* context);
WINPR_ATTR_MALLOC(ainput_server_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API ainput_server_context* ainput_server_context_new(HANDLE vcm);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_AINPUT_SERVER_H */

View File

@@ -0,0 +1,182 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Server Audio Input Virtual Channel
*
* Copyright 2012 Vic Lee
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
* Copyright 2023 Pascal Nowack <Pascal.Nowack@gmx.de>
*
* 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 FREERDP_CHANNEL_AUDIN_SERVER_H
#define FREERDP_CHANNEL_AUDIN_SERVER_H
#include <freerdp/config.h>
#include <freerdp/channels/audin.h>
#include <freerdp/channels/wtsvc.h>
#if !defined(CHANNEL_AUDIN_SERVER)
#error "This header must not be included if CHANNEL_AUDIN_SERVER is not defined"
#endif
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct s_audin_server_context audin_server_context;
typedef BOOL (*psAudinServerChannelOpen)(audin_server_context* context);
typedef BOOL (*psAudinServerChannelIsOpen)(audin_server_context* context);
typedef BOOL (*psAudinServerChannelClose)(audin_server_context* context);
typedef BOOL (*psAudinServerChannelIdAssigned)(audin_server_context* context, UINT32 channelId);
typedef UINT (*psAudinServerVersion)(audin_server_context* context,
const SNDIN_VERSION* version);
typedef UINT (*psAudinServerFormats)(audin_server_context* context,
const SNDIN_FORMATS* formats);
typedef UINT (*psAudinServerOpen)(audin_server_context* context, const SNDIN_OPEN* open);
typedef UINT (*psAudinServerOpenReply)(audin_server_context* context,
const SNDIN_OPEN_REPLY* open_reply);
typedef UINT (*psAudinServerIncomingData)(audin_server_context* context,
const SNDIN_DATA_INCOMING* data_incoming);
typedef UINT (*psAudinServerData)(audin_server_context* context, const SNDIN_DATA* data);
typedef UINT (*psAudinServerFormatChange)(audin_server_context* context,
const SNDIN_FORMATCHANGE* format_change);
struct s_audin_server_context
{
HANDLE vcm;
/* Server self-defined pointer. */
void* userdata;
/**
* Server version to send to the client, when the DVC was successfully
* opened.
**/
SNDIN_VERSION_Version serverVersion;
/*** APIs called by the server. ***/
/**
* Open the audio input channel.
*/
WINPR_ATTR_NODISCARD psAudinServerChannelOpen Open;
/**
* Check, whether the audio input channel thread was created
*/
WINPR_ATTR_NODISCARD psAudinServerChannelIsOpen IsOpen;
/**
* Close the audio input channel.
*/
WINPR_ATTR_NODISCARD psAudinServerChannelClose Close;
/**
* For the following server to client PDUs,
* the message header does not have to be set.
*/
/**
* Send a Version PDU.
*/
WINPR_ATTR_NODISCARD psAudinServerVersion SendVersion;
/**
* Send a Sound Formats PDU.
*/
WINPR_ATTR_NODISCARD psAudinServerFormats SendFormats;
/**
* Send an Open PDU.
*/
WINPR_ATTR_NODISCARD psAudinServerOpen SendOpen;
/**
* Send a Format Change PDU.
*/
WINPR_ATTR_NODISCARD psAudinServerFormatChange SendFormatChange;
/*** Callbacks registered by the server. ***/
/**
* Callback, when the channel got its id assigned.
*/
WINPR_ATTR_NODISCARD psAudinServerChannelIdAssigned ChannelIdAssigned;
/*
* Callback for the Version PDU.
*/
WINPR_ATTR_NODISCARD psAudinServerVersion ReceiveVersion;
/*
* Callback for the Sound Formats PDU.
*/
WINPR_ATTR_NODISCARD psAudinServerFormats ReceiveFormats;
/*
* Callback for the Open Reply PDU.
*/
WINPR_ATTR_NODISCARD psAudinServerOpenReply OpenReply;
/*
* Callback for the Incoming Data PDU.
*/
WINPR_ATTR_NODISCARD psAudinServerIncomingData IncomingData;
/*
* Callback for the Data PDU.
*/
WINPR_ATTR_NODISCARD psAudinServerData Data;
/*
* Callback for the Format Change PDU.
*/
WINPR_ATTR_NODISCARD psAudinServerFormatChange ReceiveFormatChange;
rdpContext* rdpcontext;
};
FREERDP_API void audin_server_context_free(audin_server_context* context);
WINPR_ATTR_MALLOC(audin_server_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API audin_server_context* audin_server_context_new(HANDLE vcm);
/** \brief sets the supported audio formats for AUDIN server channel context.
*
* \param context The context to set the formats for
* \param count The number of formats found in \b formats. Use \b -1 to set to default formats
* supported by FreeRDP \param formats An array of \b count elements
*
* \return \b TRUE if successful and at least one format is supported, \b FALSE otherwise.
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL audin_server_set_formats(audin_server_context* context, SSIZE_T count,
const AUDIO_FORMAT* formats);
WINPR_ATTR_NODISCARD
FREERDP_API const AUDIO_FORMAT*
audin_server_get_negotiated_format(const audin_server_context* context);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_AUDIN_SERVER_H */

View File

@@ -0,0 +1,25 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Server Channels
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* 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 FREERDP_CHANNELS_SERVER_H
#define FREERDP_CHANNELS_SERVER_H
#include <freerdp/api.h>
#endif /* FREERDP_CHANNELS_SERVER_H */

View File

@@ -0,0 +1,147 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Clipboard Virtual Channel Server Interface
*
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* 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 FREERDP_CHANNEL_CLIPRDR_SERVER_CLIPRDR_H
#define FREERDP_CHANNEL_CLIPRDR_SERVER_CLIPRDR_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/channels/wtsvc.h>
#include <freerdp/channels/cliprdr.h>
#include <freerdp/client/cliprdr.h>
#ifdef __cplusplus
extern "C"
{
#endif
/**
* Server Interface
*/
typedef struct s_cliprdr_server_context CliprdrServerContext;
typedef UINT (*psCliprdrOpen)(CliprdrServerContext* context);
typedef UINT (*psCliprdrClose)(CliprdrServerContext* context);
typedef UINT (*psCliprdrStart)(CliprdrServerContext* context);
typedef UINT (*psCliprdrStop)(CliprdrServerContext* context);
typedef HANDLE (*psCliprdrGetEventHandle)(CliprdrServerContext* context);
typedef UINT (*psCliprdrCheckEventHandle)(CliprdrServerContext* context);
typedef UINT (*psCliprdrServerCapabilities)(CliprdrServerContext* context,
const CLIPRDR_CAPABILITIES* capabilities);
typedef UINT (*psCliprdrClientCapabilities)(CliprdrServerContext* context,
const CLIPRDR_CAPABILITIES* capabilities);
typedef UINT (*psCliprdrMonitorReady)(CliprdrServerContext* context,
const CLIPRDR_MONITOR_READY* monitorReady);
typedef UINT (*psCliprdrTempDirectory)(CliprdrServerContext* context,
const CLIPRDR_TEMP_DIRECTORY* tempDirectory);
typedef UINT (*psCliprdrClientFormatList)(CliprdrServerContext* context,
const CLIPRDR_FORMAT_LIST* formatList);
typedef UINT (*psCliprdrServerFormatList)(CliprdrServerContext* context,
const CLIPRDR_FORMAT_LIST* formatList);
typedef UINT (*psCliprdrClientFormatListResponse)(
CliprdrServerContext* context, const CLIPRDR_FORMAT_LIST_RESPONSE* formatListResponse);
typedef UINT (*psCliprdrServerFormatListResponse)(
CliprdrServerContext* context, const CLIPRDR_FORMAT_LIST_RESPONSE* formatListResponse);
typedef UINT (*psCliprdrClientLockClipboardData)(
CliprdrServerContext* context, const CLIPRDR_LOCK_CLIPBOARD_DATA* lockClipboardData);
typedef UINT (*psCliprdrServerLockClipboardData)(
CliprdrServerContext* context, const CLIPRDR_LOCK_CLIPBOARD_DATA* lockClipboardData);
typedef UINT (*psCliprdrClientUnlockClipboardData)(
CliprdrServerContext* context, const CLIPRDR_UNLOCK_CLIPBOARD_DATA* unlockClipboardData);
typedef UINT (*psCliprdrServerUnlockClipboardData)(
CliprdrServerContext* context, const CLIPRDR_UNLOCK_CLIPBOARD_DATA* unlockClipboardData);
typedef UINT (*psCliprdrClientFormatDataRequest)(
CliprdrServerContext* context, const CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest);
typedef UINT (*psCliprdrServerFormatDataRequest)(
CliprdrServerContext* context, const CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest);
typedef UINT (*psCliprdrClientFormatDataResponse)(
CliprdrServerContext* context, const CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse);
typedef UINT (*psCliprdrServerFormatDataResponse)(
CliprdrServerContext* context, const CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse);
typedef UINT (*psCliprdrClientFileContentsRequest)(
CliprdrServerContext* context, const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest);
typedef UINT (*psCliprdrServerFileContentsRequest)(
CliprdrServerContext* context, const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest);
typedef UINT (*psCliprdrClientFileContentsResponse)(
CliprdrServerContext* context, const CLIPRDR_FILE_CONTENTS_RESPONSE* fileContentsResponse);
typedef UINT (*psCliprdrServerFileContentsResponse)(
CliprdrServerContext* context, const CLIPRDR_FILE_CONTENTS_RESPONSE* fileContentsResponse);
struct s_cliprdr_server_context
{
void* handle;
void* custom;
/* server clipboard capabilities - set by server - updated by the channel after client
* capability exchange */
BOOL useLongFormatNames;
BOOL streamFileClipEnabled;
BOOL fileClipNoFilePaths;
BOOL canLockClipData;
WINPR_ATTR_NODISCARD psCliprdrOpen Open;
psCliprdrClose Close;
WINPR_ATTR_NODISCARD psCliprdrStart Start;
psCliprdrStop Stop;
WINPR_ATTR_NODISCARD psCliprdrGetEventHandle GetEventHandle;
WINPR_ATTR_NODISCARD psCliprdrCheckEventHandle CheckEventHandle;
WINPR_ATTR_NODISCARD psCliprdrServerCapabilities ServerCapabilities;
WINPR_ATTR_NODISCARD psCliprdrClientCapabilities ClientCapabilities;
WINPR_ATTR_NODISCARD psCliprdrMonitorReady MonitorReady;
WINPR_ATTR_NODISCARD psCliprdrTempDirectory TempDirectory;
WINPR_ATTR_NODISCARD psCliprdrClientFormatList ClientFormatList;
WINPR_ATTR_NODISCARD psCliprdrServerFormatList ServerFormatList;
WINPR_ATTR_NODISCARD psCliprdrClientFormatListResponse ClientFormatListResponse;
WINPR_ATTR_NODISCARD psCliprdrServerFormatListResponse ServerFormatListResponse;
WINPR_ATTR_NODISCARD psCliprdrClientLockClipboardData ClientLockClipboardData;
WINPR_ATTR_NODISCARD psCliprdrServerLockClipboardData ServerLockClipboardData;
WINPR_ATTR_NODISCARD psCliprdrClientUnlockClipboardData ClientUnlockClipboardData;
WINPR_ATTR_NODISCARD psCliprdrServerUnlockClipboardData ServerUnlockClipboardData;
WINPR_ATTR_NODISCARD psCliprdrClientFormatDataRequest ClientFormatDataRequest;
WINPR_ATTR_NODISCARD psCliprdrServerFormatDataRequest ServerFormatDataRequest;
WINPR_ATTR_NODISCARD psCliprdrClientFormatDataResponse ClientFormatDataResponse;
WINPR_ATTR_NODISCARD psCliprdrServerFormatDataResponse ServerFormatDataResponse;
WINPR_ATTR_NODISCARD psCliprdrClientFileContentsRequest ClientFileContentsRequest;
WINPR_ATTR_NODISCARD psCliprdrServerFileContentsRequest ServerFileContentsRequest;
WINPR_ATTR_NODISCARD psCliprdrClientFileContentsResponse ClientFileContentsResponse;
WINPR_ATTR_NODISCARD psCliprdrServerFileContentsResponse ServerFileContentsResponse;
rdpContext* rdpcontext;
BOOL autoInitializationSequence;
UINT32 lastRequestedFormatId;
BOOL hasHugeFileSupport;
};
FREERDP_API void cliprdr_server_context_free(CliprdrServerContext* context);
WINPR_ATTR_MALLOC(cliprdr_server_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API CliprdrServerContext* cliprdr_server_context_new(HANDLE vcm);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_CLIPRDR_SERVER_CLIPRDR_H */

View File

@@ -0,0 +1,79 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* RDPEDISP Virtual Channel Extension
*
* Copyright 2019 Kobi Mizrachi <kmizrachi18@gmail.com>
*
* 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 FREERDP_CHANNEL_DISP_SERVER_DISP_H
#define FREERDP_CHANNEL_DISP_SERVER_DISP_H
#include <freerdp/channels/disp.h>
#include <freerdp/api.h>
#include <freerdp/types.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct s_disp_server_private DispServerPrivate;
typedef struct s_disp_server_context DispServerContext;
typedef BOOL (*psDispChannelIdAssigned)(DispServerContext* context, UINT32 channelId);
typedef UINT (*psDispMonitorLayout)(DispServerContext* context,
const DISPLAY_CONTROL_MONITOR_LAYOUT_PDU* pdu);
typedef UINT (*psDispCaps)(DispServerContext* context);
typedef UINT (*psDispOpen)(DispServerContext* context);
typedef UINT (*psDispClose)(DispServerContext* context);
struct s_disp_server_context
{
void* custom;
HANDLE vcm;
/* Server capabilities */
UINT32 MaxNumMonitors;
UINT32 MaxMonitorAreaFactorA;
UINT32 MaxMonitorAreaFactorB;
WINPR_ATTR_NODISCARD psDispOpen Open;
WINPR_ATTR_NODISCARD psDispClose Close;
WINPR_ATTR_NODISCARD psDispMonitorLayout DispMonitorLayout;
WINPR_ATTR_NODISCARD psDispCaps DisplayControlCaps;
DispServerPrivate* priv;
rdpContext* rdpcontext;
/**
* Callback, when the channel got its id assigned.
*/
WINPR_ATTR_NODISCARD psDispChannelIdAssigned ChannelIdAssigned;
};
FREERDP_API void disp_server_context_free(DispServerContext* context);
WINPR_ATTR_MALLOC(disp_server_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API DispServerContext* disp_server_context_new(HANDLE vcm);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_DISP_SERVER_DISP_H */

View File

@@ -0,0 +1,64 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Dynamic Virtual Channel Extension
*
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* 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 FREERDP_CHANNEL_DRDYNVC_SERVER_DRDYNVC_H
#define FREERDP_CHANNEL_DRDYNVC_SERVER_DRDYNVC_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/channels/wtsvc.h>
#ifdef __cplusplus
extern "C"
{
#endif
/**
* Server Interface
*/
typedef struct s_drdynvc_server_context DrdynvcServerContext;
typedef struct s_drdynvc_server_private DrdynvcServerPrivate;
typedef UINT (*psDrdynvcStart)(DrdynvcServerContext* context);
typedef UINT (*psDrdynvcStop)(DrdynvcServerContext* context);
struct s_drdynvc_server_context
{
HANDLE vcm;
WINPR_ATTR_NODISCARD psDrdynvcStart Start;
psDrdynvcStop Stop;
DrdynvcServerPrivate* priv;
};
FREERDP_API void drdynvc_server_context_free(DrdynvcServerContext* context);
WINPR_ATTR_MALLOC(drdynvc_server_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API DrdynvcServerContext* drdynvc_server_context_new(HANDLE vcm);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_DRDYNVC_SERVER_DRDYNVC_H */

View File

@@ -0,0 +1,103 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Echo Virtual Channel Extension
*
* Copyright 2014 Vic Lee
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* 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 FREERDP_CHANNEL_ECHO_SERVER_H
#define FREERDP_CHANNEL_ECHO_SERVER_H
#include <freerdp/channels/wtsvc.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef enum ECHO_SERVER_OPEN_RESULT
{
ECHO_SERVER_OPEN_RESULT_OK = 0,
ECHO_SERVER_OPEN_RESULT_CLOSED = 1,
ECHO_SERVER_OPEN_RESULT_NOTSUPPORTED = 2,
ECHO_SERVER_OPEN_RESULT_ERROR = 3
} ECHO_SERVER_OPEN_RESULT;
typedef struct s_echo_server_context echo_server_context;
typedef BOOL (*psEchoServerChannelIdAssigned)(echo_server_context* context, UINT32 channelId);
typedef UINT (*psEchoServerOpen)(echo_server_context* context);
typedef UINT (*psEchoServerClose)(echo_server_context* context);
typedef BOOL (*psEchoServerRequest)(echo_server_context* context, const BYTE* buffer,
UINT32 length);
typedef UINT (*psEchoServerOpenResult)(echo_server_context* context,
ECHO_SERVER_OPEN_RESULT result);
typedef UINT (*psEchoServerResponse)(echo_server_context* context, const BYTE* buffer,
UINT32 length);
struct s_echo_server_context
{
HANDLE vcm;
/* Server self-defined pointer. */
void* data;
/*** APIs called by the server. ***/
/**
* Open the echo channel.
*/
WINPR_ATTR_NODISCARD psEchoServerOpen Open;
/**
* Close the echo channel.
*/
WINPR_ATTR_NODISCARD psEchoServerClose Close;
/**
* Send echo request PDU.
*/
WINPR_ATTR_NODISCARD psEchoServerRequest Request;
/*** Callbacks registered by the server. ***/
/**
* Indicate whether the channel is opened successfully.
*/
WINPR_ATTR_NODISCARD psEchoServerOpenResult OpenResult;
/**
* Receive echo response PDU.
*/
WINPR_ATTR_NODISCARD psEchoServerResponse Response;
rdpContext* rdpcontext;
/**
* Callback, when the channel got its id assigned.
*/
psEchoServerChannelIdAssigned ChannelIdAssigned;
};
FREERDP_API void echo_server_context_free(echo_server_context* context);
WINPR_ATTR_MALLOC(echo_server_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API echo_server_context* echo_server_context_new(HANDLE vcm);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_ECHO_SERVER_H */

View File

@@ -0,0 +1,105 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Multiparty Virtual Channel
*
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* 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 FREERDP_CHANNEL_ENCOMSP_SERVER_ENCOMSP_H
#define FREERDP_CHANNEL_ENCOMSP_SERVER_ENCOMSP_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/channels/wtsvc.h>
#include <freerdp/channels/encomsp.h>
#ifdef __cplusplus
extern "C"
{
#endif
/**
* Server Interface
*/
typedef struct s_encomsp_server_context EncomspServerContext;
typedef struct s_encomsp_server_private EncomspServerPrivate;
typedef UINT (*psEncomspStart)(EncomspServerContext* context);
typedef UINT (*psEncomspStop)(EncomspServerContext* context);
typedef UINT (*psEncomspFilterUpdated)(EncomspServerContext* context,
ENCOMSP_FILTER_UPDATED_PDU* filterUpdated);
typedef UINT (*psEncomspApplicationCreated)(
EncomspServerContext* context, ENCOMSP_APPLICATION_CREATED_PDU* applicationCreated);
typedef UINT (*psEncomspApplicationRemoved)(
EncomspServerContext* context, ENCOMSP_APPLICATION_REMOVED_PDU* applicationRemoved);
typedef UINT (*psEncomspWindowCreated)(EncomspServerContext* context,
ENCOMSP_WINDOW_CREATED_PDU* windowCreated);
typedef UINT (*psEncomspWindowRemoved)(EncomspServerContext* context,
ENCOMSP_WINDOW_REMOVED_PDU* windowRemoved);
typedef UINT (*psEncomspShowWindow)(EncomspServerContext* context,
ENCOMSP_SHOW_WINDOW_PDU* showWindow);
typedef UINT (*psEncomspParticipantCreated)(
EncomspServerContext* context, ENCOMSP_PARTICIPANT_CREATED_PDU* participantCreated);
typedef UINT (*psEncomspParticipantRemoved)(
EncomspServerContext* context, ENCOMSP_PARTICIPANT_REMOVED_PDU* participantRemoved);
typedef UINT (*psEncomspChangeParticipantControlLevel)(
EncomspServerContext* context,
ENCOMSP_CHANGE_PARTICIPANT_CONTROL_LEVEL_PDU* changeParticipantControlLevel);
typedef UINT (*psEncomspGraphicsStreamPaused)(
EncomspServerContext* context, ENCOMSP_GRAPHICS_STREAM_PAUSED_PDU* graphicsStreamPaused);
typedef UINT (*psEncomspGraphicsStreamResumed)(
EncomspServerContext* context, ENCOMSP_GRAPHICS_STREAM_RESUMED_PDU* graphicsStreamResumed);
struct s_encomsp_server_context
{
HANDLE vcm;
void* custom;
WINPR_ATTR_NODISCARD psEncomspStart Start;
psEncomspStop Stop;
WINPR_ATTR_NODISCARD psEncomspFilterUpdated FilterUpdated;
WINPR_ATTR_NODISCARD psEncomspApplicationCreated ApplicationCreated;
WINPR_ATTR_NODISCARD psEncomspApplicationRemoved ApplicationRemoved;
WINPR_ATTR_NODISCARD psEncomspWindowCreated WindowCreated;
WINPR_ATTR_NODISCARD psEncomspWindowRemoved WindowRemoved;
WINPR_ATTR_NODISCARD psEncomspShowWindow ShowWindow;
WINPR_ATTR_NODISCARD psEncomspParticipantCreated ParticipantCreated;
WINPR_ATTR_NODISCARD psEncomspParticipantRemoved ParticipantRemoved;
WINPR_ATTR_NODISCARD psEncomspChangeParticipantControlLevel ChangeParticipantControlLevel;
WINPR_ATTR_NODISCARD psEncomspGraphicsStreamPaused GraphicsStreamPaused;
WINPR_ATTR_NODISCARD psEncomspGraphicsStreamResumed GraphicsStreamResumed;
EncomspServerPrivate* priv;
rdpContext* rdpcontext;
};
FREERDP_API void encomsp_server_context_free(EncomspServerContext* context);
WINPR_ATTR_MALLOC(encomsp_server_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API EncomspServerContext* encomsp_server_context_new(HANDLE vcm);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_ENCOMSP_SERVER_ENCOMSP_H */

View File

@@ -0,0 +1,107 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* RDPXXXX Remote App Graphics Redirection Virtual Channel Extension
*
* Copyright 2020 Microsoft
*
* 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 FREERDP_CHANNEL_GFXREDIR_SERVER_GFXREDIR_H
#define FREERDP_CHANNEL_GFXREDIR_SERVER_GFXREDIR_H
#include <freerdp/channels/gfxredir.h>
#include <freerdp/api.h>
#include <freerdp/types.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct s_gfxredir_server_private GfxRedirServerPrivate;
typedef struct s_gfxredir_server_context GfxRedirServerContext;
typedef UINT (*psGfxRedirOpen)(GfxRedirServerContext* context);
typedef UINT (*psGfxRedirClose)(GfxRedirServerContext* context);
typedef UINT (*psGfxRedirError)(GfxRedirServerContext* context,
const GFXREDIR_ERROR_PDU* error);
typedef UINT (*psGfxRedirGraphicsRedirectionLegacyCaps)(
GfxRedirServerContext* context, const GFXREDIR_LEGACY_CAPS_PDU* graphicsCaps);
typedef UINT (*psGfxRedirGraphicsRedirectionCapsAdvertise)(
GfxRedirServerContext* context, const GFXREDIR_CAPS_ADVERTISE_PDU* graphicsCapsAdvertise);
typedef UINT (*psGfxRedirGraphicsRedirectionCapsConfirm)(
GfxRedirServerContext* context, const GFXREDIR_CAPS_CONFIRM_PDU* graphicsCapsConfirm);
typedef UINT (*psGfxRedirOpenPool)(GfxRedirServerContext* context,
const GFXREDIR_OPEN_POOL_PDU* openPool);
typedef UINT (*psGfxRedirClosePool)(GfxRedirServerContext* context,
const GFXREDIR_CLOSE_POOL_PDU* closePool);
typedef UINT (*psGfxRedirCreateBuffer)(GfxRedirServerContext* context,
const GFXREDIR_CREATE_BUFFER_PDU* createBuffer);
typedef UINT (*psGfxRedirDestroyBuffer)(GfxRedirServerContext* context,
const GFXREDIR_DESTROY_BUFFER_PDU* destroyBuffer);
typedef UINT (*psGfxRedirPresentBuffer)(GfxRedirServerContext* context,
const GFXREDIR_PRESENT_BUFFER_PDU* presentBuffer);
typedef UINT (*psGfxRedirPresentBufferAck)(
GfxRedirServerContext* context, const GFXREDIR_PRESENT_BUFFER_ACK_PDU* presentBufferAck);
struct s_gfxredir_server_context
{
void* custom;
HANDLE vcm;
WINPR_ATTR_NODISCARD psGfxRedirOpen Open;
WINPR_ATTR_NODISCARD psGfxRedirClose Close;
WINPR_ATTR_NODISCARD psGfxRedirError Error;
WINPR_ATTR_NODISCARD psGfxRedirGraphicsRedirectionLegacyCaps GraphicsRedirectionLegacyCaps;
WINPR_ATTR_NODISCARD psGfxRedirGraphicsRedirectionCapsAdvertise
GraphicsRedirectionCapsAdvertise;
WINPR_ATTR_NODISCARD psGfxRedirGraphicsRedirectionCapsConfirm
GraphicsRedirectionCapsConfirm;
WINPR_ATTR_NODISCARD psGfxRedirOpenPool OpenPool;
WINPR_ATTR_NODISCARD psGfxRedirClosePool ClosePool;
WINPR_ATTR_NODISCARD psGfxRedirCreateBuffer CreateBuffer;
WINPR_ATTR_NODISCARD psGfxRedirDestroyBuffer DestroyBuffer;
WINPR_ATTR_NODISCARD psGfxRedirPresentBuffer PresentBuffer;
WINPR_ATTR_NODISCARD psGfxRedirPresentBufferAck PresentBufferAck;
GfxRedirServerPrivate* priv;
rdpContext* rdpcontext;
UINT32 confirmedCapsVersion;
};
FREERDP_API void gfxredir_server_context_free(GfxRedirServerContext* context);
WINPR_ATTR_MALLOC(gfxredir_server_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API GfxRedirServerContext* gfxredir_server_context_new(HANDLE vcm);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_GFXREDIR_SERVER_GFXREDIR_H */

View File

@@ -0,0 +1,143 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Location Virtual Channel Extension
*
* Copyright 2023 Pascal Nowack <Pascal.Nowack@gmx.de>
*
* 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 FREERDP_CHANNEL_LOCATION_SERVER_LOCATION_H
#define FREERDP_CHANNEL_LOCATION_SERVER_LOCATION_H
#include <freerdp/channels/location.h>
#include <freerdp/channels/wtsvc.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct s_location_server_context LocationServerContext;
typedef UINT (*psLocationServerOpen)(LocationServerContext* context);
typedef UINT (*psLocationServerClose)(LocationServerContext* context);
typedef BOOL (*psLocationServerChannelIdAssigned)(LocationServerContext* context,
UINT32 channelId);
typedef UINT (*psLocationServerInitialize)(LocationServerContext* context, BOOL externalThread);
typedef UINT (*psLocationServerPoll)(LocationServerContext* context);
typedef BOOL (*psLocationServerChannelHandle)(LocationServerContext* context, HANDLE* handle);
typedef UINT (*psLocationServerServerReady)(LocationServerContext* context,
const RDPLOCATION_SERVER_READY_PDU* serverReady);
typedef UINT (*psLocationServerClientReady)(LocationServerContext* context,
const RDPLOCATION_CLIENT_READY_PDU* clientReady);
typedef UINT (*psLocationServerBaseLocation3D)(
LocationServerContext* context, const RDPLOCATION_BASE_LOCATION3D_PDU* baseLocation3D);
typedef UINT (*psLocationServerLocation2DDelta)(
LocationServerContext* context, const RDPLOCATION_LOCATION2D_DELTA_PDU* location2DDelta);
typedef UINT (*psLocationServerLocation3DDelta)(
LocationServerContext* context, const RDPLOCATION_LOCATION3D_DELTA_PDU* location3DDelta);
struct s_location_server_context
{
HANDLE vcm;
/* Server self-defined pointer. */
void* userdata;
/*** APIs called by the server. ***/
/**
* Optional: Set thread handling.
* When externalThread=TRUE, the application is responsible to call
* Poll() periodically to process channel events.
*
* Defaults to externalThread=FALSE
*/
WINPR_ATTR_NODISCARD psLocationServerInitialize Initialize;
/**
* Open the location channel.
*/
WINPR_ATTR_NODISCARD psLocationServerOpen Open;
/**
* Close the location channel.
*/
WINPR_ATTR_NODISCARD psLocationServerClose Close;
/**
* Poll
* When externalThread=TRUE, call Poll() periodically from your main loop.
* If externalThread=FALSE do not call.
*/
WINPR_ATTR_NODISCARD psLocationServerPoll Poll;
/**
* Retrieve the channel handle for use in conjunction with Poll().
* If externalThread=FALSE do not call.
*/
WINPR_ATTR_NODISCARD psLocationServerChannelHandle ChannelHandle;
/* All PDUs sent by the server don't require the header to be set */
/*
* Send a ServerReady PDU.
*/
WINPR_ATTR_NODISCARD psLocationServerServerReady ServerReady;
/*** Callbacks registered by the server. ***/
/**
* Callback, when the channel got its id assigned.
*/
WINPR_ATTR_NODISCARD psLocationServerChannelIdAssigned ChannelIdAssigned;
/**
* Callback for the ClientReady PDU.
*/
WINPR_ATTR_NODISCARD psLocationServerClientReady ClientReady;
/**
* Callback for the BaseLocation3D PDU.
*/
WINPR_ATTR_NODISCARD psLocationServerBaseLocation3D BaseLocation3D;
/**
* Callback for the Location2DDelta PDU.
*/
WINPR_ATTR_NODISCARD psLocationServerLocation2DDelta Location2DDelta;
/**
* Callback for the Location3DDelta PDU.
*/
WINPR_ATTR_NODISCARD psLocationServerLocation3DDelta Location3DDelta;
rdpContext* rdpcontext;
};
FREERDP_API void location_server_context_free(LocationServerContext* context);
WINPR_ATTR_MALLOC(location_server_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API LocationServerContext* location_server_context_new(HANDLE vcm);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_LOCATION_SERVER_LOCATION_H */

View File

@@ -0,0 +1,259 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* FreeRDP Proxy Server
*
* Copyright 2021-2023 Armin Novak <armin.novak@thincast.com>
* Copyright 2021-2023 Thincast Technologies GmbH
*
* 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 FREERDP_SERVER_PROXY_CONFIG_H
#define FREERDP_SERVER_PROXY_CONFIG_H
#include <winpr/wtypes.h>
#include <winpr/ini.h>
#include <freerdp/api.h>
#include <freerdp/server/proxy/proxy_modules_api.h>
/** @defgroup proxy_config Proxy Configuration
* @ingroup proxy
* @{
*/
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct proxy_config proxyConfig;
struct proxy_config
{
/* server */
char* Host;
UINT16 Port;
/* target */
BOOL FixedTarget;
char* TargetHost;
UINT16 TargetPort;
char* TargetUser;
char* TargetDomain;
char* TargetPassword;
/* input */
BOOL Keyboard;
BOOL Mouse;
BOOL Multitouch;
/* server security */
BOOL ServerTlsSecurity;
BOOL ServerRdpSecurity;
BOOL ServerNlaSecurity;
/* client security */
BOOL ClientNlaSecurity;
BOOL ClientTlsSecurity;
BOOL ClientRdpSecurity;
BOOL ClientAllowFallbackToTls;
/* channels */
BOOL GFX;
BOOL DisplayControl;
BOOL Clipboard;
BOOL AudioOutput;
BOOL AudioInput;
BOOL RemoteApp;
BOOL DeviceRedirection;
BOOL VideoRedirection;
BOOL CameraRedirection;
BOOL PassthroughIsBlacklist;
char** Passthrough;
size_t PassthroughCount;
char** Intercept;
size_t InterceptCount;
/* clipboard specific settings */
#if !defined(WITHOUT_FREERDP_3x_DEPRECATED)
WINPR_DEPRECATED_VAR("[since 3.6.0] Unused, ignore", BOOL TextOnly);
WINPR_DEPRECATED_VAR("[since 3.6.0] Unused, ignore", UINT32 MaxTextLength);
/* gfx settings */
WINPR_DEPRECATED_VAR("[since 3.6.0] Unused, ignore", BOOL DecodeGFX);
#endif
/* modules */
char** Modules; /* module file names to load */
size_t ModulesCount;
char** RequiredPlugins; /* required plugin names */
size_t RequiredPluginsCount;
char* CertificateFile;
char* CertificateContent;
char* PrivateKeyFile;
char* PrivateKeyContent;
/* Data extracted from CertificateContent or CertificateFile (evaluation in this order) */
char* CertificatePEM;
size_t CertificatePEMLength;
/* Data extracted from PrivateKeyContent or PrivateKeyFile (evaluation in this order) */
char* PrivateKeyPEM;
size_t PrivateKeyPEMLength;
wIniFile* ini;
/* target continued */
UINT32 TargetTlsSecLevel; /** @since version 3.2.0 */
};
/**
* @brief pf_server_config_dump Dumps a default INI configuration file
* @param file The file to write to. Existing files are truncated.
* @return TRUE for success, FALSE if the file could not be written.
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL pf_server_config_dump(const char* file);
/**
* @brief pf_server_config_free Releases all resources associated with proxyConfig
*
* @param config A pointer to the proxyConfig to clean up. Might be nullptr.
*/
FREERDP_API void pf_server_config_free(proxyConfig* config);
/**
* @brief server_config_load_ini Create a proxyConfig from a already loaded
* INI file.
*
* @param ini A pointer to the parsed INI file. Must NOT be nullptr.
*
* @return A proxyConfig or nullptr in case of failure.
*/
WINPR_ATTR_MALLOC(pf_server_config_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API proxyConfig* server_config_load_ini(wIniFile* ini);
/**
* @brief pf_server_config_load_file Create a proxyConfig from a INI file found at path.
*
* @param path The path of the INI file
*
* @return A proxyConfig or nullptr in case of failure.
*/
WINPR_ATTR_MALLOC(pf_server_config_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API proxyConfig* pf_server_config_load_file(const char* path);
/**
* @brief pf_server_config_load_buffer Create a proxyConfig from a memory string buffer in INI
* file format
*
* @param buffer A pointer to the '\0' terminated INI string.
*
* @return A proxyConfig or nullptr in case of failure.
*/
WINPR_ATTR_MALLOC(pf_server_config_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API proxyConfig* pf_server_config_load_buffer(const char* buffer);
/**
* @brief pf_server_config_print Print the configuration to stdout
*
* @param config A pointer to the configuration to print. Must NOT be nullptr.
*/
FREERDP_API void pf_server_config_print(const proxyConfig* config);
/**
* @brief pf_config_required_plugins_count
*
* @param config A pointer to the proxyConfig. Must NOT be nullptr.
*
* @return The number of required plugins configured.
*/
WINPR_ATTR_NODISCARD
FREERDP_API size_t pf_config_required_plugins_count(const proxyConfig* config);
/**
* @brief pf_config_required_plugin
* @param config A pointer to the proxyConfig. Must NOT be nullptr.
* @param index The index of the plugin to return
*
* @return The name of the plugin or nullptr.
*/
WINPR_ATTR_NODISCARD
FREERDP_API const char* pf_config_required_plugin(const proxyConfig* config, size_t index);
/**
* @brief pf_config_modules_count
*
* @param config A pointer to the proxyConfig. Must NOT be nullptr.
*
* @return The number of proxy modules configured.
*/
WINPR_ATTR_NODISCARD
FREERDP_API size_t pf_config_modules_count(const proxyConfig* config);
/**
* @brief pf_config_modules
* @param config A pointer to the proxyConfig. Must NOT be nullptr.
*
* @return An array of strings of size pf_config_modules_count with the module names.
*/
WINPR_ATTR_NODISCARD
FREERDP_API const char** pf_config_modules(const proxyConfig* config);
/**
* @brief pf_config_clone Create a copy of the configuration
* @param dst A pointer that receives the newly allocated copy
* @param config The source configuration to copy
*
* @return TRUE for success, FALSE otherwise
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL pf_config_clone(proxyConfig** dst, const proxyConfig* config);
/**
* @brief pf_config_plugin Register a proxy plugin handling event filtering
* defined in the configuration.
*
* @param plugins_manager The plugin manager
* @param userdata A proxyConfig* to use as reference
*
* @return TRUE for success, FALSE for failure
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL pf_config_plugin(proxyPluginsManager* plugins_manager, void* userdata);
/**
* @brief pf_config_get get a value for a section/key
* @param config A pointer to the proxyConfig. Must NOT be nullptr.
* @param section The name of the section the key is in, must not be \b nullptr
* @param key The name of the key to look for. Must not be \b nullptr
*
* @return A pointer to the value for \b section/key or \b nullptr if not found
*/
WINPR_ATTR_NODISCARD
FREERDP_API const char* pf_config_get(const proxyConfig* config, const char* section,
const char* key);
#ifdef __cplusplus
}
#endif
/** @} */
#endif /* FREERDP_SERVER_PROXY_CONFIG_H */

View File

@@ -0,0 +1,195 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* FreeRDP Proxy Server
*
* Copyright 2019 Mati Shabtay <matishabtay@gmail.com>
* Copyright 2019 Kobi Mizrachi <kmizrachi18@gmail.com>
* Copyright 2019 Idan Freiberg <speidy@gmail.com>
*
* 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 FREERDP_SERVER_PROXY_PFCONTEXT_H
#define FREERDP_SERVER_PROXY_PFCONTEXT_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/freerdp.h>
#include <freerdp/channels/wtsvc.h>
#include <freerdp/server/proxy/proxy_config.h>
#include <freerdp/server/proxy/proxy_types.h>
#define PROXY_SESSION_ID_LENGTH 32
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct proxy_data proxyData;
typedef struct proxy_module proxyModule;
typedef struct p_server_static_channel_context pServerStaticChannelContext;
typedef struct s_InterceptContextMapEntry
{
void (*free)(struct s_InterceptContextMapEntry*);
} InterceptContextMapEntry;
/* All proxy interception channels derive from this base struct
* and set their cleanup function accordingly. */
FREERDP_API void intercept_context_entry_free(void* obj);
typedef PfChannelResult (*proxyChannelDataFn)(proxyData* pdata,
const pServerStaticChannelContext* channel,
const BYTE* xdata, size_t xsize, UINT32 flags,
size_t totalSizepServer);
typedef void (*proxyChannelContextDtor)(void* context);
/** @brief per channel configuration */
struct p_server_static_channel_context
{
char* channel_name;
UINT32 front_channel_id;
UINT32 back_channel_id;
pf_utils_channel_mode channelMode;
WINPR_ATTR_NODISCARD proxyChannelDataFn onFrontData;
WINPR_ATTR_NODISCARD proxyChannelDataFn onBackData;
proxyChannelContextDtor contextDtor;
void* context;
};
FREERDP_API void StaticChannelContext_free(pServerStaticChannelContext* ctx);
/**
* Wraps rdpContext and holds the state for the proxy's server.
*/
struct p_server_context
{
rdpContext context;
proxyData* pdata;
HANDLE vcm;
HANDLE dynvcReady;
wHashTable* interceptContextMap;
wHashTable* channelsByFrontId;
wHashTable* channelsByBackId;
};
typedef struct p_server_context pServerContext;
WINPR_ATTR_MALLOC(StaticChannelContext_free, 1)
WINPR_ATTR_NODISCARD
pServerStaticChannelContext* StaticChannelContext_new(pServerContext* ps, const char* name,
UINT32 id);
/**
* Wraps rdpContext and holds the state for the proxy's client.
*/
typedef struct p_client_context pClientContext;
struct p_client_context
{
rdpContext context;
proxyData* pdata;
/*
* In a case when freerdp_connect fails,
* Used for NLA fallback feature, to check if the server should close the connection.
* When it is set to TRUE, proxy's client knows it shouldn't signal the server thread to
* closed the connection when pf_client_post_disconnect is called, because it is trying to
* connect reconnect without NLA. It must be set to TRUE before the first try, and to FALSE
* after the connection fully established, to ensure graceful shutdown of the connection
* when it will be closed.
*/
BOOL allow_next_conn_failure;
BOOL connected; /* Set after client post_connect. */
pReceiveChannelData client_receive_channel_data_original;
wQueue* cached_server_channel_data;
WINPR_ATTR_NODISCARD BOOL (*sendChannelData)(pClientContext* pc,
const proxyChannelDataEventInfo* ev);
/* X509 specific */
char* remote_hostname;
wStream* remote_pem;
UINT16 remote_port;
UINT32 remote_flags;
BOOL input_state_sync_pending;
UINT32 input_state;
wHashTable* interceptContextMap;
UINT32 computerNameLen;
BOOL computerNameUnicode;
union
{
WCHAR* wc;
char* c;
void* v;
} computerName;
};
/**
* Holds data common to both sides of a proxy's session.
*/
struct proxy_data
{
proxyModule* module;
const proxyConfig* config;
pServerContext* ps;
pClientContext* pc;
HANDLE abort_event;
HANDLE client_thread;
HANDLE gfx_server_ready;
char session_id[PROXY_SESSION_ID_LENGTH + 1];
/* used to external modules to store per-session info */
wHashTable* modules_info;
psPeerReceiveChannelData server_receive_channel_data_original;
};
WINPR_ATTR_NODISCARD
FREERDP_API BOOL pf_context_copy_settings(rdpSettings* dst, const rdpSettings* src);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL pf_context_init_server_context(freerdp_peer* client);
WINPR_ATTR_MALLOC(freerdp_client_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API pClientContext* pf_context_create_client_context(const rdpSettings* clientSettings);
FREERDP_API void proxy_data_free(proxyData* pdata);
WINPR_ATTR_MALLOC(proxy_data_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API proxyData* proxy_data_new(void);
FREERDP_API void proxy_data_set_client_context(proxyData* pdata, pClientContext* context);
FREERDP_API void proxy_data_set_server_context(proxyData* pdata, pServerContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL proxy_data_shall_disconnect(proxyData* pdata);
FREERDP_API void proxy_data_abort_connect(proxyData* pdata);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_SERVER_PROXY_PFCONTEXT_H */

View File

@@ -0,0 +1,53 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* FreeRDP Proxy Server
*
* Copyright 2019 Mati Shabtay <matishabtay@gmail.com>
* Copyright 2019 Kobi Mizrachi <kmizrachi18@gmail.com>
* Copyright 2019 Idan Freiberg <speidy@gmail.com>
* Copyright 2021 Armin Novak <anovak@thincast.com>
* Copyright 2021 Thincast Technologies GmbH
*
* 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 FREERDP_SERVER_PROXY_LOG_H
#define FREERDP_SERVER_PROXY_LOG_H
#include <winpr/wlog.h>
#include <freerdp/log.h>
#define PROXY_TAG(tag) FREERDP_TAG("proxy." tag)
/*
* log format in proxy is:
* "[SessionID=%s]: Log message"
* SessionID is optional, but if they should be written to the log,
* that's the format.
*/
/* log macros that prepends session id and function name tp the log message */
#define PROXY_LOG_INFO(_tag, _context, _format, ...) \
WLog_INFO(TAG, "[SessionID=%s]: " _format, \
(_context && _context->pdata) ? _context->pdata->session_id : "null", ##__VA_ARGS__)
#define PROXY_LOG_ERR(_tag, _context, _format, ...) \
WLog_ERR(TAG, "[SessionID=%s]: " _format, \
(_context && _context->pdata) ? _context->pdata->session_id : "null", ##__VA_ARGS__)
#define PROXY_LOG_DBG(_tag, _context, _format, ...) \
WLog_DBG(TAG, "[SessionID=%s]: " _format, \
(_context && _context->pdata) ? _context->pdata->session_id : "null", ##__VA_ARGS__)
#define PROXY_LOG_WARN(_tag, _context, _format, ...) \
WLog_WARN(TAG, "[SessionID=%s]: " _format, \
(_context && _context->pdata) ? _context->pdata->session_id : "null", ##__VA_ARGS__)
#endif /* FREERDP_SERVER_PROXY_LOG_H */

View File

@@ -0,0 +1,246 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* FreeRDP Proxy Server
*
* Copyright 2019 Kobi Mizrachi <kmizrachi18@gmail.com>
* Copyright 2019 Idan Freiberg <speidy@gmail.com>
* Copyright 2021 Armin Novak <anovak@thincast.com>
* Copyright 2021 Thincast Technologies GmbH
* Copyright 2023 Armin Novak <anovak@thincast.com>
* Copyright 2023 Thincast Technologies GmbH
*
* 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 FREERDP_SERVER_PROXY_MODULES_API_H
#define FREERDP_SERVER_PROXY_MODULES_API_H
#include <winpr/winpr.h>
#include <winpr/stream.h>
#include <winpr/sspi.h>
#include <freerdp/server/proxy/proxy_types.h>
#define MODULE_TAG(module) "proxy.modules." module
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct proxy_data proxyData;
typedef struct proxy_module proxyModule;
typedef struct proxy_plugin proxyPlugin;
typedef struct proxy_plugins_manager proxyPluginsManager;
/* hook callback. should return TRUE on success or FALSE on error. */
typedef BOOL (*proxyHookFn)(proxyPlugin*, proxyData*, void*);
/*
* Filter callback:
* It MUST return TRUE if the related event should be proxied,
* or FALSE if it should be ignored.
*/
typedef BOOL (*proxyFilterFn)(proxyPlugin*, proxyData*, void*);
/* describes a plugin: name, description and callbacks to execute.
*
* This is public API, so always add new fields at the end of the struct to keep
* some backward compatibility.
*/
struct proxy_plugin
{
const char* name; /* 0: unique module name */
const char* description; /* 1: module description */
UINT64 reserved1[32 - 2]; /* 2-32 */
WINPR_ATTR_NODISCARD BOOL (*PluginUnload)(proxyPlugin* plugin); /* 33 */
UINT64 reserved2[66 - 34]; /* 34 - 65 */
/* proxy hooks. a module can set these function pointers to register hooks */
WINPR_ATTR_NODISCARD proxyHookFn ClientInitConnect; /* 66 custom=rdpContext* */
WINPR_ATTR_NODISCARD proxyHookFn ClientUninitConnect; /* 67 custom=rdpContext* */
WINPR_ATTR_NODISCARD proxyHookFn ClientPreConnect; /* 68 custom=rdpContext* */
WINPR_ATTR_NODISCARD proxyHookFn ClientPostConnect; /* 69 custom=rdpContext* */
WINPR_ATTR_NODISCARD proxyHookFn ClientPostDisconnect; /* 70 custom=rdpContext* */
WINPR_ATTR_NODISCARD proxyHookFn ClientX509Certificate; /* 71 custom=rdpContext* */
WINPR_ATTR_NODISCARD proxyHookFn ClientLoginFailure; /* 72 custom=rdpContext* */
WINPR_ATTR_NODISCARD proxyHookFn ClientEndPaint; /* 73 custom=rdpContext* */
WINPR_ATTR_NODISCARD proxyHookFn ClientRedirect; /* 74 custom=rdpContext* */
WINPR_ATTR_NODISCARD proxyHookFn ClientLoadChannels; /* 75 custom=rdpContext* */
UINT64 reserved3[96 - 76]; /* 76-95 */
WINPR_ATTR_NODISCARD proxyHookFn ServerPostConnect; /* 96 custom=freerdp_peer* */
WINPR_ATTR_NODISCARD proxyHookFn ServerPeerActivate; /* 97 custom=freerdp_peer* */
WINPR_ATTR_NODISCARD proxyHookFn ServerChannelsInit; /* 98 custom=freerdp_peer* */
WINPR_ATTR_NODISCARD proxyHookFn ServerChannelsFree; /* 99 custom=freerdp_peer* */
WINPR_ATTR_NODISCARD proxyHookFn ServerSessionEnd; /* 100 custom=freerdp_peer* */
WINPR_ATTR_NODISCARD proxyHookFn ServerSessionInitialize; /* 101 custom=freerdp_peer* */
WINPR_ATTR_NODISCARD proxyHookFn ServerSessionStarted; /* 102 custom=freerdp_peer* */
UINT64 reserved4[128 - 103]; /* 103 - 127 */
/* proxy filters. a module can set these function pointers to register filters */
WINPR_ATTR_NODISCARD proxyFilterFn KeyboardEvent; /* 128 */
WINPR_ATTR_NODISCARD proxyFilterFn MouseEvent; /* 129 */
WINPR_ATTR_NODISCARD proxyFilterFn ClientChannelData; /* 130 passthrough channels data */
WINPR_ATTR_NODISCARD proxyFilterFn ServerChannelData; /* 131 passthrough channels data */
WINPR_ATTR_NODISCARD proxyFilterFn
DynamicChannelCreate; /* 132 passthrough drdynvc channel create data */
WINPR_ATTR_NODISCARD proxyFilterFn ServerFetchTargetAddr; /* 133 */
WINPR_ATTR_NODISCARD proxyFilterFn ServerPeerLogon; /* 134 */
WINPR_ATTR_NODISCARD proxyFilterFn
ChannelCreate; /* 135 passthrough drdynvc channel create data */
WINPR_ATTR_NODISCARD proxyFilterFn UnicodeEvent; /* 136 */
WINPR_ATTR_NODISCARD proxyFilterFn MouseExEvent; /* 137 */
/* proxy dynamic channel filters:
*
* - a function that returns the list of channels to intercept
* - a function to call with the data received
*/
WINPR_ATTR_NODISCARD proxyFilterFn DynChannelToIntercept; /* 138 */
WINPR_ATTR_NODISCARD proxyFilterFn DynChannelIntercept; /* 139 */
WINPR_ATTR_NODISCARD proxyFilterFn StaticChannelToIntercept; /* 140 */
UINT64 reserved5[160 - 141]; /* 141-159 */
/* Runtime data fields */
proxyPluginsManager* mgr; /* 160 */ /** Set during plugin registration */
void* userdata; /* 161 */ /** Custom data provided with RegisterPlugin, memory managed
outside of plugin. */
void* custom; /* 162 */ /** Custom configuration data, must be allocated in RegisterPlugin
and freed in PluginUnload */
UINT64 reserved6[192 - 163]; /* 163-191 Add some filler data to allow for new callbacks or
* fields without breaking API */
};
/*
* Main API for use by external modules.
* Supports:
* - Registering a plugin.
* - Setting/getting plugin's per-session specific data.
* - Aborting a session.
*/
struct proxy_plugins_manager
{
/* 0 used for registering a fresh new proxy plugin. */
WINPR_ATTR_NODISCARD BOOL (*RegisterPlugin)(struct proxy_plugins_manager* mgr,
const proxyPlugin* plugin);
/* 1 used for setting plugin's per-session info. */
WINPR_ATTR_NODISCARD BOOL (*SetPluginData)(struct proxy_plugins_manager* mgr, const char*,
proxyData*, void*);
/* 2 used for getting plugin's per-session info. */
WINPR_ATTR_NODISCARD void* (*GetPluginData)(struct proxy_plugins_manager* mgr, const char*,
proxyData*);
/* 3 used for aborting a session. */
void (*AbortConnect)(struct proxy_plugins_manager* mgr, proxyData*);
UINT64 reserved[128 - 4]; /* 4-127 reserved fields */
};
typedef BOOL (*proxyModuleEntryPoint)(proxyPluginsManager* plugins_manager, void* userdata);
/* filter events parameters */
#define WINPR_PACK_PUSH
#include <winpr/pack.h>
typedef struct proxy_keyboard_event_info
{
UINT16 flags;
UINT16 rdp_scan_code;
} proxyKeyboardEventInfo;
typedef struct proxy_unicode_event_info
{
UINT16 flags;
UINT16 code;
} proxyUnicodeEventInfo;
typedef struct proxy_mouse_event_info
{
UINT16 flags;
UINT16 x;
UINT16 y;
} proxyMouseEventInfo;
typedef struct proxy_mouse_ex_event_info
{
UINT16 flags;
UINT16 x;
UINT16 y;
} proxyMouseExEventInfo;
typedef struct
{
/* channel metadata */
const char* channel_name;
UINT16 channel_id;
/* actual data */
const BYTE* data;
size_t data_len;
size_t total_size;
UINT32 flags;
} proxyChannelDataEventInfo;
typedef struct
{
/* out values */
char* target_address;
UINT16 target_port;
/*
* If this value is set to true by a plugin, target info will be fetched from config and proxy
* will connect any client to the same remote server.
*/
ProxyFetchTargetMethod fetch_method;
} proxyFetchTargetEventInfo;
typedef struct server_peer_logon
{
const SEC_WINNT_AUTH_IDENTITY* identity;
BOOL automatic;
} proxyServerPeerLogon;
typedef struct dyn_channel_intercept_data
{
const char* name;
UINT32 channelId;
wStream* data;
BOOL isBackData;
BOOL first;
BOOL last;
BOOL rewritten;
size_t packetSize;
PfChannelResult result;
} proxyDynChannelInterceptData;
typedef struct dyn_channel_to_intercept_data
{
const char* name;
UINT32 channelId;
BOOL intercept;
} proxyChannelToInterceptData;
#define WINPR_PACK_POP
#include <winpr/pack.h>
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_SERVER_PROXY_MODULES_API_H */

View File

@@ -0,0 +1,121 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* FreeRDP Proxy Server
*
* Copyright 2021 Armin Novak <armin.novak@thincast.com>
* Copyright 2021 Thincast Technologies GmbH
*
* 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 FREERDP_SERVER_PROXY_SERVER_H
#define FREERDP_SERVER_PROXY_SERVER_H
#include <freerdp/api.h>
#include <freerdp/server/proxy/proxy_config.h>
#include <freerdp/server/proxy/proxy_modules_api.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct proxy_server proxyServer;
/**
* @brief pf_server_free Cleans up a (stopped) proxy server instance.
*
* @param server The proxy server to clean up. Might be nullptr.
*/
FREERDP_API void pf_server_free(proxyServer* server);
/**
* @brief pf_server_new Creates a new proxy server instance
*
* @param config The proxy server configuration to use. Must NOT be nullptr.
*
* @return A new proxy server instance or nullptr on failure.
*/
WINPR_ATTR_MALLOC(pf_server_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API proxyServer* pf_server_new(const proxyConfig* config);
/**
* @brief pf_server_add_module Allows registering proxy modules that are
* built-in instead of shipped as separate
* module loaded at runtime.
*
* @param server A proxy instance to add the module to. Must NOT be nullptr
* @param ep The proxy entry function to add. Must NOT be nullptr
* @param userdata Custom data for the module. May be nullptr
*
* @return TRUE for success, FALSE otherwise.
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL pf_server_add_module(proxyServer* server, proxyModuleEntryPoint ep,
void* userdata);
/**
* @brief pf_server_start Starts the proxy, binding the configured port.
*
* @param server The server instance. Must NOT be nullptr.
*
* @return TRUE for success, FALSE on error
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL pf_server_start(proxyServer* server);
/**
* @brief pf_server_start_from_socket Starts the proxy using an existing bound socket
*
* @param server The server instance. Must NOT be nullptr.
* @param socket The bound socket to wait for events on.
*
* @return TRUE for success, FALSE on error
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL pf_server_start_from_socket(proxyServer* server, int socket);
/**
* @brief pf_server_start_with_peer_socket Use existing peer socket
*
* @param server The server instance. Must NOT be nullptr.
* @param socket Ready to use peer socket
*
* @return TRUE for success, FALSE on error
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL pf_server_start_with_peer_socket(proxyServer* server, int socket);
/**
* @brief pf_server_stop Stops a server instance asynchronously.
* Can be called from any thread to stop a running server instance.
* @param server A pointer to the server instance to stop. May be nullptr.
*/
FREERDP_API void pf_server_stop(proxyServer* server);
/**
* @brief pf_server_run This (blocking) function runs the main loop of the
* proxy.
*
* @param server The server instance. Must NOT be nullptr.
*
* @return TRUE for successful termination, FALSE otherwise.
*/
WINPR_ATTR_NODISCARD
FREERDP_API BOOL pf_server_run(proxyServer* server);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_SERVER_PROXY_SERVER_H */

View File

@@ -0,0 +1,57 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* FreeRDP Proxy enum types
*
* Copyright 2023 Armin Novak <armin.novak@thincast.com>
* Copyright 2023 Thincast Technologies GmbH
*
* 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 FREERDP_SERVER_PROXY_TYPES_H
#define FREERDP_SERVER_PROXY_TYPES_H
#ifdef __cplusplus
extern "C"
{
#endif
/** @brief how is handled a channel */
typedef enum
{
PF_UTILS_CHANNEL_NOT_HANDLED, /*!< channel not handled */
PF_UTILS_CHANNEL_BLOCK, /*!< block and drop traffic on this channel */
PF_UTILS_CHANNEL_PASSTHROUGH, /*!< pass traffic from this channel */
PF_UTILS_CHANNEL_INTERCEPT /*!< inspect traffic from this channel */
} pf_utils_channel_mode;
/** @brief result of a channel treatment */
typedef enum
{
PF_CHANNEL_RESULT_PASS, /*!< pass the packet as is */
PF_CHANNEL_RESULT_DROP, /*!< drop the packet */
PF_CHANNEL_RESULT_ERROR /*!< error during packet treatment */
} PfChannelResult;
typedef enum
{
PROXY_FETCH_TARGET_METHOD_DEFAULT,
PROXY_FETCH_TARGET_METHOD_CONFIG,
PROXY_FETCH_TARGET_METHOD_LOAD_BALANCE_INFO,
PROXY_FETCH_TARGET_USE_CUSTOM_ADDR
} ProxyFetchTargetMethod;
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_SERVER_PROXY_TYPES_H */

View File

@@ -0,0 +1,159 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* RAIL Virtual Channel Plugin
*
* Copyright 2019 Mati Shabtay <matishabtay@gmail.com>
*
* 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 FREERDP_CHANNEL_RAIL_SERVER_RAIL_H
#define FREERDP_CHANNEL_RAIL_SERVER_RAIL_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/rail.h>
#include <freerdp/channels/rail.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct s_rail_server_context RailServerContext;
typedef struct s_rail_server_private RailServerPrivate;
typedef UINT (*psRailStart)(RailServerContext* context);
typedef BOOL (*psRailStop)(RailServerContext* context);
/* Client side callback types */
typedef UINT (*psRailClientHandshake)(RailServerContext* context,
const RAIL_HANDSHAKE_ORDER* handshake);
typedef UINT (*psRailClientClientStatus)(RailServerContext* context,
const RAIL_CLIENT_STATUS_ORDER* clientStatus);
typedef UINT (*psRailClientExec)(RailServerContext* context, const RAIL_EXEC_ORDER* exec);
typedef UINT (*psRailClientSysparam)(RailServerContext* context,
const RAIL_SYSPARAM_ORDER* sysparam);
typedef UINT (*psRailClientActivate)(RailServerContext* context,
const RAIL_ACTIVATE_ORDER* activate);
typedef UINT (*psRailClientSysmenu)(RailServerContext* context,
const RAIL_SYSMENU_ORDER* sysmenu);
typedef UINT (*psRailClientSyscommand)(RailServerContext* context,
const RAIL_SYSCOMMAND_ORDER* syscommand);
typedef UINT (*psRailClientNotifyEvent)(RailServerContext* context,
const RAIL_NOTIFY_EVENT_ORDER* notifyEvent);
typedef UINT (*psRailClientGetAppidReq)(RailServerContext* context,
const RAIL_GET_APPID_REQ_ORDER* getAppidReq);
typedef UINT (*psRailClientWindowMove)(RailServerContext* context,
const RAIL_WINDOW_MOVE_ORDER* windowMove);
typedef UINT (*psRailClientSnapArrange)(RailServerContext* context,
const RAIL_SNAP_ARRANGE* snapArrange);
typedef UINT (*psRailClientLangbarInfo)(RailServerContext* context,
const RAIL_LANGBAR_INFO_ORDER* langbarInfo);
typedef UINT (*psRailClientLanguageImeInfo)(RailServerContext* context,
const RAIL_LANGUAGEIME_INFO_ORDER* languageImeInfo);
typedef UINT (*psRailClientCompartmentInfo)(RailServerContext* context,
const RAIL_COMPARTMENT_INFO_ORDER* compartmentInfo);
typedef UINT (*psRailClientCloak)(RailServerContext* context, const RAIL_CLOAK* cloak);
typedef UINT (*psRailClientTextScale)(RailServerContext* context, UINT32 TextScale);
typedef UINT (*psRailClientCaretBlinkRate)(RailServerContext* context, UINT32 CaretBlinkRate);
/* Server side messages sending methods */
typedef UINT (*psRailServerHandshake)(RailServerContext* context,
const RAIL_HANDSHAKE_ORDER* handshake);
typedef UINT (*psRailServerHandshakeEx)(RailServerContext* context,
const RAIL_HANDSHAKE_EX_ORDER* handshakeEx);
typedef UINT (*psRailServerSysparam)(RailServerContext* context,
const RAIL_SYSPARAM_ORDER* sysparam);
typedef UINT (*psRailServerLocalMoveSize)(RailServerContext* context,
const RAIL_LOCALMOVESIZE_ORDER* localMoveSize);
typedef UINT (*psRailServerMinMaxInfo)(RailServerContext* context,
const RAIL_MINMAXINFO_ORDER* minMaxInfo);
typedef UINT (*psRailServerTaskbarInfo)(RailServerContext* context,
const RAIL_TASKBAR_INFO_ORDER* taskbarInfo);
typedef UINT (*psRailServerLangbarInfo)(RailServerContext* context,
const RAIL_LANGBAR_INFO_ORDER* langbarInfo);
typedef UINT (*psRailServerExecResult)(RailServerContext* context,
const RAIL_EXEC_RESULT_ORDER* execResult);
typedef UINT (*psRailServerGetAppidResp)(RailServerContext* context,
const RAIL_GET_APPID_RESP_ORDER* getAppIdResp);
typedef UINT (*psRailServerZOrderSync)(RailServerContext* context,
const RAIL_ZORDER_SYNC* zOrderSync);
typedef UINT (*psRailServerCloak)(RailServerContext* context, const RAIL_CLOAK* cloak);
typedef UINT (*psRailServerPowerDisplayRequest)(
RailServerContext* context, const RAIL_POWER_DISPLAY_REQUEST* PowerDisplayRequest);
typedef UINT (*psRailServerGetAppidRespEx)(RailServerContext* context,
const RAIL_GET_APPID_RESP_EX* GetAppidRespEx);
struct s_rail_server_context
{
HANDLE vcm;
void* custom;
WINPR_ATTR_NODISCARD psRailStart Start;
psRailStop Stop;
/* Callbacks from client */
WINPR_ATTR_NODISCARD psRailClientHandshake ClientHandshake;
WINPR_ATTR_NODISCARD psRailClientClientStatus ClientClientStatus;
WINPR_ATTR_NODISCARD psRailClientExec ClientExec;
WINPR_ATTR_NODISCARD psRailClientSysparam ClientSysparam;
WINPR_ATTR_NODISCARD psRailClientActivate ClientActivate;
WINPR_ATTR_NODISCARD psRailClientSysmenu ClientSysmenu;
WINPR_ATTR_NODISCARD psRailClientSyscommand ClientSyscommand;
WINPR_ATTR_NODISCARD psRailClientNotifyEvent ClientNotifyEvent;
WINPR_ATTR_NODISCARD psRailClientGetAppidReq ClientGetAppidReq;
WINPR_ATTR_NODISCARD psRailClientWindowMove ClientWindowMove;
WINPR_ATTR_NODISCARD psRailClientSnapArrange ClientSnapArrange;
WINPR_ATTR_NODISCARD psRailClientLangbarInfo ClientLangbarInfo;
WINPR_ATTR_NODISCARD psRailClientLanguageImeInfo ClientLanguageImeInfo;
WINPR_ATTR_NODISCARD psRailClientCompartmentInfo ClientCompartmentInfo;
WINPR_ATTR_NODISCARD psRailClientCloak ClientCloak;
WINPR_ATTR_NODISCARD psRailClientTextScale ClientTextScale;
WINPR_ATTR_NODISCARD psRailClientCaretBlinkRate ClientCaretBlinkRate;
/* Methods for sending server side messages */
WINPR_ATTR_NODISCARD psRailServerHandshake ServerHandshake;
WINPR_ATTR_NODISCARD psRailServerHandshakeEx ServerHandshakeEx;
WINPR_ATTR_NODISCARD psRailServerSysparam ServerSysparam;
WINPR_ATTR_NODISCARD psRailServerLocalMoveSize ServerLocalMoveSize;
WINPR_ATTR_NODISCARD psRailServerMinMaxInfo ServerMinMaxInfo;
WINPR_ATTR_NODISCARD psRailServerTaskbarInfo ServerTaskbarInfo;
WINPR_ATTR_NODISCARD psRailServerLangbarInfo ServerLangbarInfo;
WINPR_ATTR_NODISCARD psRailServerExecResult ServerExecResult;
WINPR_ATTR_NODISCARD psRailServerZOrderSync ServerZOrderSync;
WINPR_ATTR_NODISCARD psRailServerCloak ServerCloak;
WINPR_ATTR_NODISCARD psRailServerPowerDisplayRequest ServerPowerDisplayRequest;
WINPR_ATTR_NODISCARD psRailServerGetAppidResp ServerGetAppidResp;
WINPR_ATTR_NODISCARD psRailServerGetAppidRespEx ServerGetAppidRespEx;
RailServerPrivate* priv;
rdpContext* rdpcontext;
};
FREERDP_API void rail_server_context_free(RailServerContext* context);
WINPR_ATTR_MALLOC(rail_server_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API RailServerContext* rail_server_context_new(HANDLE vcm);
WINPR_ATTR_NODISCARD
FREERDP_API UINT rail_server_handle_messages(RailServerContext* context);
FREERDP_API void rail_server_set_handshake_ex_flags(RailServerContext* context, DWORD flags);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_RAIL_SERVER_RAIL_H */

View File

@@ -0,0 +1,237 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Device Redirection Virtual Channel Server Interface
*
* Copyright 2014 Dell Software <Mike.McDonald@software.dell.com>
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* 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 FREERDP_CHANNEL_RDPDR_SERVER_RDPDR_H
#define FREERDP_CHANNEL_RDPDR_SERVER_RDPDR_H
#include <freerdp/api.h>
#include <freerdp/config.h>
#include <freerdp/types.h>
#include <freerdp/channels/wtsvc.h>
#include <freerdp/channels/rdpdr.h>
#include <freerdp/utils/rdpdr_utils.h>
#ifdef __cplusplus
extern "C"
{
#endif
/**
* Server Interface
*/
typedef struct s_rdpdr_server_context RdpdrServerContext;
typedef struct s_rdpdr_server_private RdpdrServerPrivate;
typedef struct
{
UINT16 Component;
UINT16 PacketId;
} RDPDR_HEADER;
#ifndef __MINGW32__
typedef struct
{
UINT32 NextEntryOffset;
UINT32 FileIndex;
LARGE_INTEGER CreationTime;
LARGE_INTEGER LastAccessTime;
LARGE_INTEGER LastWriteTime;
LARGE_INTEGER ChangeTime;
LARGE_INTEGER EndOfFile;
LARGE_INTEGER AllocationSize;
UINT32 FileAttributes;
#if defined(WITH_WCHAR_FILE_DIRECTORY_INFORMATION)
WCHAR FileName[512];
#else
char FileName[512];
#endif
} FILE_DIRECTORY_INFORMATION;
#endif
typedef UINT (*psRdpdrStart)(RdpdrServerContext* context);
typedef UINT (*psRdpdrStop)(RdpdrServerContext* context);
typedef UINT (*psRdpdrCapablityPDU)(RdpdrServerContext* context,
const RDPDR_CAPABILITY_HEADER* header, size_t size,
const BYTE* data);
typedef UINT (*psRdpdrReceivePDU)(RdpdrServerContext* context, const RDPDR_HEADER* header,
UINT error);
typedef UINT (*psRdpdrReceiveAnnounceResponse)(RdpdrServerContext* context, UINT16 VersionMajor,
UINT16 VersionMinor, UINT32 ClientId);
typedef UINT (*psRdpdrSendServerAnnounce)(RdpdrServerContext* context);
typedef UINT (*psRdpdrReceiveDeviceAnnounce)(RdpdrServerContext* context,
const RdpdrDevice* device);
typedef UINT (*psRdpdrReceiveDeviceRemove)(RdpdrServerContext* context, UINT32 deviceId,
const RdpdrDevice* device);
typedef UINT (*psRdpdrReceiveClientNameRequest)(RdpdrServerContext* context, size_t ComputerNameLen,
const char* name);
typedef UINT (*psRdpdrDriveCreateDirectory)(RdpdrServerContext* context, void* callbackData,
UINT32 deviceId, const char* path);
typedef UINT (*psRdpdrDriveDeleteDirectory)(RdpdrServerContext* context, void* callbackData,
UINT32 deviceId, const char* path);
typedef UINT (*psRdpdrDriveQueryDirectory)(RdpdrServerContext* context, void* callbackData,
UINT32 deviceId, const char* path);
typedef UINT (*psRdpdrDriveOpenFile)(RdpdrServerContext* context, void* callbackData,
UINT32 deviceId, const char* path, UINT32 desiredAccess,
UINT32 createDisposition);
typedef UINT (*psRdpdrDriveReadFile)(RdpdrServerContext* context, void* callbackData,
UINT32 deviceId, UINT32 fileId, UINT32 length, UINT32 offset);
typedef UINT (*psRdpdrDriveWriteFile)(RdpdrServerContext* context, void* callbackData,
UINT32 deviceId, UINT32 fileId, const char* buffer,
UINT32 length, UINT32 offset);
typedef UINT (*psRdpdrDriveCloseFile)(RdpdrServerContext* context, void* callbackData,
UINT32 deviceId, UINT32 fileId);
typedef UINT (*psRdpdrDriveDeleteFile)(RdpdrServerContext* context, void* callbackData,
UINT32 deviceId, const char* path);
typedef UINT (*psRdpdrDriveRenameFile)(RdpdrServerContext* context, void* callbackData,
UINT32 deviceId, const char* oldPath, const char* newPath);
typedef void (*psRdpdrOnDriveCreateDirectoryComplete)(RdpdrServerContext* context,
void* callbackData, UINT32 ioStatus);
typedef void (*psRdpdrOnDriveDeleteDirectoryComplete)(RdpdrServerContext* context,
void* callbackData, UINT32 ioStatus);
typedef void (*psRdpdrOnDriveQueryDirectoryComplete)(RdpdrServerContext* context,
void* callbackData, UINT32 ioStatus,
FILE_DIRECTORY_INFORMATION* fdi);
typedef void (*psRdpdrOnDriveOpenFileComplete)(RdpdrServerContext* context, void* callbackData,
UINT32 ioStatus, UINT32 deviceId, UINT32 fileId);
typedef void (*psRdpdrOnDriveReadFileComplete)(RdpdrServerContext* context, void* callbackData,
UINT32 ioStatus, const char* buffer, UINT32 length);
typedef void (*psRdpdrOnDriveWriteFileComplete)(RdpdrServerContext* context, void* callbackData,
UINT32 ioStatus, UINT32 bytesWritten);
typedef void (*psRdpdrOnDriveCloseFileComplete)(RdpdrServerContext* context, void* callbackData,
UINT32 ioStatus);
typedef void (*psRdpdrOnDriveDeleteFileComplete)(RdpdrServerContext* context, void* callbackData,
UINT32 ioStatus);
typedef void (*psRdpdrOnDriveRenameFileComplete)(RdpdrServerContext* context, void* callbackData,
UINT32 ioStatus);
typedef UINT (*psRdpdrOnDeviceCreate)(RdpdrServerContext* context, const RdpdrDevice* device);
typedef UINT (*psRdpdrOnDeviceDelete)(RdpdrServerContext* context, UINT32 deviceId);
struct s_rdpdr_server_context
{
HANDLE vcm;
WINPR_ATTR_NODISCARD psRdpdrStart Start;
psRdpdrStop Stop;
RdpdrServerPrivate* priv;
/* Server self-defined pointer. */
void* data;
/**< Server supported redirections.
* initially used to determine which redirections are supported by the
* server in the server capability, later on updated with what the client
* actually wants to have supported.
*
* Use the \b RDPDR_DTYP_* defines as a mask to check.
*/
UINT16 supported;
/*** RDPDR message intercept callbacks */
WINPR_ATTR_NODISCARD psRdpdrCapablityPDU
ReceiveCaps; /**< Called for each received capability */
WINPR_ATTR_NODISCARD psRdpdrCapablityPDU SendCaps; /**< Called for each capability to be sent */
WINPR_ATTR_NODISCARD psRdpdrReceivePDU
ReceivePDU; /**< Called after a RDPDR pdu was received and parsed */
WINPR_ATTR_NODISCARD psRdpdrSendServerAnnounce
SendServerAnnounce; /**< Called before the server sends the announce message */
WINPR_ATTR_NODISCARD psRdpdrReceiveAnnounceResponse
ReceiveAnnounceResponse; /**< Called after the client announce response is received */
WINPR_ATTR_NODISCARD psRdpdrReceiveClientNameRequest
ReceiveClientNameRequest; /**< Called after a client name request is received */
WINPR_ATTR_NODISCARD psRdpdrReceiveDeviceAnnounce
ReceiveDeviceAnnounce; /** < Called after a new device request was received but before the
device is added */
WINPR_ATTR_NODISCARD psRdpdrReceiveDeviceRemove
ReceiveDeviceRemove; /**< Called after a new device request was
received, but before it is removed */
/*** Drive APIs called by the server. ***/
WINPR_ATTR_NODISCARD psRdpdrDriveCreateDirectory DriveCreateDirectory;
WINPR_ATTR_NODISCARD psRdpdrDriveDeleteDirectory DriveDeleteDirectory;
WINPR_ATTR_NODISCARD psRdpdrDriveQueryDirectory DriveQueryDirectory;
WINPR_ATTR_NODISCARD psRdpdrDriveOpenFile DriveOpenFile;
WINPR_ATTR_NODISCARD psRdpdrDriveReadFile DriveReadFile;
WINPR_ATTR_NODISCARD psRdpdrDriveWriteFile DriveWriteFile;
WINPR_ATTR_NODISCARD psRdpdrDriveCloseFile DriveCloseFile;
WINPR_ATTR_NODISCARD psRdpdrDriveDeleteFile DriveDeleteFile;
WINPR_ATTR_NODISCARD psRdpdrDriveRenameFile DriveRenameFile;
/*** Drive callbacks registered by the server. ***/
WINPR_ATTR_NODISCARD psRdpdrOnDeviceCreate OnDriveCreate; /**< Called for devices of type \b
RDPDR_DTYP_FILESYSTEM after \b ReceiveDeviceAnnounce */
WINPR_ATTR_NODISCARD psRdpdrOnDeviceDelete OnDriveDelete; /**< Called for devices of type \b
RDPDR_DTYP_FILESYSTEM after \b ReceiveDeviceRemove */
psRdpdrOnDriveCreateDirectoryComplete OnDriveCreateDirectoryComplete;
psRdpdrOnDriveDeleteDirectoryComplete OnDriveDeleteDirectoryComplete;
psRdpdrOnDriveQueryDirectoryComplete OnDriveQueryDirectoryComplete;
psRdpdrOnDriveOpenFileComplete OnDriveOpenFileComplete;
psRdpdrOnDriveReadFileComplete OnDriveReadFileComplete;
psRdpdrOnDriveWriteFileComplete OnDriveWriteFileComplete;
psRdpdrOnDriveCloseFileComplete OnDriveCloseFileComplete;
psRdpdrOnDriveDeleteFileComplete OnDriveDeleteFileComplete;
psRdpdrOnDriveRenameFileComplete OnDriveRenameFileComplete;
/*** Serial Port callbacks registered by the server. ***/
WINPR_ATTR_NODISCARD psRdpdrOnDeviceCreate OnSerialPortCreate; /**< Called for devices of type
\b RDPDR_DTYP_SERIAL after \b ReceiveDeviceAnnounce */
WINPR_ATTR_NODISCARD psRdpdrOnDeviceDelete OnSerialPortDelete; /**< Called for devices of type
\b RDPDR_DTYP_SERIAL after \b ReceiveDeviceRemove */
/*** Parallel Port callbacks registered by the server. ***/
WINPR_ATTR_NODISCARD psRdpdrOnDeviceCreate OnParallelPortCreate; /**< Called for devices of type
\b RDPDR_DTYP_PARALLEL after \b ReceiveDeviceAnnounce */
WINPR_ATTR_NODISCARD psRdpdrOnDeviceDelete OnParallelPortDelete; /**< Called for devices of type
\b RDPDR_DTYP_PARALLEL after \b ReceiveDeviceRemove */
/*** Printer callbacks registered by the server. ***/
WINPR_ATTR_NODISCARD psRdpdrOnDeviceCreate OnPrinterCreate; /**< Called for devices of type
RDPDR_DTYP_PRINT after \b ReceiveDeviceAnnounce */
WINPR_ATTR_NODISCARD psRdpdrOnDeviceDelete OnPrinterDelete; /**< Called for devices of type
RDPDR_DTYP_PRINT after \b ReceiveDeviceRemove */
/*** Smartcard callbacks registered by the server. ***/
WINPR_ATTR_NODISCARD psRdpdrOnDeviceCreate
OnSmartcardCreate; /**< Called for devices of type RDPDR_DTYP_SMARTCARD
after \b ReceiveDeviceAnnounce */
WINPR_ATTR_NODISCARD psRdpdrOnDeviceDelete OnSmartcardDelete; /**< Called for devices of type
RDPDR_DTYP_SMARTCARD after \b ReceiveDeviceRemove */
rdpContext* rdpcontext;
};
FREERDP_API void rdpdr_server_context_free(RdpdrServerContext* context);
WINPR_ATTR_MALLOC(rdpdr_server_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API RdpdrServerContext* rdpdr_server_context_new(HANDLE vcm);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_RDPDR_SERVER_RDPDR_H */

View File

@@ -0,0 +1,140 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Video Capture Virtual Channel Extension
*
* Copyright 2022 Pascal Nowack <Pascal.Nowack@gmx.de>
*
* 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 FREERDP_CHANNEL_CAM_DEV_ENUM_SERVER_CAM_DEV_ENUM_H
#define FREERDP_CHANNEL_CAM_DEV_ENUM_SERVER_CAM_DEV_ENUM_H
#include <freerdp/channels/rdpecam.h>
#include <freerdp/channels/wtsvc.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct s_cam_dev_enum_server_context CamDevEnumServerContext;
typedef UINT (*psCamDevEnumServerServerOpen)(CamDevEnumServerContext* context);
typedef UINT (*psCamDevEnumServerServerClose)(CamDevEnumServerContext* context);
typedef BOOL (*psCamDevEnumServerServerChannelIdAssigned)(CamDevEnumServerContext* context,
UINT32 channelId);
typedef UINT (*psCamDevEnumServerServerInitialize)(CamDevEnumServerContext* context,
BOOL externalThread);
typedef UINT (*psCamDevEnumServerServerPoll)(CamDevEnumServerContext* context);
typedef BOOL (*psCamDevEnumServerServerChannelHandle)(CamDevEnumServerContext* context,
HANDLE* handle);
typedef UINT (*psCamDevEnumServerServerSelectVersionRequest)(
CamDevEnumServerContext* context, const CAM_SELECT_VERSION_REQUEST* selectVersionRequest);
typedef UINT (*psCamDevEnumServerServerSelectVersionResponse)(
CamDevEnumServerContext* context, const CAM_SELECT_VERSION_RESPONSE* selectVersionResponse);
typedef UINT (*psCamDevEnumServerServerDeviceAddedNotification)(
CamDevEnumServerContext* context,
const CAM_DEVICE_ADDED_NOTIFICATION* deviceAddedNotification);
typedef UINT (*psCamDevEnumServerServerDeviceRemovedNotification)(
CamDevEnumServerContext* context,
const CAM_DEVICE_REMOVED_NOTIFICATION* deviceRemovedNotification);
struct s_cam_dev_enum_server_context
{
HANDLE vcm;
/* Server self-defined pointer. */
void* userdata;
/*** APIs called by the server. ***/
/**
* Optional: Set thread handling.
* When externalThread=TRUE, the application is responsible to call
* Poll() periodically to process channel events.
*
* Defaults to externalThread=FALSE
*/
WINPR_ATTR_NODISCARD psCamDevEnumServerServerInitialize Initialize;
/**
* Open the camera device enumerator channel.
*/
WINPR_ATTR_NODISCARD psCamDevEnumServerServerOpen Open;
/**
* Close the camera device enumerator channel.
*/
WINPR_ATTR_NODISCARD psCamDevEnumServerServerClose Close;
/**
* Poll
* When externalThread=TRUE, call Poll() periodically from your main loop.
* If externalThread=FALSE do not call.
*/
WINPR_ATTR_NODISCARD psCamDevEnumServerServerPoll Poll;
/**
* Retrieve the channel handle for use in conjunction with Poll().
* If externalThread=FALSE do not call.
*/
WINPR_ATTR_NODISCARD psCamDevEnumServerServerChannelHandle ChannelHandle;
/*
* Send a Select Version Response PDU.
*/
WINPR_ATTR_NODISCARD psCamDevEnumServerServerSelectVersionResponse SelectVersionResponse;
/*** Callbacks registered by the server. ***/
/**
* Callback, when the channel got its id assigned.
*/
WINPR_ATTR_NODISCARD psCamDevEnumServerServerChannelIdAssigned ChannelIdAssigned;
/**
* Callback for the Select Version Request PDU.
*/
WINPR_ATTR_NODISCARD psCamDevEnumServerServerSelectVersionRequest SelectVersionRequest;
/**
* Callback for the Device Added Notification PDU.
*/
WINPR_ATTR_NODISCARD psCamDevEnumServerServerDeviceAddedNotification
DeviceAddedNotification;
/**
* Callback for the Device Removed Notification PDU.
*/
WINPR_ATTR_NODISCARD psCamDevEnumServerServerDeviceRemovedNotification
DeviceRemovedNotification;
rdpContext* rdpcontext;
};
FREERDP_API void cam_dev_enum_server_context_free(CamDevEnumServerContext* context);
WINPR_ATTR_MALLOC(cam_dev_enum_server_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API CamDevEnumServerContext* cam_dev_enum_server_context_new(HANDLE vcm);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_CAM_DEV_ENUM_SERVER_CAM_DEV_ENUM_H */

View File

@@ -0,0 +1,285 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Video Capture Virtual Channel Extension
*
* Copyright 2022 Pascal Nowack <Pascal.Nowack@gmx.de>
*
* 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 FREERDP_CHANNEL_CAMERA_DEVICE_SERVER_CAMERA_DEVICE_H
#define FREERDP_CHANNEL_CAMERA_DEVICE_SERVER_CAMERA_DEVICE_H
#include <freerdp/channels/rdpecam.h>
#include <freerdp/channels/wtsvc.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct camera_device_server_context CameraDeviceServerContext;
typedef UINT (*psCameraDeviceServerOpen)(CameraDeviceServerContext* context);
typedef UINT (*psCameraDeviceServerClose)(CameraDeviceServerContext* context);
typedef BOOL (*psCameraDeviceServerChannelIdAssigned)(CameraDeviceServerContext* context,
UINT32 channelId);
typedef UINT (*psCameraDeviceServerInitialize)(CameraDeviceServerContext* context,
BOOL externalThread);
typedef UINT (*psCameraDeviceServerPoll)(CameraDeviceServerContext* context);
typedef BOOL (*psCameraDeviceServerChannelHandle)(CameraDeviceServerContext* context,
HANDLE* handle);
typedef UINT (*psCameraDeviceServerSuccessResponse)(
CameraDeviceServerContext* context, const CAM_SUCCESS_RESPONSE* successResponse);
typedef UINT (*psCameraDeviceServerErrorResponse)(CameraDeviceServerContext* context,
const CAM_ERROR_RESPONSE* errorResponse);
typedef UINT (*psCameraDeviceServerActivateDeviceRequest)(
CameraDeviceServerContext* context,
const CAM_ACTIVATE_DEVICE_REQUEST* activateDeviceRequest);
typedef UINT (*psCameraDeviceServerDeactivateDeviceRequest)(
CameraDeviceServerContext* context,
const CAM_DEACTIVATE_DEVICE_REQUEST* deactivateDeviceRequest);
typedef UINT (*psCameraDeviceServerStreamListRequest)(
CameraDeviceServerContext* context, const CAM_STREAM_LIST_REQUEST* streamListRequest);
typedef UINT (*psCameraDeviceServerStreamListResponse)(
CameraDeviceServerContext* context, const CAM_STREAM_LIST_RESPONSE* streamListResponse);
typedef UINT (*psCameraDeviceServerMediaTypeListRequest)(
CameraDeviceServerContext* context,
const CAM_MEDIA_TYPE_LIST_REQUEST* mediaTypeListRequest);
typedef UINT (*psCameraDeviceServerMediaTypeListResponse)(
CameraDeviceServerContext* context,
const CAM_MEDIA_TYPE_LIST_RESPONSE* mediaTypeListResponse);
typedef UINT (*psCameraDeviceServerCurrentMediaTypeRequest)(
CameraDeviceServerContext* context,
const CAM_CURRENT_MEDIA_TYPE_REQUEST* currentMediaTypeRequest);
typedef UINT (*psCameraDeviceServerCurrentMediaTypeResponse)(
CameraDeviceServerContext* context,
const CAM_CURRENT_MEDIA_TYPE_RESPONSE* currentMediaTypeResponse);
typedef UINT (*psCameraDeviceServerStartStreamsRequest)(
CameraDeviceServerContext* context, const CAM_START_STREAMS_REQUEST* startStreamsRequest);
typedef UINT (*psCameraDeviceServerStopStreamsRequest)(
CameraDeviceServerContext* context, const CAM_STOP_STREAMS_REQUEST* stopStreamsRequest);
typedef UINT (*psCameraDeviceServerSampleRequest)(CameraDeviceServerContext* context,
const CAM_SAMPLE_REQUEST* sampleRequest);
typedef UINT (*psCameraDeviceServerSampleResponse)(CameraDeviceServerContext* context,
const CAM_SAMPLE_RESPONSE* sampleResponse);
typedef UINT (*psCameraDeviceServerSampleErrorResponse)(
CameraDeviceServerContext* context, const CAM_SAMPLE_ERROR_RESPONSE* sampleErrorResponse);
typedef UINT (*psCameraDeviceServerPropertyListRequest)(
CameraDeviceServerContext* context, const CAM_PROPERTY_LIST_REQUEST* propertyListRequest);
typedef UINT (*psCameraDeviceServerPropertyListResponse)(
CameraDeviceServerContext* context, const CAM_PROPERTY_LIST_RESPONSE* propertyListResponse);
typedef UINT (*psCameraDeviceServerPropertyValueRequest)(
CameraDeviceServerContext* context, const CAM_PROPERTY_VALUE_REQUEST* propertyValueRequest);
typedef UINT (*psCameraDeviceServerPropertyValueResponse)(
CameraDeviceServerContext* context,
const CAM_PROPERTY_VALUE_RESPONSE* propertyValueResponse);
typedef UINT (*psCameraDeviceServerSetPropertyValueRequest)(
CameraDeviceServerContext* context,
const CAM_SET_PROPERTY_VALUE_REQUEST* setPropertyValueRequest);
struct camera_device_server_context
{
HANDLE vcm;
/* Server self-defined pointer. */
void* userdata;
/**
* Name of the virtual channel. Pointer owned by the CameraDeviceServerContext,
* meaning camera_device_server_context_free() takes care of freeing the pointer.
*
* Server implementations should sanitize the virtual channel name for invalid
* names, like names for other known channels
* ("ECHO", "AUDIO_PLAYBACK_DVC", etc.)
*/
char* virtualChannelName;
/**
* Protocol version to be used. Every sent server to client PDU has the
* version value in the Header set to the following value.
*/
BYTE protocolVersion;
/*** APIs called by the server. ***/
/**
* Optional: Set thread handling.
* When externalThread=TRUE, the application is responsible to call
* Poll() periodically to process channel events.
*
* Defaults to externalThread=FALSE
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerInitialize Initialize;
/**
* Open the camera device channel.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerOpen Open;
/**
* Close the camera device channel.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerClose Close;
/**
* Poll
* When externalThread=TRUE, call Poll() periodically from your main loop.
* If externalThread=FALSE do not call.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerPoll Poll;
/**
* Retrieve the channel handle for use in conjunction with Poll().
* If externalThread=FALSE do not call.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerChannelHandle ChannelHandle;
/**
* For the following server to client PDUs,
* the message header does not have to be set.
*/
/**
* Send a Activate Device Request PDU.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerActivateDeviceRequest ActivateDeviceRequest;
/**
* Send a Deactivate Device Request PDU.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerDeactivateDeviceRequest DeactivateDeviceRequest;
/**
* Send a Stream List Request PDU.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerStreamListRequest StreamListRequest;
/**
* Send a Media Type List Request PDU.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerMediaTypeListRequest MediaTypeListRequest;
/**
* Send a Current Media Type Request PDU.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerCurrentMediaTypeRequest CurrentMediaTypeRequest;
/**
* Send a Start Streams Request PDU.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerStartStreamsRequest StartStreamsRequest;
/**
* Send a Stop Streams Request PDU.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerStopStreamsRequest StopStreamsRequest;
/**
* Send a Sample Request PDU.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerSampleRequest SampleRequest;
/**
* Send a Property List Request PDU.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerPropertyListRequest PropertyListRequest;
/**
* Send a Property Value Request PDU.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerPropertyValueRequest PropertyValueRequest;
/**
* Send a Set Property Value Request PDU.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerSetPropertyValueRequest SetPropertyValueRequest;
/*** Callbacks registered by the server. ***/
/**
* Callback, when the channel got its id assigned.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerChannelIdAssigned ChannelIdAssigned;
/**
* Callback for the Success Response PDU.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerSuccessResponse SuccessResponse;
/**
* Callback for the Error Response PDU.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerErrorResponse ErrorResponse;
/**
* Callback for the Stream List Response PDU.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerStreamListResponse StreamListResponse;
/**
* Callback for the Media Type List Response PDU.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerMediaTypeListResponse MediaTypeListResponse;
/**
* Callback for the Current Media Type Response PDU.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerCurrentMediaTypeResponse CurrentMediaTypeResponse;
/**
* Callback for the Sample Response PDU.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerSampleResponse SampleResponse;
/**
* Callback for the Sample Error Response PDU.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerSampleErrorResponse SampleErrorResponse;
/**
* Callback for the Property List Response PDU.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerPropertyListResponse PropertyListResponse;
/**
* Callback for the Property Value Response PDU.
*/
WINPR_ATTR_NODISCARD psCameraDeviceServerPropertyValueResponse PropertyValueResponse;
rdpContext* rdpcontext;
};
FREERDP_API void camera_device_server_context_free(CameraDeviceServerContext* context);
WINPR_ATTR_MALLOC(camera_device_server_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API CameraDeviceServerContext* camera_device_server_context_new(HANDLE vcm);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_CAMERA_DEVICE_SERVER_CAMERA_DEVICE_H */

View File

@@ -0,0 +1,112 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Extended Input channel server-side definitions
*
* Copyright 2014 Thincast Technologies Gmbh.
* Copyright 2014 David FORT <contact@hardening-consulting.com>
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* 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 FREERDP_CHANNEL_RDPEI_SERVER_H
#define FREERDP_CHANNEL_RDPEI_SERVER_H
#include <freerdp/channels/wtsvc.h>
#include <freerdp/channels/rdpei.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct s_rdpei_server_context RdpeiServerContext;
typedef struct s_rdpei_server_private RdpeiServerPrivate;
typedef UINT (*psRdpeiServerOpen)(RdpeiServerContext* context);
typedef UINT (*psRdpeiServerClose)(RdpeiServerContext* context);
struct s_rdpei_server_context
{
HANDLE vcm;
RdpeiServerPrivate* priv;
UINT32 clientVersion;
UINT16 maxTouchPoints;
UINT32 protocolFlags;
/** callbacks that can be set by the user */
WINPR_ATTR_NODISCARD UINT (*onClientReady)(RdpeiServerContext* context);
WINPR_ATTR_NODISCARD UINT (*onTouchEvent)(RdpeiServerContext* context,
const RDPINPUT_TOUCH_EVENT* touchEvent);
WINPR_ATTR_NODISCARD UINT (*onPenEvent)(RdpeiServerContext* context,
const RDPINPUT_PEN_EVENT* penEvent);
WINPR_ATTR_NODISCARD UINT (*onTouchReleased)(RdpeiServerContext* context, BYTE contactId);
void* user_data; /* user data, useful for callbacks */
/**
* Callback, when the channel got its id assigned.
*/
WINPR_ATTR_NODISCARD BOOL (*onChannelIdAssigned)(RdpeiServerContext* context,
UINT32 channelId);
/*** APIs called by the server. ***/
/**
* Open the input channel.
* @since version 3.15.0
*/
WINPR_ATTR_NODISCARD psRdpeiServerOpen Open;
/**
* Close the input channel.
* @since version 3.15.0
*/
WINPR_ATTR_NODISCARD psRdpeiServerClose Close;
};
FREERDP_API void rdpei_server_context_free(RdpeiServerContext* context);
WINPR_ATTR_MALLOC(rdpei_server_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API RdpeiServerContext* rdpei_server_context_new(HANDLE vcm);
FREERDP_API void rdpei_server_context_reset(RdpeiServerContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API HANDLE rdpei_server_get_event_handle(RdpeiServerContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API UINT rdpei_server_init(RdpeiServerContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API UINT rdpei_server_handle_messages(RdpeiServerContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API UINT rdpei_server_send_sc_ready(RdpeiServerContext* context, UINT32 version,
UINT32 features);
WINPR_ATTR_NODISCARD
FREERDP_API UINT rdpei_server_suspend(RdpeiServerContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API UINT rdpei_server_resume(RdpeiServerContext* context);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_RDPEI_SERVER_H */

View File

@@ -0,0 +1,133 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Mouse Cursor Virtual Channel Extension
*
* Copyright 2023 Pascal Nowack <Pascal.Nowack@gmx.de>
*
* 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 FREERDP_CHANNEL_RDPEMSC_SERVER_RDPEMSC_H
#define FREERDP_CHANNEL_RDPEMSC_SERVER_RDPEMSC_H
#include <freerdp/channels/rdpemsc.h>
#include <freerdp/channels/wtsvc.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct s_mouse_cursor_server_context MouseCursorServerContext;
typedef UINT (*psMouseCursorServerOpen)(MouseCursorServerContext* context);
typedef UINT (*psMouseCursorServerClose)(MouseCursorServerContext* context);
typedef BOOL (*psMouseCursorServerChannelIdAssigned)(MouseCursorServerContext* context,
UINT32 channelId);
typedef UINT (*psMouseCursorServerInitialize)(MouseCursorServerContext* context,
BOOL externalThread);
typedef UINT (*psMouseCursorServerPoll)(MouseCursorServerContext* context);
typedef BOOL (*psMouseCursorServerChannelHandle)(MouseCursorServerContext* context,
HANDLE* handle);
typedef UINT (*psMouseCursorServerCapsAdvertise)(
MouseCursorServerContext* context,
const RDP_MOUSE_CURSOR_CAPS_ADVERTISE_PDU* capsAdvertise);
typedef UINT (*psMouseCursorServerCapsConfirm)(
MouseCursorServerContext* context, const RDP_MOUSE_CURSOR_CAPS_CONFIRM_PDU* capsConfirm);
typedef UINT (*psMouseCursorServerMouseptrUpdate)(
MouseCursorServerContext* context,
const RDP_MOUSE_CURSOR_MOUSEPTR_UPDATE_PDU* mouseptrUpdate);
struct s_mouse_cursor_server_context
{
HANDLE vcm;
/* Server self-defined pointer. */
void* userdata;
/*** APIs called by the server. ***/
/**
* Optional: Set thread handling.
* When externalThread=TRUE, the application is responsible to call
* Poll() periodically to process channel events.
*
* Defaults to externalThread=FALSE
*/
WINPR_ATTR_NODISCARD psMouseCursorServerInitialize Initialize;
/**
* Open the mouse cursor channel.
*/
WINPR_ATTR_NODISCARD psMouseCursorServerOpen Open;
/**
* Close the mouse cursor channel.
*/
WINPR_ATTR_NODISCARD psMouseCursorServerClose Close;
/**
* Poll
* When externalThread=TRUE, call Poll() periodically from your main loop.
* If externalThread=FALSE do not call.
*/
WINPR_ATTR_NODISCARD psMouseCursorServerPoll Poll;
/**
* Retrieve the channel handle for use in conjunction with Poll().
* If externalThread=FALSE do not call.
*/
WINPR_ATTR_NODISCARD psMouseCursorServerChannelHandle ChannelHandle;
/* All PDUs sent by the server don't require the pduType to be set */
/*
* Send a CapsConfirm PDU.
*/
WINPR_ATTR_NODISCARD psMouseCursorServerCapsConfirm CapsConfirm;
/*
* Send a MouseptrUpdate PDU.
*/
WINPR_ATTR_NODISCARD psMouseCursorServerMouseptrUpdate MouseptrUpdate;
/*** Callbacks registered by the server. ***/
/**
* Callback, when the channel got its id assigned.
*/
WINPR_ATTR_NODISCARD psMouseCursorServerChannelIdAssigned ChannelIdAssigned;
/**
* Callback for the CapsAdvertise PDU.
*/
WINPR_ATTR_NODISCARD psMouseCursorServerCapsAdvertise CapsAdvertise;
rdpContext* rdpcontext;
};
FREERDP_API void mouse_cursor_server_context_free(MouseCursorServerContext* context);
WINPR_ATTR_MALLOC(mouse_cursor_server_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API MouseCursorServerContext* mouse_cursor_server_context_new(HANDLE vcm);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_RDPEMSC_SERVER_RDPEMSC_H */

View File

@@ -0,0 +1,162 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Graphics Pipeline Extension
*
* Copyright 2016 Jiang Zihao <zihao.jiang@yahoo.com>
*
* 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 FREERDP_CHANNEL_RDPGFX_SERVER_RDPGFX_H
#define FREERDP_CHANNEL_RDPGFX_SERVER_RDPGFX_H
#include <freerdp/channels/rdpgfx.h>
#include <freerdp/types.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct s_rdpgfx_server_context RdpgfxServerContext;
typedef struct s_rdpgfx_server_private RdpgfxServerPrivate;
typedef BOOL (*psRdpgfxServerOpen)(RdpgfxServerContext* context);
typedef BOOL (*psRdpgfxServerClose)(RdpgfxServerContext* context);
typedef BOOL (*psRdpgfxServerChannelIdAssigned)(RdpgfxServerContext* context, UINT32 channelId);
typedef BOOL (*psRdpgfxServerInitialize)(RdpgfxServerContext* context, BOOL externalThread);
typedef UINT (*psRdpgfxResetGraphics)(RdpgfxServerContext* context,
const RDPGFX_RESET_GRAPHICS_PDU* resetGraphics);
typedef UINT (*psRdpgfxStartFrame)(RdpgfxServerContext* context,
const RDPGFX_START_FRAME_PDU* startFrame);
typedef UINT (*psRdpgfxEndFrame)(RdpgfxServerContext* context,
const RDPGFX_END_FRAME_PDU* endFrame);
typedef UINT (*psRdpgfxSurfaceCommand)(RdpgfxServerContext* context,
const RDPGFX_SURFACE_COMMAND* cmd);
typedef UINT (*psRdpgfxSurfaceFrameCommand)(RdpgfxServerContext* context,
const RDPGFX_SURFACE_COMMAND* cmd,
const RDPGFX_START_FRAME_PDU* startFrame,
const RDPGFX_END_FRAME_PDU* endFrame);
typedef UINT (*psRdpgfxDeleteEncodingContext)(
RdpgfxServerContext* context,
const RDPGFX_DELETE_ENCODING_CONTEXT_PDU* deleteEncodingContext);
typedef UINT (*psRdpgfxCreateSurface)(RdpgfxServerContext* context,
const RDPGFX_CREATE_SURFACE_PDU* createSurface);
typedef UINT (*psRdpgfxDeleteSurface)(RdpgfxServerContext* context,
const RDPGFX_DELETE_SURFACE_PDU* deleteSurface);
typedef UINT (*psRdpgfxSolidFill)(RdpgfxServerContext* context,
const RDPGFX_SOLID_FILL_PDU* solidFill);
typedef UINT (*psRdpgfxSurfaceToSurface)(RdpgfxServerContext* context,
const RDPGFX_SURFACE_TO_SURFACE_PDU* surfaceToSurface);
typedef UINT (*psRdpgfxSurfaceToCache)(RdpgfxServerContext* context,
const RDPGFX_SURFACE_TO_CACHE_PDU* surfaceToCache);
typedef UINT (*psRdpgfxCacheToSurface)(RdpgfxServerContext* context,
const RDPGFX_CACHE_TO_SURFACE_PDU* cacheToSurface);
typedef UINT (*psRdpgfxCacheImportOffer)(RdpgfxServerContext* context,
const RDPGFX_CACHE_IMPORT_OFFER_PDU* cacheImportOffer);
typedef UINT (*psRdpgfxCacheImportReply)(RdpgfxServerContext* context,
const RDPGFX_CACHE_IMPORT_REPLY_PDU* cacheImportReply);
typedef UINT (*psRdpgfxEvictCacheEntry)(RdpgfxServerContext* context,
const RDPGFX_EVICT_CACHE_ENTRY_PDU* evictCacheEntry);
typedef UINT (*psRdpgfxMapSurfaceToOutput)(
RdpgfxServerContext* context, const RDPGFX_MAP_SURFACE_TO_OUTPUT_PDU* surfaceToOutput);
typedef UINT (*psRdpgfxMapSurfaceToWindow)(
RdpgfxServerContext* context, const RDPGFX_MAP_SURFACE_TO_WINDOW_PDU* surfaceToWindow);
typedef UINT (*psRdpgfxMapSurfaceToScaledOutput)(
RdpgfxServerContext* context,
const RDPGFX_MAP_SURFACE_TO_SCALED_OUTPUT_PDU* surfaceToOutput);
typedef UINT (*psRdpgfxMapSurfaceToScaledWindow)(
RdpgfxServerContext* context,
const RDPGFX_MAP_SURFACE_TO_SCALED_WINDOW_PDU* surfaceToWindow);
typedef UINT (*psRdpgfxCapsAdvertise)(RdpgfxServerContext* context,
const RDPGFX_CAPS_ADVERTISE_PDU* capsAdvertise);
typedef UINT (*psRdpgfxCapsConfirm)(RdpgfxServerContext* context,
const RDPGFX_CAPS_CONFIRM_PDU* capsConfirm);
typedef UINT (*psRdpgfxFrameAcknowledge)(RdpgfxServerContext* context,
const RDPGFX_FRAME_ACKNOWLEDGE_PDU* frameAcknowledge);
typedef UINT (*psRdpgfxQoeFrameAcknowledge)(
RdpgfxServerContext* context, const RDPGFX_QOE_FRAME_ACKNOWLEDGE_PDU* qoeFrameAcknowledge);
struct s_rdpgfx_server_context
{
HANDLE vcm;
void* custom;
WINPR_ATTR_NODISCARD psRdpgfxServerOpen Open;
WINPR_ATTR_NODISCARD psRdpgfxServerClose Close;
WINPR_ATTR_NODISCARD psRdpgfxResetGraphics ResetGraphics;
WINPR_ATTR_NODISCARD psRdpgfxStartFrame StartFrame;
WINPR_ATTR_NODISCARD psRdpgfxEndFrame EndFrame;
WINPR_ATTR_NODISCARD psRdpgfxSurfaceCommand SurfaceCommand;
WINPR_ATTR_NODISCARD psRdpgfxSurfaceFrameCommand SurfaceFrameCommand;
WINPR_ATTR_NODISCARD psRdpgfxDeleteEncodingContext DeleteEncodingContext;
WINPR_ATTR_NODISCARD psRdpgfxCreateSurface CreateSurface;
WINPR_ATTR_NODISCARD psRdpgfxDeleteSurface DeleteSurface;
WINPR_ATTR_NODISCARD psRdpgfxSolidFill SolidFill;
WINPR_ATTR_NODISCARD psRdpgfxSurfaceToSurface SurfaceToSurface;
WINPR_ATTR_NODISCARD psRdpgfxSurfaceToCache SurfaceToCache;
WINPR_ATTR_NODISCARD psRdpgfxCacheToSurface CacheToSurface;
WINPR_ATTR_NODISCARD psRdpgfxCacheImportOffer CacheImportOffer;
WINPR_ATTR_NODISCARD psRdpgfxCacheImportReply CacheImportReply;
WINPR_ATTR_NODISCARD psRdpgfxEvictCacheEntry EvictCacheEntry;
WINPR_ATTR_NODISCARD psRdpgfxMapSurfaceToOutput MapSurfaceToOutput;
WINPR_ATTR_NODISCARD psRdpgfxMapSurfaceToWindow MapSurfaceToWindow;
WINPR_ATTR_NODISCARD psRdpgfxMapSurfaceToScaledOutput MapSurfaceToScaledOutput;
WINPR_ATTR_NODISCARD psRdpgfxMapSurfaceToScaledWindow MapSurfaceToScaledWindow;
WINPR_ATTR_NODISCARD psRdpgfxCapsAdvertise CapsAdvertise;
WINPR_ATTR_NODISCARD psRdpgfxCapsConfirm CapsConfirm;
WINPR_ATTR_NODISCARD psRdpgfxFrameAcknowledge FrameAcknowledge;
WINPR_ATTR_NODISCARD psRdpgfxQoeFrameAcknowledge QoeFrameAcknowledge;
RdpgfxServerPrivate* priv;
rdpContext* rdpcontext;
/**
* Callback, when the channel got its id assigned.
*/
WINPR_ATTR_NODISCARD psRdpgfxServerChannelIdAssigned ChannelIdAssigned;
/**
* Optional: Set thread handling.
* When externalThread=TRUE, the application is responsible to call
* Poll() periodically to process channel events.
*
* Defaults to externalThread=FALSE
*/
WINPR_ATTR_NODISCARD psRdpgfxServerInitialize Initialize;
};
FREERDP_API void rdpgfx_server_context_free(RdpgfxServerContext* context);
WINPR_ATTR_MALLOC(rdpgfx_server_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API RdpgfxServerContext* rdpgfx_server_context_new(HANDLE vcm);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL rdpgfx_server_set_own_thread(RdpgfxServerContext* context,
BOOL internalThread);
WINPR_ATTR_NODISCARD
FREERDP_API HANDLE rdpgfx_server_get_event_handle(RdpgfxServerContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API UINT rdpgfx_server_handle_messages(RdpgfxServerContext* context);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_RDPGFX_SERVER_RDPGFX_H */

View File

@@ -0,0 +1,203 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Server Audio Virtual Channel
*
* Copyright 2012 Vic Lee
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* 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 FREERDP_CHANNEL_RDPSND_SERVER_H
#define FREERDP_CHANNEL_RDPSND_SERVER_H
#include <freerdp/channels/wtsvc.h>
#include <freerdp/channels/rdpsnd.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct s_rdpsnd_server_context RdpsndServerContext;
typedef struct s_rdpsnd_server_context rdpsnd_server_context;
typedef struct s_rdpsnd_server_private RdpsndServerPrivate;
typedef UINT (*psRdpsndStart)(RdpsndServerContext* context);
typedef UINT (*psRdpsndStop)(RdpsndServerContext* context);
typedef BOOL (*psRdpsndChannelIdAssigned)(RdpsndServerContext* context, UINT32 channelId);
typedef UINT (*psRdpsndServerInitialize)(RdpsndServerContext* context, BOOL ownThread);
typedef UINT (*psRdpsndServerSendFormats)(RdpsndServerContext* context);
typedef UINT (*psRdpsndServerSelectFormat)(RdpsndServerContext* context,
UINT16 client_format_index);
typedef UINT (*psRdpsndServerTraining)(RdpsndServerContext* context, UINT16 timestamp,
UINT16 packsize, BYTE* data);
typedef UINT (*psRdpsndServerTrainingConfirm)(RdpsndServerContext* context, UINT16 timestamp,
UINT16 packsize);
typedef UINT (*psRdpsndServerSendSamples)(RdpsndServerContext* context, const void* buf,
size_t nframes, UINT16 wTimestamp);
typedef UINT (*psRdpsndServerSendSamples2)(RdpsndServerContext* context, UINT16 formatNo,
const void* buf, size_t size, UINT16 timestamp,
UINT32 audioTimeStamp);
typedef UINT (*psRdpsndServerConfirmBlock)(RdpsndServerContext* context, BYTE confirmBlockNum,
UINT16 wtimestamp);
typedef UINT (*psRdpsndServerSetVolume)(RdpsndServerContext* context, UINT16 left,
UINT16 right);
typedef UINT (*psRdpsndServerClose)(RdpsndServerContext* context);
typedef void (*psRdpsndServerActivated)(RdpsndServerContext* context);
struct s_rdpsnd_server_context
{
HANDLE vcm;
WINPR_ATTR_NODISCARD psRdpsndStart Start;
psRdpsndStop Stop;
RdpsndServerPrivate* priv;
/* Server self-defined pointer. */
void* data;
/* Server to request to use dynamic virtual channel. */
BOOL use_dynamic_virtual_channel;
/* Server supported formats. Set by server. */
AUDIO_FORMAT* server_formats;
size_t num_server_formats;
/* Server source PCM audio format. Set by server. */
AUDIO_FORMAT* src_format;
/* Server audio latency, or buffer size, in milli-seconds. Set by server. */
UINT32 latency;
/* Client supported formats. */
AUDIO_FORMAT* client_formats;
UINT16 num_client_formats;
UINT16 selected_client_format;
/* Last sent audio block number. */
UINT8 block_no;
/*** APIs called by the server. ***/
/**
* Initialize the channel. The caller should check the return value to see
* whether the initialization succeed. If not, the "Activated" callback
* will not be called and the server must not call any API on this context.
*/
WINPR_ATTR_NODISCARD psRdpsndServerInitialize Initialize;
/**
* Choose the audio format to be sent. The index argument is an index into
* the client_formats array and must be smaller than num_client_formats.
*/
WINPR_ATTR_NODISCARD psRdpsndServerSelectFormat SelectFormat;
/**
* Send audio samples. Actually bytes in the buffer must be:
* nframes * src_format.nBitsPerSample * src_format.nChannels / 8
*/
WINPR_ATTR_NODISCARD psRdpsndServerSendSamples SendSamples;
/**
* Called when block confirm is received from the client
*/
WINPR_ATTR_NODISCARD psRdpsndServerConfirmBlock ConfirmBlock;
/**
* Set the volume level of the client. Valid range is between 0 and 0xFFFF.
*/
WINPR_ATTR_NODISCARD psRdpsndServerSetVolume SetVolume;
/**
* Close the audio stream.
*/
psRdpsndServerClose Close;
/*** Callbacks registered by the server. ***/
/**
* The channel has been activated. The server maybe choose audio format and
* start audio stream from this point. Note that this callback is called
* from a different thread context so the server must be careful of thread
* synchronization.
*/
psRdpsndServerActivated Activated;
/**
* MS-RDPEA channel version the client announces
*/
UINT16 clientVersion;
rdpContext* rdpcontext;
/* dwFlags in CLIENT_AUDIO_VERSION_AND_FORMATS */
UINT32 capsFlags;
/* dwVolume in CLIENT_AUDIO_VERSION_AND_FORMATS */
UINT32 initialVolume;
/* dwPitch in CLIENT_AUDIO_VERSION_AND_FORMATS */
UINT32 initialPitch;
UINT16 qualityMode;
/**
* Send server formats and version to the client. Automatically sent, when
* opening the channel.
* Also used to restart the protocol after sending the Close PDU.
*/
WINPR_ATTR_NODISCARD psRdpsndServerSendFormats SendFormats;
/**
* Send Training PDU.
*/
WINPR_ATTR_NODISCARD psRdpsndServerTraining Training;
/**
* Send encoded audio samples using a Wave2 PDU.
* When successful, the block_no member is incremented.
*/
WINPR_ATTR_NODISCARD psRdpsndServerSendSamples2 SendSamples2;
/**
* Called when a TrainingConfirm PDU is received from the client.
*/
WINPR_ATTR_NODISCARD psRdpsndServerTrainingConfirm TrainingConfirm;
/**
* Callback, when the channel got its id assigned.
* Only called, when use_dynamic_virtual_channel=TRUE.
*/
WINPR_ATTR_NODISCARD psRdpsndChannelIdAssigned ChannelIdAssigned;
UINT16 udpPort; /** @since version 3.14.0 */
UINT8 lastblock; /** @since version 3.14.0 */
};
FREERDP_API void rdpsnd_server_context_free(RdpsndServerContext* context);
WINPR_ATTR_MALLOC(rdpsnd_server_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API RdpsndServerContext* rdpsnd_server_context_new(HANDLE vcm);
FREERDP_API void rdpsnd_server_context_reset(RdpsndServerContext*);
WINPR_ATTR_NODISCARD
FREERDP_API HANDLE rdpsnd_server_get_event_handle(RdpsndServerContext* context);
WINPR_ATTR_NODISCARD
FREERDP_API UINT rdpsnd_server_handle_messages(RdpsndServerContext* context);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_RDPSND_SERVER_H */

View File

@@ -0,0 +1,68 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Remote Assistance Virtual Channel
*
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* 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 FREERDP_CHANNEL_REMDESK_SERVER_REMDESK_H
#define FREERDP_CHANNEL_REMDESK_SERVER_REMDESK_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/channels/wtsvc.h>
#include <freerdp/client/remdesk.h>
#ifdef __cplusplus
extern "C"
{
#endif
/**
* Server Interface
*/
typedef struct s_remdesk_server_context RemdeskServerContext;
typedef struct s_remdesk_server_private RemdeskServerPrivate;
typedef UINT (*psRemdeskStart)(RemdeskServerContext* context);
typedef UINT (*psRemdeskStop)(RemdeskServerContext* context);
struct s_remdesk_server_context
{
HANDLE vcm;
void* custom;
WINPR_ATTR_NODISCARD psRemdeskStart Start;
psRemdeskStop Stop;
RemdeskServerPrivate* priv;
rdpContext* rdpcontext;
};
FREERDP_API void remdesk_server_context_free(RemdeskServerContext* context);
WINPR_ATTR_MALLOC(remdesk_server_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API RemdeskServerContext* remdesk_server_context_new(HANDLE vcm);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_REMDESK_SERVER_REMDESK_H */

View File

@@ -0,0 +1,47 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* FreeRDP Server Common
*
* Copyright 2018 Armin Novak <armin.novak@thincast.com>
* Copyright 2018 Thincast Technologies GmbH
*
* 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 FREERDP_SERVER_COMMON_SERVER_H
#define FREERDP_SERVER_COMMON_SERVER_H
#include <winpr/wtypes.h>
#include <freerdp/api.h>
#include <freerdp/codec/audio.h>
#ifdef __cplusplus
extern "C"
{
#endif
WINPR_ATTR_NODISCARD
FREERDP_API size_t server_audin_get_formats(AUDIO_FORMAT** dst_formats);
WINPR_ATTR_NODISCARD
FREERDP_API size_t server_rdpsnd_get_formats(AUDIO_FORMAT** dst_formats);
FREERDP_API void freerdp_server_warn_unmaintained(int argc, char* argv[]);
FREERDP_API void freerdp_server_warn_experimental(int argc, char* argv[]);
FREERDP_API void freerdp_server_warn_deprecated(int argc, char* argv[]);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_SERVER_COMMON_SERVER_H */

View File

@@ -0,0 +1,428 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Session Shadowing
*
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* 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 FREERDP_SERVER_SHADOW_H
#define FREERDP_SERVER_SHADOW_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/freerdp.h>
#include <freerdp/settings.h>
#include <freerdp/listener.h>
#include <freerdp/channels/wtsvc.h>
#include <freerdp/channels/channels.h>
#include <freerdp/server/encomsp.h>
#include <freerdp/server/remdesk.h>
#include <freerdp/server/rdpsnd.h>
#if defined(CHANNEL_AUDIN_SERVER)
#include <freerdp/server/audin.h>
#endif
#include <freerdp/server/rdpgfx.h>
#include <freerdp/codec/color.h>
#include <freerdp/codec/region.h>
#include <winpr/crt.h>
#include <winpr/synch.h>
#include <winpr/collections.h>
#include <winpr/cmdline.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct rdp_shadow_client rdpShadowClient;
typedef struct rdp_shadow_server rdpShadowServer;
typedef struct rdp_shadow_screen rdpShadowScreen;
typedef struct rdp_shadow_surface rdpShadowSurface;
typedef struct rdp_shadow_encoder rdpShadowEncoder;
typedef struct rdp_shadow_capture rdpShadowCapture;
typedef struct rdp_shadow_subsystem rdpShadowSubsystem;
typedef struct rdp_shadow_multiclient_event rdpShadowMultiClientEvent;
typedef struct S_RDP_SHADOW_ENTRY_POINTS RDP_SHADOW_ENTRY_POINTS;
typedef int (*pfnShadowSubsystemEntry)(RDP_SHADOW_ENTRY_POINTS* pEntryPoints);
typedef rdpShadowSubsystem* (*pfnShadowSubsystemNew)(void);
typedef void (*pfnShadowSubsystemFree)(rdpShadowSubsystem* subsystem);
typedef int (*pfnShadowSubsystemInit)(rdpShadowSubsystem* subsystem);
typedef int (*pfnShadowSubsystemUninit)(rdpShadowSubsystem* subsystem);
typedef int (*pfnShadowSubsystemStart)(rdpShadowSubsystem* subsystem);
typedef int (*pfnShadowSubsystemStop)(rdpShadowSubsystem* subsystem);
typedef UINT32 (*pfnShadowEnumMonitors)(MONITOR_DEF* monitors, UINT32 maxMonitors);
typedef int (*pfnShadowAuthenticate)(rdpShadowSubsystem* subsystem, rdpShadowClient* client,
const char* user, const char* domain,
const char* password);
typedef BOOL (*pfnShadowClientConnect)(rdpShadowSubsystem* subsystem, rdpShadowClient* client);
typedef void (*pfnShadowClientDisconnect)(rdpShadowSubsystem* subsystem,
rdpShadowClient* client);
typedef BOOL (*pfnShadowClientCapabilities)(rdpShadowSubsystem* subsystem,
rdpShadowClient* client);
typedef BOOL (*pfnShadowSynchronizeEvent)(rdpShadowSubsystem* subsystem,
rdpShadowClient* client, UINT32 flags);
typedef BOOL (*pfnShadowKeyboardEvent)(rdpShadowSubsystem* subsystem, rdpShadowClient* client,
UINT16 flags, UINT8 code);
typedef BOOL (*pfnShadowUnicodeKeyboardEvent)(rdpShadowSubsystem* subsystem,
rdpShadowClient* client, UINT16 flags,
UINT16 code);
typedef BOOL (*pfnShadowMouseEvent)(rdpShadowSubsystem* subsystem, rdpShadowClient* client,
UINT16 flags, UINT16 x, UINT16 y);
typedef BOOL (*pfnShadowRelMouseEvent)(rdpShadowSubsystem* subsystem, rdpShadowClient* client,
UINT16 flags, INT16 xDelta,
INT16 yDelta); /** @since version 3.15.0 */
typedef BOOL (*pfnShadowExtendedMouseEvent)(rdpShadowSubsystem* subsystem,
rdpShadowClient* client, UINT16 flags, UINT16 x,
UINT16 y);
typedef BOOL (*pfnShadowChannelAudinServerReceiveSamples)(rdpShadowSubsystem* subsystem,
rdpShadowClient* client,
const AUDIO_FORMAT* format,
wStream* data);
struct rdp_shadow_client
{
rdpContext context;
HANDLE thread;
BOOL activated;
BOOL first_frame;
BOOL inLobby;
BOOL mayView;
BOOL mayInteract;
BOOL suppressOutput;
UINT16 surfaceId;
wMessageQueue* MsgQueue;
CRITICAL_SECTION lock;
REGION16 invalidRegion;
rdpShadowServer* server;
rdpShadowEncoder* encoder;
rdpShadowSubsystem* subsystem;
UINT32 pointerX;
UINT32 pointerY;
HANDLE vcm;
EncomspServerContext* encomsp;
RemdeskServerContext* remdesk;
RdpsndServerContext* rdpsnd;
#if defined(CHANNEL_AUDIN_SERVER)
audin_server_context* audin;
#endif
RdpgfxServerContext* rdpgfx;
BOOL resizeRequested;
UINT32 resizeWidth;
UINT32 resizeHeight;
BOOL areGfxCapsReady; /** @since version 3.3.0 */
};
struct rdp_shadow_server
{
void* ext;
HANDLE thread;
HANDLE StopEvent;
wArrayList* clients;
rdpSettings* settings;
rdpShadowScreen* screen;
rdpShadowSurface* surface;
rdpShadowSurface* lobby;
rdpShadowCapture* capture;
rdpShadowSubsystem* subsystem;
DWORD port;
BOOL mayView;
BOOL mayInteract;
BOOL shareSubRect;
BOOL authentication;
UINT32 selectedMonitor;
RECTANGLE_16 subRect;
/* Codec settings */
RLGR_MODE rfxMode; /* unused */
H264_RATECONTROL_MODE h264RateControlMode;
UINT32 h264BitRate;
UINT32 h264FrameRate;
UINT32 h264QP;
char* ipcSocket;
char* ConfigPath;
char* CertificateFile;
char* PrivateKeyFile;
CRITICAL_SECTION lock;
freerdp_listener* listener;
size_t maxClientsConnected;
BOOL SupportMultiRectBitmapUpdates; /** @since version 3.13.0 */
BOOL ShowMouseCursor; /** @since version 3.15.0 */
};
struct rdp_shadow_surface
{
rdpShadowServer* server;
UINT16 x;
UINT16 y;
UINT32 width;
UINT32 height;
UINT32 scanline;
DWORD format;
BYTE* data;
CRITICAL_SECTION lock;
REGION16 invalidRegion;
};
struct S_RDP_SHADOW_ENTRY_POINTS
{
WINPR_ATTR_NODISCARD pfnShadowSubsystemNew New;
pfnShadowSubsystemFree Free;
WINPR_ATTR_NODISCARD pfnShadowSubsystemInit Init;
pfnShadowSubsystemUninit Uninit;
WINPR_ATTR_NODISCARD pfnShadowSubsystemStart Start;
pfnShadowSubsystemStop Stop;
WINPR_ATTR_NODISCARD pfnShadowEnumMonitors EnumMonitors;
};
struct rdp_shadow_subsystem
{
RDP_SHADOW_ENTRY_POINTS ep;
HANDLE event;
UINT32 numMonitors;
UINT32 captureFrameRate;
UINT32 selectedMonitor;
MONITOR_DEF monitors[16];
MONITOR_DEF virtualScreen;
/* This event indicates that we have graphic change */
/* such as screen update and resize. It should not be */
/* used by subsystem implementation directly */
rdpShadowMultiClientEvent* updateEvent;
wMessagePipe* MsgPipe;
UINT32 pointerX;
UINT32 pointerY;
AUDIO_FORMAT* rdpsndFormats;
size_t nRdpsndFormats;
AUDIO_FORMAT* audinFormats;
size_t nAudinFormats;
WINPR_ATTR_NODISCARD pfnShadowSynchronizeEvent SynchronizeEvent;
WINPR_ATTR_NODISCARD pfnShadowKeyboardEvent KeyboardEvent;
WINPR_ATTR_NODISCARD pfnShadowUnicodeKeyboardEvent UnicodeKeyboardEvent;
WINPR_ATTR_NODISCARD pfnShadowMouseEvent MouseEvent;
WINPR_ATTR_NODISCARD pfnShadowExtendedMouseEvent ExtendedMouseEvent;
WINPR_ATTR_NODISCARD pfnShadowChannelAudinServerReceiveSamples AudinServerReceiveSamples;
WINPR_ATTR_NODISCARD pfnShadowAuthenticate Authenticate;
WINPR_ATTR_NODISCARD pfnShadowClientConnect ClientConnect;
pfnShadowClientDisconnect ClientDisconnect;
WINPR_ATTR_NODISCARD pfnShadowClientCapabilities ClientCapabilities;
rdpShadowServer* server;
WINPR_ATTR_NODISCARD pfnShadowRelMouseEvent RelMouseEvent; /** @since version 3.15.0 */
};
/* Definition of message between subsystem and clients */
#define SHADOW_MSG_IN_REFRESH_REQUEST_ID 1001
typedef struct S_SHADOW_MSG_OUT SHADOW_MSG_OUT;
typedef void (*MSG_OUT_FREE_FN)(UINT32 id,
SHADOW_MSG_OUT* msg); /* function to free SHADOW_MSG_OUT */
struct S_SHADOW_MSG_OUT
{
int refCount;
MSG_OUT_FREE_FN Free;
};
#define SHADOW_MSG_OUT_POINTER_POSITION_UPDATE_ID 2001
#define SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE_ID 2002
#define SHADOW_MSG_OUT_AUDIO_OUT_SAMPLES_ID 2003
#define SHADOW_MSG_OUT_AUDIO_OUT_VOLUME_ID 2004
typedef struct
{
SHADOW_MSG_OUT common;
UINT32 xPos;
UINT32 yPos;
} SHADOW_MSG_OUT_POINTER_POSITION_UPDATE;
typedef struct
{
SHADOW_MSG_OUT common;
UINT32 xHot;
UINT32 yHot;
UINT32 width;
UINT32 height;
UINT32 lengthAndMask;
UINT32 lengthXorMask;
BYTE* xorMaskData;
BYTE* andMaskData;
} SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE;
typedef struct
{
SHADOW_MSG_OUT common;
AUDIO_FORMAT* audio_format;
void* buf;
size_t nFrames;
UINT16 wTimestamp;
} SHADOW_MSG_OUT_AUDIO_OUT_SAMPLES;
typedef struct
{
SHADOW_MSG_OUT common;
UINT16 left;
UINT16 right;
} SHADOW_MSG_OUT_AUDIO_OUT_VOLUME;
FREERDP_API void shadow_subsystem_set_entry_builtin(const char* name);
FREERDP_API void shadow_subsystem_set_entry(pfnShadowSubsystemEntry pEntry);
#if !defined(WITHOUT_FREERDP_3x_DEPRECATED)
WINPR_DEPRECATED_VAR(
"[since 3.4.0] Use shadow_subsystem_pointer_convert_alpha_pointer_data_to_format instead",
WINPR_ATTR_NODISCARD FREERDP_API int shadow_subsystem_pointer_convert_alpha_pointer_data(
const BYTE* WINPR_RESTRICT pixels, BOOL premultiplied, UINT32 width, UINT32 height,
SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE* WINPR_RESTRICT pointerColor));
#endif
/** @brief Convert a pointer image from input format to RDP specific encoding
*
* @param pixels A pointer to the pixel data
* @param format The pixel format of the pointer image
* @param premultiplied Premultiplied format, requires scaling of pixel colors
* @param width The width in pixels of the pointer
* @param height The height of the pointer
* @param pointerColor A pointer to the struct that can hold the encoded data
*
* @return \b >=0 for success, \b <0 for any failure
*
* @since version 3.4.0
*/
WINPR_ATTR_NODISCARD
FREERDP_API int shadow_subsystem_pointer_convert_alpha_pointer_data_to_format(
const BYTE* WINPR_RESTRICT pixels, UINT32 format, BOOL premultiplied, UINT32 width,
UINT32 height, SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE* WINPR_RESTRICT pointerColor);
WINPR_ATTR_NODISCARD
FREERDP_API int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** argv,
COMMAND_LINE_ARGUMENT_A* cargs);
WINPR_ATTR_NODISCARD
FREERDP_API int shadow_server_command_line_status_print(rdpShadowServer* server, int argc,
char** argv, int status,
const COMMAND_LINE_ARGUMENT_A* cargs);
WINPR_ATTR_NODISCARD
FREERDP_API int shadow_server_start(rdpShadowServer* server);
FREERDP_API int shadow_server_stop(rdpShadowServer* server);
WINPR_ATTR_NODISCARD
FREERDP_API int shadow_server_init(rdpShadowServer* server);
FREERDP_API int shadow_server_uninit(rdpShadowServer* server);
WINPR_ATTR_NODISCARD
FREERDP_API UINT32 shadow_enum_monitors(MONITOR_DEF* monitors, UINT32 maxMonitors);
FREERDP_API void shadow_server_free(rdpShadowServer* server);
WINPR_ATTR_MALLOC(shadow_server_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API rdpShadowServer* shadow_server_new(void);
WINPR_ATTR_NODISCARD
FREERDP_API int shadow_capture_align_clip_rect(RECTANGLE_16* rect, const RECTANGLE_16* clip);
#if !defined(WITHOUT_FREERDP_3x_DEPRECATED)
WINPR_DEPRECATED_VAR("[since 3.4.0] Use shadow_capture_compare_with_format",
WINPR_ATTR_NODISCARD FREERDP_API int shadow_capture_compare(
const BYTE* WINPR_RESTRICT pData1, UINT32 nStep1, UINT32 nWidth,
UINT32 nHeight, const BYTE* WINPR_RESTRICT pData2, UINT32 nStep2,
RECTANGLE_16* WINPR_RESTRICT rect));
#endif
/** @brief Compare two framebuffer images of possibly different formats with each other
*
* @param pData1 A pointer to the data of image 1
* @param format1 The format of image 1
* @param nStep1 The line width in bytes of image 1
* @param nWidth The line width in pixels of image 1
* @param nHeight The height of image 1
* @param pData2 A pointer to the data of image 2
* @param format2 The format of image 2
* @param nStep2 The line width in bytes of image 2
* @param rect A pointer to the rectangle of the images to compare
*
* @return \b 0 if equal, \b >0 if not equal and \b <0 for any error
*
* @since version 3.4.0
*/
WINPR_ATTR_NODISCARD
FREERDP_API int shadow_capture_compare_with_format(const BYTE* WINPR_RESTRICT pData1,
UINT32 format1, UINT32 nStep1, UINT32 nWidth,
UINT32 nHeight,
const BYTE* WINPR_RESTRICT pData2,
UINT32 format2, UINT32 nStep2,
RECTANGLE_16* WINPR_RESTRICT rect);
FREERDP_API void shadow_subsystem_frame_update(rdpShadowSubsystem* subsystem);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL shadow_client_post_msg(rdpShadowClient* client, void* context, UINT32 type,
SHADOW_MSG_OUT* msg, void* lParam);
WINPR_ATTR_NODISCARD
FREERDP_API int shadow_client_boardcast_msg(rdpShadowServer* server, void* context, UINT32 type,
SHADOW_MSG_OUT* msg, void* lParam);
WINPR_ATTR_NODISCARD
FREERDP_API int shadow_client_boardcast_quit(rdpShadowServer* server, int nExitCode);
WINPR_ATTR_NODISCARD
FREERDP_API UINT32 shadow_encoder_preferred_fps(rdpShadowEncoder* encoder);
WINPR_ATTR_NODISCARD
FREERDP_API UINT32 shadow_encoder_inflight_frames(rdpShadowEncoder* encoder);
WINPR_ATTR_NODISCARD
FREERDP_API BOOL shadow_screen_resize(rdpShadowScreen* screen);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_SERVER_SHADOW_H */

View File

@@ -0,0 +1,112 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Telemetry Virtual Channel Extension
*
* Copyright 2022 Pascal Nowack <Pascal.Nowack@gmx.de>
*
* 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 FREERDP_CHANNEL_TELEMETRY_SERVER_TELEMETRY_H
#define FREERDP_CHANNEL_TELEMETRY_SERVER_TELEMETRY_H
#include <freerdp/channels/telemetry.h>
#include <freerdp/channels/wtsvc.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct s_telemetry_server_context TelemetryServerContext;
typedef UINT (*psTelemetryServerOpen)(TelemetryServerContext* context);
typedef UINT (*psTelemetryServerClose)(TelemetryServerContext* context);
typedef BOOL (*psTelemetryServerChannelIdAssigned)(TelemetryServerContext* context,
UINT32 channelId);
typedef UINT (*psTelemetryServerInitialize)(TelemetryServerContext* context,
BOOL externalThread);
typedef UINT (*psTelemetryServerPoll)(TelemetryServerContext* context);
typedef BOOL (*psTelemetryServerChannelHandle)(TelemetryServerContext* context, HANDLE* handle);
typedef UINT (*psTelemetryServerRdpTelemetry)(TelemetryServerContext* context,
const TELEMETRY_RDP_TELEMETRY_PDU* rdpTelemetry);
struct s_telemetry_server_context
{
HANDLE vcm;
/* Server self-defined pointer. */
void* userdata;
/*** APIs called by the server. ***/
/**
* Optional: Set thread handling.
* When externalThread=TRUE, the application is responsible to call
* Poll() periodically to process channel events.
*
* Defaults to externalThread=FALSE
*/
WINPR_ATTR_NODISCARD psTelemetryServerInitialize Initialize;
/**
* Open the telemetry channel.
*/
WINPR_ATTR_NODISCARD psTelemetryServerOpen Open;
/**
* Close the telemetry channel.
*/
WINPR_ATTR_NODISCARD psTelemetryServerClose Close;
/**
* Poll
* When externalThread=TRUE, call Poll() periodically from your main loop.
* If externalThread=FALSE do not call.
*/
WINPR_ATTR_NODISCARD psTelemetryServerPoll Poll;
/**
* Retrieve the channel handle for use in conjunction with Poll().
* If externalThread=FALSE do not call.
*/
WINPR_ATTR_NODISCARD psTelemetryServerChannelHandle ChannelHandle;
/*** Callbacks registered by the server. ***/
/**
* Callback, when the channel got its id assigned
*/
WINPR_ATTR_NODISCARD psTelemetryServerChannelIdAssigned ChannelIdAssigned;
/**
* Callback for the RDP Telemetry PDU.
*/
WINPR_ATTR_NODISCARD psTelemetryServerRdpTelemetry RdpTelemetry;
rdpContext* rdpcontext;
};
FREERDP_API void telemetry_server_context_free(TelemetryServerContext* context);
WINPR_ATTR_MALLOC(telemetry_server_context_free, 1)
WINPR_ATTR_NODISCARD
FREERDP_API TelemetryServerContext* telemetry_server_context_new(HANDLE vcm);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_TELEMETRY_SERVER_TELEMETRY_H */