Blame include/freerdp/update.h

Packit 1fb8d4
/**
Packit 1fb8d4
 * FreeRDP: A Remote Desktop Protocol Implementation
Packit 1fb8d4
 * Update Interface API
Packit 1fb8d4
 *
Packit 1fb8d4
 * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
Packit 1fb8d4
 *
Packit 1fb8d4
 * Licensed under the Apache License, Version 2.0 (the "License");
Packit 1fb8d4
 * you may not use this file except in compliance with the License.
Packit 1fb8d4
 * You may obtain a copy of the License at
Packit 1fb8d4
 *
Packit 1fb8d4
 *     http://www.apache.org/licenses/LICENSE-2.0
Packit 1fb8d4
 *
Packit 1fb8d4
 * Unless required by applicable law or agreed to in writing, software
Packit 1fb8d4
 * distributed under the License is distributed on an "AS IS" BASIS,
Packit 1fb8d4
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit 1fb8d4
 * See the License for the specific language governing permissions and
Packit 1fb8d4
 * limitations under the License.
Packit 1fb8d4
 */
Packit 1fb8d4
Packit 1fb8d4
#ifndef FREERDP_UPDATE_H
Packit 1fb8d4
#define FREERDP_UPDATE_H
Packit 1fb8d4
Packit 1fb8d4
typedef struct rdp_update rdpUpdate;
Packit 1fb8d4
Packit 1fb8d4
#include <winpr/crt.h>
Packit 1fb8d4
#include <winpr/wlog.h>
Packit 1fb8d4
#include <winpr/synch.h>
Packit 1fb8d4
#include <winpr/thread.h>
Packit 1fb8d4
#include <winpr/stream.h>
Packit 1fb8d4
#include <winpr/collections.h>
Packit 1fb8d4
Packit 1fb8d4
#include <freerdp/rail.h>
Packit 1fb8d4
#include <freerdp/types.h>
Packit 1fb8d4
#include <freerdp/freerdp.h>
Packit 1fb8d4
#include <freerdp/graphics.h>
Packit 1fb8d4
#include <freerdp/utils/pcap.h>
Packit 1fb8d4
Packit 1fb8d4
#include <freerdp/primary.h>
Packit 1fb8d4
#include <freerdp/secondary.h>
Packit 1fb8d4
#include <freerdp/altsec.h>
Packit 1fb8d4
#include <freerdp/window.h>
Packit 1fb8d4
#include <freerdp/pointer.h>
Packit 1fb8d4
Packit 1fb8d4
/* Bitmap Updates */
Packit 1fb8d4
#define EX_COMPRESSED_BITMAP_HEADER_PRESENT 0x01
Packit 1fb8d4
Packit 1fb8d4
struct _BITMAP_DATA
Packit 1fb8d4
{
Packit 1fb8d4
	UINT32 destLeft;
Packit 1fb8d4
	UINT32 destTop;
Packit 1fb8d4
	UINT32 destRight;
Packit 1fb8d4
	UINT32 destBottom;
Packit 1fb8d4
	UINT32 width;
Packit 1fb8d4
	UINT32 height;
Packit 1fb8d4
	UINT32 bitsPerPixel;
Packit 1fb8d4
	UINT32 flags;
Packit 1fb8d4
	UINT32 bitmapLength;
Packit 1fb8d4
	UINT32 cbCompFirstRowSize;
Packit 1fb8d4
	UINT32 cbCompMainBodySize;
Packit 1fb8d4
	UINT32 cbScanWidth;
Packit 1fb8d4
	UINT32 cbUncompressedSize;
Packit 1fb8d4
	BYTE* bitmapDataStream;
Packit 1fb8d4
	BOOL compressed;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct _BITMAP_DATA BITMAP_DATA;
Packit 1fb8d4
Packit 1fb8d4
struct _BITMAP_UPDATE
Packit 1fb8d4
{
Packit 1fb8d4
	UINT32 count;
Packit 1fb8d4
	UINT32 number;
Packit 1fb8d4
	BITMAP_DATA* rectangles;
Packit 1fb8d4
	BOOL skipCompression;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct _BITMAP_UPDATE BITMAP_UPDATE;
Packit 1fb8d4
Packit 1fb8d4
/* Palette Updates */
Packit 1fb8d4
Packit 1fb8d4
struct _PALETTE_UPDATE
Packit 1fb8d4
{
Packit 1fb8d4
	UINT32 number;
Packit 1fb8d4
	PALETTE_ENTRY entries[256];
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct _PALETTE_UPDATE PALETTE_UPDATE;
Packit 1fb8d4
Packit 1fb8d4
/* Play Sound (System Beep) Updates */
Packit 1fb8d4
Packit 1fb8d4
struct _PLAY_SOUND_UPDATE
Packit 1fb8d4
{
Packit 1fb8d4
	UINT32 duration;
Packit 1fb8d4
	UINT32 frequency;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct _PLAY_SOUND_UPDATE PLAY_SOUND_UPDATE;
Packit 1fb8d4
Packit 1fb8d4
/* Surface Command Updates */
Packit 1fb8d4
struct _TS_COMPRESSED_BITMAP_HEADER_EX
Packit 1fb8d4
{
Packit 1fb8d4
	UINT32 highUniqueId;
Packit 1fb8d4
	UINT32 lowUniqueId;
Packit 1fb8d4
	UINT64 tmMilliseconds;
Packit 1fb8d4
	UINT64 tmSeconds;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct _TS_COMPRESSED_BITMAP_HEADER_EX TS_COMPRESSED_BITMAP_HEADER_EX;
Packit 1fb8d4
Packit 1fb8d4
struct _TS_BITMAP_DATA_EX
Packit 1fb8d4
{
Packit 1fb8d4
	BYTE bpp;
Packit 1fb8d4
	BYTE flags;
Packit 1fb8d4
	UINT16 codecID;
Packit 1fb8d4
	UINT16 width;
Packit 1fb8d4
	UINT16 height;
Packit 1fb8d4
	UINT32 bitmapDataLength;
Packit 1fb8d4
	TS_COMPRESSED_BITMAP_HEADER_EX exBitmapDataHeader;
Packit 1fb8d4
	BYTE* bitmapData;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct _TS_BITMAP_DATA_EX TS_BITMAP_DATA_EX;
Packit 1fb8d4
Packit Service 5a9772
enum SURFCMD_CMDTYPE
Packit Service 5a9772
{
Packit Service 5a9772
	CMDTYPE_SET_SURFACE_BITS = 0x0001,
Packit Service 5a9772
	CMDTYPE_FRAME_MARKER = 0x0004,
Packit Service 5a9772
	CMDTYPE_STREAM_SURFACE_BITS = 0x0006
Packit Service 5a9772
};
Packit Service 5a9772
Packit 1fb8d4
struct _SURFACE_BITS_COMMAND
Packit 1fb8d4
{
Packit 1fb8d4
	UINT32 cmdType;
Packit 1fb8d4
	UINT32 destLeft;
Packit 1fb8d4
	UINT32 destTop;
Packit 1fb8d4
	UINT32 destRight;
Packit 1fb8d4
	UINT32 destBottom;
Packit 1fb8d4
	TS_BITMAP_DATA_EX bmp;
Packit 1fb8d4
	BOOL skipCompression;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct _SURFACE_BITS_COMMAND SURFACE_BITS_COMMAND;
Packit 1fb8d4
Packit 1fb8d4
struct _SURFACE_FRAME_MARKER
Packit 1fb8d4
{
Packit 1fb8d4
	UINT32 frameAction;
Packit 1fb8d4
	UINT32 frameId;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct _SURFACE_FRAME_MARKER SURFACE_FRAME_MARKER;
Packit 1fb8d4
Packit 1fb8d4
enum SURFCMD_FRAMEACTION
Packit 1fb8d4
{
Packit 1fb8d4
	SURFACECMD_FRAMEACTION_BEGIN = 0x0000,
Packit 1fb8d4
	SURFACECMD_FRAMEACTION_END = 0x0001
Packit 1fb8d4
};
Packit 1fb8d4
Packit Service 5a9772
/** @brief status code as in 2.2.5.2 Server Status Info PDU */
Packit Service 5a9772
enum
Packit Service 5a9772
{
Packit Service 5a9772
	TS_STATUS_FINDING_DESTINATION = 0x00000401,
Packit Service 5a9772
	TS_STATUS_LOADING_DESTINATION = 0x00000402,
Packit Service 5a9772
	TS_STATUS_BRINGING_SESSION_ONLINE = 0x00000403,
Packit Service 5a9772
	TS_STATUS_REDIRECTING_TO_DESTINATION = 0x00000404,
Packit Service 5a9772
	TS_STATUS_VM_LOADING = 0x00000501,
Packit Service 5a9772
	TS_STATUS_VM_WAKING = 0x00000502,
Packit Service 5a9772
	TS_STATUS_VM_STARTING = 0x00000503,
Packit Service 5a9772
	TS_STATUS_VM_STARTING_MONITORING = 0x00000504,
Packit Service 5a9772
	TS_STATUS_VM_RETRYING_MONITORING = 0x00000505
Packit Service 5a9772
};
Packit Service 5a9772
Packit 1fb8d4
struct _SURFACE_FRAME
Packit 1fb8d4
{
Packit 1fb8d4
	UINT32 frameId;
Packit 1fb8d4
	UINT32 commandCount;
Packit 1fb8d4
	SURFACE_BITS_COMMAND* commands;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct _SURFACE_FRAME SURFACE_FRAME;
Packit 1fb8d4
Packit 1fb8d4
/* defined inside libfreerdp-core */
Packit 1fb8d4
typedef struct rdp_update_proxy rdpUpdateProxy;
Packit 1fb8d4
Packit 1fb8d4
/* Update Interface */
Packit 1fb8d4
Packit 1fb8d4
typedef BOOL (*pBeginPaint)(rdpContext* context);
Packit 1fb8d4
typedef BOOL (*pEndPaint)(rdpContext* context);
Packit 1fb8d4
typedef BOOL (*pSetBounds)(rdpContext* context, const rdpBounds* bounds);
Packit 1fb8d4
Packit 1fb8d4
typedef BOOL (*pSynchronize)(rdpContext* context);
Packit 1fb8d4
typedef BOOL (*pDesktopResize)(rdpContext* context);
Packit 1fb8d4
typedef BOOL (*pBitmapUpdate)(rdpContext* context, const BITMAP_UPDATE* bitmap);
Packit 1fb8d4
typedef BOOL (*pPalette)(rdpContext* context, const PALETTE_UPDATE* palette);
Packit 1fb8d4
typedef BOOL (*pPlaySound)(rdpContext* context, const PLAY_SOUND_UPDATE* play_sound);
Packit 1fb8d4
typedef BOOL (*pSetKeyboardIndicators)(rdpContext* context, UINT16 led_flags);
Packit 1fb8d4
Packit 1fb8d4
typedef BOOL (*pRefreshRect)(rdpContext* context, BYTE count, const RECTANGLE_16* areas);
Packit 1fb8d4
typedef BOOL (*pSuppressOutput)(rdpContext* context, BYTE allow, const RECTANGLE_16* area);
Packit 1fb8d4
typedef BOOL (*pRemoteMonitors)(rdpContext* context, UINT32 count, const MONITOR_DEF* monitors);
Packit 1fb8d4
Packit 1fb8d4
typedef BOOL (*pSurfaceCommand)(rdpContext* context, wStream* s);
Packit Service 5a9772
typedef BOOL (*pSurfaceBits)(rdpContext* context, const SURFACE_BITS_COMMAND* surfaceBitsCommand);
Packit 1fb8d4
typedef BOOL (*pSurfaceFrameMarker)(rdpContext* context,
Packit 1fb8d4
                                    const SURFACE_FRAME_MARKER* surfaceFrameMarker);
Packit Service 5a9772
typedef BOOL (*pSurfaceFrameBits)(rdpContext* context, const SURFACE_BITS_COMMAND* cmd, BOOL first,
Packit 1fb8d4
                                  BOOL last, UINT32 frameId);
Packit 1fb8d4
typedef BOOL (*pSurfaceFrameAcknowledge)(rdpContext* context, UINT32 frameId);
Packit 1fb8d4
Packit 1fb8d4
typedef BOOL (*pSaveSessionInfo)(rdpContext* context, UINT32 type, void* data);
Packit 1fb8d4
typedef BOOL (*pSetKeyboardImeStatus)(rdpContext* context, UINT16 imeId, UINT32 imeState,
Packit 1fb8d4
                                      UINT32 imeConvMode);
Packit Service 5a9772
typedef BOOL (*pServerStatusInfo)(rdpContext* context, UINT32 status);
Packit 1fb8d4
Packit 1fb8d4
struct rdp_update
Packit 1fb8d4
{
Packit Service 5a9772
	rdpContext* context;     /* 0 */
Packit 1fb8d4
	UINT32 paddingA[16 - 1]; /* 1 */
Packit 1fb8d4
Packit Service 5a9772
	pBeginPaint BeginPaint;                       /* 16 */
Packit Service 5a9772
	pEndPaint EndPaint;                           /* 17 */
Packit Service 5a9772
	pSetBounds SetBounds;                         /* 18 */
Packit Service 5a9772
	pSynchronize Synchronize;                     /* 19 */
Packit Service 5a9772
	pDesktopResize DesktopResize;                 /* 20 */
Packit Service 5a9772
	pBitmapUpdate BitmapUpdate;                   /* 21 */
Packit Service 5a9772
	pPalette Palette;                             /* 22 */
Packit Service 5a9772
	pPlaySound PlaySound;                         /* 23 */
Packit 1fb8d4
	pSetKeyboardIndicators SetKeyboardIndicators; /* 24 */
Packit Service 5a9772
	pSetKeyboardImeStatus SetKeyboardImeStatus;   /* 25 */
Packit Service 5a9772
	UINT32 paddingB[32 - 26];                     /* 26 */
Packit 1fb8d4
Packit Service 5a9772
	rdpPointerUpdate* pointer;     /* 32 */
Packit Service 5a9772
	rdpPrimaryUpdate* primary;     /* 33 */
Packit 1fb8d4
	rdpSecondaryUpdate* secondary; /* 34 */
Packit Service 5a9772
	rdpAltSecUpdate* altsec;       /* 35 */
Packit Service 5a9772
	rdpWindowUpdate* window;       /* 36 */
Packit Service 5a9772
	UINT32 paddingC[48 - 37];      /* 37 */
Packit 1fb8d4
Packit Service 5a9772
	pRefreshRect RefreshRect;       /* 48 */
Packit 1fb8d4
	pSuppressOutput SuppressOutput; /* 49 */
Packit 1fb8d4
	pRemoteMonitors RemoteMonitors; /* 50 */
Packit Service 5a9772
	UINT32 paddingD[64 - 51];       /* 51 */
Packit 1fb8d4
Packit Service 5a9772
	pSurfaceCommand SurfaceCommand;                   /* 64 */
Packit Service 5a9772
	pSurfaceBits SurfaceBits;                         /* 65 */
Packit Service 5a9772
	pSurfaceFrameMarker SurfaceFrameMarker;           /* 66 */
Packit Service 5a9772
	pSurfaceFrameBits SurfaceFrameBits;               /* 67 */
Packit 1fb8d4
	pSurfaceFrameAcknowledge SurfaceFrameAcknowledge; /* 68 */
Packit Service 5a9772
	pSaveSessionInfo SaveSessionInfo;                 /* 69 */
Packit Service 5a9772
	pServerStatusInfo ServerStatusInfo;               /* 70 */
Packit Service 5a9772
	UINT32 paddingE[80 - 71];                         /* 71 */
Packit 1fb8d4
Packit 1fb8d4
	/* internal */
Packit 1fb8d4
Packit 1fb8d4
	wLog* log;
Packit 1fb8d4
Packit 1fb8d4
	BOOL dump_rfx;
Packit 1fb8d4
	BOOL play_rfx;
Packit 1fb8d4
	rdpPcap* pcap_rfx;
Packit 1fb8d4
	BOOL initialState;
Packit 1fb8d4
Packit 1fb8d4
	BOOL asynchronous;
Packit 1fb8d4
	rdpUpdateProxy* proxy;
Packit 1fb8d4
	wMessageQueue* queue;
Packit 1fb8d4
Packit 1fb8d4
	wStream* us;
Packit 1fb8d4
	UINT16 numberOrders;
Packit 1fb8d4
	BOOL combineUpdates;
Packit 1fb8d4
	rdpBounds currentBounds;
Packit 1fb8d4
	rdpBounds previousBounds;
Packit Service 5a9772
	CRITICAL_SECTION mux;
Packit Service 5a9772
Packit Service 5a9772
	/* if autoCalculateBitmapData is set to TRUE, the server automatically
Packit Service 5a9772
	 * fills BITMAP_DATA struct members: flags, cbCompMainBodySize and cbCompFirstRowSize.
Packit Service 5a9772
	 */
Packit Service 5a9772
	BOOL autoCalculateBitmapData;
Packit 1fb8d4
};
Packit 1fb8d4
Packit 1fb8d4
#endif /* FREERDP_UPDATE_H */