2011-08-01 20:19:39 +04:00
|
|
|
/**
|
2012-10-09 07:02:04 +04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2011-08-01 20:19:39 +04:00
|
|
|
* Fast Path
|
|
|
|
*
|
|
|
|
* Copyright 2011 Vic Lee
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2017-06-06 15:01:41 +03:00
|
|
|
#ifndef FREERDP_LIB_CORE_FASTPATH_H
|
|
|
|
#define FREERDP_LIB_CORE_FASTPATH_H
|
2011-08-01 20:19:39 +04:00
|
|
|
|
2014-07-24 18:29:46 +04:00
|
|
|
/*
|
|
|
|
* Fast-Path has 15 bits available for length information which would lead to a
|
|
|
|
* maximal pdu size of 0x8000. However in practice only 14 bits are used
|
|
|
|
* this isn't documented anywhere but it looks like most implementations will
|
|
|
|
* fail if fast-path packages > 0x3FFF arrive.
|
|
|
|
*/
|
|
|
|
#define FASTPATH_MAX_PACKET_SIZE 0x3FFF
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The following size guarantees that no fast-path PDU fragmentation occurs.
|
|
|
|
* It was calculated by subtracting 128 from FASTPATH_MAX_PACKET_SIZE.
|
|
|
|
* 128 was chosen because it includes all required and optional headers as well as
|
|
|
|
* possible paddings and some extra bytes for safety.
|
|
|
|
*/
|
|
|
|
#define FASTPATH_FRAGMENT_SAFE_SIZE 0x3F80
|
|
|
|
|
2013-11-01 22:13:09 +04:00
|
|
|
typedef struct rdp_fastpath rdpFastPath;
|
|
|
|
|
2011-08-09 19:28:02 +04:00
|
|
|
#include "rdp.h"
|
2013-03-22 00:45:25 +04:00
|
|
|
|
|
|
|
#include <winpr/stream.h>
|
2016-08-10 10:12:55 +03:00
|
|
|
#include <freerdp/api.h>
|
2011-08-01 20:19:39 +04:00
|
|
|
|
2012-01-25 19:07:15 +04:00
|
|
|
enum FASTPATH_INPUT_ACTION_TYPE
|
|
|
|
{
|
|
|
|
FASTPATH_INPUT_ACTION_FASTPATH = 0x0,
|
|
|
|
FASTPATH_INPUT_ACTION_X224 = 0x3
|
|
|
|
};
|
|
|
|
|
2011-08-01 20:19:39 +04:00
|
|
|
enum FASTPATH_OUTPUT_ACTION_TYPE
|
|
|
|
{
|
|
|
|
FASTPATH_OUTPUT_ACTION_FASTPATH = 0x0,
|
|
|
|
FASTPATH_OUTPUT_ACTION_X224 = 0x3
|
|
|
|
};
|
|
|
|
|
2011-08-09 19:28:02 +04:00
|
|
|
enum FASTPATH_UPDATETYPE
|
|
|
|
{
|
|
|
|
FASTPATH_UPDATETYPE_ORDERS = 0x0,
|
|
|
|
FASTPATH_UPDATETYPE_BITMAP = 0x1,
|
|
|
|
FASTPATH_UPDATETYPE_PALETTE = 0x2,
|
|
|
|
FASTPATH_UPDATETYPE_SYNCHRONIZE = 0x3,
|
|
|
|
FASTPATH_UPDATETYPE_SURFCMDS = 0x4,
|
|
|
|
FASTPATH_UPDATETYPE_PTR_NULL = 0x5,
|
|
|
|
FASTPATH_UPDATETYPE_PTR_DEFAULT = 0x6,
|
|
|
|
FASTPATH_UPDATETYPE_PTR_POSITION = 0x8,
|
|
|
|
FASTPATH_UPDATETYPE_COLOR = 0x9,
|
|
|
|
FASTPATH_UPDATETYPE_CACHED = 0xA,
|
2019-12-19 11:35:53 +03:00
|
|
|
FASTPATH_UPDATETYPE_POINTER = 0xB,
|
|
|
|
FASTPATH_UPDATETYPE_LARGE_POINTER = 0xC
|
2011-08-09 19:28:02 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
enum FASTPATH_FRAGMENT
|
|
|
|
{
|
|
|
|
FASTPATH_FRAGMENT_SINGLE = 0x0,
|
|
|
|
FASTPATH_FRAGMENT_LAST = 0x1,
|
|
|
|
FASTPATH_FRAGMENT_FIRST = 0x2,
|
|
|
|
FASTPATH_FRAGMENT_NEXT = 0x3
|
|
|
|
};
|
|
|
|
|
|
|
|
enum FASTPATH_OUTPUT_COMPRESSION
|
|
|
|
{
|
|
|
|
FASTPATH_OUTPUT_COMPRESSION_USED = 0x2
|
|
|
|
};
|
|
|
|
|
2011-08-23 11:51:51 +04:00
|
|
|
/* FastPath Input Events */
|
|
|
|
enum FASTPATH_INPUT_EVENT_CODE
|
|
|
|
{
|
|
|
|
FASTPATH_INPUT_EVENT_SCANCODE = 0x0,
|
|
|
|
FASTPATH_INPUT_EVENT_MOUSE = 0x1,
|
|
|
|
FASTPATH_INPUT_EVENT_MOUSEX = 0x2,
|
|
|
|
FASTPATH_INPUT_EVENT_SYNC = 0x3,
|
2023-10-12 14:43:00 +03:00
|
|
|
FASTPATH_INPUT_EVENT_UNICODE = 0x4,
|
2023-10-12 14:53:50 +03:00
|
|
|
TS_FP_RELPOINTER_EVENT = 0x5,
|
|
|
|
TS_FP_QOETIMESTAMP_EVENT = 0x6
|
2011-08-23 11:51:51 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/* FastPath Keyboard Event Flags */
|
|
|
|
enum FASTPATH_INPUT_KBDFLAGS
|
|
|
|
{
|
|
|
|
FASTPATH_INPUT_KBDFLAGS_RELEASE = 0x01,
|
2014-06-05 01:41:17 +04:00
|
|
|
FASTPATH_INPUT_KBDFLAGS_EXTENDED = 0x02,
|
2019-11-06 17:24:51 +03:00
|
|
|
FASTPATH_INPUT_KBDFLAGS_PREFIX_E1 = 0x04 /* for pause sequence */
|
2011-08-23 11:51:51 +04:00
|
|
|
};
|
|
|
|
|
2022-02-14 16:59:22 +03:00
|
|
|
typedef struct
|
2014-03-11 22:43:28 +04:00
|
|
|
{
|
|
|
|
BYTE length1;
|
|
|
|
BYTE length2;
|
|
|
|
BYTE fipsInformation[4];
|
|
|
|
BYTE dataSignature[8];
|
|
|
|
|
2014-03-12 01:25:00 +04:00
|
|
|
BYTE action;
|
|
|
|
BYTE secFlags;
|
2014-03-11 22:43:28 +04:00
|
|
|
UINT16 length;
|
2022-02-14 16:59:22 +03:00
|
|
|
} FASTPATH_UPDATE_PDU_HEADER;
|
2014-03-11 22:43:28 +04:00
|
|
|
|
2022-02-14 16:59:22 +03:00
|
|
|
typedef struct
|
2014-03-11 22:43:28 +04:00
|
|
|
{
|
|
|
|
BYTE compressionFlags;
|
|
|
|
UINT16 size;
|
|
|
|
|
|
|
|
BYTE updateCode;
|
|
|
|
BYTE fragmentation;
|
|
|
|
BYTE compression;
|
2022-02-14 16:59:22 +03:00
|
|
|
} FASTPATH_UPDATE_HEADER;
|
2014-03-11 22:43:28 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
FREERDP_LOCAL BOOL fastpath_read_header_rdp(rdpFastPath* fastpath, wStream* s, UINT16* length);
|
2023-12-13 11:58:23 +03:00
|
|
|
FREERDP_LOCAL state_run_t fastpath_recv_updates(rdpFastPath* fastpath, wStream* s);
|
|
|
|
FREERDP_LOCAL state_run_t fastpath_recv_inputs(rdpFastPath* fastpath, wStream* s);
|
2016-08-10 10:12:55 +03:00
|
|
|
|
2023-01-24 12:44:46 +03:00
|
|
|
FREERDP_LOCAL BOOL fastpath_decrypt(rdpFastPath* fastpath, wStream* s, UINT16* length);
|
|
|
|
|
2016-08-10 10:12:55 +03:00
|
|
|
FREERDP_LOCAL wStream* fastpath_input_pdu_init_header(rdpFastPath* fastpath);
|
2019-11-06 17:24:51 +03:00
|
|
|
FREERDP_LOCAL wStream* fastpath_input_pdu_init(rdpFastPath* fastpath, BYTE eventFlags,
|
|
|
|
BYTE eventCode);
|
|
|
|
FREERDP_LOCAL BOOL fastpath_send_multiple_input_pdu(rdpFastPath* fastpath, wStream* s,
|
2021-01-22 10:24:16 +03:00
|
|
|
size_t iEventCount);
|
2016-08-10 10:12:55 +03:00
|
|
|
FREERDP_LOCAL BOOL fastpath_send_input_pdu(rdpFastPath* fastpath, wStream* s);
|
|
|
|
|
2024-01-26 15:09:00 +03:00
|
|
|
WINPR_ATTR_MALLOC(Stream_Release, 1)
|
2016-08-10 10:12:55 +03:00
|
|
|
FREERDP_LOCAL wStream* fastpath_update_pdu_init(rdpFastPath* fastpath);
|
2024-01-26 15:09:00 +03:00
|
|
|
|
|
|
|
WINPR_ATTR_MALLOC(Stream_Free, 1)
|
2016-08-10 10:12:55 +03:00
|
|
|
FREERDP_LOCAL wStream* fastpath_update_pdu_init_new(rdpFastPath* fastpath);
|
2019-11-06 17:24:51 +03:00
|
|
|
FREERDP_LOCAL BOOL fastpath_send_update_pdu(rdpFastPath* fastpath, BYTE updateCode, wStream* s,
|
|
|
|
BOOL skipCompression);
|
2016-08-10 10:12:55 +03:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
FREERDP_LOCAL BOOL fastpath_send_surfcmd_frame_marker(rdpFastPath* fastpath, UINT16 frameAction,
|
|
|
|
UINT32 frameId);
|
2021-09-03 12:52:55 +03:00
|
|
|
FREERDP_LOCAL BYTE fastpath_get_encryption_flags(rdpFastPath* fastpath);
|
2016-08-10 10:12:55 +03:00
|
|
|
|
|
|
|
FREERDP_LOCAL rdpFastPath* fastpath_new(rdpRdp* rdp);
|
|
|
|
FREERDP_LOCAL void fastpath_free(rdpFastPath* fastpath);
|
2011-08-01 20:19:39 +04:00
|
|
|
|
2017-06-06 15:01:41 +03:00
|
|
|
#endif /* FREERDP_LIB_CORE_FASTPATH_H */
|