2011-07-28 08:38:25 +04:00
|
|
|
/**
|
2012-10-09 07:02:04 +04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2011-07-28 08:38:25 +04:00
|
|
|
* Update Interface API
|
|
|
|
*
|
|
|
|
* Copyright 2011 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.
|
|
|
|
*/
|
|
|
|
|
2012-12-14 09:25:48 +04:00
|
|
|
#ifndef FREERDP_UPDATE_H
|
|
|
|
#define FREERDP_UPDATE_H
|
2011-07-28 08:38:25 +04:00
|
|
|
|
2011-10-16 08:50:10 +04:00
|
|
|
typedef struct rdp_update rdpUpdate;
|
|
|
|
|
2013-01-09 02:18:10 +04:00
|
|
|
#include <winpr/crt.h>
|
2013-10-09 04:40:58 +04:00
|
|
|
#include <winpr/wlog.h>
|
2013-01-09 02:18:10 +04:00
|
|
|
#include <winpr/synch.h>
|
|
|
|
#include <winpr/thread.h>
|
2013-03-22 00:45:25 +04:00
|
|
|
#include <winpr/stream.h>
|
2013-01-09 02:18:10 +04:00
|
|
|
#include <winpr/collections.h>
|
|
|
|
|
2011-08-10 10:24:06 +04:00
|
|
|
#include <freerdp/rail.h>
|
2011-07-28 08:38:25 +04:00
|
|
|
#include <freerdp/types.h>
|
2011-10-16 08:50:10 +04:00
|
|
|
#include <freerdp/freerdp.h>
|
2011-10-21 01:28:59 +04:00
|
|
|
#include <freerdp/graphics.h>
|
2011-08-27 04:26:40 +04:00
|
|
|
#include <freerdp/utils/pcap.h>
|
2011-07-28 08:38:25 +04:00
|
|
|
|
2011-11-22 01:44:50 +04:00
|
|
|
#include <freerdp/primary.h>
|
|
|
|
#include <freerdp/secondary.h>
|
|
|
|
#include <freerdp/altsec.h>
|
|
|
|
#include <freerdp/window.h>
|
|
|
|
#include <freerdp/pointer.h>
|
2011-10-21 01:28:59 +04:00
|
|
|
|
2011-07-28 08:38:25 +04:00
|
|
|
/* Bitmap Updates */
|
2018-02-28 12:10:09 +03:00
|
|
|
#define EX_COMPRESSED_BITMAP_HEADER_PRESENT 0x01
|
2011-07-28 08:38:25 +04:00
|
|
|
|
2011-10-21 01:28:59 +04:00
|
|
|
struct _BITMAP_DATA
|
2011-07-28 08:38:25 +04:00
|
|
|
{
|
2012-10-09 11:26:39 +04:00
|
|
|
UINT32 destLeft;
|
|
|
|
UINT32 destTop;
|
|
|
|
UINT32 destRight;
|
|
|
|
UINT32 destBottom;
|
|
|
|
UINT32 width;
|
|
|
|
UINT32 height;
|
|
|
|
UINT32 bitsPerPixel;
|
|
|
|
UINT32 flags;
|
|
|
|
UINT32 bitmapLength;
|
|
|
|
UINT32 cbCompFirstRowSize;
|
|
|
|
UINT32 cbCompMainBodySize;
|
|
|
|
UINT32 cbScanWidth;
|
|
|
|
UINT32 cbUncompressedSize;
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE* bitmapDataStream;
|
2012-10-09 10:38:39 +04:00
|
|
|
BOOL compressed;
|
2011-08-04 11:23:53 +04:00
|
|
|
};
|
2011-10-21 01:28:59 +04:00
|
|
|
typedef struct _BITMAP_DATA BITMAP_DATA;
|
2011-07-28 08:38:25 +04:00
|
|
|
|
2011-08-04 11:23:53 +04:00
|
|
|
struct _BITMAP_UPDATE
|
2011-07-28 08:38:25 +04:00
|
|
|
{
|
2012-10-09 11:26:39 +04:00
|
|
|
UINT32 count;
|
|
|
|
UINT32 number;
|
2011-10-21 05:34:55 +04:00
|
|
|
BITMAP_DATA* rectangles;
|
2014-11-04 18:14:53 +03:00
|
|
|
BOOL skipCompression;
|
2011-08-04 11:23:53 +04:00
|
|
|
};
|
|
|
|
typedef struct _BITMAP_UPDATE BITMAP_UPDATE;
|
2011-07-28 08:38:25 +04:00
|
|
|
|
|
|
|
/* Palette Updates */
|
|
|
|
|
2011-08-04 11:23:53 +04:00
|
|
|
struct _PALETTE_UPDATE
|
2011-07-28 08:38:25 +04:00
|
|
|
{
|
2012-10-09 11:26:39 +04:00
|
|
|
UINT32 number;
|
2011-10-21 20:17:04 +04:00
|
|
|
PALETTE_ENTRY entries[256];
|
2011-08-04 11:23:53 +04:00
|
|
|
};
|
|
|
|
typedef struct _PALETTE_UPDATE PALETTE_UPDATE;
|
2011-07-28 08:38:25 +04:00
|
|
|
|
2011-08-24 10:54:46 +04:00
|
|
|
/* Play Sound (System Beep) Updates */
|
|
|
|
|
|
|
|
struct _PLAY_SOUND_UPDATE
|
|
|
|
{
|
2012-10-09 11:26:39 +04:00
|
|
|
UINT32 duration;
|
|
|
|
UINT32 frequency;
|
2011-08-24 10:54:46 +04:00
|
|
|
};
|
|
|
|
typedef struct _PLAY_SOUND_UPDATE PLAY_SOUND_UPDATE;
|
|
|
|
|
2011-11-22 01:44:50 +04:00
|
|
|
/* Surface Command Updates */
|
2018-02-28 12:10:09 +03:00
|
|
|
struct _TS_COMPRESSED_BITMAP_HEADER_EX
|
|
|
|
{
|
|
|
|
UINT32 highUniqueId;
|
|
|
|
UINT32 lowUniqueId;
|
|
|
|
UINT64 tmMilliseconds;
|
|
|
|
UINT64 tmSeconds;
|
|
|
|
};
|
|
|
|
typedef struct _TS_COMPRESSED_BITMAP_HEADER_EX TS_COMPRESSED_BITMAP_HEADER_EX;
|
|
|
|
|
|
|
|
struct _TS_BITMAP_DATA_EX
|
|
|
|
{
|
|
|
|
BYTE bpp;
|
|
|
|
BYTE flags;
|
|
|
|
UINT16 codecID;
|
|
|
|
UINT16 width;
|
|
|
|
UINT16 height;
|
|
|
|
UINT32 bitmapDataLength;
|
|
|
|
TS_COMPRESSED_BITMAP_HEADER_EX exBitmapDataHeader;
|
|
|
|
BYTE* bitmapData;
|
|
|
|
};
|
|
|
|
typedef struct _TS_BITMAP_DATA_EX TS_BITMAP_DATA_EX;
|
2011-08-09 11:01:40 +04:00
|
|
|
|
2011-08-09 20:38:52 +04:00
|
|
|
struct _SURFACE_BITS_COMMAND
|
|
|
|
{
|
2012-10-09 11:26:39 +04:00
|
|
|
UINT32 cmdType;
|
|
|
|
UINT32 destLeft;
|
|
|
|
UINT32 destTop;
|
|
|
|
UINT32 destRight;
|
|
|
|
UINT32 destBottom;
|
2018-02-28 12:10:09 +03:00
|
|
|
TS_BITMAP_DATA_EX bmp;
|
2014-11-04 18:14:53 +03:00
|
|
|
BOOL skipCompression;
|
2011-08-09 20:38:52 +04:00
|
|
|
};
|
|
|
|
typedef struct _SURFACE_BITS_COMMAND SURFACE_BITS_COMMAND;
|
|
|
|
|
2011-11-25 20:30:15 +04:00
|
|
|
struct _SURFACE_FRAME_MARKER
|
|
|
|
{
|
2012-10-09 11:26:39 +04:00
|
|
|
UINT32 frameAction;
|
|
|
|
UINT32 frameId;
|
2011-11-25 20:30:15 +04:00
|
|
|
};
|
|
|
|
typedef struct _SURFACE_FRAME_MARKER SURFACE_FRAME_MARKER;
|
|
|
|
|
2012-05-11 12:35:11 +04:00
|
|
|
enum SURFCMD_FRAMEACTION
|
|
|
|
{
|
|
|
|
SURFACECMD_FRAMEACTION_BEGIN = 0x0000,
|
|
|
|
SURFACECMD_FRAMEACTION_END = 0x0001
|
|
|
|
};
|
|
|
|
|
2019-01-29 12:33:06 +03:00
|
|
|
/** @brief status code as in 2.2.5.2 Server Status Info PDU */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
TS_STATUS_FINDING_DESTINATION = 0x00000401,
|
|
|
|
TS_STATUS_LOADING_DESTINATION = 0x00000402,
|
|
|
|
TS_STATUS_BRINGING_SESSION_ONLINE = 0x00000403,
|
|
|
|
TS_STATUS_REDIRECTING_TO_DESTINATION = 0x00000404,
|
|
|
|
TS_STATUS_VM_LOADING = 0x00000501,
|
|
|
|
TS_STATUS_VM_WAKING = 0x00000502,
|
|
|
|
TS_STATUS_VM_STARTING = 0x00000503,
|
|
|
|
TS_STATUS_VM_STARTING_MONITORING = 0x00000504,
|
|
|
|
TS_STATUS_VM_RETRYING_MONITORING = 0x00000505
|
|
|
|
};
|
|
|
|
|
2013-08-13 01:48:32 +04:00
|
|
|
struct _SURFACE_FRAME
|
|
|
|
{
|
|
|
|
UINT32 frameId;
|
|
|
|
UINT32 commandCount;
|
|
|
|
SURFACE_BITS_COMMAND* commands;
|
|
|
|
};
|
|
|
|
typedef struct _SURFACE_FRAME SURFACE_FRAME;
|
|
|
|
|
2013-01-25 05:05:03 +04:00
|
|
|
/* defined inside libfreerdp-core */
|
2013-02-04 20:05:24 +04:00
|
|
|
typedef struct rdp_update_proxy rdpUpdateProxy;
|
2013-01-25 05:05:03 +04:00
|
|
|
|
2011-07-28 08:38:25 +04:00
|
|
|
/* Update Interface */
|
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
typedef BOOL (*pBeginPaint)(rdpContext* context);
|
|
|
|
typedef BOOL (*pEndPaint)(rdpContext* context);
|
2016-04-05 18:07:45 +03:00
|
|
|
typedef BOOL (*pSetBounds)(rdpContext* context, const rdpBounds* bounds);
|
2015-04-14 11:14:23 +03:00
|
|
|
|
|
|
|
typedef BOOL (*pSynchronize)(rdpContext* context);
|
|
|
|
typedef BOOL (*pDesktopResize)(rdpContext* context);
|
2016-04-05 18:07:45 +03:00
|
|
|
typedef BOOL (*pBitmapUpdate)(rdpContext* context, const BITMAP_UPDATE* bitmap);
|
|
|
|
typedef BOOL (*pPalette)(rdpContext* context, const PALETTE_UPDATE* palette);
|
|
|
|
typedef BOOL (*pPlaySound)(rdpContext* context, const PLAY_SOUND_UPDATE* play_sound);
|
2015-04-14 11:14:23 +03:00
|
|
|
typedef BOOL (*pSetKeyboardIndicators)(rdpContext* context, UINT16 led_flags);
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
typedef BOOL (*pRefreshRect)(rdpContext* context, BYTE count, const RECTANGLE_16* areas);
|
|
|
|
typedef BOOL (*pSuppressOutput)(rdpContext* context, BYTE allow, const RECTANGLE_16* area);
|
2018-02-28 12:10:09 +03:00
|
|
|
typedef BOOL (*pRemoteMonitors)(rdpContext* context, UINT32 count, const MONITOR_DEF* monitors);
|
2015-04-14 11:14:23 +03:00
|
|
|
|
|
|
|
typedef BOOL (*pSurfaceCommand)(rdpContext* context, wStream* s);
|
2016-04-05 18:07:45 +03:00
|
|
|
typedef BOOL (*pSurfaceBits)(rdpContext* context,
|
2018-02-28 12:10:09 +03:00
|
|
|
const SURFACE_BITS_COMMAND* surfaceBitsCommand);
|
2016-04-05 18:07:45 +03:00
|
|
|
typedef BOOL (*pSurfaceFrameMarker)(rdpContext* context,
|
2018-02-28 12:10:09 +03:00
|
|
|
const SURFACE_FRAME_MARKER* surfaceFrameMarker);
|
2016-04-05 18:07:45 +03:00
|
|
|
typedef BOOL (*pSurfaceFrameBits)(rdpContext* context,
|
2018-02-28 12:10:09 +03:00
|
|
|
const SURFACE_BITS_COMMAND* cmd, BOOL first,
|
|
|
|
BOOL last, UINT32 frameId);
|
2015-04-14 11:14:23 +03:00
|
|
|
typedef BOOL (*pSurfaceFrameAcknowledge)(rdpContext* context, UINT32 frameId);
|
2011-08-09 20:38:52 +04:00
|
|
|
|
2018-02-28 12:10:09 +03:00
|
|
|
typedef BOOL (*pSaveSessionInfo)(rdpContext* context, UINT32 type, void* data);
|
|
|
|
typedef BOOL (*pSetKeyboardImeStatus)(rdpContext* context, UINT16 imeId, UINT32 imeState,
|
|
|
|
UINT32 imeConvMode);
|
2019-01-29 12:33:06 +03:00
|
|
|
typedef BOOL (*pServerStatusInfo)(rdpContext* context, UINT32 status);
|
2016-02-18 16:19:36 +03:00
|
|
|
|
2011-07-28 08:38:25 +04:00
|
|
|
struct rdp_update
|
|
|
|
{
|
2011-11-20 23:25:59 +04:00
|
|
|
rdpContext* context; /* 0 */
|
2012-10-09 11:26:39 +04:00
|
|
|
UINT32 paddingA[16 - 1]; /* 1 */
|
2011-11-20 23:25:59 +04:00
|
|
|
|
|
|
|
pBeginPaint BeginPaint; /* 16 */
|
|
|
|
pEndPaint EndPaint; /* 17 */
|
|
|
|
pSetBounds SetBounds; /* 18 */
|
|
|
|
pSynchronize Synchronize; /* 19 */
|
|
|
|
pDesktopResize DesktopResize; /* 20 */
|
|
|
|
pBitmapUpdate BitmapUpdate; /* 21 */
|
|
|
|
pPalette Palette; /* 22 */
|
|
|
|
pPlaySound PlaySound; /* 23 */
|
2014-09-30 20:18:29 +04:00
|
|
|
pSetKeyboardIndicators SetKeyboardIndicators; /* 24 */
|
2017-05-12 10:43:58 +03:00
|
|
|
pSetKeyboardImeStatus SetKeyboardImeStatus; /* 25 */
|
|
|
|
UINT32 paddingB[32 - 26]; /* 26 */
|
2011-11-20 23:25:59 +04:00
|
|
|
|
2011-11-22 02:48:03 +04:00
|
|
|
rdpPointerUpdate* pointer; /* 32 */
|
2011-11-22 04:41:49 +04:00
|
|
|
rdpPrimaryUpdate* primary; /* 33 */
|
|
|
|
rdpSecondaryUpdate* secondary; /* 34 */
|
2011-11-22 04:53:38 +04:00
|
|
|
rdpAltSecUpdate* altsec; /* 35 */
|
2011-11-22 06:07:03 +04:00
|
|
|
rdpWindowUpdate* window; /* 36 */
|
2012-10-09 11:26:39 +04:00
|
|
|
UINT32 paddingC[48 - 37]; /* 37 */
|
2011-11-22 04:41:49 +04:00
|
|
|
|
2011-11-22 06:07:03 +04:00
|
|
|
pRefreshRect RefreshRect; /* 48 */
|
|
|
|
pSuppressOutput SuppressOutput; /* 49 */
|
2016-01-20 18:54:15 +03:00
|
|
|
pRemoteMonitors RemoteMonitors; /* 50 */
|
|
|
|
UINT32 paddingD[64 - 51]; /* 51 */
|
2011-11-22 04:41:49 +04:00
|
|
|
|
2011-11-22 06:07:03 +04:00
|
|
|
pSurfaceCommand SurfaceCommand; /* 64 */
|
|
|
|
pSurfaceBits SurfaceBits; /* 65 */
|
2011-11-25 14:48:51 +04:00
|
|
|
pSurfaceFrameMarker SurfaceFrameMarker; /* 66 */
|
2014-09-19 22:23:17 +04:00
|
|
|
pSurfaceFrameBits SurfaceFrameBits; /* 67 */
|
|
|
|
pSurfaceFrameAcknowledge SurfaceFrameAcknowledge; /* 68 */
|
2016-02-18 16:19:36 +03:00
|
|
|
pSaveSessionInfo SaveSessionInfo; /* 69 */
|
2019-01-29 12:33:06 +03:00
|
|
|
pServerStatusInfo ServerStatusInfo; /* 70 */
|
|
|
|
UINT32 paddingE[80 - 71]; /* 71 */
|
2011-11-22 04:41:49 +04:00
|
|
|
|
|
|
|
/* internal */
|
2011-10-17 05:02:28 +04:00
|
|
|
|
2013-10-09 04:40:58 +04:00
|
|
|
wLog* log;
|
|
|
|
|
2012-10-09 10:38:39 +04:00
|
|
|
BOOL dump_rfx;
|
|
|
|
BOOL play_rfx;
|
2011-10-17 05:02:28 +04:00
|
|
|
rdpPcap* pcap_rfx;
|
2013-01-25 07:38:13 +04:00
|
|
|
BOOL initialState;
|
2011-10-17 05:02:28 +04:00
|
|
|
|
2013-01-24 23:09:44 +04:00
|
|
|
BOOL asynchronous;
|
2013-02-04 20:05:24 +04:00
|
|
|
rdpUpdateProxy* proxy;
|
2013-01-25 04:08:30 +04:00
|
|
|
wMessageQueue* queue;
|
2013-05-10 00:30:28 +04:00
|
|
|
|
|
|
|
wStream* us;
|
|
|
|
UINT16 numberOrders;
|
|
|
|
BOOL combineUpdates;
|
2013-05-10 03:41:32 +04:00
|
|
|
rdpBounds currentBounds;
|
|
|
|
rdpBounds previousBounds;
|
2019-04-11 16:30:05 +03:00
|
|
|
CRITICAL_SECTION mux;
|
2011-07-28 08:38:25 +04:00
|
|
|
};
|
|
|
|
|
2012-12-14 09:25:48 +04:00
|
|
|
#endif /* FREERDP_UPDATE_H */
|