Commit Graph

1410 Commits

Author SHA1 Message Date
Marc-André Moreau 7606bfffcf Optimize bulk compression hot paths with copy_within and chunk comparison
Replace byte-by-byte history buffer copies with copy_within (memmove)
for non-overlapping LZ77 matches in MPPC, NCRUSH, and XCRUSH
decompression. Use 8-byte u64 XOR chunk comparison in NCRUSH and XCRUSH
match-length finding instead of per-byte comparison.

Both optimizations are safe Rust, WASM-compatible, and scale with match
length. Add criterion benchmarks for all four compression algorithms.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-08 19:20:53 -05:00
Marc-André Moreau 3e17878fe7 Fix FastPath processor to handle multiple updates per PDU
The FastPath processor previously only read one update from each
FastPath output PDU, but the RDP spec allows multiple updates per PDU.
When the server uses bulk compression, it packs multiple updates into a
single PDU, causing fragment continuations (Next/Last) and subsequent
updates to be silently dropped. This led to bitmap decode failures and
decompressor state desynchronization.

Extract the per-update logic into process_single_update() and loop over
all updates in the PDU payload.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-08 16:37:36 -05:00
Marc-André Moreau 3efa3b6b03 Integrate bulk compression into IronRDP client
- Add --compression CLI argument (rdp4/rdp5/rdp6/rdp61) to ironrdp-client
- Add compression_type field to connector::Config and ConnectionResult
- Set INFO_COMPRESSION flag and compression type in Client Info PDU
- Add ironrdp-bulk dependency to ironrdp-session
- Integrate BulkCompressor into FastPath processor for server-to-client
  decompression with per-PDU compression flag handling
- Add compression metrics (total_compressed_bytes, total_uncompressed_bytes,
  compression_ratio) to BulkCompressor, mirroring FreeRDP's rdpMetrics
- Add tracing logs at negotiation, initialization, and per-PDU decompression
- Replace .expect() calls with non-panicking patterns in xcrush
- Add bounds safety to compressed_data() in bulk.rs
- Fix cargo fmt across all crates
- Update all call sites (ffi, web, testsuite, examples) for new fields

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-08 14:40:54 -05:00
Marc-André Moreau 54668f6b38 TASK-037: Final cleanup, documentation, and code review prep
Dead code removal:
- Removed unused `compressor` field from MppcContext, NCrushContext,
  XCrushContext (and `compressor` parameter from their constructors)
- Removed unused accessor methods from BulkCompressor and MppcContext
- Removed unused `block_buffer` field from XCrushContext
- Removed unused HuffTableMask, Rdp61MatchDetails, Rdp61CompressedData
- Moved BitStreamReader test-only helpers to #[cfg(test)] impl block

Clippy fixes (27 warnings → 0):
- Replaced 4 manual swaps with .swap()
- Replaced manual range check with .contains()
- Added missing cast lint expectations (cast_possible_truncation,
  cast_possible_wrap, cast_sign_loss) to existing #[expect] attributes
- Added #[expect(unnecessary_box_returns)] to heap_zeroed_array

Documentation:
- Rewrote crate-level docs with algorithm table, usage example
  (doctest passes), features section, and safety statement
- Fixed intra-doc link warnings in BulkCompressor

Final state: 0 warnings from cargo check, clippy, and doc.
129 tests pass. wasm32-unknown-unknown builds clean.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 20:47:35 -05:00
Marc-André Moreau 5e208f8f30 TASK-036: Verify wasm32-unknown-unknown build
Fixed no_std+alloc support by adding missing Vec/vec! imports from
alloc crate in bulk.rs and ncrush/mod.rs. All three build configs
now succeed:
- wasm32-unknown-unknown (default features / std)
- wasm32-unknown-unknown (no_std + alloc)
- native (all 130 tests pass)

Zero platform-specific dependencies confirmed.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 20:38:16 -05:00
Marc-André Moreau 30d552de1d TASK-035: Verify all tests pass after safety refactoring
All 130 tests pass in both debug and release mode.
37 byte-exact and roundtrip tests confirm no output differences
after the safety refactoring in TASK-033 and TASK-034.

Phase 10 (Memory Safety Refactoring) complete.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 20:36:22 -05:00
Marc-André Moreau 04257a9aa4 TASK-034: Replace unsafe with safe Rust patterns
Replace ~60 widening `as` casts with idiomatic `From`/`into()`:
- u8→usize, u8→u32, u16→usize, u16→u32, u16→i32 conversions
- Byte extraction via `to_be_bytes()`/`to_le_bytes()` instead of
  manual shift-and-mask patterns

All remaining narrowing casts are documented with
`#[expect(clippy::as_conversions)]` and reason strings explaining
why each is bounded. Zero `as_conversions` clippy warnings remain.

All 130 tests pass with byte-exact output preserved.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 20:35:06 -05:00
Marc-André Moreau f0768149b6 TASK-033: Audit all unsafe blocks and raw pointer usage
Comprehensive safety audit of the ironrdp-bulk crate found:
- Zero unsafe blocks in the entire crate
- Zero raw pointer operations (*const, *mut, as_ptr, as_mut_ptr)
- Zero transmute or unchecked operations
- Zero safety lint suppressions

Added #![forbid(unsafe_code)] to lib.rs to enforce this invariant at
compile time. Documented the audit findings in a crate-level doc comment
including the inventory of ~161 `as` casts (tracked for TASK-034) and
2 infallible unwrap_or_else(unreachable) calls.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 20:22:44 -05:00
Marc-André Moreau b71a1d2526 TASK-032: Unit tests for bulk coordinator
Add 13 tests for the BulkCompressor routing and round-trip logic:

Routing tests:
- Compression skip for small/empty input (returns size, flags=0)
- Decompress pass-through when no compression flags set
- Unsupported compression type returns error
- Type-bit verification for RDP5, RDP6, RDP6.1

Round-trip tests (compress → decompress → verify identical):
- RDP4 (MPPC 8K)
- RDP5 (MPPC 64K)
- RDP6 (NCRUSH) with "bells" and longer text
- RDP6.1 (XCRUSH)
- Binary data (all 256 byte values)

All 130 tests pass. This completes Phase 9 (Bulk Compressor Coordinator).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 20:19:49 -05:00
Marc-André Moreau 37fbffa4be TASK-031: Implement bulk compress/decompress routing
Add compress() and decompress() routing methods to BulkCompressor:

- decompress(): extracts compression type from flags (low 4 bits),
  routes to MPPC (level 0/1), NCRUSH, or XCRUSH. Returns source data
  unchanged if no compression flags are set.

- compress(): routes to the configured algorithm based on
  compression_level. Skips compression for sizes <=50 or >=16384.
  Compressed output goes into the internal 64KB output buffer.

- compressed_data(): accessor to retrieve compressed bytes from the
  internal buffer after a successful compress() call.

All 117 tests pass.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 20:18:05 -05:00
Marc-André Moreau fb85958f8d TASK-030: Implement BulkCompressor struct
Port the rdp_bulk coordinator struct from FreeRDP. BulkCompressor holds
send/receive context pairs for all three compression algorithms (MPPC,
NCRUSH, XCRUSH) plus a 64KB output buffer for compressed data.

- BulkCompressor::new(compression_level) creates all 6 contexts
- compression_level() returns the configured outbound algorithm
- should_skip_compression() checks size bounds (<=50 or >=16384)
- reset() resets all 6 contexts
- Accessor methods for each send/receive context
- Exported BulkCompressor from lib.rs

Added 9 unit tests. All 117 tests pass.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 20:15:27 -05:00
Marc-André Moreau 08745bad16 TASK-029: NCRUSH round-trip validation
Add 5 round-trip tests that compress then decompress and verify the
output matches the original input byte-for-byte:

- test_ncrush_roundtrip_bells: FreeRDP "bells" test data
- test_ncrush_roundtrip_repetitive: "ABCABC..." pattern
- test_ncrush_roundtrip_prose: longer text with repeated phrases
- test_ncrush_roundtrip_binary: all 256 byte values repeated twice
- test_ncrush_roundtrip_sequential: multiple messages on the same
  compressor/decompressor context pair (tests history state carryover)

All 108 tests pass. This completes Phase 8 (NCRUSH Compression & Tests).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 20:12:45 -05:00
Marc-André Moreau b1c1421aef TASK-028: Port NCRUSH compression test
Add byte-exact compression test ported from FreeRDP's
test_NCrushCompressBells. Compresses the "bells" test string with
a fresh compressor context and verifies the output matches FreeRDP's
expected 44-byte compressed output exactly.

Test passes on first try, confirming the full NCRUSH compression
pipeline (hash chains, LRU offset cache, Huffman encoding, EOS)
produces bit-identical output to FreeRDP.

Also fixed unused variable and unused mut warnings. All 103 tests pass.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 20:11:09 -05:00
Marc-André Moreau 6fbcbb2118 TASK-027: Implement ncrush_compress function
Port the full NCRUSH compression pipeline from FreeRDP's ncrush_compress:
- Window management: flush detection and encoder window sliding at 32KB
- Hash chain population and source data copy into history buffer
- Main compression loop with literal and match encoding paths
- LRU offset cache management (4-entry cache with swap logic)
- Offset cache hit vs miss encoding using TASK-026 helpers
- Trailing literal encoding for last 0-2 bytes
- EOS marker and output finalization
- Output size validation (compressed must not exceed source)

Fixed critical bug: self.history_offset must be set to end of valid
data (history_offset + src_size) before the compression loop, since
find_best_match reads it as the limit for find_match_length.

Added 5 unit tests for compress: basic, repeats, empty, history
offset update, and offset cache update. All 102 tests pass.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 20:09:05 -05:00
Marc-André Moreau 833106bde9 TASK-026: Implement NCRUSH Huffman encoding
Add NCrushBitWriter (LSB-first bit accumulator) and Huffman encoding
helpers for NCRUSH compression: encode_literal, encode_copy_offset,
encode_offset_cache_hit, encode_length_of_match, encode_eos, and
get_lec_code. These port the encoding patterns from FreeRDP's
NCrushWriteStart/WriteBits/WriteFinish and the LEC/LOM Huffman
table lookups used in ncrush_compress.

Includes 12 unit tests covering bit writer mechanics, literal
encoding, EOS marker, offset cache hits, LOM encoding, and
copy offset encoding. All 97 tests pass.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 20:04:14 -05:00
Marc-André Moreau 67c4cb4ee2 feat(ironrdp-bulk): implement NCRUSH hash-chain match finding (TASK-025)
Port hash_table_add, find_match_length, find_best_match, and
move_encoder_windows from FreeRDP. Uses 2-byte direct hash into
65536-entry hash table with match table chain traversal (up to
4 candidates with 6-step unrolled quick-filter). Add 9 unit tests
for hash insertion, chain creation, match finding, and window
sliding. 86 tests passing.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 19:59:44 -05:00
Marc-André Moreau 563c4a9fbf feat(ironrdp-bulk): port NCRUSH decompression test (TASK-024)
Add byte-exact test vectors from FreeRDP TestFreeRDPCodecNCrush.c
(TEST_BELLS_DATA and TEST_BELLS_NCRUSH). Verify ncrush_decompress
produces identical output to FreeRDP. Phase 7 complete (77 tests).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 19:54:38 -05:00
Marc-André Moreau 7248904ac3 feat(ironrdp-bulk): implement ncrush_decompress function (TASK-023)
Port ncrush_decompress from FreeRDP with LSB-first bit reading,
Huffman LEC/LOM decoding, CopyOffset with extra bits, LRU offset
cache rotation, and history buffer copy with overlap/wrap handling.
Includes fetch_bits helper and 7 unit tests (76 total passing).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 19:52:34 -05:00
Marc-André Moreau f5ed22b79e feat(ironrdp-bulk): implement NCRUSH context struct (TASK-022)
Add NCrushContext with:
- 64KB history buffer, hash table, and match table (Box-allocated)
- 4-entry LRU offset cache
- Runtime Huffman tables (HuffTableCopyOffset[1024], HuffTableLOM[4096])
  generated from static CopyOffsetBitsLUT and LOMBitsLUT at init time
- new(compressor) constructor with table generation and verification
- reset(flush) method matching FreeRDP semantics

6 unit tests covering context creation, reset, and table generation.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 19:37:54 -05:00
Marc-André Moreau 0ecff6c193 feat(ironrdp-bulk): port NCRUSH constants and Huffman tables (TASK-021)
Port all 11 static lookup tables from FreeRDP ncrush.c:
- HuffTableLEC[8192] (u16): Huffman decode table for LEC symbols
- HuffTableLOM[512] (u16): Huffman decode table for LOM symbols
- HuffTableMask[39] (u8): Bit masks for Huffman decoding
- HuffLengthLEC[294] (u8): Huffman code lengths for LEC
- HuffCodeLEC[588] (u8): Huffman codes for LEC encoding
- HuffLengthLOM[32] (u8): Huffman code lengths for LOM
- HuffCodeLOM[32] (u16): Huffman codes for LOM encoding
- CopyOffsetBitsLUT[32] (u32): Extra bits for copy offset decoding
- CopyOffsetBaseLUT[32] (u32): Base values for copy offset decoding
- LOMBitsLUT[30] (u32): Extra bits for length-of-match decoding
- LOMBaseLUT[30] (u32): Base values for length-of-match decoding

Also add NCRUSH module constants (buffer sizes, fence value).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 19:35:18 -05:00
Marc-André Moreau 5442952530 feat(ironrdp-bulk): port XCRUSH tests from FreeRDP (TASK-020)
Port byte-exact compression tests from TestFreeRDPCodecXCrush.c:
- test_xcrush_compress_bells: verifies 49-byte input is not compressed
- test_xcrush_compress_island: verifies 386-byte input produces byte-exact
  compressed output matching FreeRDP (299 bytes, L1+L2/MPPC)

Also fix overlapping match copy bug in decompress_l1: replaced copy_within
(which uses memmove/right-to-left semantics) with byte-by-byte left-to-right
copy, required for LZ77-style overlapping matches where match_length exceeds
distance. Added 4 additional roundtrip tests (500b, 1kb, 4kb, 16kb).

Phase 6 (XCRUSH Compression & Tests) is now complete.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 19:31:20 -05:00
Marc-André Moreau f36e9c24d7 feat(ironrdp-bulk): implement XCRUSH full compression (TASK-019)
Port xcrush_compress_l1 and xcrush_compress from FreeRDP:
- compress_l1: copies src to history, runs chunk computation → match
  finding → optimization → output generation pipeline; falls back to
  L1_NO_COMPRESSION when no matches found or input ≤ 50 bytes
- compress: two-level pipeline — L1 chunk matching then L2 MPPC
  compression with proper flag header, fallback handling, and
  compression flags carry-over between calls

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 19:14:07 -05:00
Marc-André Moreau 6626626e8f feat(ironrdp-bulk): implement XCRUSH match finding and optimization (TASK-018)
Port 7 compression helper functions from FreeRDP's xcrush.c:
- clear_hash_table_range: clears chunk hash entries in a range
- find_next_matching_chunk: walks chunk chain for same-seed matches
- insert_chunk: inserts chunk into hash table, returns prev chunk
- find_match_length: bidirectional match extension (min 11 bytes)
- find_all_matches: iterates signatures, finds best matches via hash
- optimize_matches: removes overlaps, adjusts boundaries
- generate_output: produces L1 compressed format (match details + literals)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 19:12:02 -05:00
Marc-André Moreau 27c565e75b feat(ironrdp-bulk): implement XCRUSH chunk computation (TASK-017)
Port rolling hash chunk computation from FreeRDP's xcrush_compute_chunks:
- update_hash: djb2-style hash over first 32 bytes of a chunk
- append_chunk: records chunk signature if size >= 15
- compute_signatures: 32-byte rolling hash window with boundary when
  accumulator & 0x7F == 0, producing variable-size chunk signatures

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 19:09:03 -05:00
Marc-André Moreau 2d7c9394e8 feat(ironrdp-bulk): implement XCRUSH L1 and full decompression (TASK-015, TASK-016)
Port xcrush_decompress_l1 and xcrush_decompress from FreeRDP:
- Level-1 decompression: parses RDP 6.1 match details header, interleaves
  literal copies with history match copies using copy_within for overlap safety
- Full decompression: handles all flag combinations — L1-only, L1+L2 (MPPC),
  no-compression passthrough, and PACKET_FLUSHED history reset
- 8 new unit tests covering L1 decompression, full decompression, error cases

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 19:04:54 -05:00
Marc-André Moreau 158a9d1472 feat(ironrdp-bulk): port XCRUSH types and structures (TASK-014)
Define all XCRUSH data types ported from FreeRDP's xcrush.c:
- XCrushContext: 2MB history buffer, chunk tables, signature arrays,
  match arrays, and inner MPPC context
- XCrushMatchInfo, XCrushChunk, XCrushSignature: helper structs
- Rdp61MatchDetails, Rdp61CompressedData: RDP 6.1 wire format types

Large buffers allocated on the heap via vec! to avoid stack overflow
(2MB history + 512KB chunks + 128KB next_chunks).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 19:00:38 -05:00
Marc-André Moreau 9582492588 test(ironrdp-bulk): add MPPC compress/decompress round-trip tests (TASK-013)
Add 6 round-trip tests that compress then decompress data and verify
the output matches the original input:
- Small text (49B "bells") with RDP4 and RDP5
- Medium text (386B "island") with RDP5
- Large binary buffer (6.5KB) with RDP5
- 16KB repeating pattern with RDP4 and RDP5

Completes Phase 4 (MPPC Compression): all 3 tasks done, 38 total
tests passing.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 18:56:31 -05:00
Marc-André Moreau 27ffb0065d test(ironrdp-bulk): port MPPC compression tests from FreeRDP (TASK-012)
Port all four compression tests from FreeRDP's TestFreeRDPCodecMppc.c:
- test_mppc_compress_bells_rdp4 (RDP4 "bells" text)
- test_mppc_compress_bells_rdp5 (RDP5 "bells" text)
- test_mppc_compress_island_rdp5 (RDP5 John Donne "island" excerpt)
- test_mppc_compress_buffer_rdp5 (RDP5 large binary buffer)

All tests produce byte-exact output matching FreeRDP's reference
implementation. Added TEST_ISLAND_DATA (386 bytes) and
TEST_ISLAND_DATA_RDP5 (297 bytes) test vectors to test_data.rs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 18:55:13 -05:00
Marc-André Moreau 11286af319 feat(ironrdp-bulk): implement mppc_compress function (TASK-011)
Port mppc_compress from FreeRDP's libfreerdp/codec/mppc.c to Rust.
Uses LZ77 with 3-byte hash matching (MPPC_MATCH_INDEX) for finding
repeated sequences in the history buffer. Encodes literals, copy-offset
and length-of-match using BitStreamWriter with different encoding
tables for RDP4 (8K) and RDP5 (64K) compression levels. Falls back to
PACKET_FLUSHED when compressed output exceeds source size.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 18:51:10 -05:00
Marc-André Moreau 92b62f0930 test(ironrdp-bulk): port MPPC decompression tests from FreeRDP (TASK-010)
Port three decompression test vectors from FreeRDP's TestFreeRDPCodecMppc.c:

- test_mppc_decompress_bells_rdp4: RDP4 (8K) decompression of
  "for.whom.the.bell.tolls,.the.bell.tolls.for.thee!" (33 bytes → 49 bytes)
- test_mppc_decompress_bells_rdp5: RDP5 (64K) decompression of the same
  string (34 bytes → 49 bytes)
- test_mppc_decompress_buffer_rdp5: Large binary buffer RDP5 decompression
  (2835 bytes → 6496 bytes)

All three tests produce byte-for-byte identical output to FreeRDP.

New file: test_data.rs contains all test vectors extracted from the C source.
Phase 3 (MPPC Decompression) is now complete.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 18:42:41 -05:00
Marc-André Moreau 473243e393 feat(ironrdp-bulk): implement mppc_decompress function (TASK-009)
Port FreeRDP's mppc_decompress() to Rust with full support for both
RDP4 (8K history) and RDP5 (64K history) compression levels. Implements:
- PACKET_FLUSHED and PACKET_AT_FRONT flag handling
- Literal decoding (< 0x80 with 0-prefix, >= 0x80 with 10-prefix)
- CopyOffset decoding with RDP4/RDP5 encoding variants
- Unary-coded LengthOfMatch decoding (ranges 3 to 65535)
- History buffer copy with wrapping via mask (0x1FFF/0xFFFF)
- Zero-copy passthrough for uncompressed packets via shared lifetime

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 18:22:11 -05:00
Marc-André Moreau cacdb70cc6 feat(ironrdp-bulk): implement MPPC context struct (TASK-008)
Add MppcContext with Box-allocated history buffer (64K) and match
buffer (32K), supporting both RDP4 (8K) and RDP5 (64K) modes.

Includes new(), reset(flush), set_compression_level(), and
accessor methods for compression_level, history_buffer_size,
history_mask, and is_compressor.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 18:19:18 -05:00
Marc-André Moreau 94ae29beb0 feat(ironrdp-bulk): port MPPC constants and lookup tables (TASK-007)
Port from FreeRDP's mppc.c:
- MPPC_MATCH_TABLE[256] static lookup table for 3-byte hash
- mppc_match_index() function (port of MPPC_MATCH_INDEX macro)
- History buffer size constants (8K RDP4, 64K RDP5)
- History wrapping masks (0x1FFF RDP4, 0xFFFF RDP5)
- Match buffer size constant (32768)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 18:17:15 -05:00
Marc-André Moreau bee963fa8c test(ironrdp-bulk): add unit tests for bitstream utilities (TASK-006)
Add 22 comprehensive tests for BitStreamReader and BitStreamWriter:
- Reader: single bit, 8/16-bit, mixed widths, boundary crossing,
  peek, accumulator access, shift32, small/empty buffers
- Writer: 8/16-bit, single bits, mixed widths, boundary crossing,
  odd-width boundary, partial byte length
- Round-trip: single byte, multiple values, across boundary,
  many small values (20 x 3-bit crossing 32-bit boundary)

Also enabled test compilation by removing `test = false` from
Cargo.toml. This completes Phase 2 (Bitstream Utilities).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 18:15:08 -05:00
Marc-André Moreau ffba93c684 feat(ironrdp-bulk): implement BitStreamWriter for compression (TASK-005)
Port FreeRDP's wBitStream write operations to Rust. The writer uses a
32-bit accumulator that flushes big-endian to the output buffer when
full, matching the exact semantics of BitStream_Write_Bits and
BitStream_Flush.

API: new(), write_bits(), flush(), bits_written(), byte_length().
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 18:11:30 -05:00
Marc-André Moreau d9bcbffd6a feat(ironrdp-bulk): implement BitStreamReader for decompression (TASK-004)
Port FreeRDP's wBitStream read operations to Rust. The reader uses a
32-bit accumulator with big-endian prefetch, matching the exact
semantics of BitStream_Fetch, BitStream_Prefetch, and BitStream_Shift.

API: new(), read_bits(), peek_bits(), shift(), accumulator(),
remaining_bits(), bits_consumed(), shift32().

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 18:07:31 -05:00
Marc-André Moreau e29a0418e5 feat(ironrdp-bulk): define shared types and error types (TASK-003)
Add CompressionType enum (Rdp4/Rdp5/Rdp6/Rdp61) with from_flags()
constructor, compression flag constants matching FreeRDP bulk.h
(PACKET_COMPRESSED, PACKET_AT_FRONT, PACKET_FLUSHED, L1 flags),
and BulkError enum with Display and core::error::Error impls.

This completes Phase 1 (Project Setup & Crate Scaffold).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 18:03:58 -05:00
Marc-André Moreau 658bc7bab5 feat(ironrdp-bulk): set up module structure (TASK-002)
Add module declarations to lib.rs and create placeholder files:
- src/bitstream.rs - bitstream reader/writer utilities
- src/bulk.rs - bulk compressor coordinator
- src/mppc/mod.rs - MPPC (RDP4/RDP5) compression
- src/xcrush/mod.rs - XCRUSH (RDP 6.1) two-level compression
- src/ncrush/mod.rs - NCRUSH (RDP 6.0) Huffman-based compression

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 18:00:31 -05:00
Marc-André Moreau 30db64eab2 feat(ironrdp-bulk): scaffold ironrdp-bulk crate (TASK-001)
Create the ironrdp-bulk crate under crates/ironrdp-bulk/ with:
- Cargo.toml with no_std/alloc/std feature flags
- Minimal lib.rs with crate attributes following IronRDP conventions

The crate is automatically included in the workspace via the
crates/* glob in the root Cargo.toml.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 17:59:18 -05:00
Marc-André Moreau 7ff14c8a7a chore(planning): initialize bulk compression porting plan
Add structured project plan for porting FreeRDP's bulk compressor
support (MPPC, XCRUSH, NCRUSH) to IronRDP. The plan covers 37 tasks
across 11 phases, from crate setup through memory safety refactoring
and WebAssembly compatibility.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 17:56:26 -05:00
dependabot[bot] 50168c8693 build(deps): bump uuid from 1.19.0 to 1.20.0 (#1087) 2026-02-03 20:31:35 +09:00
dependabot[bot] 6afe86f2de build(deps): bump time from 0.3.45 to 0.3.46 in the patch group across 1 directory (#1084) 2026-01-28 22:26:08 +09:00
dependabot[bot] e92135dc0d build(deps): bump nix from 0.30.1 to 0.31.1 (#1085) 2026-01-28 22:10:58 +09:00
dependabot[bot] b099279424 build(deps): bump whoami from 1.6.1 to 2.0.2 (#1081) 2026-01-20 15:52:03 +00:00
dependabot[bot] 5680b593d9 build(deps): bump the patch group across 1 directory with 6 updates (#1080) 2026-01-20 09:50:33 -05:00
Benoît Cortier bedff7ebb7 build(deps): bump sspi from 0.18.6 to 0.18.7 (#1079) 2026-01-19 20:06:49 +00:00
Benoît Cortier 790669b040 revert: set protect_breaking_commits = true in release-plz.toml (#1078)
Already enabled in cliff.toml.

Refs: d202d0516f.
2026-01-16 20:26:51 +00:00
Benoît Cortier d202d0516f chore: set protect_breaking_commits = true in release-plz.toml (#1072) 2026-01-13 13:54:56 -05:00
glamberson 25f81337aa feat(cliprdr): add SendFileContentsResponse message variant (#1066)
Adds `SendFileContentsResponse` to `ClipboardMessage` enum, enabling
clipboard
backends to signal when file data is ready to send via
`submit_file_contents()`.

This provides the message-based interface pattern used consistently by
server
implementations for clipboard operations.

Co-authored-by: lamco-office <office@lamco.io>
2026-01-13 17:57:32 +00:00
glamberson c30fc35a28 feat(cliprdr): add request_file_contents method (#1065)
Per [MS-RDPECLIP section 2.2.5.3][file-contents-spec], the Local
Clipboard Owner
sends File Contents Request PDU to retrieve file data from the Shared
Clipboard
Owner during paste operations.

This enables server implementations to request file contents from
clients,
completing the bidirectional file transfer capability.

[file-contents-spec]:
https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpeclip/cbc851d3-4e68-45f4-9292-26872a9209f2

Co-authored-by: lamco-office <office@lamco.io>
2026-01-13 12:38:20 -05:00