libfreerdp-core: exporting new interface

This commit is contained in:
Marc-André Moreau 2011-07-28 00:38:25 -04:00
parent c860fd631d
commit 72fc75b5a6
18 changed files with 942 additions and 783 deletions

View File

@ -85,7 +85,7 @@ add_subdirectory(include)
add_subdirectory(libfreerdp-utils)
add_subdirectory(libfreerdp-kbd)
add_subdirectory(libfreerdp-gdi)
add_subdirectory(libfreerdp-chanman)
# add_subdirectory(libfreerdp-chanman)
add_subdirectory(libfreerdp-core)
add_subdirectory(channels)

View File

@ -22,9 +22,14 @@
#include "connection.h"
#include <freerdp/freerdp.h>
#include <freerdp/settings.h>
#include <freerdp/utils/memory.h>
rdpRdp* rdp;
freerdp* instance;
rdpSettings* settings;
#define PARAM_EQUALS(_param) (strcmp(_param, argv[*i]) == 0)
#define CHECK_VALUE_PRESENT(_msg) do { \
@ -185,14 +190,26 @@ boolean freerdp_process_params(int argc, char* argv[], rdpSettings* settings, in
return True;
}
int bitmap_update(rdpUpdate* update, BITMAP_UPDATE* bitmap)
{
printf("received bitmap update from core\n");
return 0;
}
void register_update_callbacks(rdpUpdate* update)
{
update->Bitmap = bitmap_update;
}
int main(int argc, char* argv[])
{
rdpRdp* rdp;
int index = 1;
rdpSettings* settings;
rdp = rdp_new();
settings = rdp->settings;
instance = freerdp_new();
register_update_callbacks(instance->update);
settings = instance->settings;
rdp = (rdpRdp*) instance->rdp;
if (freerdp_process_params(argc, argv, settings, &index) != True)
{
@ -205,5 +222,7 @@ int main(int argc, char* argv[])
rdp_client_connect(rdp);
freerdp_free(instance);
return 0;
}

View File

@ -48,12 +48,12 @@ add_executable(test_freerdp
test_utils.h
test_transport.c
test_transport.h
test_chanman.c
test_chanman.h
test_cliprdr.c
test_cliprdr.h
test_drdynvc.c
test_drdynvc.h
#test_chanman.c
#test_chanman.h
#test_cliprdr.c
#test_cliprdr.h
#test_drdynvc.c
#test_drdynvc.h
test_freerdp.c
test_freerdp.h)
@ -62,6 +62,6 @@ target_link_libraries(test_freerdp ${CUNIT_LIBRARIES})
target_link_libraries(test_freerdp freerdp-core)
target_link_libraries(test_freerdp freerdp-gdi)
target_link_libraries(test_freerdp freerdp-utils)
target_link_libraries(test_freerdp freerdp-chanman)
#target_link_libraries(test_freerdp freerdp-chanman)
add_test(CUnitTests ${EXECUTABLE_OUTPUT_PATH}/test_freerdp)

View File

@ -126,9 +126,9 @@ int main(int argc, char* argv[])
add_stream_suite();
add_utils_suite();
add_transport_suite();
add_chanman_suite();
add_cliprdr_suite();
add_drdynvc_suite();
//add_chanman_suite();
//add_cliprdr_suite();
//add_drdynvc_suite();
}
else
{
@ -168,15 +168,15 @@ int main(int argc, char* argv[])
}
else if (strcmp("chanman", argv[*pindex]) == 0)
{
add_chanman_suite();
//add_chanman_suite();
}
else if (strcmp("cliprdr", argv[*pindex]) == 0)
{
add_cliprdr_suite();
//add_cliprdr_suite();
}
else if (strcmp("drdynvc", argv[*pindex]) == 0)
{
add_drdynvc_suite();
//add_drdynvc_suite();
}
else if (strcmp("per", argv[*pindex]) == 0)
{

View File

@ -50,4 +50,6 @@
#define FREERDP_CC
#endif
#define IFCALL(_cb, ...) do { if (_cb != NULL) { _cb( __VA_ARGS__ ); } } while (0)
#endif

View File

@ -25,10 +25,32 @@
#include <freerdp/settings.h>
#include <freerdp/extension.h>
#include <freerdp/input.h>
#include <freerdp/update.h>
#ifdef __cplusplus
extern "C" {
#endif
/* New Interface */
FREERDP_API boolean freerdp_global_init();
FREERDP_API void freerdp_global_finish();
typedef struct
{
void* rdp;
rdpInput* input;
rdpUpdate* update;
rdpSettings* settings;
} freerdp;
FREERDP_API freerdp* freerdp_new();
FREERDP_API void freerdp_free(freerdp* instance);
#if 0
/* Old Interface */
FREERDP_API boolean
freerdp_global_init(void);
FREERDP_API void
@ -38,12 +60,12 @@ struct rdp_inst
{
int version;
int size;
rdpSettings * settings;
void * rdp;
void * param1;
void * param2;
void * param3;
void * param4;
rdpSettings* settings;
void* rdp;
void* param1;
void* param2;
void* param3;
void* param4;
uint32 disc_reason;
/* calls from ui to library */
int (* rdp_connect)(rdpInst * inst);
@ -126,6 +148,7 @@ FREERDP_API rdpInst *
freerdp_new(rdpSettings * settings);
FREERDP_API void
freerdp_free(rdpInst * inst);
#endif
#ifdef __cplusplus
}

76
include/freerdp/input.h Normal file
View File

@ -0,0 +1,76 @@
/**
* FreeRDP: A Remote Desktop Protocol Client
* Input Interface API
*
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __INPUT_API_H
#define __INPUT_API_H
/* Input Events */
#define INPUT_EVENT_SYNC 0x0000
#define INPUT_EVENT_SCANCODE 0x0004
#define INPUT_EVENT_UNICODE 0x0005
#define INPUT_EVENT_MOUSE 0x8001
#define INPUT_EVENT_MOUSEX 0x8002
/* keyboard Flags */
#define KBD_FLAGS_EXTENDED 0x0100
#define KBD_FLAGS_DOWN 0x4000
#define KBD_FLAGS_RELEASE 0x8000
/* Pointer Flags */
#define PTR_FLAGS_WHEEL 0x0200
#define PTR_FLAGS_WHEEL_NEGATIVE 0x0100
#define PTR_FLAGS_MOVE 0x0800
#define PTR_FLAGS_DOWN 0x8000
#define PTR_FLAGS_BUTTON1 0x1000
#define PTR_FLAGS_BUTTON2 0x2000
#define PTR_FLAGS_BUTTON3 0x4000
#define WheelRotationMask 0x01FF
/* Extended Pointer Flags */
#define PTR_XFLAGS_DOWN 0x8000
#define PTR_XFLAGS_BUTTON1 0x0001
#define PTR_XFLAGS_BUTTON2 0x0002
/* Keyboard Toggle Flags */
#define KBD_SYNC_SCROLL_LOCK 0x00000001
#define KBD_SYNC_NUM_LOCK 0x00000002
#define KBD_SYNC_CAPS_LOCK 0x00000004
#define KBD_SYNC_KANA_LOCK 0x00000008
#define RDP_CLIENT_INPUT_PDU_HEADER_LENGTH 4
typedef struct rdp_input rdpInput;
typedef void (*pcSynchronizeEvent)(rdpInput* input, uint32 flags);
typedef void (*pcKeyboardEvent)(rdpInput* input, uint16 flags, uint16 code);
typedef void (*pcUnicodeKeyboardEvent)(rdpInput* input, uint16 code);
typedef void (*pcMouseEvent)(rdpInput* input, uint16 flags, uint16 x, uint16 y);
typedef void (*pcExtendedMouseEvent)(rdpInput* input, uint16 flags, uint16 x, uint16 y);
struct rdp_input
{
void* rdp;
pcSynchronizeEvent SynchronizeEvent;
pcKeyboardEvent KeyboardEvent;
pcUnicodeKeyboardEvent UnicodeKeyboardEvent;
pcMouseEvent MouseEvent;
pcExtendedMouseEvent ExtendedMouseEvent;
};
#endif /* __INPUT_API_H */

465
include/freerdp/update.h Normal file
View File

@ -0,0 +1,465 @@
/**
* FreeRDP: A Remote Desktop Protocol Client
* Update Interface API
*
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __UPDATE_API_H
#define __UPDATE_API_H
#include <freerdp/types.h>
/* Bitmap Updates */
typedef struct
{
uint16 left;
uint16 top;
uint16 right;
uint16 bottom;
uint16 width;
uint16 height;
uint16 bpp;
uint16 flags;
uint16 length;
uint8* data;
} BITMAP_DATA;
typedef struct
{
uint16 number;
BITMAP_DATA* bitmaps;
} BITMAP_UPDATE;
/* Palette Updates */
typedef struct
{
uint32 number;
uint32 entries[256];
} PALETTE_UPDATE;
/* Orders Updates */
typedef struct
{
uint8 orderType;
uint32 fieldFlags;
uint16 boundLeft;
uint16 boundTop;
uint16 boundRight;
uint16 boundBottom;
sint8 deltaBoundLeft;
sint8 deltaBoundTop;
sint8 deltaBoundRight;
sint8 deltaBoundBottom;
boolean deltaCoordinates;
} ORDER_INFO;
typedef struct
{
sint16 nLeftRect;
sint16 nTopRect;
sint16 nWidth;
sint16 nHeight;
uint8 bRop;
} DSTBLT_ORDER;
typedef struct
{
sint16 nLeftRect;
sint16 nTopRect;
sint16 nWidth;
sint16 nHeight;
uint8 bRop;
uint32 backColor;
uint32 foreColor;
uint8 brushOrgX;
uint8 brushOrgY;
uint8 brushStyle;
uint8 brushHatch;
uint8 brushExtra[7];
} PATBLT_ORDER;
typedef struct
{
sint16 nLeftRect;
sint16 nTopRect;
sint16 nWidth;
sint16 nHeight;
uint8 bRop;
sint16 nXSrc;
sint16 nYSrc;
} SCRBLT_ORDER;
typedef struct
{
sint16 srcLeft;
sint16 srcTop;
sint16 srcRight;
sint16 srcBottom;
uint16 bitmapId;
} DRAW_NINE_GRID_ORDER;
typedef struct
{
sint16 srcLeft;
sint16 srcTop;
sint16 srcRight;
sint16 srcBottom;
uint16 bitmapId;
uint8 nDeltaEntries;
uint8* codeDeltaList;
} MULTI_DRAW_NINE_GRID_ORDER;
typedef struct
{
uint16 backMode;
sint16 nXStart;
sint16 nYStart;
sint16 nXEnd;
sint16 nYEnd;
uint32 backColor;
uint8 bRop2;
uint8 penStyle;
uint8 penWidth;
uint32 penColor;
} LINE_TO_ORDER;
typedef struct
{
sint16 nLeftRect;
sint16 nTopRect;
sint16 nWidth;
sint16 nHeight;
uint32 color;
} OPAQUE_RECT_ORDER;
typedef struct
{
uint32 savedBitmapPosition;
sint16 nLeftRect;
sint16 nTopRect;
sint16 nRightRect;
sint16 nBottomRect;
uint8 operation;
} SAVE_BITMAP_ORDER;
typedef struct
{
uint16 cacheId;
sint16 nLeftRect;
sint16 nTopRect;
sint16 nWidth;
sint16 nHeight;
uint8 bRop;
sint16 nXSrc;
sint16 nYSrc;
uint16 cacheIndex;
} MEMBLT_ORDER;
typedef struct
{
uint16 cacheId;
sint16 nLeftRect;
sint16 nTopRect;
sint16 nWidth;
sint16 nHeight;
uint8 bRop;
sint16 nXSrc;
sint16 nYSrc;
uint32 backColor;
uint32 foreColor;
uint8 brushOrgX;
uint8 brushOrgY;
uint8 brushStyle;
uint8 brushHatch;
uint8 brushExtra[7];
uint16 cacheIndex;
} MEM3BLT_ORDER;
typedef struct
{
sint16 nLeftRect;
sint16 nTopRect;
sint16 nWidth;
sint16 nHeight;
uint8 bRop;
uint8 nDeltaEntries;
uint8* codeDeltaList;
} MULTI_DSTBLT_ORDER;
typedef struct
{
sint16 nLeftRect;
sint16 nTopRect;
sint16 nWidth;
sint16 nHeight;
uint8 bRop;
uint32 backColor;
uint32 foreColor;
uint8 brushOrgX;
uint8 brushOrgY;
uint8 brushStyle;
uint8 brushHatch;
uint8 brushExtra[7];
uint8 nDeltaEntries;
uint8* codeDeltaList;
} MULTI_PATBLT_ORDER;
typedef struct
{
sint16 nLeftRect;
sint16 nTopRect;
sint16 nWidth;
sint16 nHeight;
uint8 bRop;
sint16 nXSrc;
sint16 nYSrc;
uint8 nDeltaEntries;
uint8* codeDeltaList;
} MULTI_SCRBLT_ORDER;
typedef struct
{
sint16 nLeftRect;
sint16 nTopRect;
sint16 nWidth;
sint16 nHeight;
uint32 color;
uint8 nDeltaEntries;
uint8* codeDeltaList;
} MULTI_OPAQUE_RECT_ORDER;
typedef struct
{
uint8 cacheId;
uint16 fDrawing;
uint32 backColor;
uint32 foreColor;
sint16 bkLeft;
sint16 bkTop;
sint16 bkRight;
sint16 bkBottom;
sint16 opLeft;
sint16 opTop;
sint16 opRight;
sint16 opBottom;
uint16 x;
uint16 y;
uint8* data;
} FAST_INDEX_ORDER;
typedef struct
{
sint16 xStart;
sint16 yStart;
uint8 bRop2;
uint8 fillMode;
uint32 brushColor;
uint8 nDeltaEntries;
uint8* codeDeltaList;
} POLYGON_SC_ORDER;
typedef struct
{
sint16 xStart;
sint16 yStart;
uint8 bRop2;
uint8 fillMode;
uint32 backColor;
uint32 foreColor;
uint8 brushOrgX;
uint8 brushOrgY;
uint8 brushStyle;
uint8 brushHatch;
uint8 brushExtra[7];
uint8 nDeltaEntries;
uint8* codeDeltaList;
} POLYGON_CB_ORDER;
typedef struct
{
sint16 xStart;
sint16 yStart;
uint8 bRop2;
uint32 penColor;
uint8 nDeltaEntries;
uint8* codeDeltaList;
} POLYLINE_ORDER;
typedef struct
{
uint8 cacheId;
uint16 fDrawing;
uint32 backColor;
uint32 foreColor;
sint16 bkLeft;
sint16 bkTop;
sint16 bkRight;
sint16 bkBottom;
sint16 opLeft;
sint16 opTop;
sint16 opRight;
sint16 opBottom;
uint16 x;
uint16 y;
uint8* data;
} FAST_GLYPH_ORDER;
typedef struct
{
sint16 leftRect;
sint16 topRect;
sint16 rightRect;
sint16 bottomRect;
uint8 bRop2;
uint8 fillMode;
uint32 color;
} ELLIPSE_SC_ORDER;
typedef struct
{
sint16 leftRect;
sint16 topRect;
sint16 rightRect;
sint16 bottomRect;
uint8 bRop2;
uint8 fillMode;
uint32 backColor;
uint32 foreColor;
uint8 brushOrgX;
uint8 brushOrgY;
uint8 brushStyle;
uint8 brushHatch;
uint8 brushExtra[7];
} ELLIPSE_CB_ORDER;
typedef struct
{
uint8 cacheId;
uint8 flAccel;
uint8 ulCharInc;
uint8 fOpRedundant;
uint32 backColor;
uint32 foreColor;
sint16 bkLeft;
sint16 bkTop;
sint16 bkRight;
sint16 bkBottom;
sint16 opLeft;
sint16 opTop;
sint16 opRight;
sint16 opBottom;
uint8 brushOrgX;
uint8 brushOrgY;
uint8 brushStyle;
uint8 brushHatch;
uint8 brushExtra[7];
sint16 x;
sint16 y;
uint8* data;
} GLYPH_INDEX_ORDER;
/* Update Interface */
typedef struct rdp_update rdpUpdate;
typedef int (*pcSynchronize)(rdpUpdate* update);
typedef int (*pcBitmap)(rdpUpdate* update, BITMAP_UPDATE* bitmap);
typedef int (*pcPalette)(rdpUpdate* update, PALETTE_UPDATE* palette);
typedef int (*pcDstBlt)(rdpUpdate* update, DSTBLT_ORDER* dstblt);
typedef int (*pcPatBlt)(rdpUpdate* update, PATBLT_ORDER* patblt);
typedef int (*pcScrBlt)(rdpUpdate* update, SCRBLT_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* multi_dstblt);
typedef int (*pcMultiPatBlt)(rdpUpdate* update, MULTI_PATBLT_ORDER* multi_patblt);
typedef int (*pcMultiScrBlt)(rdpUpdate* update, MULTI_SCRBLT_ORDER* multi_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
{
void* rdp;
pcSynchronize Synchronize;
pcBitmap Bitmap;
pcPalette Palette;
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;
BITMAP_UPDATE bitmap_update;
PALETTE_UPDATE palette_update;
ORDER_INFO order_info;
DSTBLT_ORDER dstblt;
PATBLT_ORDER patblt;
SCRBLT_ORDER scrblt;
DRAW_NINE_GRID_ORDER draw_nine_grid;
MULTI_DRAW_NINE_GRID_ORDER multi_draw_nine_grid;
LINE_TO_ORDER line_to;
OPAQUE_RECT_ORDER opaque_rect;
SAVE_BITMAP_ORDER save_bitmap;
MEMBLT_ORDER memblt;
MEM3BLT_ORDER mem3blt;
MULTI_DSTBLT_ORDER multi_dstblt;
MULTI_PATBLT_ORDER multi_patblt;
MULTI_SCRBLT_ORDER multi_scrblt;
MULTI_OPAQUE_RECT_ORDER multi_opaque_rect;
FAST_INDEX_ORDER fast_index;
POLYGON_SC_ORDER polygon_sc;
POLYGON_CB_ORDER polygon_cb;
POLYLINE_ORDER polyline;
FAST_GLYPH_ORDER fast_glyph;
ELLIPSE_SC_ORDER ellipse_sc;
ELLIPSE_CB_ORDER ellipse_cb;
GLYPH_INDEX_ORDER glyph_index;
};
#endif /* __UPDATE_API_H */

View File

@ -51,6 +51,7 @@ set(LIBFREERDP_CORE_SRCS
settings.c
orders.c
orders.h
freerdp.c
capabilities.c
capabilities.h
certificate.c

48
libfreerdp-core/freerdp.c Normal file
View File

@ -0,0 +1,48 @@
/**
* FreeRDP: A Remote Desktop Protocol Client
* FreeRDP Core
*
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "rdp.h"
#include "input.h"
#include "update.h"
#include <freerdp/freerdp.h>
#include <freerdp/utils/memory.h>
freerdp* freerdp_new()
{
freerdp* instance;
instance = xzalloc(sizeof(freerdp));
if (instance != NULL)
{
rdpRdp* rdp = rdp_new();
instance->rdp = (void*) rdp;
instance->input = rdp->input;
instance->update = rdp->update;
instance->settings = rdp->settings;
}
return instance;
}
void freerdp_free(freerdp* freerdp)
{
xfree(freerdp);
}

View File

@ -22,63 +22,13 @@
#include "rdp.h"
#include <freerdp/input.h>
#include <freerdp/freerdp.h>
#include <freerdp/utils/stream.h>
#include <freerdp/utils/memory.h>
/* Input Events */
#define INPUT_EVENT_SYNC 0x0000
#define INPUT_EVENT_SCANCODE 0x0004
#define INPUT_EVENT_UNICODE 0x0005
#define INPUT_EVENT_MOUSE 0x8001
#define INPUT_EVENT_MOUSEX 0x8002
/* keyboard Flags */
#define KBD_FLAGS_EXTENDED 0x0100
#define KBD_FLAGS_DOWN 0x4000
#define KBD_FLAGS_RELEASE 0x8000
/* Pointer Flags */
#define PTR_FLAGS_WHEEL 0x0200
#define PTR_FLAGS_WHEEL_NEGATIVE 0x0100
#define PTR_FLAGS_MOVE 0x0800
#define PTR_FLAGS_DOWN 0x8000
#define PTR_FLAGS_BUTTON1 0x1000
#define PTR_FLAGS_BUTTON2 0x2000
#define PTR_FLAGS_BUTTON3 0x4000
#define WheelRotationMask 0x01FF
/* Extended Pointer Flags */
#define PTR_XFLAGS_DOWN 0x8000
#define PTR_XFLAGS_BUTTON1 0x0001
#define PTR_XFLAGS_BUTTON2 0x0002
/* Keyboard Toggle Flags */
#define KBD_SYNC_SCROLL_LOCK 0x00000001
#define KBD_SYNC_NUM_LOCK 0x00000002
#define KBD_SYNC_CAPS_LOCK 0x00000004
#define KBD_SYNC_KANA_LOCK 0x00000008
#define RDP_CLIENT_INPUT_PDU_HEADER_LENGTH 4
typedef struct rdp_input rdpInput;
typedef void (*pcSynchronizeEvent)(rdpInput* input, uint32 flags);
typedef void (*pcKeyboardEvent)(rdpInput* input, uint16 flags, uint16 code);
typedef void (*pcUnicodeKeyboardEvent)(rdpInput* input, uint16 code);
typedef void (*pcMouseEvent)(rdpInput* input, uint16 flags, uint16 x, uint16 y);
typedef void (*pcExtendedMouseEvent)(rdpInput* input, uint16 flags, uint16 x, uint16 y);
struct rdp_input
{
struct rdp_rdp* rdp;
pcSynchronizeEvent SynchronizeEvent;
pcKeyboardEvent KeyboardEvent;
pcUnicodeKeyboardEvent UnicodeKeyboardEvent;
pcMouseEvent MouseEvent;
pcExtendedMouseEvent ExtendedMouseEvent;
};
void input_send_synchronize_event(rdpInput* input, uint32 flags);
void input_send_keyboard_event(rdpInput* input, uint16 flags, uint16 code);
void input_send_unicode_keyboard_event(rdpInput* input, uint16 code);

File diff suppressed because it is too large Load Diff

View File

@ -20,358 +20,9 @@
#ifndef __ORDERS_H
#define __ORDERS_H
#include <freerdp/types.h>
typedef struct rdp_orders rdpOrders;
typedef struct
{
uint8 orderType;
uint32 fieldFlags;
uint16 boundLeft;
uint16 boundTop;
uint16 boundRight;
uint16 boundBottom;
sint8 deltaBoundLeft;
sint8 deltaBoundTop;
sint8 deltaBoundRight;
sint8 deltaBoundBottom;
boolean deltaCoordinates;
} ORDER_INFO;
typedef struct
{
sint16 nLeftRect;
sint16 nTopRect;
sint16 nWidth;
sint16 nHeight;
uint8 bRop;
} DSTBLT_ORDER;
typedef struct
{
sint16 nLeftRect;
sint16 nTopRect;
sint16 nWidth;
sint16 nHeight;
uint8 bRop;
uint32 backColor;
uint32 foreColor;
uint8 brushOrgX;
uint8 brushOrgY;
uint8 brushStyle;
uint8 brushHatch;
uint8 brushExtra[7];
} PATBLT_ORDER;
typedef struct
{
sint16 nLeftRect;
sint16 nTopRect;
sint16 nWidth;
sint16 nHeight;
uint8 bRop;
sint16 nXSrc;
sint16 nYSrc;
} SCRBLT_ORDER;
typedef struct
{
sint16 srcLeft;
sint16 srcTop;
sint16 srcRight;
sint16 srcBottom;
uint16 bitmapId;
} DRAW_NINE_GRID_ORDER;
typedef struct
{
sint16 srcLeft;
sint16 srcTop;
sint16 srcRight;
sint16 srcBottom;
uint16 bitmapId;
uint8 nDeltaEntries;
uint8* codeDeltaList;
} MULTI_DRAW_NINE_GRID_ORDER;
typedef struct
{
uint16 backMode;
sint16 nXStart;
sint16 nYStart;
sint16 nXEnd;
sint16 nYEnd;
uint32 backColor;
uint8 bRop2;
uint8 penStyle;
uint8 penWidth;
uint32 penColor;
} LINE_TO_ORDER;
typedef struct
{
sint16 nLeftRect;
sint16 nTopRect;
sint16 nWidth;
sint16 nHeight;
uint32 color;
} OPAQUE_RECT_ORDER;
typedef struct
{
uint32 savedBitmapPosition;
sint16 nLeftRect;
sint16 nTopRect;
sint16 nRightRect;
sint16 nBottomRect;
uint8 operation;
} SAVE_BITMAP_ORDER;
typedef struct
{
uint16 cacheId;
sint16 nLeftRect;
sint16 nTopRect;
sint16 nWidth;
sint16 nHeight;
uint8 bRop;
sint16 nXSrc;
sint16 nYSrc;
uint16 cacheIndex;
} MEMBLT_ORDER;
typedef struct
{
uint16 cacheId;
sint16 nLeftRect;
sint16 nTopRect;
sint16 nWidth;
sint16 nHeight;
uint8 bRop;
sint16 nXSrc;
sint16 nYSrc;
uint32 backColor;
uint32 foreColor;
uint8 brushOrgX;
uint8 brushOrgY;
uint8 brushStyle;
uint8 brushHatch;
uint8 brushExtra[7];
uint16 cacheIndex;
} MEM3BLT_ORDER;
typedef struct
{
sint16 nLeftRect;
sint16 nTopRect;
sint16 nWidth;
sint16 nHeight;
uint8 bRop;
uint8 nDeltaEntries;
uint8* codeDeltaList;
} MULTI_DSTBLT_ORDER;
typedef struct
{
sint16 nLeftRect;
sint16 nTopRect;
sint16 nWidth;
sint16 nHeight;
uint8 bRop;
uint32 backColor;
uint32 foreColor;
uint8 brushOrgX;
uint8 brushOrgY;
uint8 brushStyle;
uint8 brushHatch;
uint8 brushExtra[7];
uint8 nDeltaEntries;
uint8* codeDeltaList;
} MULTI_PATBLT_ORDER;
typedef struct
{
sint16 nLeftRect;
sint16 nTopRect;
sint16 nWidth;
sint16 nHeight;
uint8 bRop;
sint16 nXSrc;
sint16 nYSrc;
uint8 nDeltaEntries;
uint8* codeDeltaList;
} MULTI_SCRBLT_ORDER;
typedef struct
{
sint16 nLeftRect;
sint16 nTopRect;
sint16 nWidth;
sint16 nHeight;
uint32 color;
uint8 nDeltaEntries;
uint8* codeDeltaList;
} MULTI_OPAQUE_RECT_ORDER;
typedef struct
{
uint8 cacheId;
uint16 fDrawing;
uint32 backColor;
uint32 foreColor;
sint16 bkLeft;
sint16 bkTop;
sint16 bkRight;
sint16 bkBottom;
sint16 opLeft;
sint16 opTop;
sint16 opRight;
sint16 opBottom;
uint16 x;
uint16 y;
uint8* data;
} FAST_INDEX_ORDER;
typedef struct
{
sint16 xStart;
sint16 yStart;
uint8 bRop2;
uint8 fillMode;
uint32 brushColor;
uint8 nDeltaEntries;
uint8* codeDeltaList;
} POLYGON_SC_ORDER;
typedef struct
{
sint16 xStart;
sint16 yStart;
uint8 bRop2;
uint8 fillMode;
uint32 backColor;
uint32 foreColor;
uint8 brushOrgX;
uint8 brushOrgY;
uint8 brushStyle;
uint8 brushHatch;
uint8 brushExtra[7];
uint8 nDeltaEntries;
uint8* codeDeltaList;
} POLYGON_CB_ORDER;
typedef struct
{
sint16 xStart;
sint16 yStart;
uint8 bRop2;
uint32 penColor;
uint8 nDeltaEntries;
uint8* codeDeltaList;
} POLYLINE_ORDER;
typedef struct
{
uint8 cacheId;
uint16 fDrawing;
uint32 backColor;
uint32 foreColor;
sint16 bkLeft;
sint16 bkTop;
sint16 bkRight;
sint16 bkBottom;
sint16 opLeft;
sint16 opTop;
sint16 opRight;
sint16 opBottom;
uint16 x;
uint16 y;
uint8* data;
} FAST_GLYPH_ORDER;
typedef struct
{
sint16 leftRect;
sint16 topRect;
sint16 rightRect;
sint16 bottomRect;
uint8 bRop2;
uint8 fillMode;
uint32 color;
} ELLIPSE_SC_ORDER;
typedef struct
{
sint16 leftRect;
sint16 topRect;
sint16 rightRect;
sint16 bottomRect;
uint8 bRop2;
uint8 fillMode;
uint32 backColor;
uint32 foreColor;
uint8 brushOrgX;
uint8 brushOrgY;
uint8 brushStyle;
uint8 brushHatch;
uint8 brushExtra[7];
} ELLIPSE_CB_ORDER;
typedef struct
{
uint8 cacheId;
uint8 flAccel;
uint8 ulCharInc;
uint8 fOpRedundant;
uint32 backColor;
uint32 foreColor;
sint16 bkLeft;
sint16 bkTop;
sint16 bkRight;
sint16 bkBottom;
sint16 opLeft;
sint16 opTop;
sint16 opRight;
sint16 opBottom;
uint8 brushOrgX;
uint8 brushOrgY;
uint8 brushStyle;
uint8 brushHatch;
uint8 brushExtra[7];
sint16 x;
sint16 y;
uint8* data;
} GLYPH_INDEX_ORDER;
struct rdp_orders
{
ORDER_INFO order_info;
DSTBLT_ORDER dstblt;
PATBLT_ORDER patblt;
SCRBLT_ORDER scrblt;
DRAW_NINE_GRID_ORDER draw_nine_grid;
MULTI_DRAW_NINE_GRID_ORDER multi_draw_nine_grid;
LINE_TO_ORDER line_to;
OPAQUE_RECT_ORDER opaque_rect;
SAVE_BITMAP_ORDER save_bitmap;
MEMBLT_ORDER memblt;
MEM3BLT_ORDER mem3blt;
MULTI_DSTBLT_ORDER multi_dstblt;
MULTI_PATBLT_ORDER multi_patblt;
MULTI_SCRBLT_ORDER multi_scrblt;
MULTI_OPAQUE_RECT_ORDER multi_opaque_rect;
FAST_INDEX_ORDER fast_index;
POLYGON_SC_ORDER polygon_sc;
POLYGON_CB_ORDER polygon_cb;
POLYLINE_ORDER polyline;
FAST_GLYPH_ORDER fast_glyph;
ELLIPSE_SC_ORDER ellipse_sc;
ELLIPSE_CB_ORDER ellipse_cb;
GLYPH_INDEX_ORDER glyph_index;
};
#include "rdp.h"
#include <freerdp/types.h>
#include <freerdp/update.h>
#include <freerdp/utils/stream.h>
/* Order Control Flags */
@ -523,9 +174,6 @@ struct rdp_orders
#define ORDER_TYPE_COMPDESK_FIRST 0x0C
#define ORDER_TYPE_FRAME_MARKER 0x0D
rdpOrders* orders_new();
void orders_free(rdpOrders* orders);
void rdp_recv_order(rdpRdp* rdp, STREAM* s);
void update_recv_order(rdpUpdate* update, STREAM* s);
#endif /* __ORDERS_H */

View File

@ -261,7 +261,7 @@ void rdp_read_data_pdu(rdpRdp* rdp, STREAM* s)
switch (type)
{
case DATA_PDU_TYPE_UPDATE:
rdp_recv_update_data_pdu(rdp, s);
update_recv(rdp->update, s);
break;
case DATA_PDU_TYPE_CONTROL:
@ -439,8 +439,8 @@ rdpRdp* rdp_new()
rdp->registry = registry_new(rdp->settings);
rdp->transport = transport_new(rdp->settings);
rdp->license = license_new(rdp);
rdp->orders = orders_new();
rdp->update = update_new();
rdp->input = input_new(rdp);
rdp->update = update_new(rdp);
rdp->nego = nego_new(rdp->transport);
rdp->mcs = mcs_new(rdp->transport);
}
@ -460,7 +460,7 @@ void rdp_free(rdpRdp* rdp)
settings_free(rdp->settings);
transport_free(rdp->transport);
license_free(rdp->license);
orders_free(rdp->orders);
input_free(rdp->input);
update_free(rdp->update);
mcs_free(rdp->mcs);
xfree(rdp);

View File

@ -26,8 +26,8 @@ typedef struct rdp_rdp rdpRdp;
#include "tpkt.h"
#include "tpdu.h"
#include "nego.h"
#include "input.h"
#include "update.h"
#include "orders.h"
#include "license.h"
#include "security.h"
#include "registry.h"
@ -207,7 +207,7 @@ struct rdp_rdp
boolean activated;
struct rdp_mcs* mcs;
struct rdp_nego* nego;
struct rdp_orders* orders;
struct rdp_input* input;
struct rdp_update* update;
struct rdp_license* license;
struct rdp_settings* settings;

View File

@ -28,7 +28,7 @@ uint8 UPDATE_TYPE_STRINGS[][32] =
"Synchronize"
};
void rdp_recv_orders_update(rdpRdp* rdp, STREAM* s)
void update_recv_orders(rdpUpdate* update, STREAM* s)
{
uint16 numberOrders;
@ -38,12 +38,12 @@ void rdp_recv_orders_update(rdpRdp* rdp, STREAM* s)
while (numberOrders > 0)
{
rdp_recv_order(rdp, s);
update_recv_order(update, s);
numberOrders--;
}
}
void rdp_read_bitmap_data(STREAM* s, BITMAP_DATA* bitmap_data)
void update_read_bitmap_data(STREAM* s, BITMAP_DATA* bitmap_data)
{
uint8* srcData;
uint16 dstSize;
@ -95,7 +95,7 @@ void rdp_read_bitmap_data(STREAM* s, BITMAP_DATA* bitmap_data)
printf("bitmap decompression failed\n");
}
void rdp_read_bitmap_update(rdpRdp* rdp, STREAM* s, BITMAP_UPDATE* bitmap_update)
void update_read_bitmap(rdpUpdate* update, STREAM* s, BITMAP_UPDATE* bitmap_update)
{
int i;
@ -106,11 +106,11 @@ void rdp_read_bitmap_update(rdpRdp* rdp, STREAM* s, BITMAP_UPDATE* bitmap_update
/* rectangles */
for (i = 0; i < bitmap_update->number; i++)
{
rdp_read_bitmap_data(s, &bitmap_update->bitmaps[i]);
update_read_bitmap_data(s, &bitmap_update->bitmaps[i]);
}
}
void rdp_read_palette_update(rdpRdp* rdp, STREAM* s, PALETTE_UPDATE* palette_update)
void update_read_palette(rdpUpdate* update, STREAM* s, PALETTE_UPDATE* palette_update)
{
int i;
uint8 byte;
@ -135,7 +135,7 @@ void rdp_read_palette_update(rdpRdp* rdp, STREAM* s, PALETTE_UPDATE* palette_upd
}
}
void rdp_read_synchronize_update(rdpRdp* rdp, STREAM* s)
void update_read_synchronize(rdpUpdate* update, STREAM* s)
{
stream_seek_uint16(s); /* pad2Octets (2 bytes) */
@ -145,36 +145,38 @@ void rdp_read_synchronize_update(rdpRdp* rdp, STREAM* s)
*/
}
void rdp_recv_update_data_pdu(rdpRdp* rdp, STREAM* s)
void update_recv(rdpUpdate* update, STREAM* s)
{
uint16 updateType;
stream_read_uint16(s, updateType); /* updateType (2 bytes) */
if (updateType != UPDATE_TYPE_ORDERS)
printf("%s Update Data PDU\n", UPDATE_TYPE_STRINGS[updateType]);
//printf("%s Update Data PDU\n", UPDATE_TYPE_STRINGS[updateType]);
switch (updateType)
{
case UPDATE_TYPE_ORDERS:
rdp_recv_orders_update(rdp, s);
update_recv_orders(update, s);
break;
case UPDATE_TYPE_BITMAP:
rdp_read_bitmap_update(rdp, s, &rdp->update->bitmap_update);
update_read_bitmap(update, s, &update->bitmap_update);
IFCALL(update->Bitmap, update, &update->bitmap_update);
break;
case UPDATE_TYPE_PALETTE:
rdp_read_palette_update(rdp, s, &rdp->update->palette_update);
update_read_palette(update, s, &update->palette_update);
IFCALL(update->Palette, update, &update->palette_update);
break;
case UPDATE_TYPE_SYNCHRONIZE:
rdp_read_synchronize_update(rdp, s);
update_read_synchronize(update, s);
IFCALL(update->Synchronize, update);
break;
}
}
rdpUpdate* update_new()
rdpUpdate* update_new(rdpRdp* rdp)
{
rdpUpdate* update;
@ -182,7 +184,7 @@ rdpUpdate* update_new()
if (update != NULL)
{
update->rdp = (void*) rdp;
}
return update;

View File

@ -22,8 +22,9 @@
#include "rdp.h"
#include "orders.h"
#include <freerdp/freerdp.h>
#include <freerdp/types.h>
#include <freerdp/update.h>
#include <freerdp/freerdp.h>
#include <freerdp/utils/stream.h>
#define UPDATE_TYPE_ORDERS 0x0000
@ -31,96 +32,14 @@
#define UPDATE_TYPE_PALETTE 0x0002
#define UPDATE_TYPE_SYNCHRONIZE 0x0003
typedef struct
{
uint16 left;
uint16 top;
uint16 right;
uint16 bottom;
uint16 width;
uint16 height;
uint16 bpp;
uint16 flags;
uint16 length;
uint8* data;
} BITMAP_DATA;
typedef struct
{
uint16 number;
BITMAP_DATA* bitmaps;
} BITMAP_UPDATE;
#define BITMAP_COMPRESSION 0x0001
#define NO_BITMAP_COMPRESSION_HDR 0x0400
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();
rdpUpdate* update_new(rdpRdp* rdp);
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);
void update_read_bitmap(rdpUpdate* update, STREAM* s, BITMAP_UPDATE* bitmap_update);
void update_read_palette(rdpUpdate* update, STREAM* s, PALETTE_UPDATE* palette_update);
void update_recv(rdpUpdate* update, STREAM* s);
#endif /* __UPDATE_H */

View File

@ -444,6 +444,8 @@ gdi_bitmap_free(GDI_IMAGE *gdi_bmp)
}
}
#if 0
/* GDI callbacks registered in libfreerdp */
static void
@ -1193,3 +1195,6 @@ void gdi_free(rdpInst* inst)
SET_GDI(inst, NULL);
}
#endif