Initial commit - from Precise source
[freerdp-ubuntu-pcb-backport.git] / include / freerdp / update.h
1 /**
2  * FreeRDP: A Remote Desktop Protocol Client
3  * Update Interface API
4  *
5  * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 #ifndef __UPDATE_API_H
21 #define __UPDATE_API_H
22
23 typedef struct rdp_update rdpUpdate;
24
25 #include <freerdp/rail.h>
26 #include <freerdp/types.h>
27 #include <freerdp/freerdp.h>
28 #include <freerdp/graphics.h>
29 #include <freerdp/utils/pcap.h>
30 #include <freerdp/utils/stream.h>
31
32 #include <freerdp/primary.h>
33 #include <freerdp/secondary.h>
34 #include <freerdp/altsec.h>
35 #include <freerdp/window.h>
36 #include <freerdp/pointer.h>
37
38 /* Bitmap Updates */
39
40 struct _BITMAP_DATA
41 {
42         uint32 destLeft;
43         uint32 destTop;
44         uint32 destRight;
45         uint32 destBottom;
46         uint32 width;
47         uint32 height;
48         uint32 bitsPerPixel;
49         uint32 flags;
50         uint32 bitmapLength;
51         uint32 cbCompFirstRowSize;
52         uint32 cbCompMainBodySize;
53         uint32 cbScanWidth;
54         uint32 cbUncompressedSize;
55         uint8* bitmapDataStream;
56         boolean compressed;
57 };
58 typedef struct _BITMAP_DATA BITMAP_DATA;
59
60 struct _BITMAP_UPDATE
61 {
62         uint32 count;
63         uint32 number;
64         BITMAP_DATA* rectangles;
65 };
66 typedef struct _BITMAP_UPDATE BITMAP_UPDATE;
67
68 /* Palette Updates */
69
70 struct _PALETTE_ENTRY
71 {
72         uint8 red;
73         uint8 green;
74         uint8 blue;
75 };
76 typedef struct _PALETTE_ENTRY PALETTE_ENTRY;
77
78 struct _PALETTE_UPDATE
79 {
80         uint32 number;
81         PALETTE_ENTRY entries[256];
82 };
83 typedef struct _PALETTE_UPDATE PALETTE_UPDATE;
84
85 struct rdp_palette
86 {
87         uint32 count;
88         PALETTE_ENTRY* entries;
89 };
90 typedef struct rdp_palette rdpPalette;
91
92 /* Play Sound (System Beep) Updates */
93
94 struct _PLAY_SOUND_UPDATE
95 {
96         uint32 duration;
97         uint32 frequency;
98 };
99 typedef struct _PLAY_SOUND_UPDATE PLAY_SOUND_UPDATE;
100
101 /* Surface Command Updates */
102
103 struct _SURFACE_BITS_COMMAND
104 {
105         uint32 cmdType;
106         uint32 destLeft;
107         uint32 destTop;
108         uint32 destRight;
109         uint32 destBottom;
110         uint32 bpp;
111         uint32 codecID;
112         uint32 width;
113         uint32 height;
114         uint32 bitmapDataLength;
115         uint8* bitmapData;
116 };
117 typedef struct _SURFACE_BITS_COMMAND SURFACE_BITS_COMMAND;
118
119 struct _SURFACE_FRAME_MARKER
120 {
121         uint32 frameAction;
122         uint32 frameId;
123 };
124 typedef struct _SURFACE_FRAME_MARKER SURFACE_FRAME_MARKER;
125
126 /* Update Interface */
127
128 typedef void (*pBeginPaint)(rdpContext* context);
129 typedef void (*pEndPaint)(rdpContext* context);
130 typedef void (*pSetBounds)(rdpContext* context, rdpBounds* bounds);
131
132 typedef void (*pSynchronize)(rdpContext* context);
133 typedef void (*pDesktopResize)(rdpContext* context);
134 typedef void (*pBitmapUpdate)(rdpContext* context, BITMAP_UPDATE* bitmap);
135 typedef void (*pPalette)(rdpContext* context, PALETTE_UPDATE* palette);
136 typedef void (*pPlaySound)(rdpContext* context, PLAY_SOUND_UPDATE* play_sound);
137
138 typedef void (*pRefreshRect)(rdpContext* context, uint8 count, RECTANGLE_16* areas);
139 typedef void (*pSuppressOutput)(rdpContext* context, uint8 allow, RECTANGLE_16* area);
140
141 typedef void (*pSurfaceCommand)(rdpContext* context, STREAM* s);
142 typedef void (*pSurfaceBits)(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits_command);
143 typedef void (*pSurfaceFrameMarker)(rdpContext* context, SURFACE_FRAME_MARKER* surface_frame_marker);
144
145 struct rdp_update
146 {
147         rdpContext* context; /* 0 */
148         uint32 paddingA[16 - 1]; /* 1 */
149
150         pBeginPaint BeginPaint; /* 16 */
151         pEndPaint EndPaint; /* 17 */
152         pSetBounds SetBounds; /* 18 */
153         pSynchronize Synchronize; /* 19 */
154         pDesktopResize DesktopResize; /* 20 */
155         pBitmapUpdate BitmapUpdate; /* 21 */
156         pPalette Palette; /* 22 */
157         pPlaySound PlaySound; /* 23 */
158         uint32 paddingB[32 - 24]; /* 24 */
159
160         rdpPointerUpdate* pointer; /* 32 */
161         rdpPrimaryUpdate* primary; /* 33 */
162         rdpSecondaryUpdate* secondary; /* 34 */
163         rdpAltSecUpdate* altsec; /* 35 */
164         rdpWindowUpdate* window; /* 36 */
165         uint32 paddingC[48 - 37]; /* 37 */
166
167         pRefreshRect RefreshRect; /* 48 */
168         pSuppressOutput SuppressOutput; /* 49 */
169         uint32 paddingD[64 - 50]; /* 50 */
170
171         pSurfaceCommand SurfaceCommand; /* 64 */
172         pSurfaceBits SurfaceBits; /* 65 */
173         pSurfaceFrameMarker SurfaceFrameMarker; /* 66 */
174         uint32 paddingE[80 - 67]; /* 67 */
175
176         /* internal */
177
178         boolean dump_rfx;
179         boolean play_rfx;
180         rdpPcap* pcap_rfx;
181
182         BITMAP_UPDATE bitmap_update;
183         PALETTE_UPDATE palette_update;
184         PLAY_SOUND_UPDATE play_sound;
185
186         SURFACE_BITS_COMMAND surface_bits_command;
187         SURFACE_FRAME_MARKER surface_frame_marker;
188 };
189
190 #endif /* __UPDATE_API_H */
191