From 55d11a5000ebd474c2ddc294b8b3935554443112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Cortier?= Date: Tue, 9 May 2023 17:00:07 -0400 Subject: [PATCH] refactor: clarify project architecture (#123) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit > Make the root of the workspace a virtual manifest. It might > be tempting to put the main crate into the root, but that > pollutes the root with src/, requires passing --workspace to > every Cargo command, and adds an exception to an otherwise > consistent structure. > Don’t succumb to the temptation to strip common prefix > from folder names. If each crate is named exactly as the > folder it lives in, navigation and renames become easier. > Cargo.tomls of reverse dependencies mention both the folder > and the crate name, it’s useful when they are exactly the > same. Source: https://matklad.github.io/2021/08/22/large-rust-workspaces.html#Smaller-Tips --- ARCHITECTURE.md | 110 +++++++ Cargo.lock | 29 +- Cargo.toml | 70 +--- README.md | 38 +-- crates/async/src/framed.rs | 307 ------------------ crates/{async => ironrdp-async}/Cargo.toml | 21 +- crates/{async => ironrdp-async}/README.md | 0 .../{async => ironrdp-async}/src/connector.rs | 0 crates/ironrdp-async/src/framed.rs | 157 +++++++++ crates/{async => ironrdp-async}/src/lib.rs | 0 .../{async => ironrdp-async}/src/session.rs | 0 .../Cargo.toml | 0 .../README.md | 0 .../src/config.rs | 0 .../src/gui.rs | 0 .../src/gui/input.rs | 0 .../src/main.rs | 0 crates/{client => ironrdp-client}/Cargo.toml | 4 +- crates/{client => ironrdp-client}/README.md | 0 .../{client => ironrdp-client}/src/config.rs | 0 crates/{client => ironrdp-client}/src/gui.rs | 0 crates/{client => ironrdp-client}/src/lib.rs | 0 crates/{client => ironrdp-client}/src/main.rs | 0 crates/{client => ironrdp-client}/src/rdp.rs | 14 +- .../Cargo.toml | 0 .../README.md | 0 .../src/channel_connection.rs | 0 .../src/connection.rs | 0 .../src/connection_finalization.rs | 0 .../src/legacy.rs | 0 .../src/lib.rs | 0 .../src/license_exchange.rs | 0 .../src/server_name.rs | 0 crates/ironrdp-futures/Cargo.toml | 17 + crates/ironrdp-futures/src/lib.rs | 76 +++++ .../Cargo.toml | 0 .../shaders/avc.vert | 0 .../shaders/avc420.frag | 0 .../shaders/avc444.frag | 0 .../shaders/avc444v2.frag | 0 .../shaders/texture_shader.frag | 0 .../shaders/texture_shader.vert | 0 .../src/draw.rs | 0 .../src/lib.rs | 0 .../src/renderer.rs | 0 .../src/surface.rs | 0 .../{graphics => ironrdp-graphics}/Cargo.toml | 0 .../{graphics => ironrdp-graphics}/README.md | 0 .../src/color_conversion.rs | 0 .../{graphics => ironrdp-graphics}/src/dwt.rs | 0 .../src/image_processing.rs | 0 .../{graphics => ironrdp-graphics}/src/lib.rs | 0 .../src/quantization.rs | 0 .../src/rdp6/bitmap_stream.rs | 0 .../src/rdp6/mod.rs | 0 .../src/rdp6/rle.rs | 0 .../src/rdp6/test_assets/32x64_rgb_raw.bin | Bin .../src/rdp6/test_assets/32x64_rgb_raw.bmp | Bin .../src/rdp6/test_assets/64x24_argb_rle.bin | Bin .../src/rdp6/test_assets/64x24_argb_rle.bmp | Bin .../src/rdp6/test_assets/64x24_aycocg_rle.bin | Bin .../src/rdp6/test_assets/64x24_aycocg_rle.bmp | Bin .../rdp6/test_assets/64x24_ycocg_rle_ss.bin | Bin .../rdp6/test_assets/64x24_ycocg_rle_ss.bmp | Bin .../rdp6/test_assets/64x57_ycocg_rle_ss.bin | Bin .../rdp6/test_assets/64x57_ycocg_rle_ss.bmp | Bin .../rdp6/test_assets/64x64_ycocg_raw_ss.bin | Bin .../rdp6/test_assets/64x64_ycocg_raw_ss.bmp | Bin .../src/rectangle_processing.rs | 0 .../{graphics => ironrdp-graphics}/src/rle.rs | 0 .../src/rlgr.rs | 0 .../src/subband_reconstruction.rs | 0 .../src/utils.rs | 0 .../src/zgfx/circular_buffer.rs | 0 .../src/zgfx/control_messages.rs | 0 .../src/zgfx/mod.rs | 0 .../src/zgfx/test_assets/decoded.0.bin | Bin .../src/zgfx/test_assets/decoded.1.bin | Bin .../src/zgfx/test_assets/decoded.2.bin | Bin .../src/zgfx/test_assets/decoded.3.bin | Bin .../src/zgfx/test_assets/decoded.4.bin | Bin .../src/zgfx/test_assets/encoded.0.bin | 0 .../src/zgfx/test_assets/encoded.1.bin | 0 .../src/zgfx/test_assets/encoded.2.bin | Bin .../src/zgfx/test_assets/encoded.3.bin | Bin .../src/zgfx/test_assets/encoded.4.bin | Bin .../tests/color_conversion.rs | 0 .../tests/dwt.rs | 0 .../tests/image_processing.rs | 0 .../tests/rle.rs | 0 .../tests/rlgr.rs | 0 crates/{input => ironrdp-input}/Cargo.toml | 0 crates/{input => ironrdp-input}/README.md | 0 crates/{input => ironrdp-input}/src/lib.rs | 0 .../tests/fastpath_packets.rs | 0 .../{input => ironrdp-input}/tests/smoke.rs | 0 .../Cargo.toml | 0 .../src/lib.rs | 0 .../Cargo.toml | 0 .../src/capsets.rs | 0 .../src/client_info.rs | 0 .../src/cluster_data.rs | 0 .../src/conference_create.rs | 0 .../src/core_data.rs | 0 .../src/gcc.rs | 0 .../src/gfx.rs | 0 .../src/graphics_messages.rs | 0 .../src/lib.rs | 0 .../src/macros.rs | 0 .../src/mcs.rs | 0 .../src/message_channel_data.rs | 0 .../src/monitor_data.rs | 0 .../src/monitor_extended_data.rs | 0 .../src/multi_transport_channel_data.rs | 0 .../src/network_data.rs | 0 .../src/rdp.rs | 0 .../src/security_data.rs | 0 crates/{pdu => ironrdp-pdu}/Cargo.toml | 0 crates/{pdu => ironrdp-pdu}/README.md | 0 .../{pdu => ironrdp-pdu}/src/basic_output.rs | 0 .../src/basic_output/bitmap.rs | 0 .../src/basic_output/bitmap/rdp6.rs | 0 .../src/basic_output/bitmap/tests.rs | 0 .../src/basic_output/fast_path.rs | 0 .../src/basic_output/fast_path/tests.rs | 0 .../src/basic_output/surface_commands.rs | 0 .../basic_output/surface_commands/tests.rs | 0 crates/{pdu => ironrdp-pdu}/src/ber.rs | 0 crates/{pdu => ironrdp-pdu}/src/codecs.rs | 0 crates/{pdu => ironrdp-pdu}/src/codecs/rfx.rs | 0 .../src/codecs/rfx/data_messages.rs | 0 .../src/codecs/rfx/header_messages.rs | 0 crates/{pdu => ironrdp-pdu}/src/crypto.rs | 0 crates/{pdu => ironrdp-pdu}/src/crypto/rc4.rs | 0 crates/{pdu => ironrdp-pdu}/src/crypto/rsa.rs | 0 crates/{pdu => ironrdp-pdu}/src/cursor.rs | 0 crates/{pdu => ironrdp-pdu}/src/gcc.rs | 0 .../src/gcc/cluster_data.rs | 0 .../src/gcc/conference_create.rs | 0 .../{pdu => ironrdp-pdu}/src/gcc/core_data.rs | 0 .../src/gcc/core_data/client.rs | 0 .../src/gcc/core_data/server.rs | 0 .../src/gcc/message_channel_data.rs | 0 .../src/gcc/monitor_data.rs | 0 .../src/gcc/monitor_extended_data.rs | 0 .../src/gcc/multi_transport_channel_data.rs | 0 .../src/gcc/network_data.rs | 0 .../src/gcc/security_data.rs | 0 crates/{pdu => ironrdp-pdu}/src/geometry.rs | 0 .../src/input/fast_path.rs | 0 crates/{pdu => ironrdp-pdu}/src/input/mod.rs | 0 .../{pdu => ironrdp-pdu}/src/input/mouse.rs | 0 .../{pdu => ironrdp-pdu}/src/input/mouse_x.rs | 0 .../src/input/scan_code.rs | 0 crates/{pdu => ironrdp-pdu}/src/input/sync.rs | 0 .../{pdu => ironrdp-pdu}/src/input/unicode.rs | 0 .../{pdu => ironrdp-pdu}/src/input/unused.rs | 0 crates/{pdu => ironrdp-pdu}/src/lib.rs | 0 crates/{pdu => ironrdp-pdu}/src/macros.rs | 0 crates/{pdu => ironrdp-pdu}/src/mcs.rs | 0 crates/{pdu => ironrdp-pdu}/src/nego.rs | 0 crates/{pdu => ironrdp-pdu}/src/padding.rs | 0 crates/{pdu => ironrdp-pdu}/src/pcb.rs | 0 crates/{pdu => ironrdp-pdu}/src/per.rs | 0 crates/{pdu => ironrdp-pdu}/src/rdp.rs | 0 .../src/rdp/capability_sets.rs | 0 .../src/rdp/capability_sets/bitmap.rs | 0 .../src/rdp/capability_sets/bitmap/tests.rs | 0 .../src/rdp/capability_sets/bitmap_cache.rs | 0 .../rdp/capability_sets/bitmap_cache/tests.rs | 0 .../src/rdp/capability_sets/bitmap_codecs.rs | 0 .../capability_sets/bitmap_codecs/tests.rs | 0 .../src/rdp/capability_sets/brush.rs | 0 .../src/rdp/capability_sets/brush/tests.rs | 0 .../rdp/capability_sets/frame_acknowledge.rs | 0 .../src/rdp/capability_sets/general.rs | 0 .../src/rdp/capability_sets/general/tests.rs | 0 .../src/rdp/capability_sets/glyph_cache.rs | 0 .../rdp/capability_sets/glyph_cache/tests.rs | 0 .../src/rdp/capability_sets/input.rs | 0 .../src/rdp/capability_sets/input/tests.rs | 0 .../src/rdp/capability_sets/large_pointer.rs | 0 .../capability_sets/multifragment_update.rs | 0 .../capability_sets/offscreen_bitmap_cache.rs | 0 .../offscreen_bitmap_cache/tests.rs | 0 .../src/rdp/capability_sets/order.rs | 0 .../src/rdp/capability_sets/order/tests.rs | 0 .../src/rdp/capability_sets/pointer.rs | 0 .../src/rdp/capability_sets/pointer/tests.rs | 0 .../src/rdp/capability_sets/sound.rs | 0 .../src/rdp/capability_sets/sound/tests.rs | 0 .../rdp/capability_sets/surface_commands.rs | 0 .../capability_sets/surface_commands/tests.rs | 0 .../rdp/capability_sets/virtual_channel.rs | 0 .../capability_sets/virtual_channel/tests.rs | 0 .../src/rdp/client_info.rs | 0 .../src/rdp/finalization_messages.rs | 0 .../{pdu => ironrdp-pdu}/src/rdp/headers.rs | 0 .../src/rdp/server_error_info.rs | 0 .../src/rdp/server_license.rs | 0 .../client_new_license_request.rs | 0 .../client_new_license_request/tests.rs | 0 .../client_platform_challenge_response.rs | 0 .../test.rs | 0 .../server_license/licensing_error_message.rs | 0 .../licensing_error_message/test.rs | 0 .../server_license/server_license_request.rs | 0 .../server_license_request/cert.rs | 0 .../server_license_request/tests.rs | 0 .../server_platform_challenge.rs | 0 .../server_platform_challenge/test.rs | 0 .../server_license/server_upgrade_license.rs | 0 .../server_upgrade_license/tests.rs | 0 .../src/rdp/server_license/tests.rs | 0 .../src/rdp/session_info.rs | 0 .../src/rdp/session_info/logon_extended.rs | 0 .../src/rdp/session_info/logon_info.rs | 0 .../src/rdp/session_info/tests.rs | 0 crates/{pdu => ironrdp-pdu}/src/rdp/vc.rs | 0 crates/{pdu => ironrdp-pdu}/src/rdp/vc/dvc.rs | 0 .../src/rdp/vc/dvc/capabilities.rs | 0 .../src/rdp/vc/dvc/capabilities/tests.rs | 0 .../src/rdp/vc/dvc/close.rs | 0 .../src/rdp/vc/dvc/close/tests.rs | 0 .../src/rdp/vc/dvc/create.rs | 0 .../src/rdp/vc/dvc/create/tests.rs | 0 .../src/rdp/vc/dvc/data.rs | 0 .../src/rdp/vc/dvc/data/tests.rs | 0 .../src/rdp/vc/dvc/data_first.rs | 0 .../src/rdp/vc/dvc/data_first/tests.rs | 0 .../src/rdp/vc/dvc/display.rs | 0 .../src/rdp/vc/dvc/gfx.rs | 0 .../src/rdp/vc/dvc/gfx/graphics_messages.rs | 0 .../dvc/gfx/graphics_messages/avc_messages.rs | 0 .../vc/dvc/gfx/graphics_messages/client.rs | 0 .../vc/dvc/gfx/graphics_messages/server.rs | 0 .../src/rdp/vc/dvc/tests.rs | 0 .../{pdu => ironrdp-pdu}/src/rdp/vc/tests.rs | 0 crates/{pdu => ironrdp-pdu}/src/tpdu.rs | 0 crates/{pdu => ironrdp-pdu}/src/tpkt.rs | 0 crates/{pdu => ironrdp-pdu}/src/utils.rs | 0 crates/{pdu => ironrdp-pdu}/src/x224.rs | 0 crates/{pdu => ironrdp-pdu}/tests/gcc.rs | 0 crates/{pdu => ironrdp-pdu}/tests/gfx.rs | 0 crates/{pdu => ironrdp-pdu}/tests/input.rs | 0 crates/{pdu => ironrdp-pdu}/tests/mcs.rs | 0 crates/{pdu => ironrdp-pdu}/tests/rdp.rs | 0 crates/{pdu => ironrdp-pdu}/tests/rfx.rs | 0 crates/{pdu => ironrdp-pdu}/tests/x224.rs | 0 .../Cargo.toml | 0 .../README.md | 0 .../src/lib.rs | 0 .../Cargo.toml | 0 .../README.md | 0 .../scripts/runtests.ps1 | 0 .../src/main.rs | 0 .../test_data/README.md | 0 .../test_data/sample1_avc444.data | Bin .../test_data/sample1_avc444v2.data | Bin .../test_data/sample2_avc444.data | Bin .../test_data/sample2_avc444v2.data | Bin .../Cargo.toml | 0 .../src/lib.rs | 0 .../{session => ironrdp-session}/Cargo.toml | 0 crates/{session => ironrdp-session}/README.md | 0 .../src/active_stage.rs | 0 .../src/fast_path.rs | 0 .../{session => ironrdp-session}/src/image.rs | 0 .../src/legacy.rs | 0 .../{session => ironrdp-session}/src/lib.rs | 0 .../{session => ironrdp-session}/src/rfx.rs | 0 .../{session => ironrdp-session}/src/utils.rs | 0 .../src/x224/display.rs | 0 .../src/x224/gfx.rs | 0 .../src/x224/mod.rs | 0 crates/{tls => ironrdp-tls}/Cargo.toml | 0 crates/{tls => ironrdp-tls}/README.md | 0 crates/{tls => ironrdp-tls}/src/lib.rs | 3 +- crates/ironrdp-tokio/Cargo.toml | 18 + crates/ironrdp-tokio/src/lib.rs | 69 ++++ crates/{web => ironrdp-web}/.gitignore | 0 crates/{web => ironrdp-web}/Cargo.toml | 2 +- crates/{web => ironrdp-web}/README.md | 0 .../{web => ironrdp-web}/rust-toolchain.toml | 0 crates/{web => ironrdp-web}/src/error.rs | 0 crates/{web => ironrdp-web}/src/image.rs | 0 crates/{web => ironrdp-web}/src/input.rs | 0 crates/{web => ironrdp-web}/src/lib.rs | 0 .../src/network_client.rs | 0 crates/{web => ironrdp-web}/src/session.rs | 21 +- crates/{web => ironrdp-web}/src/utils.rs | 0 crates/{web => ironrdp-web}/src/websocket.rs | 0 crates/ironrdp/Cargo.toml | 27 ++ {src => crates/ironrdp/src}/lib.rs | 4 - fuzz/Cargo.toml | 4 +- fuzz/README.md | 36 ++ 296 files changed, 577 insertions(+), 450 deletions(-) create mode 100644 ARCHITECTURE.md delete mode 100644 crates/async/src/framed.rs rename crates/{async => ironrdp-async}/Cargo.toml (54%) rename crates/{async => ironrdp-async}/README.md (100%) rename crates/{async => ironrdp-async}/src/connector.rs (100%) create mode 100644 crates/ironrdp-async/src/framed.rs rename crates/{async => ironrdp-async}/src/lib.rs (100%) rename crates/{async => ironrdp-async}/src/session.rs (100%) rename crates/{client-glutin => ironrdp-client-glutin}/Cargo.toml (100%) rename crates/{client-glutin => ironrdp-client-glutin}/README.md (100%) rename crates/{client-glutin => ironrdp-client-glutin}/src/config.rs (100%) rename crates/{client-glutin => ironrdp-client-glutin}/src/gui.rs (100%) rename crates/{client-glutin => ironrdp-client-glutin}/src/gui/input.rs (100%) rename crates/{client-glutin => ironrdp-client-glutin}/src/main.rs (100%) rename crates/{client => ironrdp-client}/Cargo.toml (88%) rename crates/{client => ironrdp-client}/README.md (100%) rename crates/{client => ironrdp-client}/src/config.rs (100%) rename crates/{client => ironrdp-client}/src/gui.rs (100%) rename crates/{client => ironrdp-client}/src/lib.rs (100%) rename crates/{client => ironrdp-client}/src/main.rs (100%) rename crates/{client => ironrdp-client}/src/rdp.rs (94%) rename crates/{connector => ironrdp-connector}/Cargo.toml (100%) rename crates/{connector => ironrdp-connector}/README.md (100%) rename crates/{connector => ironrdp-connector}/src/channel_connection.rs (100%) rename crates/{connector => ironrdp-connector}/src/connection.rs (100%) rename crates/{connector => ironrdp-connector}/src/connection_finalization.rs (100%) rename crates/{connector => ironrdp-connector}/src/legacy.rs (100%) rename crates/{connector => ironrdp-connector}/src/lib.rs (100%) rename crates/{connector => ironrdp-connector}/src/license_exchange.rs (100%) rename crates/{connector => ironrdp-connector}/src/server_name.rs (100%) create mode 100644 crates/ironrdp-futures/Cargo.toml create mode 100644 crates/ironrdp-futures/src/lib.rs rename crates/{glutin-renderer => ironrdp-glutin-renderer}/Cargo.toml (100%) rename crates/{glutin-renderer => ironrdp-glutin-renderer}/shaders/avc.vert (100%) rename crates/{glutin-renderer => ironrdp-glutin-renderer}/shaders/avc420.frag (100%) rename crates/{glutin-renderer => ironrdp-glutin-renderer}/shaders/avc444.frag (100%) rename crates/{glutin-renderer => ironrdp-glutin-renderer}/shaders/avc444v2.frag (100%) rename crates/{glutin-renderer => ironrdp-glutin-renderer}/shaders/texture_shader.frag (100%) rename crates/{glutin-renderer => ironrdp-glutin-renderer}/shaders/texture_shader.vert (100%) rename crates/{glutin-renderer => ironrdp-glutin-renderer}/src/draw.rs (100%) rename crates/{glutin-renderer => ironrdp-glutin-renderer}/src/lib.rs (100%) rename crates/{glutin-renderer => ironrdp-glutin-renderer}/src/renderer.rs (100%) rename crates/{glutin-renderer => ironrdp-glutin-renderer}/src/surface.rs (100%) rename crates/{graphics => ironrdp-graphics}/Cargo.toml (100%) rename crates/{graphics => ironrdp-graphics}/README.md (100%) rename crates/{graphics => ironrdp-graphics}/src/color_conversion.rs (100%) rename crates/{graphics => ironrdp-graphics}/src/dwt.rs (100%) rename crates/{graphics => ironrdp-graphics}/src/image_processing.rs (100%) rename crates/{graphics => ironrdp-graphics}/src/lib.rs (100%) rename crates/{graphics => ironrdp-graphics}/src/quantization.rs (100%) rename crates/{graphics => ironrdp-graphics}/src/rdp6/bitmap_stream.rs (100%) rename crates/{graphics => ironrdp-graphics}/src/rdp6/mod.rs (100%) rename crates/{graphics => ironrdp-graphics}/src/rdp6/rle.rs (100%) rename crates/{graphics => ironrdp-graphics}/src/rdp6/test_assets/32x64_rgb_raw.bin (100%) rename crates/{graphics => ironrdp-graphics}/src/rdp6/test_assets/32x64_rgb_raw.bmp (100%) rename crates/{graphics => ironrdp-graphics}/src/rdp6/test_assets/64x24_argb_rle.bin (100%) rename crates/{graphics => ironrdp-graphics}/src/rdp6/test_assets/64x24_argb_rle.bmp (100%) rename crates/{graphics => ironrdp-graphics}/src/rdp6/test_assets/64x24_aycocg_rle.bin (100%) rename crates/{graphics => ironrdp-graphics}/src/rdp6/test_assets/64x24_aycocg_rle.bmp (100%) rename crates/{graphics => ironrdp-graphics}/src/rdp6/test_assets/64x24_ycocg_rle_ss.bin (100%) rename crates/{graphics => ironrdp-graphics}/src/rdp6/test_assets/64x24_ycocg_rle_ss.bmp (100%) rename crates/{graphics => ironrdp-graphics}/src/rdp6/test_assets/64x57_ycocg_rle_ss.bin (100%) rename crates/{graphics => ironrdp-graphics}/src/rdp6/test_assets/64x57_ycocg_rle_ss.bmp (100%) rename crates/{graphics => ironrdp-graphics}/src/rdp6/test_assets/64x64_ycocg_raw_ss.bin (100%) rename crates/{graphics => ironrdp-graphics}/src/rdp6/test_assets/64x64_ycocg_raw_ss.bmp (100%) rename crates/{graphics => ironrdp-graphics}/src/rectangle_processing.rs (100%) rename crates/{graphics => ironrdp-graphics}/src/rle.rs (100%) rename crates/{graphics => ironrdp-graphics}/src/rlgr.rs (100%) rename crates/{graphics => ironrdp-graphics}/src/subband_reconstruction.rs (100%) rename crates/{graphics => ironrdp-graphics}/src/utils.rs (100%) rename crates/{graphics => ironrdp-graphics}/src/zgfx/circular_buffer.rs (100%) rename crates/{graphics => ironrdp-graphics}/src/zgfx/control_messages.rs (100%) rename crates/{graphics => ironrdp-graphics}/src/zgfx/mod.rs (100%) rename crates/{graphics => ironrdp-graphics}/src/zgfx/test_assets/decoded.0.bin (100%) rename crates/{graphics => ironrdp-graphics}/src/zgfx/test_assets/decoded.1.bin (100%) rename crates/{graphics => ironrdp-graphics}/src/zgfx/test_assets/decoded.2.bin (100%) rename crates/{graphics => ironrdp-graphics}/src/zgfx/test_assets/decoded.3.bin (100%) rename crates/{graphics => ironrdp-graphics}/src/zgfx/test_assets/decoded.4.bin (100%) rename crates/{graphics => ironrdp-graphics}/src/zgfx/test_assets/encoded.0.bin (100%) rename crates/{graphics => ironrdp-graphics}/src/zgfx/test_assets/encoded.1.bin (100%) rename crates/{graphics => ironrdp-graphics}/src/zgfx/test_assets/encoded.2.bin (100%) rename crates/{graphics => ironrdp-graphics}/src/zgfx/test_assets/encoded.3.bin (100%) rename crates/{graphics => ironrdp-graphics}/src/zgfx/test_assets/encoded.4.bin (100%) rename crates/{graphics => ironrdp-graphics}/tests/color_conversion.rs (100%) rename crates/{graphics => ironrdp-graphics}/tests/dwt.rs (100%) rename crates/{graphics => ironrdp-graphics}/tests/image_processing.rs (100%) rename crates/{graphics => ironrdp-graphics}/tests/rle.rs (100%) rename crates/{graphics => ironrdp-graphics}/tests/rlgr.rs (100%) rename crates/{input => ironrdp-input}/Cargo.toml (100%) rename crates/{input => ironrdp-input}/README.md (100%) rename crates/{input => ironrdp-input}/src/lib.rs (100%) rename crates/{input => ironrdp-input}/tests/fastpath_packets.rs (100%) rename crates/{input => ironrdp-input}/tests/smoke.rs (100%) rename crates/{pdu-generators => ironrdp-pdu-generators}/Cargo.toml (100%) rename crates/{pdu-generators => ironrdp-pdu-generators}/src/lib.rs (100%) rename crates/{pdu-samples => ironrdp-pdu-samples}/Cargo.toml (100%) rename crates/{pdu-samples => ironrdp-pdu-samples}/src/capsets.rs (100%) rename crates/{pdu-samples => ironrdp-pdu-samples}/src/client_info.rs (100%) rename crates/{pdu-samples => ironrdp-pdu-samples}/src/cluster_data.rs (100%) rename crates/{pdu-samples => ironrdp-pdu-samples}/src/conference_create.rs (100%) rename crates/{pdu-samples => ironrdp-pdu-samples}/src/core_data.rs (100%) rename crates/{pdu-samples => ironrdp-pdu-samples}/src/gcc.rs (100%) rename crates/{pdu-samples => ironrdp-pdu-samples}/src/gfx.rs (100%) rename crates/{pdu-samples => ironrdp-pdu-samples}/src/graphics_messages.rs (100%) rename crates/{pdu-samples => ironrdp-pdu-samples}/src/lib.rs (100%) rename crates/{pdu-samples => ironrdp-pdu-samples}/src/macros.rs (100%) rename crates/{pdu-samples => ironrdp-pdu-samples}/src/mcs.rs (100%) rename crates/{pdu-samples => ironrdp-pdu-samples}/src/message_channel_data.rs (100%) rename crates/{pdu-samples => ironrdp-pdu-samples}/src/monitor_data.rs (100%) rename crates/{pdu-samples => ironrdp-pdu-samples}/src/monitor_extended_data.rs (100%) rename crates/{pdu-samples => ironrdp-pdu-samples}/src/multi_transport_channel_data.rs (100%) rename crates/{pdu-samples => ironrdp-pdu-samples}/src/network_data.rs (100%) rename crates/{pdu-samples => ironrdp-pdu-samples}/src/rdp.rs (100%) rename crates/{pdu-samples => ironrdp-pdu-samples}/src/security_data.rs (100%) rename crates/{pdu => ironrdp-pdu}/Cargo.toml (100%) rename crates/{pdu => ironrdp-pdu}/README.md (100%) rename crates/{pdu => ironrdp-pdu}/src/basic_output.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/basic_output/bitmap.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/basic_output/bitmap/rdp6.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/basic_output/bitmap/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/basic_output/fast_path.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/basic_output/fast_path/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/basic_output/surface_commands.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/basic_output/surface_commands/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/ber.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/codecs.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/codecs/rfx.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/codecs/rfx/data_messages.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/codecs/rfx/header_messages.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/crypto.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/crypto/rc4.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/crypto/rsa.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/cursor.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/gcc.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/gcc/cluster_data.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/gcc/conference_create.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/gcc/core_data.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/gcc/core_data/client.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/gcc/core_data/server.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/gcc/message_channel_data.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/gcc/monitor_data.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/gcc/monitor_extended_data.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/gcc/multi_transport_channel_data.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/gcc/network_data.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/gcc/security_data.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/geometry.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/input/fast_path.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/input/mod.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/input/mouse.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/input/mouse_x.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/input/scan_code.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/input/sync.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/input/unicode.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/input/unused.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/lib.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/macros.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/mcs.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/nego.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/padding.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/pcb.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/per.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/bitmap.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/bitmap/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/bitmap_cache.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/bitmap_cache/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/bitmap_codecs.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/bitmap_codecs/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/brush.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/brush/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/frame_acknowledge.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/general.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/general/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/glyph_cache.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/glyph_cache/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/input.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/input/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/large_pointer.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/multifragment_update.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/offscreen_bitmap_cache.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/offscreen_bitmap_cache/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/order.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/order/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/pointer.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/pointer/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/sound.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/sound/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/surface_commands.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/surface_commands/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/virtual_channel.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/capability_sets/virtual_channel/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/client_info.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/finalization_messages.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/headers.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/server_error_info.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/server_license.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/server_license/client_new_license_request.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/server_license/client_new_license_request/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/server_license/client_platform_challenge_response.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/server_license/client_platform_challenge_response/test.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/server_license/licensing_error_message.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/server_license/licensing_error_message/test.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/server_license/server_license_request.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/server_license/server_license_request/cert.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/server_license/server_license_request/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/server_license/server_platform_challenge.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/server_license/server_platform_challenge/test.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/server_license/server_upgrade_license.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/server_license/server_upgrade_license/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/server_license/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/session_info.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/session_info/logon_extended.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/session_info/logon_info.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/session_info/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/vc.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/vc/dvc.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/vc/dvc/capabilities.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/vc/dvc/capabilities/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/vc/dvc/close.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/vc/dvc/close/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/vc/dvc/create.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/vc/dvc/create/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/vc/dvc/data.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/vc/dvc/data/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/vc/dvc/data_first.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/vc/dvc/data_first/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/vc/dvc/display.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/vc/dvc/gfx.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/vc/dvc/gfx/graphics_messages.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/vc/dvc/gfx/graphics_messages/avc_messages.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/vc/dvc/gfx/graphics_messages/client.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/vc/dvc/gfx/graphics_messages/server.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/vc/dvc/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/rdp/vc/tests.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/tpdu.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/tpkt.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/utils.rs (100%) rename crates/{pdu => ironrdp-pdu}/src/x224.rs (100%) rename crates/{pdu => ironrdp-pdu}/tests/gcc.rs (100%) rename crates/{pdu => ironrdp-pdu}/tests/gfx.rs (100%) rename crates/{pdu => ironrdp-pdu}/tests/input.rs (100%) rename crates/{pdu => ironrdp-pdu}/tests/mcs.rs (100%) rename crates/{pdu => ironrdp-pdu}/tests/rdp.rs (100%) rename crates/{pdu => ironrdp-pdu}/tests/rfx.rs (100%) rename crates/{pdu => ironrdp-pdu}/tests/x224.rs (100%) rename crates/{rdcleanpath => ironrdp-rdcleanpath}/Cargo.toml (100%) rename crates/{rdcleanpath => ironrdp-rdcleanpath}/README.md (100%) rename crates/{rdcleanpath => ironrdp-rdcleanpath}/src/lib.rs (100%) rename crates/{replay-client => ironrdp-replay-client}/Cargo.toml (100%) rename crates/{replay-client => ironrdp-replay-client}/README.md (100%) rename crates/{replay-client => ironrdp-replay-client}/scripts/runtests.ps1 (100%) rename crates/{replay-client => ironrdp-replay-client}/src/main.rs (100%) rename crates/{replay-client => ironrdp-replay-client}/test_data/README.md (100%) rename crates/{replay-client => ironrdp-replay-client}/test_data/sample1_avc444.data (100%) rename crates/{replay-client => ironrdp-replay-client}/test_data/sample1_avc444v2.data (100%) rename crates/{replay-client => ironrdp-replay-client}/test_data/sample2_avc444.data (100%) rename crates/{replay-client => ironrdp-replay-client}/test_data/sample2_avc444v2.data (100%) rename crates/{session-generators => ironrdp-session-generators}/Cargo.toml (100%) rename crates/{session-generators => ironrdp-session-generators}/src/lib.rs (100%) rename crates/{session => ironrdp-session}/Cargo.toml (100%) rename crates/{session => ironrdp-session}/README.md (100%) rename crates/{session => ironrdp-session}/src/active_stage.rs (100%) rename crates/{session => ironrdp-session}/src/fast_path.rs (100%) rename crates/{session => ironrdp-session}/src/image.rs (100%) rename crates/{session => ironrdp-session}/src/legacy.rs (100%) rename crates/{session => ironrdp-session}/src/lib.rs (100%) rename crates/{session => ironrdp-session}/src/rfx.rs (100%) rename crates/{session => ironrdp-session}/src/utils.rs (100%) rename crates/{session => ironrdp-session}/src/x224/display.rs (100%) rename crates/{session => ironrdp-session}/src/x224/gfx.rs (100%) rename crates/{session => ironrdp-session}/src/x224/mod.rs (100%) rename crates/{tls => ironrdp-tls}/Cargo.toml (100%) rename crates/{tls => ironrdp-tls}/README.md (100%) rename crates/{tls => ironrdp-tls}/src/lib.rs (96%) create mode 100644 crates/ironrdp-tokio/Cargo.toml create mode 100644 crates/ironrdp-tokio/src/lib.rs rename crates/{web => ironrdp-web}/.gitignore (100%) rename crates/{web => ironrdp-web}/Cargo.toml (96%) rename crates/{web => ironrdp-web}/README.md (100%) rename crates/{web => ironrdp-web}/rust-toolchain.toml (100%) rename crates/{web => ironrdp-web}/src/error.rs (100%) rename crates/{web => ironrdp-web}/src/image.rs (100%) rename crates/{web => ironrdp-web}/src/input.rs (100%) rename crates/{web => ironrdp-web}/src/lib.rs (100%) rename crates/{web => ironrdp-web}/src/network_client.rs (100%) rename crates/{web => ironrdp-web}/src/session.rs (96%) rename crates/{web => ironrdp-web}/src/utils.rs (100%) rename crates/{web => ironrdp-web}/src/websocket.rs (100%) create mode 100644 crates/ironrdp/Cargo.toml rename {src => crates/ironrdp/src}/lib.rs (79%) create mode 100644 fuzz/README.md diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md new file mode 100644 index 00000000..87b2a835 --- /dev/null +++ b/ARCHITECTURE.md @@ -0,0 +1,110 @@ +# Architecture + +This document describes the high-level architecture of IronRDP. + +> Roughly, it takes 2x more time to write a patch if you are unfamiliar with the +> project, but it takes 10x more time to figure out where you should change the +> code. + +[Source](https://matklad.github.io/2021/02/06/ARCHITECTURE.md.html) + +## Code Map + +This section talks briefly about various important directories and data structures. + +### Core Crates + +- `crates/ironrdp`: meta crate re-exporting important crates. +- `crates/ironrdp-pdu`: PDU encoding and decoding (no I/O, trivial to fuzz). +- `crates/ironrdp-graphics`: image processing primitives (no I/O, trivial to fuzz). +- `crates/ironrdp-connector`: state machines to drive an RDP connection sequence (no I/O, not _too_ hard to fuzz). +- `crates/ironrdp-session`: state machines to drive an RDP session (no I/O, not _too_ hard to fuzz). +- `crates/ironrdp-input`: utilities to manage and build input packets (no I/O). +- `crates/ironrdp-rdcleanpath`: RDCleanPath PDU structure used by IronRDP web client and Devolutions Gateway. + +### Utility Crates + +- `crates/ironrdp-async`: provides `Future`s wrapping the state machines conveniently. +- `crates/ironrdp-tokio`: `Framed*` traits implementation above `tokio`’s traits. +- `crates/ironrdp-futures`: `Framed*` traits implementation above `futures`’s traits. +- `crates/ironrdp-tls`: TLS boilerplate common with most IronRDP clients. + +### Client Crates + +- `crates/ironrdp-client`: portable RDP client without GPU acceleration using softbuffer and winit for windowing. +- `crates/ironrdp-web`: WebAssembly high-level bindings targeting web browsers. +- `crates/ironrdp-glutin-renderer`: `glutin` primitives for OpenGL rendering. +- `crates/ironrdp-client-glutin`: GPU-accelerated RDP client using glutin. +- `crates/ironrdp-replay-client`: utility tool to replay RDP graphics pipeline for debugging purposes. +- `web-client/iron-remote-gui`: core frontend UI used by `iron-svelte-client` as a Web Component. +- `web-client/iron-svelte-client`: web-based frontend using `Svelte` and `Material` frameworks. + +### Private Crates + +Crates that are only used inside the IronRDP project, not meant to be published. + +- `crates/ironrdp-pdu-generators`: `proptest` generators for `ironrdp-pdu` types. +- `crates/ironrdp-session-generators`: `proptest` generators for `ironrdp-session` types. +- `fuzz`: fuzz targets for core crates. +- `xtask`: IronRDP’s free-form automation using Rust code. + +## Cross-Cutting Concerns + +This section talks about the things which are everywhere and nowhere in particular. + +### General + +- Dependency injection when runtime information is necessary in core crates (no system call such as `gethostname`) +- Keep non-portable code out of core crates +- Make crate `no_std`-compatible wherever possible +- Facilitate fuzzing +- In libraries, provide concrete error types either hand-crafted or using `thiserror` crate +- In binaries, use the convenient catch-all error type `anyhow::Error` +- Free-form automation a-la `make` following [`cargo xtask`](https://github.com/matklad/cargo-xtask) specification + +### Avoid I/O wherever possible + +**Architecture Invariant**: core crates must never interact with the outside world. Only client and utility crates +such as `ironrdp-client`, `ironrdp-web` or `ironrdp-async` are allowed to do I/O. + +### Continuous integration + +We use GitHub action and our workflows simply run `cargo xtask`. +The expectation is that, if `cargo xtask ci` passes locally, the CI will be green as well. + +**Architecture Invariant**: `cargo xtask ci` and CI workflow must be logically equivalents. It must +be the case that a successful `cargo xtask ci` run implies a successful CI workflow run and vice versa. + +### Testing + +#### Fuzzing + +See [`fuzz/README.md`](../fuzz/README.md). + +#### Readability + +Do not include huge binary chunks directly in source files (`*.rs`). Place these in separate files (`*.bin`, `*.bmp`) +and include them using macros such as `include_bytes!` or `include_str!`. + +#### Use `expect-test` for snapshot testing + +When comparing structured data (e.g.: error results, decoded PDUs), use `expect-test`. It is both easy to create +and maintain such tests. When something affecting the representation is changed, simply run the test again with +`UPDATE_EXPECT=1` env variable to magically update the code. + +See: +- +- + +TODO: take further inspiration from rust-analyzer +- https://github.com/rust-lang/rust-analyzer/blob/d7c99931d05e3723d878bea5dc26766791fa4e69/docs/dev/architecture.md#testing +- https://matklad.github.io/2021/05/31/how-to-test.html + +#### Use `rstest` for fixture-based testing + +When a test can be generalized for multiple inputs, use [`rstest`](https://github.com/la10736/rstest) to avoid code duplication. + +#### Use `proptest` for property testing + +It allows to test that certain properties of your code hold for arbitrary inputs, and if a failure +is found, automatically finds the minimal test case to reproduce the problem. diff --git a/Cargo.lock b/Cargo.lock index cb114702..308dd42f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1509,12 +1509,9 @@ name = "ironrdp-async" version = "0.1.0" dependencies = [ "bytes", - "futures-util", "ironrdp-connector", "ironrdp-pdu", "tap", - "tokio", - "tokio-util", "tracing", ] @@ -1526,18 +1523,16 @@ dependencies = [ "chrono", "clap", "exitcode", - "futures-util", "inquire", "ironrdp", - "ironrdp-async", "ironrdp-tls", + "ironrdp-tokio", "semver", "smallvec", "softbuffer", "sspi", "tap", "tokio", - "tokio-util", "tracing", "tracing-subscriber", "whoami", @@ -1556,6 +1551,15 @@ dependencies = [ "tracing", ] +[[package]] +name = "ironrdp-futures" +version = "0.1.0" +dependencies = [ + "bytes", + "futures-util", + "ironrdp-async", +] + [[package]] name = "ironrdp-graphics" version = "0.1.0" @@ -1669,6 +1673,16 @@ dependencies = [ "x509-cert", ] +[[package]] +name = "ironrdp-tokio" +version = "0.1.0" +dependencies = [ + "bytes", + "ironrdp-async", + "tokio", + "tokio-util", +] + [[package]] name = "ironrdp-web" version = "0.1.0" @@ -1681,7 +1695,7 @@ dependencies = [ "getrandom 0.2.8", "gloo-net", "ironrdp", - "ironrdp-async", + "ironrdp-futures", "ironrdp-rdcleanpath", "js-sys", "semver", @@ -3798,7 +3812,6 @@ checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" dependencies = [ "bytes", "futures-core", - "futures-io", "futures-sink", "pin-project-lite", "tokio", diff --git a/Cargo.toml b/Cargo.toml index 451fa139..94c93372 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,52 +1,14 @@ -[package] -name = "ironrdp" -version = "0.5.0" -readme = "README.md" -description = "A Rust implementation of the Microsoft Remote Desktop Protocol (RDP)" -edition.workspace = true -license.workspace = true -homepage.workspace = true -repository.workspace = true -authors.workspace = true -keywords.workspace = true -categories.workspace = true - -[features] -default = ["pdu", "connector", "session"] -pdu = ["dep:ironrdp-pdu"] -connector = ["dep:ironrdp-connector"] -session = ["dep:ironrdp-session"] -graphics = ["dep:ironrdp-graphics"] -input = ["dep:ironrdp-input"] - -[dependencies] -ironrdp-pdu = { workspace = true, optional = true } -ironrdp-connector = { workspace = true, optional = true } -ironrdp-session = { workspace = true, optional = true } -ironrdp-graphics = { workspace = true, optional = true } -ironrdp-input = { workspace = true, optional = true } - [workspace] members = [ "crates/*", "xtask", ] -default-members = [ - "crates/pdu", - "crates/connector", - "crates/session", - "crates/graphics", - "crates/input", - "crates/async", - "crates/client", - "crates/web", -] # FIXME: fix compilation exclude = [ - "crates/client-glutin", - "crates/glutin-renderer", - "crates/replay-client", + "crates/ironrdp-client-glutin", + "crates/ironrdp-glutin-renderer", + "crates/ironrdp-replay-client", ] [workspace.package] @@ -60,18 +22,20 @@ categories = ["network-programming"] [workspace.dependencies] expect-test = "1" -ironrdp = { version = "0.5", path = "." } -ironrdp-async = { version = "0.1", path = "crates/async" } -ironrdp-connector = { version = "0.1", path = "crates/connector" } -ironrdp-graphics = { version = "0.1", path = "crates/graphics" } -ironrdp-input = { version = "0.1", path = "crates/input" } -ironrdp-pdu = { version = "0.1", path = "crates/pdu" } -ironrdp-pdu-generators = { path = "crates/pdu-generators" } -ironrdp-pdu-samples = { path = "crates/pdu-samples" } -ironrdp-rdcleanpath = { version = "0.1", path = "crates/rdcleanpath" } -ironrdp-session = { version = "0.1", path = "crates/session" } -ironrdp-session-generators = { path = "crates/session-generators" } -ironrdp-tls = { version = "0.1", path = "crates/tls" } +ironrdp-async = { version = "0.1", path = "crates/ironrdp-async" } +ironrdp-connector = { version = "0.1", path = "crates/ironrdp-connector" } +ironrdp-futures = { version = "0.1", path = "crates/ironrdp-futures" } +ironrdp-graphics = { version = "0.1", path = "crates/ironrdp-graphics" } +ironrdp-input = { version = "0.1", path = "crates/ironrdp-input" } +ironrdp-pdu-generators = { path = "crates/ironrdp-pdu-generators" } +ironrdp-pdu-samples = { path = "crates/ironrdp-pdu-samples" } +ironrdp-pdu = { version = "0.1", path = "crates/ironrdp-pdu" } +ironrdp-rdcleanpath = { version = "0.1", path = "crates/ironrdp-rdcleanpath" } +ironrdp-session-generators = { path = "crates/ironrdp-session-generators" } +ironrdp-session = { version = "0.1", path = "crates/ironrdp-session" } +ironrdp-tls = { version = "0.1", path = "crates/ironrdp-tls" } +ironrdp-tokio = { version = "0.1", path = "crates/ironrdp-tokio" } +ironrdp = { version = "0.5", path = "crates/ironrdp" } proptest = "1.1.0" rstest = "0.17.0" sspi = "0.8.1" diff --git a/README.md b/README.md index 3fa46f7c..b2873881 100644 --- a/README.md +++ b/README.md @@ -35,40 +35,6 @@ Alternatively, you may change a few group policies using `gpedit.msc`: 5. Reboot. -## Architecture (Work In Progress…) +## Architecture -- `ironrdp` (root package): meta crate re-exporting important crates, -- `ironrdp-pdu` (`crates/pdu`): PDU encoding and decoding (no I/O, trivial to fuzz), -- `ironrdp-graphics` (`crates/graphics`): image processing primitives (no I/O, trivial to fuzz), -- `ironrdp-connector` (`crates/connector`): state machines to drive an RDP connection sequence (no I/O, not _too_ hard to fuzz), -- `ironrdp-session` (`crates/session`): state machines to drive an RDP session (no I/O, not _too_ hard to fuzz), -- `ironrdp-input` (`crates/input`): utilities to manage and build input packets (no I/O), -- `ironrdp-async` (`crates/async`): provides `Future`s wrapping the state machines conveniently, -- `ironrdp-tls` (`crates/tls`): TLS boilerplate common with most IronRDP clients, -- `ironrdp-rdcleanpath` (`crates/rdcleanpath`): RDCleanPath PDU structure used by IronRDP web client and Devolutions Gateway, -- `ironrdp-client` (`crates/client`): Portable RDP client without GPU acceleration using softbuffer and winit for windowing, -- `ironrdp-web` (`crates/web`): WebAssembly high-level bindings targeting web browsers, -- `ironrdp-glutin-renderer` (`crates/glutin-renderer`): `glutin` primitives for OpenGL rendering, -- `ironrdp-client-glutin` (`crates/client-glutin`): GPU-accelerated RDP client using glutin, -- `ironrdp-replay-client` (`crates/replay-client`): utility tool to replay RDP graphics pipeline for debugging purposes, -- `ironrdp-pdu-generators` (`crates/pdu-generators`): `proptest` generators for `ironrdp-pdu` types, -- `ironrdp-session-generators` (`crates/session-generators`): `proptest` generators for `ironrdp-session` types, -- `iron-remote-gui` (`web-client/iron-remote-gui`): core frontend UI used by `iron-svelte-client` as a Web Component, -- `iron-svelte-client` (`web-client/iron-svelte-client`): web-based frontend using `Svelte` and `Material` frameworks, -- and finally, `ironrdp-fuzz` (`fuzz`): fuzz targets for core crates. - -## General design - -- Avoid I/O wherever possible -- Dependency injection when runtime information is necessary in core crates (no system call such as `gethostname`) -- Keep non-portable code out of core crates -- Make crate `no_std`-compatible wherever possible -- Facilitate fuzzing -- In libraries, provide concrete error types either hand-crafted or using `thiserror` crate -- In binaries, use the convenient catch-all error type `anyhow::Error` -- Free-form automation a-la `make` following [`cargo xtask`](https://github.com/matklad/cargo-xtask) specification - -## Continuous integration - -We use GitHub action and our workflows simply run `cargo xtask`. -The expectation is that, if `cargo xtask ci` passes locally, the CI will be green as well. +See the [ARCHITECTURE.md](./ARCHITECTURE.md) document. diff --git a/crates/async/src/framed.rs b/crates/async/src/framed.rs deleted file mode 100644 index bc2d9aff..00000000 --- a/crates/async/src/framed.rs +++ /dev/null @@ -1,307 +0,0 @@ -use std::io; -use std::pin::Pin; - -use bytes::{Bytes, BytesMut}; -use ironrdp_pdu::PduHint; - -// TODO: use static async fn / return position impl trait in traits where stabiziled (https://github.com/rust-lang/rust/issues/91611) - -pub trait FramedRead: private::Sealed { - /// Reads from stream and fills internal buffer - fn read<'a>( - &'a mut self, - buf: &'a mut BytesMut, - ) -> Pin> + 'a>> - where - Self: 'a; -} - -pub trait FramedWrite: private::Sealed { - /// Writes an entire buffer into this stream. - fn write_all<'a>(&'a mut self, buf: &'a [u8]) -> Pin> + 'a>> - where - Self: 'a; -} - -pub struct Framed { - stream: S, - buf: BytesMut, -} - -impl Framed { - pub fn new(stream: S) -> Self { - Self { - stream, - buf: BytesMut::new(), - } - } - - pub fn into_inner(self) -> (S, BytesMut) { - (self.stream, self.buf) - } - - pub fn into_inner_no_leftover(self) -> S { - let (stream, leftover) = self.into_inner(); - debug_assert_eq!(leftover.len(), 0, "unexpected leftover"); - stream - } - - pub fn get_inner(&self) -> (&S, &BytesMut) { - (&self.stream, &self.buf) - } - - pub fn get_inner_mut(&mut self) -> (&mut S, &mut BytesMut) { - (&mut self.stream, &mut self.buf) - } - - pub fn peek(&self) -> &[u8] { - &self.buf - } -} - -#[cfg(feature = "tokio")] -impl Framed> { - pub fn tokio_new(stream: S) -> Self { - Self { - stream: TokioCompat { inner: stream }, - buf: BytesMut::new(), - } - } - - pub fn tokio_into_inner(self) -> (S, BytesMut) { - (self.stream.inner, self.buf) - } - - pub fn tokio_into_inner_no_leftover(self) -> S { - let (stream, leftover) = self.tokio_into_inner(); - assert_eq!(leftover.len(), 0, "unexpected leftover"); - stream - } - - pub fn tokio_get_inner(&self) -> (&S, &BytesMut) { - (&self.stream.inner, &self.buf) - } - - pub fn tokio_get_inner_mut(&mut self) -> (&mut S, &mut BytesMut) { - (&mut self.stream.inner, &mut self.buf) - } -} - -#[cfg(feature = "futures")] -impl Framed> { - pub fn futures_new(stream: S) -> Self { - Self { - stream: FuturesCompat { inner: stream }, - buf: BytesMut::new(), - } - } - - pub fn futures_into_inner(self) -> (S, BytesMut) { - (self.stream.inner, self.buf) - } - - pub fn futures_into_inner_no_leftover(self) -> S { - let (stream, leftover) = self.futures_into_inner(); - debug_assert_eq!(leftover.len(), 0, "unexpected leftover"); - stream - } - - pub fn futures_get_inner(&self) -> (&S, &BytesMut) { - (&self.stream.inner, &self.buf) - } - - pub fn futures_get_inner_mut(&mut self) -> (&mut S, &mut BytesMut) { - (&mut self.stream.inner, &mut self.buf) - } -} - -impl Framed -where - S: FramedRead, -{ - /// Reads from stream and fills internal buffer - pub async fn read(&mut self) -> io::Result { - self.stream.read(&mut self.buf).await - } - - pub async fn read_exact(&mut self, length: usize) -> io::Result { - loop { - if self.buf.len() >= length { - return Ok(self.buf.split_to(length).freeze()); - } else { - self.buf.reserve(length - self.buf.len()); - } - - let len = self.read().await?; - - // Handle EOF - if len == 0 { - return Err(io::Error::new(io::ErrorKind::UnexpectedEof, "not enough bytes")); - } - } - } - - pub async fn read_pdu(&mut self) -> io::Result<(ironrdp_pdu::Action, Bytes)> { - loop { - // Try decoding and see if a frame has been received already - match ironrdp_pdu::find_size(self.peek()) { - Ok(Some(pdu_info)) => { - let frame = self.read_exact(pdu_info.length).await?; - - return Ok((pdu_info.action, frame)); - } - Ok(None) => { - let len = self.read().await?; - - // Handle EOF - if len == 0 { - return Err(io::Error::new(io::ErrorKind::UnexpectedEof, "not enough bytes")); - } - } - Err(e) => return Err(io::Error::new(io::ErrorKind::Other, e)), - }; - } - } - - pub async fn read_by_hint(&mut self, hint: &dyn PduHint) -> io::Result { - loop { - match hint - .find_size(self.peek()) - .map_err(|e| io::Error::new(io::ErrorKind::Other, e))? - { - Some(length) => { - return self.read_exact(length).await; - } - None => { - let len = self.read().await?; - - // Handle EOF - if len == 0 { - return Err(io::Error::new(io::ErrorKind::UnexpectedEof, "not enough bytes")); - } - } - }; - } - } -} - -impl Framed -where - S: FramedWrite, -{ - /// Reads from stream and fills internal buffer - pub async fn write_all(&mut self, buf: &[u8]) -> io::Result<()> { - self.stream.write_all(buf).await - } -} - -#[cfg(feature = "tokio")] -pub struct TokioCompat { - inner: S, -} - -#[cfg(feature = "tokio")] -mod tokio_impl { - use tokio::io::{AsyncRead, AsyncWrite}; - - use super::*; - - impl private::Sealed for TokioCompat {} - - impl FramedRead for TokioCompat - where - S: Unpin + AsyncRead, - { - fn read<'a>( - &'a mut self, - buf: &'a mut BytesMut, - ) -> Pin> + 'a>> - where - Self: 'a, - { - use tokio::io::AsyncReadExt as _; - - Box::pin(async { self.inner.read_buf(buf).await }) - } - } - - impl FramedWrite for TokioCompat - where - S: Unpin + AsyncWrite, - { - fn write_all<'a>(&'a mut self, buf: &'a [u8]) -> Pin> + 'a>> - where - Self: 'a, - { - use tokio::io::AsyncWriteExt as _; - - Box::pin(async { - self.inner.write_all(buf).await?; - self.inner.flush().await?; - - Ok(()) - }) - } - } -} - -#[cfg(feature = "futures")] -pub struct FuturesCompat { - pub(super) inner: S, -} - -#[cfg(feature = "futures")] -mod futures_impl { - pub use futures_util::io::{AsyncRead, AsyncWrite}; - - use super::*; - - impl private::Sealed for FuturesCompat {} - - impl FramedRead for FuturesCompat - where - S: Unpin + AsyncRead, - { - fn read<'a>( - &'a mut self, - buf: &'a mut BytesMut, - ) -> Pin> + 'a>> - where - Self: 'a, - { - use futures_util::io::AsyncReadExt as _; - - Box::pin(async { - // NOTE(perf): tokio implementation is more efficient - let mut read_bytes = [0u8; 1024]; - let len = self.inner.read(&mut read_bytes[..]).await?; - buf.extend_from_slice(&read_bytes[..len]); - - Ok(len) - }) - } - } - - impl FramedWrite for FuturesCompat - where - S: Unpin + AsyncWrite, - { - fn write_all<'a>(&'a mut self, buf: &'a [u8]) -> Pin> + 'a>> - where - Self: 'a, - { - use futures_util::io::AsyncWriteExt as _; - - Box::pin(async { - self.inner.write_all(buf).await?; - self.inner.flush().await?; - - Ok(()) - }) - } - } -} - -mod private { - pub trait Sealed {} -} diff --git a/crates/async/Cargo.toml b/crates/ironrdp-async/Cargo.toml similarity index 54% rename from crates/async/Cargo.toml rename to crates/ironrdp-async/Cargo.toml index 8a91678d..b23b5366 100644 --- a/crates/async/Cargo.toml +++ b/crates/ironrdp-async/Cargo.toml @@ -11,25 +11,10 @@ authors.workspace = true keywords.workspace = true categories.workspace = true -[features] -default = ["tokio"] -tokio = ["dep:tokio", "dep:tokio-util"] -futures = ["dep:futures-util"] - [dependencies] -# Protocols -ironrdp-pdu.workspace = true +bytes = "1" ironrdp-connector.workspace = true +ironrdp-pdu.workspace = true # ironrdp-session.workspace = true - -# Logging +tap = "1" tracing.workspace = true - -# Utils -bytes = "1.4.0" -tap = "1.0.1" - -# Async -tokio = { version = "1.25.0", features = ["io-util"], optional = true } -tokio-util = { version = "0.7.7", features = ["codec"], optional = true } -futures-util = { version = "0.3.26", features = ["io"], optional = true } diff --git a/crates/async/README.md b/crates/ironrdp-async/README.md similarity index 100% rename from crates/async/README.md rename to crates/ironrdp-async/README.md diff --git a/crates/async/src/connector.rs b/crates/ironrdp-async/src/connector.rs similarity index 100% rename from crates/async/src/connector.rs rename to crates/ironrdp-async/src/connector.rs diff --git a/crates/ironrdp-async/src/framed.rs b/crates/ironrdp-async/src/framed.rs new file mode 100644 index 00000000..815ef812 --- /dev/null +++ b/crates/ironrdp-async/src/framed.rs @@ -0,0 +1,157 @@ +use std::io; +use std::pin::Pin; + +use bytes::{Bytes, BytesMut}; +use ironrdp_pdu::PduHint; + +// TODO: use static async fn / return position impl trait in traits when stabiziled (https://github.com/rust-lang/rust/issues/91611) + +pub trait FramedRead { + /// Reads from stream and fills internal buffer + fn read<'a>( + &'a mut self, + buf: &'a mut BytesMut, + ) -> Pin> + 'a>> + where + Self: 'a; +} + +pub trait FramedWrite { + /// Writes an entire buffer into this stream. + fn write_all<'a>(&'a mut self, buf: &'a [u8]) -> Pin> + 'a>> + where + Self: 'a; +} + +pub trait StreamWrapper: Sized { + type InnerStream; + + fn from_inner(stream: Self::InnerStream) -> Self; + + fn into_inner(self) -> Self::InnerStream; + + fn get_inner(&self) -> &Self::InnerStream; + + fn get_inner_mut(&mut self) -> &mut Self::InnerStream; +} + +pub struct Framed { + stream: S, + buf: BytesMut, +} + +impl Framed { + pub fn peek(&self) -> &[u8] { + &self.buf + } +} + +impl Framed +where + S: StreamWrapper, +{ + pub fn new(stream: S::InnerStream) -> Self { + Self { + stream: S::from_inner(stream), + buf: BytesMut::new(), + } + } + + pub fn into_inner(self) -> (S::InnerStream, BytesMut) { + (self.stream.into_inner(), self.buf) + } + + pub fn into_inner_no_leftover(self) -> S::InnerStream { + let (stream, leftover) = self.into_inner(); + debug_assert_eq!(leftover.len(), 0, "unexpected leftover"); + stream + } + + pub fn get_inner(&self) -> (&S::InnerStream, &BytesMut) { + (self.stream.get_inner(), &self.buf) + } + + pub fn get_inner_mut(&mut self) -> (&mut S::InnerStream, &mut BytesMut) { + (self.stream.get_inner_mut(), &mut self.buf) + } +} + +impl Framed +where + S: FramedRead, +{ + /// Reads from stream and fills internal buffer + pub async fn read(&mut self) -> io::Result { + self.stream.read(&mut self.buf).await + } + + pub async fn read_exact(&mut self, length: usize) -> io::Result { + loop { + if self.buf.len() >= length { + return Ok(self.buf.split_to(length).freeze()); + } else { + self.buf.reserve(length - self.buf.len()); + } + + let len = self.read().await?; + + // Handle EOF + if len == 0 { + return Err(io::Error::new(io::ErrorKind::UnexpectedEof, "not enough bytes")); + } + } + } + + pub async fn read_pdu(&mut self) -> io::Result<(ironrdp_pdu::Action, Bytes)> { + loop { + // Try decoding and see if a frame has been received already + match ironrdp_pdu::find_size(self.peek()) { + Ok(Some(pdu_info)) => { + let frame = self.read_exact(pdu_info.length).await?; + + return Ok((pdu_info.action, frame)); + } + Ok(None) => { + let len = self.read().await?; + + // Handle EOF + if len == 0 { + return Err(io::Error::new(io::ErrorKind::UnexpectedEof, "not enough bytes")); + } + } + Err(e) => return Err(io::Error::new(io::ErrorKind::Other, e)), + }; + } + } + + pub async fn read_by_hint(&mut self, hint: &dyn PduHint) -> io::Result { + loop { + match hint + .find_size(self.peek()) + .map_err(|e| io::Error::new(io::ErrorKind::Other, e))? + { + Some(length) => { + return self.read_exact(length).await; + } + None => { + let len = self.read().await?; + + // Handle EOF + if len == 0 { + return Err(io::Error::new(io::ErrorKind::UnexpectedEof, "not enough bytes")); + } + } + }; + } + } +} + +impl Framed +where + S: FramedWrite, +{ + /// Reads from stream and fills internal buffer + pub async fn write_all(&mut self, buf: &[u8]) -> io::Result<()> { + self.stream.write_all(buf).await + } +} diff --git a/crates/async/src/lib.rs b/crates/ironrdp-async/src/lib.rs similarity index 100% rename from crates/async/src/lib.rs rename to crates/ironrdp-async/src/lib.rs diff --git a/crates/async/src/session.rs b/crates/ironrdp-async/src/session.rs similarity index 100% rename from crates/async/src/session.rs rename to crates/ironrdp-async/src/session.rs diff --git a/crates/client-glutin/Cargo.toml b/crates/ironrdp-client-glutin/Cargo.toml similarity index 100% rename from crates/client-glutin/Cargo.toml rename to crates/ironrdp-client-glutin/Cargo.toml diff --git a/crates/client-glutin/README.md b/crates/ironrdp-client-glutin/README.md similarity index 100% rename from crates/client-glutin/README.md rename to crates/ironrdp-client-glutin/README.md diff --git a/crates/client-glutin/src/config.rs b/crates/ironrdp-client-glutin/src/config.rs similarity index 100% rename from crates/client-glutin/src/config.rs rename to crates/ironrdp-client-glutin/src/config.rs diff --git a/crates/client-glutin/src/gui.rs b/crates/ironrdp-client-glutin/src/gui.rs similarity index 100% rename from crates/client-glutin/src/gui.rs rename to crates/ironrdp-client-glutin/src/gui.rs diff --git a/crates/client-glutin/src/gui/input.rs b/crates/ironrdp-client-glutin/src/gui/input.rs similarity index 100% rename from crates/client-glutin/src/gui/input.rs rename to crates/ironrdp-client-glutin/src/gui/input.rs diff --git a/crates/client-glutin/src/main.rs b/crates/ironrdp-client-glutin/src/main.rs similarity index 100% rename from crates/client-glutin/src/main.rs rename to crates/ironrdp-client-glutin/src/main.rs diff --git a/crates/client/Cargo.toml b/crates/ironrdp-client/Cargo.toml similarity index 88% rename from crates/client/Cargo.toml rename to crates/ironrdp-client/Cargo.toml index 808313f5..fe8cd8b7 100644 --- a/crates/client/Cargo.toml +++ b/crates/ironrdp-client/Cargo.toml @@ -21,7 +21,7 @@ native-tls = ["ironrdp-tls/native-tls"] # Protocols ironrdp = { workspace = true, features = ["input", "graphics"] } ironrdp-tls.workspace = true -ironrdp-async = { workspace = true, features = ["tokio"] } +ironrdp-tokio.workspace = true sspi = { workspace = true, features = ["network_client"] } # TODO: enable dns_resolver at some point # GUI @@ -39,8 +39,6 @@ tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } # Async, futures tokio = { version = "1", features = ["full"]} -tokio-util = { version = "0.7.7", features = ["compat"] } -futures-util = "0.3" # Utils chrono = "0.4.24" diff --git a/crates/client/README.md b/crates/ironrdp-client/README.md similarity index 100% rename from crates/client/README.md rename to crates/ironrdp-client/README.md diff --git a/crates/client/src/config.rs b/crates/ironrdp-client/src/config.rs similarity index 100% rename from crates/client/src/config.rs rename to crates/ironrdp-client/src/config.rs diff --git a/crates/client/src/gui.rs b/crates/ironrdp-client/src/gui.rs similarity index 100% rename from crates/client/src/gui.rs rename to crates/ironrdp-client/src/gui.rs diff --git a/crates/client/src/lib.rs b/crates/ironrdp-client/src/lib.rs similarity index 100% rename from crates/client/src/lib.rs rename to crates/ironrdp-client/src/lib.rs diff --git a/crates/client/src/main.rs b/crates/ironrdp-client/src/main.rs similarity index 100% rename from crates/client/src/main.rs rename to crates/ironrdp-client/src/main.rs diff --git a/crates/client/src/rdp.rs b/crates/ironrdp-client/src/rdp.rs similarity index 94% rename from crates/client/src/rdp.rs rename to crates/ironrdp-client/src/rdp.rs index d833e178..821809bf 100644 --- a/crates/client/src/rdp.rs +++ b/crates/ironrdp-client/src/rdp.rs @@ -78,7 +78,7 @@ enum RdpControlFlow { TerminatedGracefully, } -type UpgradedFramed = ironrdp_async::Framed>>; +type UpgradedFramed = ironrdp_tokio::TokioFramed>; async fn connect(config: &Config) -> connector::Result<(connector::ConnectionResult, UpgradedFramed)> { let server_addr = config @@ -90,29 +90,29 @@ async fn connect(config: &Config) -> connector::Result<(connector::ConnectionRes .await .map_err(|e| connector::Error::new("TCP connect").with_custom(e))?; - let mut framed = ironrdp_async::Framed::tokio_new(stream); + let mut framed = ironrdp_tokio::TokioFramed::new(stream); let mut connector = connector::ClientConnector::new(config.connector.clone()) .with_server_addr(server_addr) .with_server_name(&config.destination) .with_credssp_client_factory(Box::new(RequestClientFactory)); - let should_upgrade = ironrdp_async::connect_begin(&mut framed, &mut connector).await?; + let should_upgrade = ironrdp_tokio::connect_begin(&mut framed, &mut connector).await?; debug!("TLS upgrade"); // Ensure there is no leftover - let initial_stream = framed.tokio_into_inner_no_leftover(); + let initial_stream = framed.into_inner_no_leftover(); let (upgraded_stream, server_public_key) = ironrdp_tls::upgrade(initial_stream, config.destination.name()) .await .map_err(|e| connector::Error::new("TLS upgrade").with_custom(e))?; - let upgraded = ironrdp_async::mark_as_upgraded(should_upgrade, &mut connector, server_public_key); + let upgraded = ironrdp_tokio::mark_as_upgraded(should_upgrade, &mut connector, server_public_key); - let mut upgraded_framed = ironrdp_async::Framed::tokio_new(upgraded_stream); + let mut upgraded_framed = ironrdp_tokio::TokioFramed::new(upgraded_stream); - let connection_result = ironrdp_async::connect_finalize(upgraded, &mut upgraded_framed, connector).await?; + let connection_result = ironrdp_tokio::connect_finalize(upgraded, &mut upgraded_framed, connector).await?; Ok((connection_result, upgraded_framed)) } diff --git a/crates/connector/Cargo.toml b/crates/ironrdp-connector/Cargo.toml similarity index 100% rename from crates/connector/Cargo.toml rename to crates/ironrdp-connector/Cargo.toml diff --git a/crates/connector/README.md b/crates/ironrdp-connector/README.md similarity index 100% rename from crates/connector/README.md rename to crates/ironrdp-connector/README.md diff --git a/crates/connector/src/channel_connection.rs b/crates/ironrdp-connector/src/channel_connection.rs similarity index 100% rename from crates/connector/src/channel_connection.rs rename to crates/ironrdp-connector/src/channel_connection.rs diff --git a/crates/connector/src/connection.rs b/crates/ironrdp-connector/src/connection.rs similarity index 100% rename from crates/connector/src/connection.rs rename to crates/ironrdp-connector/src/connection.rs diff --git a/crates/connector/src/connection_finalization.rs b/crates/ironrdp-connector/src/connection_finalization.rs similarity index 100% rename from crates/connector/src/connection_finalization.rs rename to crates/ironrdp-connector/src/connection_finalization.rs diff --git a/crates/connector/src/legacy.rs b/crates/ironrdp-connector/src/legacy.rs similarity index 100% rename from crates/connector/src/legacy.rs rename to crates/ironrdp-connector/src/legacy.rs diff --git a/crates/connector/src/lib.rs b/crates/ironrdp-connector/src/lib.rs similarity index 100% rename from crates/connector/src/lib.rs rename to crates/ironrdp-connector/src/lib.rs diff --git a/crates/connector/src/license_exchange.rs b/crates/ironrdp-connector/src/license_exchange.rs similarity index 100% rename from crates/connector/src/license_exchange.rs rename to crates/ironrdp-connector/src/license_exchange.rs diff --git a/crates/connector/src/server_name.rs b/crates/ironrdp-connector/src/server_name.rs similarity index 100% rename from crates/connector/src/server_name.rs rename to crates/ironrdp-connector/src/server_name.rs diff --git a/crates/ironrdp-futures/Cargo.toml b/crates/ironrdp-futures/Cargo.toml new file mode 100644 index 00000000..4ffffcec --- /dev/null +++ b/crates/ironrdp-futures/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "ironrdp-futures" +version = "0.1.0" +readme = "README.md" +description = "`Framed*` traits implementation above futures’s traits" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true +authors.workspace = true +keywords.workspace = true +categories.workspace = true + +[dependencies] +bytes = "1" +futures-util = { version = "0.3.26", features = ["io"] } +ironrdp-async.workspace = true diff --git a/crates/ironrdp-futures/src/lib.rs b/crates/ironrdp-futures/src/lib.rs new file mode 100644 index 00000000..c15022b0 --- /dev/null +++ b/crates/ironrdp-futures/src/lib.rs @@ -0,0 +1,76 @@ +use std::io; +use std::pin::Pin; + +use bytes::BytesMut; +use futures_util::io::{AsyncRead, AsyncWrite}; + +pub use ironrdp_async::*; + +pub type FuturesFramed = Framed>; + +pub struct FuturesStream { + inner: S, +} + +impl StreamWrapper for FuturesStream { + type InnerStream = S; + + fn from_inner(stream: Self::InnerStream) -> Self { + Self { inner: stream } + } + + fn into_inner(self) -> Self::InnerStream { + self.inner + } + + fn get_inner(&self) -> &Self::InnerStream { + &self.inner + } + + fn get_inner_mut(&mut self) -> &mut Self::InnerStream { + &mut self.inner + } +} + +impl FramedRead for FuturesStream +where + S: Unpin + AsyncRead, +{ + fn read<'a>( + &'a mut self, + buf: &'a mut BytesMut, + ) -> Pin> + 'a>> + where + Self: 'a, + { + use futures_util::io::AsyncReadExt as _; + + Box::pin(async { + // NOTE(perf): tokio implementation is more efficient + let mut read_bytes = [0u8; 1024]; + let len = self.inner.read(&mut read_bytes[..]).await?; + buf.extend_from_slice(&read_bytes[..len]); + + Ok(len) + }) + } +} + +impl FramedWrite for FuturesStream +where + S: Unpin + AsyncWrite, +{ + fn write_all<'a>(&'a mut self, buf: &'a [u8]) -> Pin> + 'a>> + where + Self: 'a, + { + use futures_util::io::AsyncWriteExt as _; + + Box::pin(async { + self.inner.write_all(buf).await?; + self.inner.flush().await?; + + Ok(()) + }) + } +} diff --git a/crates/glutin-renderer/Cargo.toml b/crates/ironrdp-glutin-renderer/Cargo.toml similarity index 100% rename from crates/glutin-renderer/Cargo.toml rename to crates/ironrdp-glutin-renderer/Cargo.toml diff --git a/crates/glutin-renderer/shaders/avc.vert b/crates/ironrdp-glutin-renderer/shaders/avc.vert similarity index 100% rename from crates/glutin-renderer/shaders/avc.vert rename to crates/ironrdp-glutin-renderer/shaders/avc.vert diff --git a/crates/glutin-renderer/shaders/avc420.frag b/crates/ironrdp-glutin-renderer/shaders/avc420.frag similarity index 100% rename from crates/glutin-renderer/shaders/avc420.frag rename to crates/ironrdp-glutin-renderer/shaders/avc420.frag diff --git a/crates/glutin-renderer/shaders/avc444.frag b/crates/ironrdp-glutin-renderer/shaders/avc444.frag similarity index 100% rename from crates/glutin-renderer/shaders/avc444.frag rename to crates/ironrdp-glutin-renderer/shaders/avc444.frag diff --git a/crates/glutin-renderer/shaders/avc444v2.frag b/crates/ironrdp-glutin-renderer/shaders/avc444v2.frag similarity index 100% rename from crates/glutin-renderer/shaders/avc444v2.frag rename to crates/ironrdp-glutin-renderer/shaders/avc444v2.frag diff --git a/crates/glutin-renderer/shaders/texture_shader.frag b/crates/ironrdp-glutin-renderer/shaders/texture_shader.frag similarity index 100% rename from crates/glutin-renderer/shaders/texture_shader.frag rename to crates/ironrdp-glutin-renderer/shaders/texture_shader.frag diff --git a/crates/glutin-renderer/shaders/texture_shader.vert b/crates/ironrdp-glutin-renderer/shaders/texture_shader.vert similarity index 100% rename from crates/glutin-renderer/shaders/texture_shader.vert rename to crates/ironrdp-glutin-renderer/shaders/texture_shader.vert diff --git a/crates/glutin-renderer/src/draw.rs b/crates/ironrdp-glutin-renderer/src/draw.rs similarity index 100% rename from crates/glutin-renderer/src/draw.rs rename to crates/ironrdp-glutin-renderer/src/draw.rs diff --git a/crates/glutin-renderer/src/lib.rs b/crates/ironrdp-glutin-renderer/src/lib.rs similarity index 100% rename from crates/glutin-renderer/src/lib.rs rename to crates/ironrdp-glutin-renderer/src/lib.rs diff --git a/crates/glutin-renderer/src/renderer.rs b/crates/ironrdp-glutin-renderer/src/renderer.rs similarity index 100% rename from crates/glutin-renderer/src/renderer.rs rename to crates/ironrdp-glutin-renderer/src/renderer.rs diff --git a/crates/glutin-renderer/src/surface.rs b/crates/ironrdp-glutin-renderer/src/surface.rs similarity index 100% rename from crates/glutin-renderer/src/surface.rs rename to crates/ironrdp-glutin-renderer/src/surface.rs diff --git a/crates/graphics/Cargo.toml b/crates/ironrdp-graphics/Cargo.toml similarity index 100% rename from crates/graphics/Cargo.toml rename to crates/ironrdp-graphics/Cargo.toml diff --git a/crates/graphics/README.md b/crates/ironrdp-graphics/README.md similarity index 100% rename from crates/graphics/README.md rename to crates/ironrdp-graphics/README.md diff --git a/crates/graphics/src/color_conversion.rs b/crates/ironrdp-graphics/src/color_conversion.rs similarity index 100% rename from crates/graphics/src/color_conversion.rs rename to crates/ironrdp-graphics/src/color_conversion.rs diff --git a/crates/graphics/src/dwt.rs b/crates/ironrdp-graphics/src/dwt.rs similarity index 100% rename from crates/graphics/src/dwt.rs rename to crates/ironrdp-graphics/src/dwt.rs diff --git a/crates/graphics/src/image_processing.rs b/crates/ironrdp-graphics/src/image_processing.rs similarity index 100% rename from crates/graphics/src/image_processing.rs rename to crates/ironrdp-graphics/src/image_processing.rs diff --git a/crates/graphics/src/lib.rs b/crates/ironrdp-graphics/src/lib.rs similarity index 100% rename from crates/graphics/src/lib.rs rename to crates/ironrdp-graphics/src/lib.rs diff --git a/crates/graphics/src/quantization.rs b/crates/ironrdp-graphics/src/quantization.rs similarity index 100% rename from crates/graphics/src/quantization.rs rename to crates/ironrdp-graphics/src/quantization.rs diff --git a/crates/graphics/src/rdp6/bitmap_stream.rs b/crates/ironrdp-graphics/src/rdp6/bitmap_stream.rs similarity index 100% rename from crates/graphics/src/rdp6/bitmap_stream.rs rename to crates/ironrdp-graphics/src/rdp6/bitmap_stream.rs diff --git a/crates/graphics/src/rdp6/mod.rs b/crates/ironrdp-graphics/src/rdp6/mod.rs similarity index 100% rename from crates/graphics/src/rdp6/mod.rs rename to crates/ironrdp-graphics/src/rdp6/mod.rs diff --git a/crates/graphics/src/rdp6/rle.rs b/crates/ironrdp-graphics/src/rdp6/rle.rs similarity index 100% rename from crates/graphics/src/rdp6/rle.rs rename to crates/ironrdp-graphics/src/rdp6/rle.rs diff --git a/crates/graphics/src/rdp6/test_assets/32x64_rgb_raw.bin b/crates/ironrdp-graphics/src/rdp6/test_assets/32x64_rgb_raw.bin similarity index 100% rename from crates/graphics/src/rdp6/test_assets/32x64_rgb_raw.bin rename to crates/ironrdp-graphics/src/rdp6/test_assets/32x64_rgb_raw.bin diff --git a/crates/graphics/src/rdp6/test_assets/32x64_rgb_raw.bmp b/crates/ironrdp-graphics/src/rdp6/test_assets/32x64_rgb_raw.bmp similarity index 100% rename from crates/graphics/src/rdp6/test_assets/32x64_rgb_raw.bmp rename to crates/ironrdp-graphics/src/rdp6/test_assets/32x64_rgb_raw.bmp diff --git a/crates/graphics/src/rdp6/test_assets/64x24_argb_rle.bin b/crates/ironrdp-graphics/src/rdp6/test_assets/64x24_argb_rle.bin similarity index 100% rename from crates/graphics/src/rdp6/test_assets/64x24_argb_rle.bin rename to crates/ironrdp-graphics/src/rdp6/test_assets/64x24_argb_rle.bin diff --git a/crates/graphics/src/rdp6/test_assets/64x24_argb_rle.bmp b/crates/ironrdp-graphics/src/rdp6/test_assets/64x24_argb_rle.bmp similarity index 100% rename from crates/graphics/src/rdp6/test_assets/64x24_argb_rle.bmp rename to crates/ironrdp-graphics/src/rdp6/test_assets/64x24_argb_rle.bmp diff --git a/crates/graphics/src/rdp6/test_assets/64x24_aycocg_rle.bin b/crates/ironrdp-graphics/src/rdp6/test_assets/64x24_aycocg_rle.bin similarity index 100% rename from crates/graphics/src/rdp6/test_assets/64x24_aycocg_rle.bin rename to crates/ironrdp-graphics/src/rdp6/test_assets/64x24_aycocg_rle.bin diff --git a/crates/graphics/src/rdp6/test_assets/64x24_aycocg_rle.bmp b/crates/ironrdp-graphics/src/rdp6/test_assets/64x24_aycocg_rle.bmp similarity index 100% rename from crates/graphics/src/rdp6/test_assets/64x24_aycocg_rle.bmp rename to crates/ironrdp-graphics/src/rdp6/test_assets/64x24_aycocg_rle.bmp diff --git a/crates/graphics/src/rdp6/test_assets/64x24_ycocg_rle_ss.bin b/crates/ironrdp-graphics/src/rdp6/test_assets/64x24_ycocg_rle_ss.bin similarity index 100% rename from crates/graphics/src/rdp6/test_assets/64x24_ycocg_rle_ss.bin rename to crates/ironrdp-graphics/src/rdp6/test_assets/64x24_ycocg_rle_ss.bin diff --git a/crates/graphics/src/rdp6/test_assets/64x24_ycocg_rle_ss.bmp b/crates/ironrdp-graphics/src/rdp6/test_assets/64x24_ycocg_rle_ss.bmp similarity index 100% rename from crates/graphics/src/rdp6/test_assets/64x24_ycocg_rle_ss.bmp rename to crates/ironrdp-graphics/src/rdp6/test_assets/64x24_ycocg_rle_ss.bmp diff --git a/crates/graphics/src/rdp6/test_assets/64x57_ycocg_rle_ss.bin b/crates/ironrdp-graphics/src/rdp6/test_assets/64x57_ycocg_rle_ss.bin similarity index 100% rename from crates/graphics/src/rdp6/test_assets/64x57_ycocg_rle_ss.bin rename to crates/ironrdp-graphics/src/rdp6/test_assets/64x57_ycocg_rle_ss.bin diff --git a/crates/graphics/src/rdp6/test_assets/64x57_ycocg_rle_ss.bmp b/crates/ironrdp-graphics/src/rdp6/test_assets/64x57_ycocg_rle_ss.bmp similarity index 100% rename from crates/graphics/src/rdp6/test_assets/64x57_ycocg_rle_ss.bmp rename to crates/ironrdp-graphics/src/rdp6/test_assets/64x57_ycocg_rle_ss.bmp diff --git a/crates/graphics/src/rdp6/test_assets/64x64_ycocg_raw_ss.bin b/crates/ironrdp-graphics/src/rdp6/test_assets/64x64_ycocg_raw_ss.bin similarity index 100% rename from crates/graphics/src/rdp6/test_assets/64x64_ycocg_raw_ss.bin rename to crates/ironrdp-graphics/src/rdp6/test_assets/64x64_ycocg_raw_ss.bin diff --git a/crates/graphics/src/rdp6/test_assets/64x64_ycocg_raw_ss.bmp b/crates/ironrdp-graphics/src/rdp6/test_assets/64x64_ycocg_raw_ss.bmp similarity index 100% rename from crates/graphics/src/rdp6/test_assets/64x64_ycocg_raw_ss.bmp rename to crates/ironrdp-graphics/src/rdp6/test_assets/64x64_ycocg_raw_ss.bmp diff --git a/crates/graphics/src/rectangle_processing.rs b/crates/ironrdp-graphics/src/rectangle_processing.rs similarity index 100% rename from crates/graphics/src/rectangle_processing.rs rename to crates/ironrdp-graphics/src/rectangle_processing.rs diff --git a/crates/graphics/src/rle.rs b/crates/ironrdp-graphics/src/rle.rs similarity index 100% rename from crates/graphics/src/rle.rs rename to crates/ironrdp-graphics/src/rle.rs diff --git a/crates/graphics/src/rlgr.rs b/crates/ironrdp-graphics/src/rlgr.rs similarity index 100% rename from crates/graphics/src/rlgr.rs rename to crates/ironrdp-graphics/src/rlgr.rs diff --git a/crates/graphics/src/subband_reconstruction.rs b/crates/ironrdp-graphics/src/subband_reconstruction.rs similarity index 100% rename from crates/graphics/src/subband_reconstruction.rs rename to crates/ironrdp-graphics/src/subband_reconstruction.rs diff --git a/crates/graphics/src/utils.rs b/crates/ironrdp-graphics/src/utils.rs similarity index 100% rename from crates/graphics/src/utils.rs rename to crates/ironrdp-graphics/src/utils.rs diff --git a/crates/graphics/src/zgfx/circular_buffer.rs b/crates/ironrdp-graphics/src/zgfx/circular_buffer.rs similarity index 100% rename from crates/graphics/src/zgfx/circular_buffer.rs rename to crates/ironrdp-graphics/src/zgfx/circular_buffer.rs diff --git a/crates/graphics/src/zgfx/control_messages.rs b/crates/ironrdp-graphics/src/zgfx/control_messages.rs similarity index 100% rename from crates/graphics/src/zgfx/control_messages.rs rename to crates/ironrdp-graphics/src/zgfx/control_messages.rs diff --git a/crates/graphics/src/zgfx/mod.rs b/crates/ironrdp-graphics/src/zgfx/mod.rs similarity index 100% rename from crates/graphics/src/zgfx/mod.rs rename to crates/ironrdp-graphics/src/zgfx/mod.rs diff --git a/crates/graphics/src/zgfx/test_assets/decoded.0.bin b/crates/ironrdp-graphics/src/zgfx/test_assets/decoded.0.bin similarity index 100% rename from crates/graphics/src/zgfx/test_assets/decoded.0.bin rename to crates/ironrdp-graphics/src/zgfx/test_assets/decoded.0.bin diff --git a/crates/graphics/src/zgfx/test_assets/decoded.1.bin b/crates/ironrdp-graphics/src/zgfx/test_assets/decoded.1.bin similarity index 100% rename from crates/graphics/src/zgfx/test_assets/decoded.1.bin rename to crates/ironrdp-graphics/src/zgfx/test_assets/decoded.1.bin diff --git a/crates/graphics/src/zgfx/test_assets/decoded.2.bin b/crates/ironrdp-graphics/src/zgfx/test_assets/decoded.2.bin similarity index 100% rename from crates/graphics/src/zgfx/test_assets/decoded.2.bin rename to crates/ironrdp-graphics/src/zgfx/test_assets/decoded.2.bin diff --git a/crates/graphics/src/zgfx/test_assets/decoded.3.bin b/crates/ironrdp-graphics/src/zgfx/test_assets/decoded.3.bin similarity index 100% rename from crates/graphics/src/zgfx/test_assets/decoded.3.bin rename to crates/ironrdp-graphics/src/zgfx/test_assets/decoded.3.bin diff --git a/crates/graphics/src/zgfx/test_assets/decoded.4.bin b/crates/ironrdp-graphics/src/zgfx/test_assets/decoded.4.bin similarity index 100% rename from crates/graphics/src/zgfx/test_assets/decoded.4.bin rename to crates/ironrdp-graphics/src/zgfx/test_assets/decoded.4.bin diff --git a/crates/graphics/src/zgfx/test_assets/encoded.0.bin b/crates/ironrdp-graphics/src/zgfx/test_assets/encoded.0.bin similarity index 100% rename from crates/graphics/src/zgfx/test_assets/encoded.0.bin rename to crates/ironrdp-graphics/src/zgfx/test_assets/encoded.0.bin diff --git a/crates/graphics/src/zgfx/test_assets/encoded.1.bin b/crates/ironrdp-graphics/src/zgfx/test_assets/encoded.1.bin similarity index 100% rename from crates/graphics/src/zgfx/test_assets/encoded.1.bin rename to crates/ironrdp-graphics/src/zgfx/test_assets/encoded.1.bin diff --git a/crates/graphics/src/zgfx/test_assets/encoded.2.bin b/crates/ironrdp-graphics/src/zgfx/test_assets/encoded.2.bin similarity index 100% rename from crates/graphics/src/zgfx/test_assets/encoded.2.bin rename to crates/ironrdp-graphics/src/zgfx/test_assets/encoded.2.bin diff --git a/crates/graphics/src/zgfx/test_assets/encoded.3.bin b/crates/ironrdp-graphics/src/zgfx/test_assets/encoded.3.bin similarity index 100% rename from crates/graphics/src/zgfx/test_assets/encoded.3.bin rename to crates/ironrdp-graphics/src/zgfx/test_assets/encoded.3.bin diff --git a/crates/graphics/src/zgfx/test_assets/encoded.4.bin b/crates/ironrdp-graphics/src/zgfx/test_assets/encoded.4.bin similarity index 100% rename from crates/graphics/src/zgfx/test_assets/encoded.4.bin rename to crates/ironrdp-graphics/src/zgfx/test_assets/encoded.4.bin diff --git a/crates/graphics/tests/color_conversion.rs b/crates/ironrdp-graphics/tests/color_conversion.rs similarity index 100% rename from crates/graphics/tests/color_conversion.rs rename to crates/ironrdp-graphics/tests/color_conversion.rs diff --git a/crates/graphics/tests/dwt.rs b/crates/ironrdp-graphics/tests/dwt.rs similarity index 100% rename from crates/graphics/tests/dwt.rs rename to crates/ironrdp-graphics/tests/dwt.rs diff --git a/crates/graphics/tests/image_processing.rs b/crates/ironrdp-graphics/tests/image_processing.rs similarity index 100% rename from crates/graphics/tests/image_processing.rs rename to crates/ironrdp-graphics/tests/image_processing.rs diff --git a/crates/graphics/tests/rle.rs b/crates/ironrdp-graphics/tests/rle.rs similarity index 100% rename from crates/graphics/tests/rle.rs rename to crates/ironrdp-graphics/tests/rle.rs diff --git a/crates/graphics/tests/rlgr.rs b/crates/ironrdp-graphics/tests/rlgr.rs similarity index 100% rename from crates/graphics/tests/rlgr.rs rename to crates/ironrdp-graphics/tests/rlgr.rs diff --git a/crates/input/Cargo.toml b/crates/ironrdp-input/Cargo.toml similarity index 100% rename from crates/input/Cargo.toml rename to crates/ironrdp-input/Cargo.toml diff --git a/crates/input/README.md b/crates/ironrdp-input/README.md similarity index 100% rename from crates/input/README.md rename to crates/ironrdp-input/README.md diff --git a/crates/input/src/lib.rs b/crates/ironrdp-input/src/lib.rs similarity index 100% rename from crates/input/src/lib.rs rename to crates/ironrdp-input/src/lib.rs diff --git a/crates/input/tests/fastpath_packets.rs b/crates/ironrdp-input/tests/fastpath_packets.rs similarity index 100% rename from crates/input/tests/fastpath_packets.rs rename to crates/ironrdp-input/tests/fastpath_packets.rs diff --git a/crates/input/tests/smoke.rs b/crates/ironrdp-input/tests/smoke.rs similarity index 100% rename from crates/input/tests/smoke.rs rename to crates/ironrdp-input/tests/smoke.rs diff --git a/crates/pdu-generators/Cargo.toml b/crates/ironrdp-pdu-generators/Cargo.toml similarity index 100% rename from crates/pdu-generators/Cargo.toml rename to crates/ironrdp-pdu-generators/Cargo.toml diff --git a/crates/pdu-generators/src/lib.rs b/crates/ironrdp-pdu-generators/src/lib.rs similarity index 100% rename from crates/pdu-generators/src/lib.rs rename to crates/ironrdp-pdu-generators/src/lib.rs diff --git a/crates/pdu-samples/Cargo.toml b/crates/ironrdp-pdu-samples/Cargo.toml similarity index 100% rename from crates/pdu-samples/Cargo.toml rename to crates/ironrdp-pdu-samples/Cargo.toml diff --git a/crates/pdu-samples/src/capsets.rs b/crates/ironrdp-pdu-samples/src/capsets.rs similarity index 100% rename from crates/pdu-samples/src/capsets.rs rename to crates/ironrdp-pdu-samples/src/capsets.rs diff --git a/crates/pdu-samples/src/client_info.rs b/crates/ironrdp-pdu-samples/src/client_info.rs similarity index 100% rename from crates/pdu-samples/src/client_info.rs rename to crates/ironrdp-pdu-samples/src/client_info.rs diff --git a/crates/pdu-samples/src/cluster_data.rs b/crates/ironrdp-pdu-samples/src/cluster_data.rs similarity index 100% rename from crates/pdu-samples/src/cluster_data.rs rename to crates/ironrdp-pdu-samples/src/cluster_data.rs diff --git a/crates/pdu-samples/src/conference_create.rs b/crates/ironrdp-pdu-samples/src/conference_create.rs similarity index 100% rename from crates/pdu-samples/src/conference_create.rs rename to crates/ironrdp-pdu-samples/src/conference_create.rs diff --git a/crates/pdu-samples/src/core_data.rs b/crates/ironrdp-pdu-samples/src/core_data.rs similarity index 100% rename from crates/pdu-samples/src/core_data.rs rename to crates/ironrdp-pdu-samples/src/core_data.rs diff --git a/crates/pdu-samples/src/gcc.rs b/crates/ironrdp-pdu-samples/src/gcc.rs similarity index 100% rename from crates/pdu-samples/src/gcc.rs rename to crates/ironrdp-pdu-samples/src/gcc.rs diff --git a/crates/pdu-samples/src/gfx.rs b/crates/ironrdp-pdu-samples/src/gfx.rs similarity index 100% rename from crates/pdu-samples/src/gfx.rs rename to crates/ironrdp-pdu-samples/src/gfx.rs diff --git a/crates/pdu-samples/src/graphics_messages.rs b/crates/ironrdp-pdu-samples/src/graphics_messages.rs similarity index 100% rename from crates/pdu-samples/src/graphics_messages.rs rename to crates/ironrdp-pdu-samples/src/graphics_messages.rs diff --git a/crates/pdu-samples/src/lib.rs b/crates/ironrdp-pdu-samples/src/lib.rs similarity index 100% rename from crates/pdu-samples/src/lib.rs rename to crates/ironrdp-pdu-samples/src/lib.rs diff --git a/crates/pdu-samples/src/macros.rs b/crates/ironrdp-pdu-samples/src/macros.rs similarity index 100% rename from crates/pdu-samples/src/macros.rs rename to crates/ironrdp-pdu-samples/src/macros.rs diff --git a/crates/pdu-samples/src/mcs.rs b/crates/ironrdp-pdu-samples/src/mcs.rs similarity index 100% rename from crates/pdu-samples/src/mcs.rs rename to crates/ironrdp-pdu-samples/src/mcs.rs diff --git a/crates/pdu-samples/src/message_channel_data.rs b/crates/ironrdp-pdu-samples/src/message_channel_data.rs similarity index 100% rename from crates/pdu-samples/src/message_channel_data.rs rename to crates/ironrdp-pdu-samples/src/message_channel_data.rs diff --git a/crates/pdu-samples/src/monitor_data.rs b/crates/ironrdp-pdu-samples/src/monitor_data.rs similarity index 100% rename from crates/pdu-samples/src/monitor_data.rs rename to crates/ironrdp-pdu-samples/src/monitor_data.rs diff --git a/crates/pdu-samples/src/monitor_extended_data.rs b/crates/ironrdp-pdu-samples/src/monitor_extended_data.rs similarity index 100% rename from crates/pdu-samples/src/monitor_extended_data.rs rename to crates/ironrdp-pdu-samples/src/monitor_extended_data.rs diff --git a/crates/pdu-samples/src/multi_transport_channel_data.rs b/crates/ironrdp-pdu-samples/src/multi_transport_channel_data.rs similarity index 100% rename from crates/pdu-samples/src/multi_transport_channel_data.rs rename to crates/ironrdp-pdu-samples/src/multi_transport_channel_data.rs diff --git a/crates/pdu-samples/src/network_data.rs b/crates/ironrdp-pdu-samples/src/network_data.rs similarity index 100% rename from crates/pdu-samples/src/network_data.rs rename to crates/ironrdp-pdu-samples/src/network_data.rs diff --git a/crates/pdu-samples/src/rdp.rs b/crates/ironrdp-pdu-samples/src/rdp.rs similarity index 100% rename from crates/pdu-samples/src/rdp.rs rename to crates/ironrdp-pdu-samples/src/rdp.rs diff --git a/crates/pdu-samples/src/security_data.rs b/crates/ironrdp-pdu-samples/src/security_data.rs similarity index 100% rename from crates/pdu-samples/src/security_data.rs rename to crates/ironrdp-pdu-samples/src/security_data.rs diff --git a/crates/pdu/Cargo.toml b/crates/ironrdp-pdu/Cargo.toml similarity index 100% rename from crates/pdu/Cargo.toml rename to crates/ironrdp-pdu/Cargo.toml diff --git a/crates/pdu/README.md b/crates/ironrdp-pdu/README.md similarity index 100% rename from crates/pdu/README.md rename to crates/ironrdp-pdu/README.md diff --git a/crates/pdu/src/basic_output.rs b/crates/ironrdp-pdu/src/basic_output.rs similarity index 100% rename from crates/pdu/src/basic_output.rs rename to crates/ironrdp-pdu/src/basic_output.rs diff --git a/crates/pdu/src/basic_output/bitmap.rs b/crates/ironrdp-pdu/src/basic_output/bitmap.rs similarity index 100% rename from crates/pdu/src/basic_output/bitmap.rs rename to crates/ironrdp-pdu/src/basic_output/bitmap.rs diff --git a/crates/pdu/src/basic_output/bitmap/rdp6.rs b/crates/ironrdp-pdu/src/basic_output/bitmap/rdp6.rs similarity index 100% rename from crates/pdu/src/basic_output/bitmap/rdp6.rs rename to crates/ironrdp-pdu/src/basic_output/bitmap/rdp6.rs diff --git a/crates/pdu/src/basic_output/bitmap/tests.rs b/crates/ironrdp-pdu/src/basic_output/bitmap/tests.rs similarity index 100% rename from crates/pdu/src/basic_output/bitmap/tests.rs rename to crates/ironrdp-pdu/src/basic_output/bitmap/tests.rs diff --git a/crates/pdu/src/basic_output/fast_path.rs b/crates/ironrdp-pdu/src/basic_output/fast_path.rs similarity index 100% rename from crates/pdu/src/basic_output/fast_path.rs rename to crates/ironrdp-pdu/src/basic_output/fast_path.rs diff --git a/crates/pdu/src/basic_output/fast_path/tests.rs b/crates/ironrdp-pdu/src/basic_output/fast_path/tests.rs similarity index 100% rename from crates/pdu/src/basic_output/fast_path/tests.rs rename to crates/ironrdp-pdu/src/basic_output/fast_path/tests.rs diff --git a/crates/pdu/src/basic_output/surface_commands.rs b/crates/ironrdp-pdu/src/basic_output/surface_commands.rs similarity index 100% rename from crates/pdu/src/basic_output/surface_commands.rs rename to crates/ironrdp-pdu/src/basic_output/surface_commands.rs diff --git a/crates/pdu/src/basic_output/surface_commands/tests.rs b/crates/ironrdp-pdu/src/basic_output/surface_commands/tests.rs similarity index 100% rename from crates/pdu/src/basic_output/surface_commands/tests.rs rename to crates/ironrdp-pdu/src/basic_output/surface_commands/tests.rs diff --git a/crates/pdu/src/ber.rs b/crates/ironrdp-pdu/src/ber.rs similarity index 100% rename from crates/pdu/src/ber.rs rename to crates/ironrdp-pdu/src/ber.rs diff --git a/crates/pdu/src/codecs.rs b/crates/ironrdp-pdu/src/codecs.rs similarity index 100% rename from crates/pdu/src/codecs.rs rename to crates/ironrdp-pdu/src/codecs.rs diff --git a/crates/pdu/src/codecs/rfx.rs b/crates/ironrdp-pdu/src/codecs/rfx.rs similarity index 100% rename from crates/pdu/src/codecs/rfx.rs rename to crates/ironrdp-pdu/src/codecs/rfx.rs diff --git a/crates/pdu/src/codecs/rfx/data_messages.rs b/crates/ironrdp-pdu/src/codecs/rfx/data_messages.rs similarity index 100% rename from crates/pdu/src/codecs/rfx/data_messages.rs rename to crates/ironrdp-pdu/src/codecs/rfx/data_messages.rs diff --git a/crates/pdu/src/codecs/rfx/header_messages.rs b/crates/ironrdp-pdu/src/codecs/rfx/header_messages.rs similarity index 100% rename from crates/pdu/src/codecs/rfx/header_messages.rs rename to crates/ironrdp-pdu/src/codecs/rfx/header_messages.rs diff --git a/crates/pdu/src/crypto.rs b/crates/ironrdp-pdu/src/crypto.rs similarity index 100% rename from crates/pdu/src/crypto.rs rename to crates/ironrdp-pdu/src/crypto.rs diff --git a/crates/pdu/src/crypto/rc4.rs b/crates/ironrdp-pdu/src/crypto/rc4.rs similarity index 100% rename from crates/pdu/src/crypto/rc4.rs rename to crates/ironrdp-pdu/src/crypto/rc4.rs diff --git a/crates/pdu/src/crypto/rsa.rs b/crates/ironrdp-pdu/src/crypto/rsa.rs similarity index 100% rename from crates/pdu/src/crypto/rsa.rs rename to crates/ironrdp-pdu/src/crypto/rsa.rs diff --git a/crates/pdu/src/cursor.rs b/crates/ironrdp-pdu/src/cursor.rs similarity index 100% rename from crates/pdu/src/cursor.rs rename to crates/ironrdp-pdu/src/cursor.rs diff --git a/crates/pdu/src/gcc.rs b/crates/ironrdp-pdu/src/gcc.rs similarity index 100% rename from crates/pdu/src/gcc.rs rename to crates/ironrdp-pdu/src/gcc.rs diff --git a/crates/pdu/src/gcc/cluster_data.rs b/crates/ironrdp-pdu/src/gcc/cluster_data.rs similarity index 100% rename from crates/pdu/src/gcc/cluster_data.rs rename to crates/ironrdp-pdu/src/gcc/cluster_data.rs diff --git a/crates/pdu/src/gcc/conference_create.rs b/crates/ironrdp-pdu/src/gcc/conference_create.rs similarity index 100% rename from crates/pdu/src/gcc/conference_create.rs rename to crates/ironrdp-pdu/src/gcc/conference_create.rs diff --git a/crates/pdu/src/gcc/core_data.rs b/crates/ironrdp-pdu/src/gcc/core_data.rs similarity index 100% rename from crates/pdu/src/gcc/core_data.rs rename to crates/ironrdp-pdu/src/gcc/core_data.rs diff --git a/crates/pdu/src/gcc/core_data/client.rs b/crates/ironrdp-pdu/src/gcc/core_data/client.rs similarity index 100% rename from crates/pdu/src/gcc/core_data/client.rs rename to crates/ironrdp-pdu/src/gcc/core_data/client.rs diff --git a/crates/pdu/src/gcc/core_data/server.rs b/crates/ironrdp-pdu/src/gcc/core_data/server.rs similarity index 100% rename from crates/pdu/src/gcc/core_data/server.rs rename to crates/ironrdp-pdu/src/gcc/core_data/server.rs diff --git a/crates/pdu/src/gcc/message_channel_data.rs b/crates/ironrdp-pdu/src/gcc/message_channel_data.rs similarity index 100% rename from crates/pdu/src/gcc/message_channel_data.rs rename to crates/ironrdp-pdu/src/gcc/message_channel_data.rs diff --git a/crates/pdu/src/gcc/monitor_data.rs b/crates/ironrdp-pdu/src/gcc/monitor_data.rs similarity index 100% rename from crates/pdu/src/gcc/monitor_data.rs rename to crates/ironrdp-pdu/src/gcc/monitor_data.rs diff --git a/crates/pdu/src/gcc/monitor_extended_data.rs b/crates/ironrdp-pdu/src/gcc/monitor_extended_data.rs similarity index 100% rename from crates/pdu/src/gcc/monitor_extended_data.rs rename to crates/ironrdp-pdu/src/gcc/monitor_extended_data.rs diff --git a/crates/pdu/src/gcc/multi_transport_channel_data.rs b/crates/ironrdp-pdu/src/gcc/multi_transport_channel_data.rs similarity index 100% rename from crates/pdu/src/gcc/multi_transport_channel_data.rs rename to crates/ironrdp-pdu/src/gcc/multi_transport_channel_data.rs diff --git a/crates/pdu/src/gcc/network_data.rs b/crates/ironrdp-pdu/src/gcc/network_data.rs similarity index 100% rename from crates/pdu/src/gcc/network_data.rs rename to crates/ironrdp-pdu/src/gcc/network_data.rs diff --git a/crates/pdu/src/gcc/security_data.rs b/crates/ironrdp-pdu/src/gcc/security_data.rs similarity index 100% rename from crates/pdu/src/gcc/security_data.rs rename to crates/ironrdp-pdu/src/gcc/security_data.rs diff --git a/crates/pdu/src/geometry.rs b/crates/ironrdp-pdu/src/geometry.rs similarity index 100% rename from crates/pdu/src/geometry.rs rename to crates/ironrdp-pdu/src/geometry.rs diff --git a/crates/pdu/src/input/fast_path.rs b/crates/ironrdp-pdu/src/input/fast_path.rs similarity index 100% rename from crates/pdu/src/input/fast_path.rs rename to crates/ironrdp-pdu/src/input/fast_path.rs diff --git a/crates/pdu/src/input/mod.rs b/crates/ironrdp-pdu/src/input/mod.rs similarity index 100% rename from crates/pdu/src/input/mod.rs rename to crates/ironrdp-pdu/src/input/mod.rs diff --git a/crates/pdu/src/input/mouse.rs b/crates/ironrdp-pdu/src/input/mouse.rs similarity index 100% rename from crates/pdu/src/input/mouse.rs rename to crates/ironrdp-pdu/src/input/mouse.rs diff --git a/crates/pdu/src/input/mouse_x.rs b/crates/ironrdp-pdu/src/input/mouse_x.rs similarity index 100% rename from crates/pdu/src/input/mouse_x.rs rename to crates/ironrdp-pdu/src/input/mouse_x.rs diff --git a/crates/pdu/src/input/scan_code.rs b/crates/ironrdp-pdu/src/input/scan_code.rs similarity index 100% rename from crates/pdu/src/input/scan_code.rs rename to crates/ironrdp-pdu/src/input/scan_code.rs diff --git a/crates/pdu/src/input/sync.rs b/crates/ironrdp-pdu/src/input/sync.rs similarity index 100% rename from crates/pdu/src/input/sync.rs rename to crates/ironrdp-pdu/src/input/sync.rs diff --git a/crates/pdu/src/input/unicode.rs b/crates/ironrdp-pdu/src/input/unicode.rs similarity index 100% rename from crates/pdu/src/input/unicode.rs rename to crates/ironrdp-pdu/src/input/unicode.rs diff --git a/crates/pdu/src/input/unused.rs b/crates/ironrdp-pdu/src/input/unused.rs similarity index 100% rename from crates/pdu/src/input/unused.rs rename to crates/ironrdp-pdu/src/input/unused.rs diff --git a/crates/pdu/src/lib.rs b/crates/ironrdp-pdu/src/lib.rs similarity index 100% rename from crates/pdu/src/lib.rs rename to crates/ironrdp-pdu/src/lib.rs diff --git a/crates/pdu/src/macros.rs b/crates/ironrdp-pdu/src/macros.rs similarity index 100% rename from crates/pdu/src/macros.rs rename to crates/ironrdp-pdu/src/macros.rs diff --git a/crates/pdu/src/mcs.rs b/crates/ironrdp-pdu/src/mcs.rs similarity index 100% rename from crates/pdu/src/mcs.rs rename to crates/ironrdp-pdu/src/mcs.rs diff --git a/crates/pdu/src/nego.rs b/crates/ironrdp-pdu/src/nego.rs similarity index 100% rename from crates/pdu/src/nego.rs rename to crates/ironrdp-pdu/src/nego.rs diff --git a/crates/pdu/src/padding.rs b/crates/ironrdp-pdu/src/padding.rs similarity index 100% rename from crates/pdu/src/padding.rs rename to crates/ironrdp-pdu/src/padding.rs diff --git a/crates/pdu/src/pcb.rs b/crates/ironrdp-pdu/src/pcb.rs similarity index 100% rename from crates/pdu/src/pcb.rs rename to crates/ironrdp-pdu/src/pcb.rs diff --git a/crates/pdu/src/per.rs b/crates/ironrdp-pdu/src/per.rs similarity index 100% rename from crates/pdu/src/per.rs rename to crates/ironrdp-pdu/src/per.rs diff --git a/crates/pdu/src/rdp.rs b/crates/ironrdp-pdu/src/rdp.rs similarity index 100% rename from crates/pdu/src/rdp.rs rename to crates/ironrdp-pdu/src/rdp.rs diff --git a/crates/pdu/src/rdp/capability_sets.rs b/crates/ironrdp-pdu/src/rdp/capability_sets.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets.rs diff --git a/crates/pdu/src/rdp/capability_sets/bitmap.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/bitmap.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/bitmap.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/bitmap.rs diff --git a/crates/pdu/src/rdp/capability_sets/bitmap/tests.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/bitmap/tests.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/bitmap/tests.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/bitmap/tests.rs diff --git a/crates/pdu/src/rdp/capability_sets/bitmap_cache.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/bitmap_cache.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/bitmap_cache.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/bitmap_cache.rs diff --git a/crates/pdu/src/rdp/capability_sets/bitmap_cache/tests.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/bitmap_cache/tests.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/bitmap_cache/tests.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/bitmap_cache/tests.rs diff --git a/crates/pdu/src/rdp/capability_sets/bitmap_codecs.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/bitmap_codecs.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/bitmap_codecs.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/bitmap_codecs.rs diff --git a/crates/pdu/src/rdp/capability_sets/bitmap_codecs/tests.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/bitmap_codecs/tests.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/bitmap_codecs/tests.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/bitmap_codecs/tests.rs diff --git a/crates/pdu/src/rdp/capability_sets/brush.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/brush.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/brush.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/brush.rs diff --git a/crates/pdu/src/rdp/capability_sets/brush/tests.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/brush/tests.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/brush/tests.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/brush/tests.rs diff --git a/crates/pdu/src/rdp/capability_sets/frame_acknowledge.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/frame_acknowledge.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/frame_acknowledge.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/frame_acknowledge.rs diff --git a/crates/pdu/src/rdp/capability_sets/general.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/general.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/general.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/general.rs diff --git a/crates/pdu/src/rdp/capability_sets/general/tests.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/general/tests.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/general/tests.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/general/tests.rs diff --git a/crates/pdu/src/rdp/capability_sets/glyph_cache.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/glyph_cache.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/glyph_cache.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/glyph_cache.rs diff --git a/crates/pdu/src/rdp/capability_sets/glyph_cache/tests.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/glyph_cache/tests.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/glyph_cache/tests.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/glyph_cache/tests.rs diff --git a/crates/pdu/src/rdp/capability_sets/input.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/input.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/input.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/input.rs diff --git a/crates/pdu/src/rdp/capability_sets/input/tests.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/input/tests.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/input/tests.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/input/tests.rs diff --git a/crates/pdu/src/rdp/capability_sets/large_pointer.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/large_pointer.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/large_pointer.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/large_pointer.rs diff --git a/crates/pdu/src/rdp/capability_sets/multifragment_update.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/multifragment_update.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/multifragment_update.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/multifragment_update.rs diff --git a/crates/pdu/src/rdp/capability_sets/offscreen_bitmap_cache.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/offscreen_bitmap_cache.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/offscreen_bitmap_cache.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/offscreen_bitmap_cache.rs diff --git a/crates/pdu/src/rdp/capability_sets/offscreen_bitmap_cache/tests.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/offscreen_bitmap_cache/tests.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/offscreen_bitmap_cache/tests.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/offscreen_bitmap_cache/tests.rs diff --git a/crates/pdu/src/rdp/capability_sets/order.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/order.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/order.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/order.rs diff --git a/crates/pdu/src/rdp/capability_sets/order/tests.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/order/tests.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/order/tests.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/order/tests.rs diff --git a/crates/pdu/src/rdp/capability_sets/pointer.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/pointer.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/pointer.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/pointer.rs diff --git a/crates/pdu/src/rdp/capability_sets/pointer/tests.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/pointer/tests.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/pointer/tests.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/pointer/tests.rs diff --git a/crates/pdu/src/rdp/capability_sets/sound.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/sound.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/sound.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/sound.rs diff --git a/crates/pdu/src/rdp/capability_sets/sound/tests.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/sound/tests.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/sound/tests.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/sound/tests.rs diff --git a/crates/pdu/src/rdp/capability_sets/surface_commands.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/surface_commands.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/surface_commands.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/surface_commands.rs diff --git a/crates/pdu/src/rdp/capability_sets/surface_commands/tests.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/surface_commands/tests.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/surface_commands/tests.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/surface_commands/tests.rs diff --git a/crates/pdu/src/rdp/capability_sets/virtual_channel.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/virtual_channel.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/virtual_channel.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/virtual_channel.rs diff --git a/crates/pdu/src/rdp/capability_sets/virtual_channel/tests.rs b/crates/ironrdp-pdu/src/rdp/capability_sets/virtual_channel/tests.rs similarity index 100% rename from crates/pdu/src/rdp/capability_sets/virtual_channel/tests.rs rename to crates/ironrdp-pdu/src/rdp/capability_sets/virtual_channel/tests.rs diff --git a/crates/pdu/src/rdp/client_info.rs b/crates/ironrdp-pdu/src/rdp/client_info.rs similarity index 100% rename from crates/pdu/src/rdp/client_info.rs rename to crates/ironrdp-pdu/src/rdp/client_info.rs diff --git a/crates/pdu/src/rdp/finalization_messages.rs b/crates/ironrdp-pdu/src/rdp/finalization_messages.rs similarity index 100% rename from crates/pdu/src/rdp/finalization_messages.rs rename to crates/ironrdp-pdu/src/rdp/finalization_messages.rs diff --git a/crates/pdu/src/rdp/headers.rs b/crates/ironrdp-pdu/src/rdp/headers.rs similarity index 100% rename from crates/pdu/src/rdp/headers.rs rename to crates/ironrdp-pdu/src/rdp/headers.rs diff --git a/crates/pdu/src/rdp/server_error_info.rs b/crates/ironrdp-pdu/src/rdp/server_error_info.rs similarity index 100% rename from crates/pdu/src/rdp/server_error_info.rs rename to crates/ironrdp-pdu/src/rdp/server_error_info.rs diff --git a/crates/pdu/src/rdp/server_license.rs b/crates/ironrdp-pdu/src/rdp/server_license.rs similarity index 100% rename from crates/pdu/src/rdp/server_license.rs rename to crates/ironrdp-pdu/src/rdp/server_license.rs diff --git a/crates/pdu/src/rdp/server_license/client_new_license_request.rs b/crates/ironrdp-pdu/src/rdp/server_license/client_new_license_request.rs similarity index 100% rename from crates/pdu/src/rdp/server_license/client_new_license_request.rs rename to crates/ironrdp-pdu/src/rdp/server_license/client_new_license_request.rs diff --git a/crates/pdu/src/rdp/server_license/client_new_license_request/tests.rs b/crates/ironrdp-pdu/src/rdp/server_license/client_new_license_request/tests.rs similarity index 100% rename from crates/pdu/src/rdp/server_license/client_new_license_request/tests.rs rename to crates/ironrdp-pdu/src/rdp/server_license/client_new_license_request/tests.rs diff --git a/crates/pdu/src/rdp/server_license/client_platform_challenge_response.rs b/crates/ironrdp-pdu/src/rdp/server_license/client_platform_challenge_response.rs similarity index 100% rename from crates/pdu/src/rdp/server_license/client_platform_challenge_response.rs rename to crates/ironrdp-pdu/src/rdp/server_license/client_platform_challenge_response.rs diff --git a/crates/pdu/src/rdp/server_license/client_platform_challenge_response/test.rs b/crates/ironrdp-pdu/src/rdp/server_license/client_platform_challenge_response/test.rs similarity index 100% rename from crates/pdu/src/rdp/server_license/client_platform_challenge_response/test.rs rename to crates/ironrdp-pdu/src/rdp/server_license/client_platform_challenge_response/test.rs diff --git a/crates/pdu/src/rdp/server_license/licensing_error_message.rs b/crates/ironrdp-pdu/src/rdp/server_license/licensing_error_message.rs similarity index 100% rename from crates/pdu/src/rdp/server_license/licensing_error_message.rs rename to crates/ironrdp-pdu/src/rdp/server_license/licensing_error_message.rs diff --git a/crates/pdu/src/rdp/server_license/licensing_error_message/test.rs b/crates/ironrdp-pdu/src/rdp/server_license/licensing_error_message/test.rs similarity index 100% rename from crates/pdu/src/rdp/server_license/licensing_error_message/test.rs rename to crates/ironrdp-pdu/src/rdp/server_license/licensing_error_message/test.rs diff --git a/crates/pdu/src/rdp/server_license/server_license_request.rs b/crates/ironrdp-pdu/src/rdp/server_license/server_license_request.rs similarity index 100% rename from crates/pdu/src/rdp/server_license/server_license_request.rs rename to crates/ironrdp-pdu/src/rdp/server_license/server_license_request.rs diff --git a/crates/pdu/src/rdp/server_license/server_license_request/cert.rs b/crates/ironrdp-pdu/src/rdp/server_license/server_license_request/cert.rs similarity index 100% rename from crates/pdu/src/rdp/server_license/server_license_request/cert.rs rename to crates/ironrdp-pdu/src/rdp/server_license/server_license_request/cert.rs diff --git a/crates/pdu/src/rdp/server_license/server_license_request/tests.rs b/crates/ironrdp-pdu/src/rdp/server_license/server_license_request/tests.rs similarity index 100% rename from crates/pdu/src/rdp/server_license/server_license_request/tests.rs rename to crates/ironrdp-pdu/src/rdp/server_license/server_license_request/tests.rs diff --git a/crates/pdu/src/rdp/server_license/server_platform_challenge.rs b/crates/ironrdp-pdu/src/rdp/server_license/server_platform_challenge.rs similarity index 100% rename from crates/pdu/src/rdp/server_license/server_platform_challenge.rs rename to crates/ironrdp-pdu/src/rdp/server_license/server_platform_challenge.rs diff --git a/crates/pdu/src/rdp/server_license/server_platform_challenge/test.rs b/crates/ironrdp-pdu/src/rdp/server_license/server_platform_challenge/test.rs similarity index 100% rename from crates/pdu/src/rdp/server_license/server_platform_challenge/test.rs rename to crates/ironrdp-pdu/src/rdp/server_license/server_platform_challenge/test.rs diff --git a/crates/pdu/src/rdp/server_license/server_upgrade_license.rs b/crates/ironrdp-pdu/src/rdp/server_license/server_upgrade_license.rs similarity index 100% rename from crates/pdu/src/rdp/server_license/server_upgrade_license.rs rename to crates/ironrdp-pdu/src/rdp/server_license/server_upgrade_license.rs diff --git a/crates/pdu/src/rdp/server_license/server_upgrade_license/tests.rs b/crates/ironrdp-pdu/src/rdp/server_license/server_upgrade_license/tests.rs similarity index 100% rename from crates/pdu/src/rdp/server_license/server_upgrade_license/tests.rs rename to crates/ironrdp-pdu/src/rdp/server_license/server_upgrade_license/tests.rs diff --git a/crates/pdu/src/rdp/server_license/tests.rs b/crates/ironrdp-pdu/src/rdp/server_license/tests.rs similarity index 100% rename from crates/pdu/src/rdp/server_license/tests.rs rename to crates/ironrdp-pdu/src/rdp/server_license/tests.rs diff --git a/crates/pdu/src/rdp/session_info.rs b/crates/ironrdp-pdu/src/rdp/session_info.rs similarity index 100% rename from crates/pdu/src/rdp/session_info.rs rename to crates/ironrdp-pdu/src/rdp/session_info.rs diff --git a/crates/pdu/src/rdp/session_info/logon_extended.rs b/crates/ironrdp-pdu/src/rdp/session_info/logon_extended.rs similarity index 100% rename from crates/pdu/src/rdp/session_info/logon_extended.rs rename to crates/ironrdp-pdu/src/rdp/session_info/logon_extended.rs diff --git a/crates/pdu/src/rdp/session_info/logon_info.rs b/crates/ironrdp-pdu/src/rdp/session_info/logon_info.rs similarity index 100% rename from crates/pdu/src/rdp/session_info/logon_info.rs rename to crates/ironrdp-pdu/src/rdp/session_info/logon_info.rs diff --git a/crates/pdu/src/rdp/session_info/tests.rs b/crates/ironrdp-pdu/src/rdp/session_info/tests.rs similarity index 100% rename from crates/pdu/src/rdp/session_info/tests.rs rename to crates/ironrdp-pdu/src/rdp/session_info/tests.rs diff --git a/crates/pdu/src/rdp/vc.rs b/crates/ironrdp-pdu/src/rdp/vc.rs similarity index 100% rename from crates/pdu/src/rdp/vc.rs rename to crates/ironrdp-pdu/src/rdp/vc.rs diff --git a/crates/pdu/src/rdp/vc/dvc.rs b/crates/ironrdp-pdu/src/rdp/vc/dvc.rs similarity index 100% rename from crates/pdu/src/rdp/vc/dvc.rs rename to crates/ironrdp-pdu/src/rdp/vc/dvc.rs diff --git a/crates/pdu/src/rdp/vc/dvc/capabilities.rs b/crates/ironrdp-pdu/src/rdp/vc/dvc/capabilities.rs similarity index 100% rename from crates/pdu/src/rdp/vc/dvc/capabilities.rs rename to crates/ironrdp-pdu/src/rdp/vc/dvc/capabilities.rs diff --git a/crates/pdu/src/rdp/vc/dvc/capabilities/tests.rs b/crates/ironrdp-pdu/src/rdp/vc/dvc/capabilities/tests.rs similarity index 100% rename from crates/pdu/src/rdp/vc/dvc/capabilities/tests.rs rename to crates/ironrdp-pdu/src/rdp/vc/dvc/capabilities/tests.rs diff --git a/crates/pdu/src/rdp/vc/dvc/close.rs b/crates/ironrdp-pdu/src/rdp/vc/dvc/close.rs similarity index 100% rename from crates/pdu/src/rdp/vc/dvc/close.rs rename to crates/ironrdp-pdu/src/rdp/vc/dvc/close.rs diff --git a/crates/pdu/src/rdp/vc/dvc/close/tests.rs b/crates/ironrdp-pdu/src/rdp/vc/dvc/close/tests.rs similarity index 100% rename from crates/pdu/src/rdp/vc/dvc/close/tests.rs rename to crates/ironrdp-pdu/src/rdp/vc/dvc/close/tests.rs diff --git a/crates/pdu/src/rdp/vc/dvc/create.rs b/crates/ironrdp-pdu/src/rdp/vc/dvc/create.rs similarity index 100% rename from crates/pdu/src/rdp/vc/dvc/create.rs rename to crates/ironrdp-pdu/src/rdp/vc/dvc/create.rs diff --git a/crates/pdu/src/rdp/vc/dvc/create/tests.rs b/crates/ironrdp-pdu/src/rdp/vc/dvc/create/tests.rs similarity index 100% rename from crates/pdu/src/rdp/vc/dvc/create/tests.rs rename to crates/ironrdp-pdu/src/rdp/vc/dvc/create/tests.rs diff --git a/crates/pdu/src/rdp/vc/dvc/data.rs b/crates/ironrdp-pdu/src/rdp/vc/dvc/data.rs similarity index 100% rename from crates/pdu/src/rdp/vc/dvc/data.rs rename to crates/ironrdp-pdu/src/rdp/vc/dvc/data.rs diff --git a/crates/pdu/src/rdp/vc/dvc/data/tests.rs b/crates/ironrdp-pdu/src/rdp/vc/dvc/data/tests.rs similarity index 100% rename from crates/pdu/src/rdp/vc/dvc/data/tests.rs rename to crates/ironrdp-pdu/src/rdp/vc/dvc/data/tests.rs diff --git a/crates/pdu/src/rdp/vc/dvc/data_first.rs b/crates/ironrdp-pdu/src/rdp/vc/dvc/data_first.rs similarity index 100% rename from crates/pdu/src/rdp/vc/dvc/data_first.rs rename to crates/ironrdp-pdu/src/rdp/vc/dvc/data_first.rs diff --git a/crates/pdu/src/rdp/vc/dvc/data_first/tests.rs b/crates/ironrdp-pdu/src/rdp/vc/dvc/data_first/tests.rs similarity index 100% rename from crates/pdu/src/rdp/vc/dvc/data_first/tests.rs rename to crates/ironrdp-pdu/src/rdp/vc/dvc/data_first/tests.rs diff --git a/crates/pdu/src/rdp/vc/dvc/display.rs b/crates/ironrdp-pdu/src/rdp/vc/dvc/display.rs similarity index 100% rename from crates/pdu/src/rdp/vc/dvc/display.rs rename to crates/ironrdp-pdu/src/rdp/vc/dvc/display.rs diff --git a/crates/pdu/src/rdp/vc/dvc/gfx.rs b/crates/ironrdp-pdu/src/rdp/vc/dvc/gfx.rs similarity index 100% rename from crates/pdu/src/rdp/vc/dvc/gfx.rs rename to crates/ironrdp-pdu/src/rdp/vc/dvc/gfx.rs diff --git a/crates/pdu/src/rdp/vc/dvc/gfx/graphics_messages.rs b/crates/ironrdp-pdu/src/rdp/vc/dvc/gfx/graphics_messages.rs similarity index 100% rename from crates/pdu/src/rdp/vc/dvc/gfx/graphics_messages.rs rename to crates/ironrdp-pdu/src/rdp/vc/dvc/gfx/graphics_messages.rs diff --git a/crates/pdu/src/rdp/vc/dvc/gfx/graphics_messages/avc_messages.rs b/crates/ironrdp-pdu/src/rdp/vc/dvc/gfx/graphics_messages/avc_messages.rs similarity index 100% rename from crates/pdu/src/rdp/vc/dvc/gfx/graphics_messages/avc_messages.rs rename to crates/ironrdp-pdu/src/rdp/vc/dvc/gfx/graphics_messages/avc_messages.rs diff --git a/crates/pdu/src/rdp/vc/dvc/gfx/graphics_messages/client.rs b/crates/ironrdp-pdu/src/rdp/vc/dvc/gfx/graphics_messages/client.rs similarity index 100% rename from crates/pdu/src/rdp/vc/dvc/gfx/graphics_messages/client.rs rename to crates/ironrdp-pdu/src/rdp/vc/dvc/gfx/graphics_messages/client.rs diff --git a/crates/pdu/src/rdp/vc/dvc/gfx/graphics_messages/server.rs b/crates/ironrdp-pdu/src/rdp/vc/dvc/gfx/graphics_messages/server.rs similarity index 100% rename from crates/pdu/src/rdp/vc/dvc/gfx/graphics_messages/server.rs rename to crates/ironrdp-pdu/src/rdp/vc/dvc/gfx/graphics_messages/server.rs diff --git a/crates/pdu/src/rdp/vc/dvc/tests.rs b/crates/ironrdp-pdu/src/rdp/vc/dvc/tests.rs similarity index 100% rename from crates/pdu/src/rdp/vc/dvc/tests.rs rename to crates/ironrdp-pdu/src/rdp/vc/dvc/tests.rs diff --git a/crates/pdu/src/rdp/vc/tests.rs b/crates/ironrdp-pdu/src/rdp/vc/tests.rs similarity index 100% rename from crates/pdu/src/rdp/vc/tests.rs rename to crates/ironrdp-pdu/src/rdp/vc/tests.rs diff --git a/crates/pdu/src/tpdu.rs b/crates/ironrdp-pdu/src/tpdu.rs similarity index 100% rename from crates/pdu/src/tpdu.rs rename to crates/ironrdp-pdu/src/tpdu.rs diff --git a/crates/pdu/src/tpkt.rs b/crates/ironrdp-pdu/src/tpkt.rs similarity index 100% rename from crates/pdu/src/tpkt.rs rename to crates/ironrdp-pdu/src/tpkt.rs diff --git a/crates/pdu/src/utils.rs b/crates/ironrdp-pdu/src/utils.rs similarity index 100% rename from crates/pdu/src/utils.rs rename to crates/ironrdp-pdu/src/utils.rs diff --git a/crates/pdu/src/x224.rs b/crates/ironrdp-pdu/src/x224.rs similarity index 100% rename from crates/pdu/src/x224.rs rename to crates/ironrdp-pdu/src/x224.rs diff --git a/crates/pdu/tests/gcc.rs b/crates/ironrdp-pdu/tests/gcc.rs similarity index 100% rename from crates/pdu/tests/gcc.rs rename to crates/ironrdp-pdu/tests/gcc.rs diff --git a/crates/pdu/tests/gfx.rs b/crates/ironrdp-pdu/tests/gfx.rs similarity index 100% rename from crates/pdu/tests/gfx.rs rename to crates/ironrdp-pdu/tests/gfx.rs diff --git a/crates/pdu/tests/input.rs b/crates/ironrdp-pdu/tests/input.rs similarity index 100% rename from crates/pdu/tests/input.rs rename to crates/ironrdp-pdu/tests/input.rs diff --git a/crates/pdu/tests/mcs.rs b/crates/ironrdp-pdu/tests/mcs.rs similarity index 100% rename from crates/pdu/tests/mcs.rs rename to crates/ironrdp-pdu/tests/mcs.rs diff --git a/crates/pdu/tests/rdp.rs b/crates/ironrdp-pdu/tests/rdp.rs similarity index 100% rename from crates/pdu/tests/rdp.rs rename to crates/ironrdp-pdu/tests/rdp.rs diff --git a/crates/pdu/tests/rfx.rs b/crates/ironrdp-pdu/tests/rfx.rs similarity index 100% rename from crates/pdu/tests/rfx.rs rename to crates/ironrdp-pdu/tests/rfx.rs diff --git a/crates/pdu/tests/x224.rs b/crates/ironrdp-pdu/tests/x224.rs similarity index 100% rename from crates/pdu/tests/x224.rs rename to crates/ironrdp-pdu/tests/x224.rs diff --git a/crates/rdcleanpath/Cargo.toml b/crates/ironrdp-rdcleanpath/Cargo.toml similarity index 100% rename from crates/rdcleanpath/Cargo.toml rename to crates/ironrdp-rdcleanpath/Cargo.toml diff --git a/crates/rdcleanpath/README.md b/crates/ironrdp-rdcleanpath/README.md similarity index 100% rename from crates/rdcleanpath/README.md rename to crates/ironrdp-rdcleanpath/README.md diff --git a/crates/rdcleanpath/src/lib.rs b/crates/ironrdp-rdcleanpath/src/lib.rs similarity index 100% rename from crates/rdcleanpath/src/lib.rs rename to crates/ironrdp-rdcleanpath/src/lib.rs diff --git a/crates/replay-client/Cargo.toml b/crates/ironrdp-replay-client/Cargo.toml similarity index 100% rename from crates/replay-client/Cargo.toml rename to crates/ironrdp-replay-client/Cargo.toml diff --git a/crates/replay-client/README.md b/crates/ironrdp-replay-client/README.md similarity index 100% rename from crates/replay-client/README.md rename to crates/ironrdp-replay-client/README.md diff --git a/crates/replay-client/scripts/runtests.ps1 b/crates/ironrdp-replay-client/scripts/runtests.ps1 similarity index 100% rename from crates/replay-client/scripts/runtests.ps1 rename to crates/ironrdp-replay-client/scripts/runtests.ps1 diff --git a/crates/replay-client/src/main.rs b/crates/ironrdp-replay-client/src/main.rs similarity index 100% rename from crates/replay-client/src/main.rs rename to crates/ironrdp-replay-client/src/main.rs diff --git a/crates/replay-client/test_data/README.md b/crates/ironrdp-replay-client/test_data/README.md similarity index 100% rename from crates/replay-client/test_data/README.md rename to crates/ironrdp-replay-client/test_data/README.md diff --git a/crates/replay-client/test_data/sample1_avc444.data b/crates/ironrdp-replay-client/test_data/sample1_avc444.data similarity index 100% rename from crates/replay-client/test_data/sample1_avc444.data rename to crates/ironrdp-replay-client/test_data/sample1_avc444.data diff --git a/crates/replay-client/test_data/sample1_avc444v2.data b/crates/ironrdp-replay-client/test_data/sample1_avc444v2.data similarity index 100% rename from crates/replay-client/test_data/sample1_avc444v2.data rename to crates/ironrdp-replay-client/test_data/sample1_avc444v2.data diff --git a/crates/replay-client/test_data/sample2_avc444.data b/crates/ironrdp-replay-client/test_data/sample2_avc444.data similarity index 100% rename from crates/replay-client/test_data/sample2_avc444.data rename to crates/ironrdp-replay-client/test_data/sample2_avc444.data diff --git a/crates/replay-client/test_data/sample2_avc444v2.data b/crates/ironrdp-replay-client/test_data/sample2_avc444v2.data similarity index 100% rename from crates/replay-client/test_data/sample2_avc444v2.data rename to crates/ironrdp-replay-client/test_data/sample2_avc444v2.data diff --git a/crates/session-generators/Cargo.toml b/crates/ironrdp-session-generators/Cargo.toml similarity index 100% rename from crates/session-generators/Cargo.toml rename to crates/ironrdp-session-generators/Cargo.toml diff --git a/crates/session-generators/src/lib.rs b/crates/ironrdp-session-generators/src/lib.rs similarity index 100% rename from crates/session-generators/src/lib.rs rename to crates/ironrdp-session-generators/src/lib.rs diff --git a/crates/session/Cargo.toml b/crates/ironrdp-session/Cargo.toml similarity index 100% rename from crates/session/Cargo.toml rename to crates/ironrdp-session/Cargo.toml diff --git a/crates/session/README.md b/crates/ironrdp-session/README.md similarity index 100% rename from crates/session/README.md rename to crates/ironrdp-session/README.md diff --git a/crates/session/src/active_stage.rs b/crates/ironrdp-session/src/active_stage.rs similarity index 100% rename from crates/session/src/active_stage.rs rename to crates/ironrdp-session/src/active_stage.rs diff --git a/crates/session/src/fast_path.rs b/crates/ironrdp-session/src/fast_path.rs similarity index 100% rename from crates/session/src/fast_path.rs rename to crates/ironrdp-session/src/fast_path.rs diff --git a/crates/session/src/image.rs b/crates/ironrdp-session/src/image.rs similarity index 100% rename from crates/session/src/image.rs rename to crates/ironrdp-session/src/image.rs diff --git a/crates/session/src/legacy.rs b/crates/ironrdp-session/src/legacy.rs similarity index 100% rename from crates/session/src/legacy.rs rename to crates/ironrdp-session/src/legacy.rs diff --git a/crates/session/src/lib.rs b/crates/ironrdp-session/src/lib.rs similarity index 100% rename from crates/session/src/lib.rs rename to crates/ironrdp-session/src/lib.rs diff --git a/crates/session/src/rfx.rs b/crates/ironrdp-session/src/rfx.rs similarity index 100% rename from crates/session/src/rfx.rs rename to crates/ironrdp-session/src/rfx.rs diff --git a/crates/session/src/utils.rs b/crates/ironrdp-session/src/utils.rs similarity index 100% rename from crates/session/src/utils.rs rename to crates/ironrdp-session/src/utils.rs diff --git a/crates/session/src/x224/display.rs b/crates/ironrdp-session/src/x224/display.rs similarity index 100% rename from crates/session/src/x224/display.rs rename to crates/ironrdp-session/src/x224/display.rs diff --git a/crates/session/src/x224/gfx.rs b/crates/ironrdp-session/src/x224/gfx.rs similarity index 100% rename from crates/session/src/x224/gfx.rs rename to crates/ironrdp-session/src/x224/gfx.rs diff --git a/crates/session/src/x224/mod.rs b/crates/ironrdp-session/src/x224/mod.rs similarity index 100% rename from crates/session/src/x224/mod.rs rename to crates/ironrdp-session/src/x224/mod.rs diff --git a/crates/tls/Cargo.toml b/crates/ironrdp-tls/Cargo.toml similarity index 100% rename from crates/tls/Cargo.toml rename to crates/ironrdp-tls/Cargo.toml diff --git a/crates/tls/README.md b/crates/ironrdp-tls/README.md similarity index 100% rename from crates/tls/README.md rename to crates/ironrdp-tls/README.md diff --git a/crates/tls/src/lib.rs b/crates/ironrdp-tls/src/lib.rs similarity index 96% rename from crates/tls/src/lib.rs rename to crates/ironrdp-tls/src/lib.rs index 72b99d3a..a46e8315 100644 --- a/crates/tls/src/lib.rs +++ b/crates/ironrdp-tls/src/lib.rs @@ -86,7 +86,8 @@ fn extract_tls_server_public_key(cert: &[u8]) -> io::Result> { .tbs_certificate .subject_public_key_info .subject_public_key - .raw_bytes() + .as_bytes() + .ok_or_else(|| io::Error::new(io::ErrorKind::Other, "subject public key BIT STRING is not aligned"))? .to_owned(); Ok(server_public_key) diff --git a/crates/ironrdp-tokio/Cargo.toml b/crates/ironrdp-tokio/Cargo.toml new file mode 100644 index 00000000..21455839 --- /dev/null +++ b/crates/ironrdp-tokio/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "ironrdp-tokio" +version = "0.1.0" +readme = "README.md" +description = "`Framed*` traits implementation above Tokio’s traits" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true +authors.workspace = true +keywords.workspace = true +categories.workspace = true + +[dependencies] +bytes = "1" +ironrdp-async.workspace = true +tokio-util = { version = "0.7.7", features = ["codec"] } +tokio = { version = "1", features = ["io-util"] } diff --git a/crates/ironrdp-tokio/src/lib.rs b/crates/ironrdp-tokio/src/lib.rs new file mode 100644 index 00000000..ae5fbd4b --- /dev/null +++ b/crates/ironrdp-tokio/src/lib.rs @@ -0,0 +1,69 @@ +use std::io; +use std::pin::Pin; + +use bytes::BytesMut; +use tokio::io::{AsyncRead, AsyncWrite}; + +pub use ironrdp_async::*; + +pub type TokioFramed = Framed>; + +pub struct TokioStream { + inner: S, +} + +impl StreamWrapper for TokioStream { + type InnerStream = S; + + fn from_inner(stream: Self::InnerStream) -> Self { + Self { inner: stream } + } + + fn into_inner(self) -> Self::InnerStream { + self.inner + } + + fn get_inner(&self) -> &Self::InnerStream { + &self.inner + } + + fn get_inner_mut(&mut self) -> &mut Self::InnerStream { + &mut self.inner + } +} + +impl FramedRead for TokioStream +where + S: Unpin + AsyncRead, +{ + fn read<'a>( + &'a mut self, + buf: &'a mut BytesMut, + ) -> Pin> + 'a>> + where + Self: 'a, + { + use tokio::io::AsyncReadExt as _; + + Box::pin(async { self.inner.read_buf(buf).await }) + } +} + +impl FramedWrite for TokioStream +where + S: Unpin + AsyncWrite, +{ + fn write_all<'a>(&'a mut self, buf: &'a [u8]) -> Pin> + 'a>> + where + Self: 'a, + { + use tokio::io::AsyncWriteExt as _; + + Box::pin(async { + self.inner.write_all(buf).await?; + self.inner.flush().await?; + + Ok(()) + }) + } +} diff --git a/crates/web/.gitignore b/crates/ironrdp-web/.gitignore similarity index 100% rename from crates/web/.gitignore rename to crates/ironrdp-web/.gitignore diff --git a/crates/web/Cargo.toml b/crates/ironrdp-web/Cargo.toml similarity index 96% rename from crates/web/Cargo.toml rename to crates/ironrdp-web/Cargo.toml index 8ab21082..dd8b0dd6 100644 --- a/crates/web/Cargo.toml +++ b/crates/ironrdp-web/Cargo.toml @@ -23,7 +23,7 @@ panic_hook = ["dep:console_error_panic_hook"] # Protocols ironrdp = { workspace = true, features = ["input", "graphics"] } -ironrdp-async = { workspace = true, features = ["futures"] } +ironrdp-futures.workspace = true ironrdp-rdcleanpath.workspace = true # WASM diff --git a/crates/web/README.md b/crates/ironrdp-web/README.md similarity index 100% rename from crates/web/README.md rename to crates/ironrdp-web/README.md diff --git a/crates/web/rust-toolchain.toml b/crates/ironrdp-web/rust-toolchain.toml similarity index 100% rename from crates/web/rust-toolchain.toml rename to crates/ironrdp-web/rust-toolchain.toml diff --git a/crates/web/src/error.rs b/crates/ironrdp-web/src/error.rs similarity index 100% rename from crates/web/src/error.rs rename to crates/ironrdp-web/src/error.rs diff --git a/crates/web/src/image.rs b/crates/ironrdp-web/src/image.rs similarity index 100% rename from crates/web/src/image.rs rename to crates/ironrdp-web/src/image.rs diff --git a/crates/web/src/input.rs b/crates/ironrdp-web/src/input.rs similarity index 100% rename from crates/web/src/input.rs rename to crates/ironrdp-web/src/input.rs diff --git a/crates/web/src/lib.rs b/crates/ironrdp-web/src/lib.rs similarity index 100% rename from crates/web/src/lib.rs rename to crates/ironrdp-web/src/lib.rs diff --git a/crates/web/src/network_client.rs b/crates/ironrdp-web/src/network_client.rs similarity index 100% rename from crates/web/src/network_client.rs rename to crates/ironrdp-web/src/network_client.rs diff --git a/crates/web/src/session.rs b/crates/ironrdp-web/src/session.rs similarity index 96% rename from crates/web/src/session.rs rename to crates/ironrdp-web/src/session.rs index 05bcd398..7466f15c 100644 --- a/crates/web/src/session.rs +++ b/crates/ironrdp-web/src/session.rs @@ -196,7 +196,7 @@ impl Session { .take() .context("RDP session can be started only once")?; - let mut framed = ironrdp_async::Framed::futures_new(rdp_reader); + let mut framed = ironrdp_futures::FuturesFramed::new(rdp_reader); info!("Start RDP session"); @@ -425,7 +425,7 @@ async fn connect( destination: String, pcb: Option, ) -> Result<(connector::ConnectionResult, WebSocketCompat), IronRdpError> { - let mut framed = ironrdp_async::Framed::futures_new(ws); + let mut framed = ironrdp_futures::FuturesFramed::new(ws); let mut connector = connector::ClientConnector::new(config) .with_server_name(&destination) @@ -433,22 +433,22 @@ async fn connect( let upgraded = connect_rdcleanpath(&mut framed, &mut connector, destination, proxy_auth_token, pcb).await?; - let connection_result = ironrdp_async::connect_finalize(upgraded, &mut framed, connector).await?; + let connection_result = ironrdp_futures::connect_finalize(upgraded, &mut framed, connector).await?; - let ws = framed.futures_into_inner_no_leftover(); + let ws = framed.into_inner_no_leftover(); Ok((connection_result, ws)) } async fn connect_rdcleanpath( - framed: &mut ironrdp_async::Framed, + framed: &mut ironrdp_futures::Framed, connector: &mut ClientConnector, destination: String, proxy_auth_token: String, pcb: Option, -) -> Result +) -> Result where - S: ironrdp_async::FramedRead + ironrdp_async::FramedWrite, + S: ironrdp_futures::FramedRead + ironrdp_futures::FramedWrite, { use ironrdp::connector::Sequence as _; use x509_cert::der::Decode as _; @@ -559,14 +559,15 @@ where .tbs_certificate .subject_public_key_info .subject_public_key - .raw_bytes() + .as_bytes() + .context("subject public key BIT STRING is not aligned")? .to_owned(); - let should_upgrade = ironrdp_async::skip_connect_begin(connector); + let should_upgrade = ironrdp_futures::skip_connect_begin(connector); // At this point, proxy established the TLS session - let upgraded = ironrdp_async::mark_as_upgraded(should_upgrade, connector, server_public_key); + let upgraded = ironrdp_futures::mark_as_upgraded(should_upgrade, connector, server_public_key); Ok(upgraded) } diff --git a/crates/web/src/utils.rs b/crates/ironrdp-web/src/utils.rs similarity index 100% rename from crates/web/src/utils.rs rename to crates/ironrdp-web/src/utils.rs diff --git a/crates/web/src/websocket.rs b/crates/ironrdp-web/src/websocket.rs similarity index 100% rename from crates/web/src/websocket.rs rename to crates/ironrdp-web/src/websocket.rs diff --git a/crates/ironrdp/Cargo.toml b/crates/ironrdp/Cargo.toml new file mode 100644 index 00000000..22a97248 --- /dev/null +++ b/crates/ironrdp/Cargo.toml @@ -0,0 +1,27 @@ +[package] +name = "ironrdp" +version = "0.5.0" +readme = "README.md" +description = "A Rust implementation of the Microsoft Remote Desktop Protocol (RDP)" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true +authors.workspace = true +keywords.workspace = true +categories.workspace = true + +[features] +default = ["pdu", "connector", "session"] +pdu = ["dep:ironrdp-pdu"] +connector = ["dep:ironrdp-connector"] +session = ["dep:ironrdp-session"] +graphics = ["dep:ironrdp-graphics"] +input = ["dep:ironrdp-input"] + +[dependencies] +ironrdp-pdu = { workspace = true, optional = true } +ironrdp-connector = { workspace = true, optional = true } +ironrdp-session = { workspace = true, optional = true } +ironrdp-graphics = { workspace = true, optional = true } +ironrdp-input = { workspace = true, optional = true } diff --git a/src/lib.rs b/crates/ironrdp/src/lib.rs similarity index 79% rename from src/lib.rs rename to crates/ironrdp/src/lib.rs index f7cf7ed3..08790551 100644 --- a/src/lib.rs +++ b/crates/ironrdp/src/lib.rs @@ -2,10 +2,6 @@ //! //! This is a meta crate re-exporting other ironrdp crates for convenience. -#[cfg(feature = "tokio")] -pub use ironrdp_async as tokio; -#[cfg(feature = "futures")] -pub use ironrdp_async as futures; #[cfg(feature = "connector")] pub use ironrdp_connector as connector; #[cfg(feature = "graphics")] diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 64329b5b..d01a1b44 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -14,8 +14,8 @@ members = ["."] debug = 1 [dependencies] -ironrdp-pdu = { path = "../crates/pdu" } -ironrdp-graphics = { path = "../crates/graphics" } +ironrdp-pdu = { path = "../crates/ironrdp-pdu" } +ironrdp-graphics = { path = "../crates/ironrdp-graphics" } libfuzzer-sys = "0.4" arbitrary = { version = "1", features = ["derive"] } diff --git a/fuzz/README.md b/fuzz/README.md new file mode 100644 index 00000000..07fc11a6 --- /dev/null +++ b/fuzz/README.md @@ -0,0 +1,36 @@ +# IronRDP fuzzing + +## Difference between fuzzing and property testing + +`ironrdp` correctness is validated in various ways. Two of these are fuzzing and property testing. +Both of these methods involve feeding random inputs to the API in order to check if the program is +behaving as expected or not. + +However, + +- Fuzzing is well suited for black-box-like testing. + Inputs are typically guided by instrumentalizing the code (coverage…) rather than manually informed. + +- Property testing requires the developer to describe the interesting inputs and properties to test. + +- When fuzzing, some properties are tested as well, but those are typically simple (absence of crash, round-trip…). + +- In contrast, property testing is well suited when testing more complex properties. + +- With fuzzing, we are actively trying to show that something is (unexpectedly) broken. + +- With property testing, we are actively trying to show that the properties are holding (as expected). + +## Targets + +### `pdu_decoding` + +Feeds random inputs to PDU decoding code. + +### `bitmap_stream` + +Feeds random inputs to the RDP6 bitmap decoder. + +### `rle_decompression` + +Feeds random inputs to the interleaved Run-Length Encoding (RLE) bitmap decoder.