16
#define RDP_FROM_INST(_inst) ((rdpRdp *) (_inst->rdp))
19
ui_error(rdpInst * inst, char * format, ...)
25
text1 = (char *) xmalloc(1024);
26
text2 = (char *) xmalloc(1024);
28
vsnprintf(text1, 1023, format, ap);
31
snprintf(text2, 1023, "ERROR: %s", text1);
33
inst->ui_error(inst, text2);
39
ui_warning(rdpInst * inst, char * format, ...)
45
text1 = (char *) xmalloc(1024);
46
text2 = (char *) xmalloc(1024);
48
vsnprintf(text1, 1023, format, ap);
51
snprintf(text2, 1023, "WARNING: %s", text1);
53
inst->ui_warning(inst, text2);
59
ui_unimpl(rdpInst * inst, char * format, ...)
65
text1 = (char *) xmalloc(1024);
66
text2 = (char *) xmalloc(1024);
68
vsnprintf(text1, 1023, format, ap);
71
snprintf(text2, 1023, "NOT IMPLEMENTED: %s", text1);
73
inst->ui_unimpl(inst, text2);
79
hexdump(unsigned char * p, int len)
81
unsigned char *line = p;
82
int i, thisline, offset = 0;
86
printf("%04x ", offset);
87
thisline = len - offset;
91
for (i = 0; i < thisline; i++)
92
printf("%02x ", line[i]);
97
for (i = 0; i < thisline; i++)
98
printf("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.');
107
load_licence(unsigned char ** data)
113
rd_lock_file(int fd, int start, int len)
119
rd_lseek_file(int fd, int offset)
125
rd_write_file(int fd, void * ptr, int len)
131
rd_pstcache_mkdir(void)
137
rd_close_file(int fd)
142
rd_read_file(int fd, void * ptr, int len)
148
rd_open_file(char * filename)
154
generate_random(uint8 * random)
159
srand((unsigned int)index);
160
for (index = 0; index < 32; index++)
162
random[index] = rand();
167
save_licence(unsigned char * data, int length)
172
ui_begin_update(rdpInst * inst)
174
inst->ui_begin_update(inst);
178
ui_end_update(rdpInst * inst)
180
inst->ui_end_update(inst);
184
ui_line(rdpInst * inst, uint8 opcode, int startx, int starty, int endx, int endy, RD_PEN * pen)
186
inst->ui_line(inst, opcode, startx, starty, endx, endy, pen);
190
ui_rect(rdpInst * inst, int x, int y, int cx, int cy, int colour)
192
inst->ui_rect(inst, x, y, cx, cy, colour);
196
ui_polygon(rdpInst * inst, uint8 opcode, uint8 fillmode, RD_POINT * point, int npoints,
197
RD_BRUSH * brush, int bgcolour, int fgcolour)
199
inst->ui_polygon(inst, opcode, fillmode, point, npoints, brush, bgcolour, fgcolour);
203
ui_polyline(rdpInst * inst, uint8 opcode, RD_POINT * points, int npoints, RD_PEN * pen)
205
inst->ui_polyline(inst, opcode, points, npoints, pen);
209
ui_ellipse(rdpInst * inst, uint8 opcode, uint8 fillmode, int x, int y, int cx, int cy,
210
RD_BRUSH * brush, int bgcolour, int fgcolour)
212
inst->ui_ellipse(inst, opcode, fillmode, x, y, cx, cy, brush, bgcolour, fgcolour);
216
ui_start_draw_glyphs(rdpInst * inst, int bgcolour, int fgcolour)
218
inst->ui_start_draw_glyphs(inst, bgcolour, fgcolour);
222
ui_draw_glyph(rdpInst * inst, int x, int y, int cx, int cy, RD_HGLYPH glyph)
224
inst->ui_draw_glyph(inst, x, y, cx, cy, glyph);
228
ui_end_draw_glyphs(rdpInst * inst, int x, int y, int cx, int cy)
230
inst->ui_end_draw_glyphs(inst, x, y, cx, cy);
234
ui_desktop_save(rdpInst * inst, uint32 offset, int x, int y, int cx, int cy)
236
inst->ui_desktop_save(inst, offset, x, y, cx, cy);
240
ui_desktop_restore(rdpInst * inst, uint32 offset, int x, int y, int cx, int cy)
242
inst->ui_desktop_save(inst, offset, x, y, cx, cy);
246
ui_get_toggle_keys_state(rdpInst * inst)
248
return inst->ui_get_toggle_keys_state(inst);
252
ui_bell(rdpInst * inst)
258
ui_destblt(rdpInst * inst, uint8 opcode, int x, int y, int cx, int cy)
260
inst->ui_destblt(inst, opcode, x, y, cx, cy);
264
ui_patblt(rdpInst * inst, uint8 opcode, int x, int y, int cx, int cy, RD_BRUSH * brush,
265
int bgcolour, int fgcolour)
267
inst->ui_patblt(inst, opcode, x, y, cx, cy, brush, bgcolour, fgcolour);
271
ui_screenblt(rdpInst * inst, uint8 opcode, int x, int y, int cx, int cy, int srcx, int srcy)
273
inst->ui_screenblt(inst, opcode, x, y, cx, cy, srcx, srcy);
277
ui_memblt(rdpInst * inst, uint8 opcode, int x, int y, int cx, int cy, RD_HBITMAP src,
280
inst->ui_memblt(inst, opcode, x, y, cx, cy, src, srcx, srcy);
284
ui_triblt(rdpInst * inst, uint8 opcode, int x, int y, int cx, int cy, RD_HBITMAP src,
285
int srcx, int srcy, RD_BRUSH * brush, int bgcolour, int fgcolour)
287
inst->ui_triblt(inst, opcode, x, y, cx, cy, src, srcx, srcy, brush, bgcolour, fgcolour);
291
ui_create_glyph(rdpInst * inst, int width, int height, uint8 * data)
293
return inst->ui_create_glyph(inst, width, height, data);
297
ui_destroy_glyph(rdpInst * inst, RD_HGLYPH glyph)
299
inst->ui_destroy_glyph(inst, glyph);
303
ui_select(rdpInst * inst, int rdp_socket)
305
return inst->ui_select(inst, rdp_socket);
309
ui_set_clip(rdpInst * inst, int x, int y, int cx, int cy)
311
inst->ui_set_clip(inst, x, y, cx, cy);
315
ui_reset_clip(rdpInst * inst)
317
inst->ui_reset_clip(inst);
321
ui_resize_window(rdpInst * inst)
323
inst->ui_resize_window(inst);
327
ui_create_cursor(rdpInst * inst, unsigned int x, unsigned int y, int width, int height,
328
uint8 * andmask, uint8 * xormask, int bpp)
330
return inst->ui_create_cursor(inst, x, y, width, height, andmask, xormask, bpp);
334
ui_set_cursor(rdpInst * inst, RD_HCURSOR cursor)
336
inst->ui_set_cursor(inst, cursor);
340
ui_set_null_cursor(rdpInst * inst)
342
inst->ui_set_null_cursor(inst);
346
ui_set_default_cursor(rdpInst * inst)
348
inst->ui_set_default_cursor(inst);
352
ui_destroy_cursor(rdpInst * inst, RD_HCURSOR cursor)
354
inst->ui_destroy_cursor(inst, cursor);
358
ui_create_bitmap(rdpInst * inst, int width, int height, uint8 * data)
360
return inst->ui_create_bitmap(inst, width, height, data);
364
ui_paint_bitmap(rdpInst * inst, int x, int y, int cx, int cy, int width, int height, uint8 * data)
366
inst->ui_paint_bitmap(inst, x, y, cx, cy, width, height, data);
370
ui_destroy_bitmap(rdpInst * inst, RD_HBITMAP bmp)
372
inst->ui_destroy_bitmap(inst, bmp);
376
ui_create_colourmap(rdpInst * inst, RD_COLOURMAP * colours)
378
return inst->ui_create_colourmap(inst, colours);
382
ui_move_pointer(rdpInst * inst, int x, int y)
384
inst->ui_move_pointer(inst, x, y);
388
ui_set_colourmap(rdpInst * inst, RD_HCOLOURMAP map)
390
inst->ui_set_colourmap(inst, map);
394
ui_create_surface(rdpInst * inst, int width, int height, RD_HBITMAP old)
396
return inst->ui_create_surface(inst, width, height, old);
400
ui_set_surface(rdpInst * inst, RD_HBITMAP surface)
402
inst->ui_set_surface(inst, surface);
406
ui_destroy_surface(rdpInst * inst, RD_HBITMAP surface)
408
inst->ui_destroy_surface(inst, surface);
412
ui_channel_data(rdpInst * inst, int chan_id, char * data, int data_size,
413
int flags, int total_size)
415
inst->ui_channel_data(inst, chan_id, data, data_size, flags, total_size);
420
l_rdp_connect(rdpInst * inst)
425
rdp = RDP_FROM_INST(inst);
426
for (index = 0; index < rdp->settings->num_channels; index++)
428
rdp->settings->channels[index].chan_id = MCS_GLOBAL_CHANNEL + 1 + index;
430
if (rdp_connect(rdp))
438
l_rdp_get_fds(rdpInst * inst, void ** read_fds, int * read_count,
439
void ** write_fds, int * write_count)
443
rdp = RDP_FROM_INST(inst);
445
read_fds[*read_count] = (void *) (rdp->sec->mcs->iso->tcp->wsa_event);
447
read_fds[*read_count] = (void *)(long) (rdp->sec->mcs->iso->tcp->sock);
453
/* Process receivable fds, return true if connection should live on */
455
l_rdp_check_fds(rdpInst * inst)
461
rdp = RDP_FROM_INST(inst);
463
WSAResetEvent(rdp->sec->mcs->iso->tcp->wsa_event);
466
if (tcp_can_recv(rdp->sec->mcs->iso->tcp->sock, 0))
468
if (!rdp_loop(rdp, &deactivated))
473
if ((rv != 0) && rdp->redirect)
475
rdp->redirect = False;
477
if (rdp_reconnect(rdp))
486
l_rdp_send_input(rdpInst * inst, int message_type, int device_flags,
487
int param1, int param2)
491
rdp = RDP_FROM_INST(inst);
492
rdp_send_input(rdp, time(NULL), message_type, device_flags, param1, param2);
497
l_rdp_sync_input(rdpInst * inst, int toggle_flags)
501
rdp = (rdpRdp *) (inst->rdp);
502
rdp_sync_input(rdp, time(NULL), toggle_flags);
507
l_rdp_channel_data(rdpInst * inst, int chan_id, char * data, int data_size)
512
rdp = RDP_FROM_INST(inst);
513
chan = rdp->sec->mcs->chan;
514
return vchan_send(chan, chan_id, data, data_size);
518
l_rdp_disconnect(rdpInst * inst)
522
rdp = RDP_FROM_INST(inst);
527
freerdp_new(rdpSet * settings)
531
inst = (rdpInst *) xmalloc(sizeof(rdpInst));
532
inst->version = FREERDP_INTERFACE_VERSION;
533
inst->size = sizeof(rdpInst);
534
inst->settings = settings;
535
inst->rdp_connect = l_rdp_connect;
536
inst->rdp_get_fds = l_rdp_get_fds;
537
inst->rdp_check_fds = l_rdp_check_fds;
538
inst->rdp_send_input = l_rdp_send_input;
539
inst->rdp_sync_input = l_rdp_sync_input;
540
inst->rdp_channel_data = l_rdp_channel_data;
541
inst->rdp_disconnect = l_rdp_disconnect;
542
inst->rdp = (void *) rdp_new(settings, inst);
547
freerdp_free(rdpInst * inst)
553
rdp = RDP_FROM_INST(inst);