FreeRDP
Loading...
Searching...
No Matches
libfreerdp/core/update.h
1
20#ifndef FREERDP_LIB_CORE_UPDATE_H
21#define FREERDP_LIB_CORE_UPDATE_H
22
23#include "rdp.h"
24#include "orders.h"
25
26#include <freerdp/types.h>
27#include <freerdp/update.h>
28#include <freerdp/freerdp.h>
29#include <freerdp/api.h>
30
31#include <winpr/stream.h>
32
33#include "../cache/bitmap.h"
34#include "../cache/palette.h"
35#include "../cache/pointer.h"
36
37#define UPDATE_TYPE_ORDERS 0x0000
38#define UPDATE_TYPE_BITMAP 0x0001
39#define UPDATE_TYPE_PALETTE 0x0002
40#define UPDATE_TYPE_SYNCHRONIZE 0x0003
41
42#define BITMAP_COMPRESSION 0x0001
43#define NO_BITMAP_COMPRESSION_HDR 0x0400
44
45typedef enum
46{
47 RDP_STATS_SURFACE_BITS = 0,
48 RDP_STATS_SURFACE_BITS_RFX,
49 RDP_STATS_SURFACE_BITS_RFX_IMAGE,
50 RDP_STATS_SURFACE_BITS_NSC,
51 RDP_STATS_SURFACE_BITS_NONE,
52 RDP_STATS_SURFACE_BITS_UNKNOWN,
53 RDP_STATS_BEGIN_PAINT,
54 RDP_STATS_END_PAINT,
55 RDP_STATS_SET_BOUNDS,
56 RDP_STATS_SYNC,
57 RDP_STATS_RESIZE,
58 RDP_STATS_BITMAP_UPDATE,
59 RDP_STATS_PALETTE,
60 RDP_STATS_REFRESH_RECT,
61 RDP_STATS_SUPPRESS_OUTPUT,
62 RDP_STATS_SURFACE_COMMAND,
63 RDP_STATS_SURFACE_FRAME_MARKER,
64 RDP_STATS_SURFACE_FRAME_ACK,
65 RDP_STATS_POINTER_SYSTEM,
66 RDP_STATS_POINTER_DEFAULT,
67 RDP_STATS_POINTER_POSITION,
68 RDP_STATS_POINTER_COLOR,
69 RDP_STATS_POINTER_CACHED,
70 RDP_STATS_POINTER_NEW,
71 RDP_STATS_POINTER_LARGE
72} rdp_codec_stats;
73
74typedef struct
75{
76 uint64_t primary[0x100];
77 uint64_t secondary[0x100];
78 uint64_t altsec[0x100];
79 uint64_t base[0x40];
80} rdp_stats;
81
82typedef struct
83{
84 rdpUpdate common;
85
86 wLog* log;
87
88 BOOL dump_rfx;
89 BOOL play_rfx;
90 rdpPcap* pcap_rfx;
91 BOOL initialState;
92
93 BOOL asynchronous;
94 rdpUpdateProxy* proxy;
95 wMessageQueue* queue;
96
97 wStream* us;
98 UINT16 numberOrders;
99 size_t offsetOrders; /* the offset to patch numberOrders in the stream */
100 BOOL combineUpdates;
101 rdpBounds currentBounds;
102 rdpBounds previousBounds;
104 BOOL withinBeginEndPaint;
105
106 rdp_stats stats;
108
109typedef struct
110{
111 rdpAltSecUpdate common;
112
113 CREATE_OFFSCREEN_BITMAP_ORDER create_offscreen_bitmap;
114 SWITCH_SURFACE_ORDER switch_surface;
115 CREATE_NINE_GRID_BITMAP_ORDER create_nine_grid_bitmap;
116 FRAME_MARKER_ORDER frame_marker;
117 STREAM_BITMAP_FIRST_ORDER stream_bitmap_first;
118 STREAM_BITMAP_NEXT_ORDER stream_bitmap_next;
119 DRAW_GDIPLUS_CACHE_FIRST_ORDER draw_gdiplus_cache_first;
120 DRAW_GDIPLUS_CACHE_NEXT_ORDER draw_gdiplus_cache_next;
121 DRAW_GDIPLUS_CACHE_END_ORDER draw_gdiplus_cache_end;
122 DRAW_GDIPLUS_FIRST_ORDER draw_gdiplus_first;
123 DRAW_GDIPLUS_NEXT_ORDER draw_gdiplus_next;
124 DRAW_GDIPLUS_END_ORDER draw_gdiplus_end;
126
127typedef struct
128{
129 rdpPrimaryUpdate common;
130
131 ORDER_INFO order_info;
132 DSTBLT_ORDER dstblt;
133 PATBLT_ORDER patblt;
134 SCRBLT_ORDER scrblt;
135 OPAQUE_RECT_ORDER opaque_rect;
136 DRAW_NINE_GRID_ORDER draw_nine_grid;
137 MULTI_DSTBLT_ORDER multi_dstblt;
138 MULTI_PATBLT_ORDER multi_patblt;
139 MULTI_SCRBLT_ORDER multi_scrblt;
140 MULTI_OPAQUE_RECT_ORDER multi_opaque_rect;
141 MULTI_DRAW_NINE_GRID_ORDER multi_draw_nine_grid;
142 LINE_TO_ORDER line_to;
143 POLYLINE_ORDER polyline;
144 MEMBLT_ORDER memblt;
145 MEM3BLT_ORDER mem3blt;
146 SAVE_BITMAP_ORDER save_bitmap;
147 GLYPH_INDEX_ORDER glyph_index;
148 FAST_INDEX_ORDER fast_index;
149 FAST_GLYPH_ORDER fast_glyph;
150 POLYGON_SC_ORDER polygon_sc;
151 POLYGON_CB_ORDER polygon_cb;
152 ELLIPSE_SC_ORDER ellipse_sc;
153 ELLIPSE_CB_ORDER ellipse_cb;
155
156typedef struct
157{
158 rdpSecondaryUpdate common;
159 BOOL glyph_v2;
161
162WINPR_ATTR_NODISCARD
163static inline rdp_update_internal* update_cast(rdpUpdate* update)
164{
165 union
166 {
167 rdpUpdate* pub;
168 rdp_update_internal* internal;
169 } cnv;
170
171 WINPR_ASSERT(update);
172 cnv.pub = update;
173 return cnv.internal;
174}
175
176WINPR_ATTR_NODISCARD
177static inline rdp_altsec_update_internal* altsec_update_cast(rdpAltSecUpdate* update)
178{
179 union
180 {
181 rdpAltSecUpdate* pub;
183 } cnv;
184
185 WINPR_ASSERT(update);
186 cnv.pub = update;
187 return cnv.internal;
188}
189
190WINPR_ATTR_NODISCARD
191static inline rdp_primary_update_internal* primary_update_cast(rdpPrimaryUpdate* update)
192{
193 union
194 {
195 rdpPrimaryUpdate* pub;
197 } cnv;
198
199 WINPR_ASSERT(update);
200 cnv.pub = update;
201 return cnv.internal;
202}
203
204WINPR_ATTR_NODISCARD
205static inline rdp_secondary_update_internal* secondary_update_cast(rdpSecondaryUpdate* update)
206{
207 union
208 {
209 rdpSecondaryUpdate* pub;
211 } cnv;
212
213 WINPR_ASSERT(update);
214 cnv.pub = update;
215 return cnv.internal;
216}
217
218FREERDP_LOCAL void update_free(rdpUpdate* update);
219
220WINPR_ATTR_MALLOC(update_free, 1)
221FREERDP_LOCAL rdpUpdate* update_new(rdpRdp* rdp);
222
223FREERDP_LOCAL void update_reset_state(rdpUpdate* update);
224
225WINPR_ATTR_NODISCARD
226FREERDP_LOCAL BOOL update_post_connect(rdpUpdate* update);
227
228FREERDP_LOCAL void update_post_disconnect(rdpUpdate* update);
229
230WINPR_ATTR_NODISCARD
231FREERDP_LOCAL BOOL update_recv_play_sound(rdpUpdate* update, wStream* s);
232
233WINPR_ATTR_NODISCARD
234FREERDP_LOCAL BOOL update_recv_pointer(rdpUpdate* update, wStream* s);
235
236WINPR_ATTR_NODISCARD
237FREERDP_LOCAL BOOL update_recv(rdpUpdate* update, wStream* s);
238
239WINPR_ATTR_MALLOC(free_bitmap_update, 2)
240FREERDP_LOCAL BITMAP_UPDATE* update_read_bitmap_update(rdpUpdate* update, wStream* s);
241
242WINPR_ATTR_MALLOC(free_palette_update, 2)
243FREERDP_LOCAL PALETTE_UPDATE* update_read_palette(rdpUpdate* update, wStream* s);
244
245WINPR_ATTR_MALLOC(free_pointer_system_update, 2)
246FREERDP_LOCAL POINTER_SYSTEM_UPDATE* update_read_pointer_system(rdpUpdate* update, wStream* s);
247
248WINPR_ATTR_MALLOC(free_pointer_position_update, 2)
249FREERDP_LOCAL POINTER_POSITION_UPDATE* update_read_pointer_position(rdpUpdate* update, wStream* s);
250
251WINPR_ATTR_MALLOC(free_pointer_color_update, 2)
252FREERDP_LOCAL POINTER_COLOR_UPDATE* update_read_pointer_color(rdpUpdate* update, wStream* s,
253 BYTE xorBpp);
254
255WINPR_ATTR_MALLOC(free_pointer_large_update, 2)
256FREERDP_LOCAL POINTER_LARGE_UPDATE* update_read_pointer_large(rdpUpdate* update, wStream* s);
257
258WINPR_ATTR_MALLOC(free_pointer_new_update, 2)
259FREERDP_LOCAL POINTER_NEW_UPDATE* update_read_pointer_new(rdpUpdate* update, wStream* s);
260
261WINPR_ATTR_MALLOC(free_pointer_cached_update, 2)
262FREERDP_LOCAL POINTER_CACHED_UPDATE* update_read_pointer_cached(rdpUpdate* update, wStream* s);
263
264WINPR_ATTR_NODISCARD
265FREERDP_LOCAL BOOL update_read_refresh_rect(rdpUpdate* update, wStream* s);
266
267WINPR_ATTR_NODISCARD
268FREERDP_LOCAL BOOL update_read_suppress_output(rdpUpdate* update, wStream* s);
269
270FREERDP_LOCAL void update_register_server_callbacks(rdpUpdate* update);
271FREERDP_LOCAL void update_register_client_callbacks(rdpUpdate* update);
272
273WINPR_ATTR_NODISCARD
274FREERDP_LOCAL int update_process_messages(rdpUpdate* update);
275
276WINPR_ATTR_NODISCARD
277FREERDP_LOCAL BOOL update_begin_paint(rdpUpdate* update);
278
279WINPR_ATTR_NODISCARD
280FREERDP_LOCAL BOOL update_end_paint(rdpUpdate* update);
281
282FREERDP_LOCAL void update_dump_stats(rdpUpdate* update);
283
284#endif /* FREERDP_LIB_CORE_UPDATE_H */