Commit graph

96 commits

Author SHA1 Message Date
Marc-André Lureau
7307148cb8 chore: use workspace lints
Among other things, this allows tools and LSP to pick up our settings.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2024-07-24 04:35:32 -04:00
Marc-André Lureau
adf2797ef7 fix: unnecessary qualification
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2024-07-24 04:35:32 -04:00
Zac Bergquist
dfbe947e5b
fix(session): handle the set keyboard indicators PDU (#482)
This message doesn't require a response of any kind, but handling
it here will prevent an unknown PDU error which kills the session.

Co-authored-by: Benoît Cortier <bcortier@proton.me>
2024-06-26 02:17:10 +00:00
Isaiah Becker-Mayer
fd105e4b56
feat(displaycontrol): hook up resize for ironrdp-client crate (#430) 2024-04-29 22:20:02 +03:00
Isaiah Becker-Mayer
5c42ade597
fix: make license parsing and protocol more resilient (#436)
* Converts `BlobType` to a resilient parsing style
* Makes the licensing parsing and handling more resilient to make it compatible with xrdp
2024-04-25 08:23:20 +03:00
Isaiah Becker-Mayer
ba3796f738
feat: implement the connection activation sequence rerun (#421) 2024-04-05 11:05:15 -04:00
Marc-Andre Lureau
c8f6fe5181
feat: RemoteFX encoder (#379) 2024-04-02 11:38:38 -04:00
Isaiah Becker-Mayer
1e53669b11
feat: add support for dydynvc (#419) 2024-03-29 04:18:12 -04:00
Isaiah Becker-Mayer
e3aa8bcf0d
feat: support for Server Deactivate All PDU (#418) 2024-03-27 02:39:35 -04:00
Marc-André Lureau
9faf1ff08d refactor(pdu): convert input module to PduEncode/Decode
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2024-03-21 02:43:50 +09:00
Marc-André Lureau
b0dd0677a4 refactor(dvc): switch to PduEncode/Decode
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2024-03-21 02:43:50 +09:00
Marc-André Lureau
ed963cefb6 refactor(pdu): convert DVC PDUs to PduEncode/Decode
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2024-03-21 02:43:50 +09:00
Marc-André Lureau
a45deebc98 refactor(pdu): convert RDP module to PduEncode/Decode
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2024-03-21 02:43:50 +09:00
Isaiah Becker-Mayer
3ee44b5c9b Adds logic for sending Capabilities Response
even in cases where the server doesn't send a Capabilities Request
as expected. This mimics the logic in FreeRDP, and empirically appears
to fix a bug where DVC channels behave irregularly.
2024-03-06 11:36:22 -05:00
Przemko Robakowski
af7805a5fc
fix(session): DVC message length (#383) 2024-02-27 07:24:32 +00:00
Marc-André Lureau
3a52fed1fe fix(session): bitmap is in BgrX format
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2024-02-06 18:49:42 +09:00
Marc-André Lureau
896f4b32a1 fix(session): correct Exclusive->Inclusive rectangle
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2024-02-06 18:49:42 +09:00
Marc-André Lureau
0d21e39272 refactor(session): use client_encode_svc_messages
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2024-01-15 13:21:51 +09:00
Marc-André Lureau
090440a45d refactor: rename StaticVirtualChannelProcessor->SvcProcessor
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2024-01-15 13:21:51 +09:00
Vladyslav Nikonov
056ec6a034
feat(session): graceful disconnection support (#336) 2023-12-14 15:36:20 +00:00
Marc-Andre Lureau
3725455682
feat(session): handle surface with codec ID 0 (raw bitmap) (#331)
This fixes the compability with the server example.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-12-08 14:18:07 -05:00
Marc-André Lureau
1c516e0026 misc(session): simplify a bit the code
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-12-05 11:37:18 -05:00
Isaiah Becker-Mayer
6aa3f3e63b
feat(rdpdr): SetInformation* handling (#312)
- Extend ReadCursor with methods to read and try reading i64 values in both little and big endian formats.
- Update RdpdrPdu to handle ClientDriveSetInformationResponse, reflecting the addition of ServerDriveSetInformationRequest handling in the RDPDR (Remote Desktop Protocol: Device Redirection) protocol.
- Implement decoding and encoding of various FileInformationClass types such as FileEndOfFileInformation, FileDispositionInformation, FileRenameInformation, and FileAllocationInformation.
- Refactor the existing code to improve the handling of different FileInformationClassLevels and FileSystemInformationClassLevels.
- Add handling for ServerDriveNotifyChangeDirectoryRequest in ServerDriveIoRequest, supporting the specific case when MinorFunction is set to IRP_MN_NOTIFY_CHANGE_DIRECTORY.
2023-11-29 17:38:01 +00:00
Vladyslav Nikonov
5b210f2fc7
feat(web): support for hardware cursor (#290)
Adds support for native cursors for `IronRDP-web`.

- Uses CSS `cursor` property to set the custom cursor (which we encode as Base64 data URL
- Software rendering is still in place and could be enabled via the config flag
- "Inverted colors" are implemented for native cursors as a "checkerboard pattern" (As in FreeRDP)
- Native cursors have size **limitation** - _Any remote cursor bigger than 32x32 will be scaled down._ This is due to browser limitations described [here](https://chromestatus.com/feature/5825971391299584) and [here](https://bugs.chromium.org/p/chromium/issues/detail?id=880863)

Closes #250
2023-11-21 17:20:03 +00:00
Vladyslav Nikonov
5a1999aae3
fix(session): add out of bounds cursor rendering check (#262) 2023-11-03 14:12:43 -04:00
Benoît Cortier
7d648ef56e
refactor: use u16 for pointer position (#240)
This removes some as casts that were never required.
2023-10-30 16:36:37 +02:00
Benoît CORTIER
c1802b625e test(graphics): save snapshots for RLE test
Instead of directly depending on the unmaintained rdp-rs to decompress
RLE tiles dynamically, a few snapshots are saved to test against.

The benefit is to remove a lot of outdated dependencies from our
(developement) dependency graph.
2023-10-05 10:58:16 -04:00
Benoît Cortier
3d98cd1d94
refactor: enable elided_lifetimes_in_paths lint (#203)
Hiding the lifetimes is making the code less obvious.

That’s not a problem for types that I know about intimately such as
`ReadCursor` or `WriteCursor`, but I actually found myself surprised
more than once when reading code I didn’t authored, discovering  later
there was in fact a hidden lifetime parameter.
I expect this problem to be worse for someone not familiar with
our codebase.

I understand this lint is "allow" by default because in some cases
it leads to writing unergonomic ugly code when a type has many generic
lifetimes parameters:

```
TyCtxt<'_, '_, '_>
```

However we _never_ work with more than one generic lifetime parameter in
IronRDP codebase, so it seems to me that the tradeoff towards clarity is
worth it, in our case.
2023-10-04 09:14:36 -07:00
Benoît Cortier
6283e37937
refactor: check for additional lints (#200) 2023-10-02 13:46:05 +03:00
Vladyslav Nikonov
6b660fa298
feat(cliprdr): Clipboard support for Windows (#194)
Includes refactoring changes by @ibeckermayer from #196 and #197

Co-authored-by: Isaiah Becker-Mayer <isaiah@goteleport.com>
2023-09-27 14:45:47 -04:00
Isaiah Becker-Mayer
fe1567c887
feat(rdpdr): DR_CORE_SERVER_CLIENTID_CONFIRM and DR_CORE_DEVICELIST_ANNOUNCE (#193)
Adds handling for `DR_CORE_SERVER_CLIENTID_CONFIRM` and `DR_CORE_DEVICELIST_ANNOUNCE`/`DR_CORE_DEVICELIST_ANNOUNCE_REQ`.
The next steps in the rdpdr initialization sequence.
2023-09-20 18:29:01 -04:00
Benoît Cortier
9d33cad303
feat(web): use softbuffer to draw into the canvas (#191)
Instead of copying and sending image buffers to JavaScript, the WASM
module now draws into the canvas by itself. This removes some overhead
associated with the previous approach and open the door for further
optimizations.

In order to achieve good performance, the newest API of
`softbuffer@0.3.0` is used: the "owned buffer" that can be written into
by us with direct access and `present_with_damage` to apply partial
updates. The presentation itself is currently not yet "no-copy" in
the case of the web backend because the current API of `softbuffer` is
expecting a pixel buffer in the BGRX format while the underlying canvas
can only takes RGBA pixels. There is an open issue for this.

There was a bug with the `present_with_damage` implementation for the
web backend. I fixed the issue and opened a PR to upstream the patch.
The cargo dependency patch will be removed once the fix is published
on crates.io.

Issue: ARC-164
2023-09-09 00:16:27 +03:00
Vladyslav Nikonov
eb049f69db
fix: remove redundant eprintln! (#190) 2023-09-05 15:51:08 -04:00
Vladyslav Nikonov
cd91756305
feat: CLIPRDR initialization sequence (#182) 2023-08-28 15:50:43 +00:00
Benoît CORTIER
2938db416b feat: API for custom static virtual channels
Issue: ARC-147
Co-authored-by: Isaiah Becker-Mayer <isaiah@goteleport.com>
2023-08-26 04:37:13 -04:00
Benoît Cortier
55176ff99b
refactor: write_padding! and read_padding! macros (#177)
Macros ensuring optimal handling of padding at compile time.
2023-08-15 21:36:53 +03:00
Vladyslav Nikonov
1f401a1350
feat: pointer processing logic (#168)
FastPath pointer messages handling:

- Add pointer messages handling in `ironrdp-session`, `ironrdp-client` and `ironrdp-web`
  - Supported bpp's: 1, 16, 24, 32 (8bpp is not supported yet, palette messages handling
    should be added first)
  - Alpha blending is supported, and done via software-based compositing
  - Inverted cursor pixels are supported (FreeRDP do not support them correctly)
  - Large pointers are supported (FreeRDP crashes on them)
  - Cursor caching is supported
- Add new CLI argument to enable/disable pointer rendering (--no-server-pointer)
- `session`/`client` refactoring to facilitate multiple types of session output updates besides
  framebuffer update (e.g. request to hide/show system pointer on client)
- Minor changes in web client typescript code to hide/show cursor on canvas

Closes #108
2023-08-04 13:55:11 -04:00
Vladyslav Nikonov
20312a678e
feat(pdu): pointer messages PDUs parsing support
* Add cursor messages PDUs parsing support
* Refactor the `basic_output` module to use new error-handling logic
2023-07-17 17:59:53 +03:00
Vladyslav Nikonov
4844e77b7f
fix(graphics): invalid YCoCg color conversion (#146)
Closes #141
2023-05-23 11:22:30 -04:00
Isaiah Becker-Mayer
9b7bad65e5
fix: change read_pdu to return BytesMut (#143) 2023-05-19 09:44:21 -04:00
Benoît Cortier
310df4c319
feat(web): configurable clientName and default to 16bpp (#142)
Changes IronRDP web module:

- `clientName` field in Client Core Data is now configurable (but
  defaults to "ironrdp-web")
- Set supported bitmap color depth to 16bpp
2023-05-18 15:40:07 +00:00
Benoît Cortier
0125089bc6
fix: proprietary certificate public key extraction (#134)
Also commented out some properties advertising not yet supported
features in GCC blocks.
2023-05-16 18:54:48 -04:00
Marc-André Moreau
9c3ec78588 fix: GCC client, 16/32bpp, RemoteFX rectangles
Co-authored-by: Benoît CORTIER <bcortier@proton.me>
2023-05-15 23:45:22 -04:00
Benoît CORTIER
cf2287739d refactor: error handling
Base all library errors on `ironrdp_error::Error`, a lightweight and
`no_std`-compatible generic `Error` type.
A custom consumer-defined type (such as `PduErrorKind`) for
domain-specific details is wrapped by this type.
2023-05-15 23:45:22 -04:00
Benoît CORTIER
60bc72f873 test: organize integration tests into single crate
Put all integration tests in a single crate, and organized in modules.

This is similar to what was done in `cargo` repository:
https://github.com/rust-lang/cargo/pull/5022#issuecomment-364691154

```
$ rustup show
stable-x86_64-unknown-linux-gnu (default)
rustc 1.69.0 (84c898d65 2023-04-16)
```

Run on a recent high-end laptop:
12th Gen Intel(R) Core(TM) i9-12900HK

Original (multiple integration binaries):

- `cargo clean && cargo test --no-run`: 62.893s
- `cargo clean && cargo build --lib`: 54.959s
- `cargo clean && cargo build --bins`: 55.933s
- `cargo test --no-run` (after `cargo build`): 14.472s
- `cargo test` (after `cargo test --no-run`): 1.786s
- `du -hs target/`: 4.2G

After (ironrdp-testsuite):

- `cargo clean && cargo test --no-run`: 41.157s (crates with no tests are ignored)
- `cargo clean && cargo build --lib`: 53.983s
- `cargo clean && cargo build --bins`: 54.482s
- `cargo test --no-run` (after `cargo build`): 12.915s
- `cargo test` (after `cargo test --no-run`): 0.240s
- `du -hs target/`: 3.4G

Absolute diff:
- `cargo clean && cargo test --no-run`: -21.736s
- `cargo clean && cargo build --lib`: -0.976s
- `cargo clean && cargo build --bins`: -1.451s
- `cargo test --no-run` (after `cargo build`): -1.557s
- `cargo test` (after `cargo test --no-run`): -1.546s
- `du -hs target/`: -0.8G

Relative diff (%):
- `cargo clean && cargo test --no-run`: -34.5%
- `cargo clean && cargo build --lib`: -1.77%
- `cargo clean && cargo build --bins`: -2.59%
- `cargo test --no-run` (after `cargo build`): -10.7%
- `cargo test` (after `cargo test --no-run`): -86.5%
- `du -hs target/`: -19.0%
2023-05-11 19:41:11 -04:00
Benoît Cortier
55d11a5000
refactor: clarify project architecture (#123)
> 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
2023-05-09 21:00:07 +00:00