mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
libfreerdp-core: started update interface
This commit is contained in:
@@ -20,11 +20,9 @@
|
||||
#ifndef __ORDERS_H
|
||||
#define __ORDERS_H
|
||||
|
||||
typedef struct rdp_orders rdpOrders;
|
||||
|
||||
#include "rdp.h"
|
||||
#include <freerdp/types.h>
|
||||
#include <freerdp/utils/stream.h>
|
||||
|
||||
typedef struct rdp_orders rdpOrders;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -373,6 +371,9 @@ struct rdp_orders
|
||||
GLYPH_INDEX_ORDER glyph_index;
|
||||
};
|
||||
|
||||
#include "rdp.h"
|
||||
#include <freerdp/utils/stream.h>
|
||||
|
||||
/* Order Control Flags */
|
||||
#define ORDER_STANDARD 0x01
|
||||
#define ORDER_SECONDARY 0x02
|
||||
|
||||
@@ -251,7 +251,8 @@ void rdp_read_data_pdu(rdpRdp* rdp, STREAM* s)
|
||||
|
||||
rdp_read_share_data_header(s, &length, &type, &share_id);
|
||||
|
||||
printf("recv %s Data PDU (0x%02X), length:%d\n", DATA_PDU_TYPE_STRINGS[type], type, length);
|
||||
if (type != DATA_PDU_TYPE_UPDATE)
|
||||
printf("recv %s Data PDU (0x%02X), length:%d\n", DATA_PDU_TYPE_STRINGS[type], type, length);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
@@ -435,6 +436,7 @@ rdpRdp* rdp_new()
|
||||
rdp->transport = transport_new(rdp->settings);
|
||||
rdp->license = license_new(rdp);
|
||||
rdp->orders = orders_new();
|
||||
rdp->update = update_new();
|
||||
rdp->nego = nego_new(rdp->transport);
|
||||
rdp->mcs = mcs_new(rdp->transport);
|
||||
}
|
||||
@@ -455,6 +457,7 @@ void rdp_free(rdpRdp* rdp)
|
||||
transport_free(rdp->transport);
|
||||
license_free(rdp->license);
|
||||
orders_free(rdp->orders);
|
||||
update_free(rdp->update);
|
||||
mcs_free(rdp->mcs);
|
||||
xfree(rdp);
|
||||
}
|
||||
|
||||
@@ -208,6 +208,7 @@ struct rdp_rdp
|
||||
struct rdp_mcs* mcs;
|
||||
struct rdp_nego* nego;
|
||||
struct rdp_orders* orders;
|
||||
struct rdp_update* update;
|
||||
struct rdp_license* license;
|
||||
struct rdp_settings* settings;
|
||||
struct rdp_registry* registry;
|
||||
|
||||
@@ -94,31 +94,47 @@ void rdp_read_bitmap_data(STREAM* s, BITMAP_DATA* bitmap_data)
|
||||
printf("bitmap decompression failed\n");
|
||||
}
|
||||
|
||||
void rdp_recv_bitmap_update(rdpRdp* rdp, STREAM* s)
|
||||
void rdp_read_bitmap_update(rdpRdp* rdp, STREAM* s, BITMAP_UPDATE* bitmap_update)
|
||||
{
|
||||
uint16 numberRectangles;
|
||||
BITMAP_DATA bitmap_data;
|
||||
int i;
|
||||
|
||||
bitmap_data.data = NULL;
|
||||
stream_read_uint16(s, numberRectangles); /* numberRectangles (2 bytes) */
|
||||
stream_read_uint16(s, bitmap_update->number); /* numberRectangles (2 bytes) */
|
||||
|
||||
bitmap_update->bitmaps = (BITMAP_DATA*) xmalloc(sizeof(BITMAP_DATA) * bitmap_update->number);
|
||||
|
||||
/* rectangles */
|
||||
while (numberRectangles > 0)
|
||||
for (i = 0; i < bitmap_update->number; i++)
|
||||
{
|
||||
rdp_read_bitmap_data(s, &bitmap_data);
|
||||
numberRectangles--;
|
||||
rdp_read_bitmap_data(s, &bitmap_update->bitmaps[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void rdp_recv_palette_update(rdpRdp* rdp, STREAM* s)
|
||||
void rdp_read_palette_update(rdpRdp* rdp, STREAM* s, PALETTE_UPDATE* palette_update)
|
||||
{
|
||||
int i;
|
||||
uint8 byte;
|
||||
uint32 color;
|
||||
|
||||
stream_seek_uint16(s); /* pad2Octets (2 bytes) */
|
||||
stream_seek_uint32(s); /* numberColors (4 bytes), must be set to 256 */
|
||||
stream_seek_uint32(palette_update->number); /* numberColors (4 bytes), must be set to 256 */
|
||||
|
||||
if (palette_update->number > 256)
|
||||
palette_update->number = 256;
|
||||
|
||||
/* paletteEntries */
|
||||
for (i = 0; i < palette_update->number; i++)
|
||||
{
|
||||
stream_read_uint8(s, byte);
|
||||
color = byte;
|
||||
stream_read_uint8(s, byte);
|
||||
color |= (byte << 8);
|
||||
stream_read_uint8(s, byte);
|
||||
color |= (byte << 16);
|
||||
palette_update->entries[i] = color;
|
||||
}
|
||||
}
|
||||
|
||||
void rdp_recv_synchronize_update(rdpRdp* rdp, STREAM* s)
|
||||
void rdp_read_synchronize_update(rdpRdp* rdp, STREAM* s)
|
||||
{
|
||||
stream_seek_uint16(s); /* pad2Octets (2 bytes) */
|
||||
|
||||
@@ -134,7 +150,8 @@ void rdp_recv_update_data_pdu(rdpRdp* rdp, STREAM* s)
|
||||
|
||||
stream_read_uint16(s, updateType); /* updateType (2 bytes) */
|
||||
|
||||
printf("%s Update Data PDU\n", UPDATE_TYPE_STRINGS[updateType]);
|
||||
if (updateType != UPDATE_TYPE_ORDERS)
|
||||
printf("%s Update Data PDU\n", UPDATE_TYPE_STRINGS[updateType]);
|
||||
|
||||
switch (updateType)
|
||||
{
|
||||
@@ -143,16 +160,38 @@ void rdp_recv_update_data_pdu(rdpRdp* rdp, STREAM* s)
|
||||
break;
|
||||
|
||||
case UPDATE_TYPE_BITMAP:
|
||||
rdp_recv_bitmap_update(rdp, s);
|
||||
rdp_read_bitmap_update(rdp, s, &rdp->update->bitmap_update);
|
||||
break;
|
||||
|
||||
case UPDATE_TYPE_PALETTE:
|
||||
rdp_recv_palette_update(rdp, s);
|
||||
rdp_read_palette_update(rdp, s, &rdp->update->palette_update);
|
||||
break;
|
||||
|
||||
case UPDATE_TYPE_SYNCHRONIZE:
|
||||
rdp_recv_synchronize_update(rdp, s);
|
||||
rdp_read_synchronize_update(rdp, s);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
rdpUpdate* update_new()
|
||||
{
|
||||
rdpUpdate* update;
|
||||
|
||||
update = (rdpUpdate*) xzalloc(sizeof(rdpUpdate));
|
||||
|
||||
if (update != NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return update;
|
||||
}
|
||||
|
||||
void update_free(rdpUpdate* update)
|
||||
{
|
||||
if (update != NULL)
|
||||
{
|
||||
xfree(update);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "rdp.h"
|
||||
#include "orders.h"
|
||||
#include <freerdp/freerdp.h>
|
||||
#include <freerdp/types.h>
|
||||
#include <freerdp/utils/stream.h>
|
||||
|
||||
@@ -44,11 +45,82 @@ typedef struct
|
||||
uint8* data;
|
||||
} BITMAP_DATA;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16 number;
|
||||
BITMAP_DATA* bitmaps;
|
||||
} BITMAP_UPDATE;
|
||||
|
||||
#define BITMAP_COMPRESSION 0x0001
|
||||
#define NO_BITMAP_COMPRESSION_HDR 0x0400
|
||||
|
||||
void rdp_read_bitmap_data(STREAM* s, BITMAP_DATA* bitmap_data);
|
||||
void rdp_recv_bitmap_update(rdpRdp* rdp, STREAM* s);
|
||||
typedef struct
|
||||
{
|
||||
uint32 number;
|
||||
uint32 entries[256];
|
||||
} PALETTE_UPDATE;
|
||||
|
||||
typedef struct rdp_update rdpUpdate;
|
||||
|
||||
typedef int (*pcBitmap)(rdpUpdate* update, BITMAP_UPDATE* bitmap);
|
||||
typedef int (*pcDstBlt)(rdpUpdate* update, DSTBLT_ORDER* dstblt);
|
||||
typedef int (*pcPatBlt)(rdpUpdate* update, PATBLT_ORDER* patblt);
|
||||
typedef int (*pcScrBlt)(rdpUpdate* update, PATBLT_ORDER* scrblt);
|
||||
typedef int (*pcDrawNineGrid)(rdpUpdate* update, DRAW_NINE_GRID_ORDER* draw_nine_grid);
|
||||
typedef int (*pcMultiDrawNineGrid)(rdpUpdate* update, MULTI_DRAW_NINE_GRID_ORDER* multi_draw_nine_grid);
|
||||
typedef int (*pcLineTo)(rdpUpdate* update, LINE_TO_ORDER* line_to);
|
||||
typedef int (*pcOpaqueRect)(rdpUpdate* update, OPAQUE_RECT_ORDER* opaque_rect);
|
||||
typedef int (*pcSaveBitmap)(rdpUpdate* update, SAVE_BITMAP_ORDER* save_bitmap);
|
||||
typedef int (*pcMemBlt)(rdpUpdate* update, MEMBLT_ORDER* memblt);
|
||||
typedef int (*pcMem3Blt)(rdpUpdate* update, MEM3BLT_ORDER* memblt);
|
||||
typedef int (*pcMultiDstBlt)(rdpUpdate* update, MULTI_DSTBLT_ORDER* dstblt);
|
||||
typedef int (*pcMultiPatBlt)(rdpUpdate* update, MULTI_PATBLT_ORDER* patblt);
|
||||
typedef int (*pcMultiScrBlt)(rdpUpdate* update, MULTI_PATBLT_ORDER* scrblt);
|
||||
typedef int (*pcMultiOpaqueRect)(rdpUpdate* update, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect);
|
||||
typedef int (*pcFastIndex)(rdpUpdate* update, FAST_INDEX_ORDER* fast_index);
|
||||
typedef int (*pcPolygonSC)(rdpUpdate* update, POLYGON_SC_ORDER* polygon_sc);
|
||||
typedef int (*pcPolygonCB)(rdpUpdate* update, POLYGON_CB_ORDER* polygon_cb);
|
||||
typedef int (*pcPolyline)(rdpUpdate* update, POLYLINE_ORDER* polyline);
|
||||
typedef int (*pcFastGlyph)(rdpUpdate* update, FAST_GLYPH_ORDER* fast_glyph);
|
||||
typedef int (*pcEllipseSC)(rdpUpdate* update, ELLIPSE_SC_ORDER* ellipse_sc);
|
||||
typedef int (*pcEllipseCB)(rdpUpdate* update, ELLIPSE_CB_ORDER* ellipse_cb);
|
||||
typedef int (*pcGlyphIndex)(rdpUpdate* update, GLYPH_INDEX_ORDER* glyph_index);
|
||||
|
||||
struct rdp_update
|
||||
{
|
||||
BITMAP_UPDATE bitmap_update;
|
||||
PALETTE_UPDATE palette_update;
|
||||
|
||||
pcBitmap Bitmap;
|
||||
pcDstBlt DstBlt;
|
||||
pcPatBlt PatBlt;
|
||||
pcScrBlt ScrBlt;
|
||||
pcDrawNineGrid DrawNineGrid;
|
||||
pcMultiDrawNineGrid MultiDrawNineGrid;
|
||||
pcLineTo LineTo;
|
||||
pcOpaqueRect OpaqueRect;
|
||||
pcSaveBitmap SaveBitmap;
|
||||
pcMemBlt MemBlt;
|
||||
pcMem3Blt Mem3Blt;
|
||||
pcMultiDstBlt MultiDstBlt;
|
||||
pcMultiPatBlt MultiPatBlt;
|
||||
pcMultiScrBlt MultiScrBlt;
|
||||
pcMultiOpaqueRect MultiOpaqueRect;
|
||||
pcFastIndex FastIndex;
|
||||
pcPolygonSC PolygonSC;
|
||||
pcPolygonCB PolygonCB;
|
||||
pcPolyline Polyline;
|
||||
pcFastGlyph FastGlyph;
|
||||
pcEllipseSC EllipseSC;
|
||||
pcEllipseCB EllipseCB;
|
||||
pcGlyphIndex GlyphIndex;
|
||||
};
|
||||
|
||||
rdpUpdate* update_new();
|
||||
void update_free(rdpUpdate* update);
|
||||
|
||||
void rdp_read_bitmap_update(rdpRdp* rdp, STREAM* s, BITMAP_UPDATE* bitmap_update);
|
||||
void rdp_read_palette_update(rdpRdp* rdp, STREAM* s, PALETTE_UPDATE* palette_update);
|
||||
void rdp_recv_update_data_pdu(rdpRdp* rdp, STREAM* s);
|
||||
|
||||
#endif /* __UPDATE_H */
|
||||
|
||||
Reference in New Issue
Block a user