Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/ironrdp-client/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1619,6 +1619,7 @@ impl ConfigBuilder {
request_data: None,
pointer_software_rendering: self.pointer_software_rendering.unwrap_or(false),
multitransport_flags: None,
support_dyn_vc_gfx_protocol: false,
compression_type,
performance_flags: self.performance_flags.unwrap_or_default(),
timezone_info: TimezoneInfo::default(),
Expand Down
7 changes: 7 additions & 0 deletions crates/ironrdp-connector/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1643,6 +1643,10 @@ fn create_gcc_blocks<'a>(
early_capability_flags |= ClientEarlyCapabilityFlags::SUPPORT_MONITOR_LAYOUT_PDU;
}

if config.support_dyn_vc_gfx_protocol {
early_capability_flags |= ClientEarlyCapabilityFlags::SUPPORT_DYN_VC_GFX_PROTOCOL;
}

Some(early_capability_flags)
},
dig_product_id: Some(config.dig_product_id.clone()),
Expand Down Expand Up @@ -1852,6 +1856,7 @@ mod tests {
enable_server_pointer: false,
pointer_software_rendering: false,
multitransport_flags: None,
support_dyn_vc_gfx_protocol: false,
};

let client_info = create_client_info_pdu(&config, &"127.0.0.1:3389".parse().unwrap(), None).client_info;
Expand Down Expand Up @@ -1907,6 +1912,7 @@ mod tests {
enable_server_pointer: false,
pointer_software_rendering: false,
multitransport_flags: None,
support_dyn_vc_gfx_protocol: false,
};

let client_info = create_client_info_pdu(&config, &"127.0.0.1:3389".parse().unwrap(), None).client_info;
Expand Down Expand Up @@ -1971,6 +1977,7 @@ mod tests {
enable_server_pointer: false,
pointer_software_rendering: false,
multitransport_flags: None,
support_dyn_vc_gfx_protocol: false,
};

let blocks = create_gcc_blocks(&config, nego::SecurityProtocol::empty(), true, core::iter::empty())
Expand Down
22 changes: 22 additions & 0 deletions crates/ironrdp-connector/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,28 @@ pub struct Config {
/// [\[MS-RDPBCGR\] 2.2.1.3.7]: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/861f2bbb-6ca2-4c5a-8c44-0714fa901e70
/// [`MultiTransportChannelData`]: ironrdp_pdu::gcc::MultiTransportChannelData
pub multitransport_flags: Option<gcc::MultiTransportFlags>,

/// Advertise client support for the Remote Desktop Protocol: Graphics Pipeline Extension.
///
/// When `true`, the connector sets `RNS_UD_CS_SUPPORT_DYNVC_GFX_PROTOCOL` in `earlyCapabilityFlags`.
/// [\[MS-RDPBCGR\] 2.2.1.3.2] defines this Client Core Data flag.
/// [\[MS-RDPEGFX\] 1.5.1] requires clients to advertise it before using EGFX.
///
/// Enable this only after registering an EGFX-capable [`DvcClientProcessor`].
/// [`GraphicsPipelineClient`] provides IronRDP's implementation.
/// Register it with [`DrdynvcClient::with_dynamic_channel`].
/// Then attach the DRDYNVC client through [`ClientConnector::with_static_channel`].
/// Advertising the flag without a processor can make a server route graphics to an unhandled channel.
/// The desktop then remains blank.
///
/// The default is `false`, so EGFX is not advertised.
///
/// [\[MS-RDPBCGR\] 2.2.1.3.2]: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/00f1da4a-ee9c-421a-852f-c19f92343d73
/// [\[MS-RDPEGFX\] 1.5.1]: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpegfx/da5c75f9-cd99-450c-98c4-014a496942b0
/// [`DvcClientProcessor`]: https://docs.rs/ironrdp-dvc/latest/ironrdp_dvc/trait.DvcClientProcessor.html
/// [`DrdynvcClient::with_dynamic_channel`]: https://docs.rs/ironrdp-dvc/latest/ironrdp_dvc/struct.DrdynvcClient.html#method.with_dynamic_channel
/// [`GraphicsPipelineClient`]: https://docs.rs/ironrdp-egfx/latest/ironrdp_egfx/client/struct.GraphicsPipelineClient.html
pub support_dyn_vc_gfx_protocol: bool,
}

ironrdp_core::assert_impl!(Config: Send, Sync);
Expand Down
53 changes: 2 additions & 51 deletions crates/ironrdp-testsuite-core/tests/connector/autodetect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
use std::borrow::Cow;

use ironrdp_connector::MonotonicInstant;
use ironrdp_connector::{ClientConnector, ClientConnectorState, Credentials, DesktopSize, Sequence as _, Written};
use ironrdp_connector::{ClientConnector, ClientConnectorState, Sequence as _, Written};
use ironrdp_core::{WriteBuf, encode_vec};
use ironrdp_pdu::gcc;
use ironrdp_pdu::mcs::{McsMessage, SendDataIndication};
use ironrdp_pdu::rdp::autodetect::{AutoDetectReqPdu, AutoDetectRequest, AutoDetectResponse, AutoDetectRspPdu};
use ironrdp_pdu::rdp::capability_sets::MajorPlatformType;
use ironrdp_pdu::rdp::headers::{BasicSecurityHeader, BasicSecurityHeaderFlags};
use ironrdp_pdu::rdp::server_license::{
LicenseErrorCode, LicenseHeader, LicensePdu, LicensingErrorMessage, LicensingStateTransition, PreambleFlags,
Expand All @@ -27,57 +25,10 @@ const USER_CHANNEL_ID: u16 = 1002;
const IO_CHANNEL_ID: u16 = 1003;
const MESSAGE_CHANNEL_ID: u16 = 1004;

fn test_config() -> ironrdp_connector::Config {
ironrdp_connector::Config {
desktop_size: DesktopSize {
width: 1024,
height: 768,
},
monitor_layout: None,
desktop_scale_factor: 0,
enable_tls: true,
enable_credssp: false,
enable_standard_rdp_security: false,
credentials: Credentials::UsernamePassword {
username: "test".into(),
password: "test".into(),
},
domain: None,
client_build: 0,
client_name: "test".into(),
keyboard_type: gcc::KeyboardType::IBM_ENHANCED,
keyboard_subtype: 0,
keyboard_layout: 0,
keyboard_functional_keys_count: 12,
connection_type: gcc::ConnectionType::Lan,
ime_file_name: String::new(),
bitmap: None,
dig_product_id: String::new(),
client_dir: String::new(),
platform: MajorPlatformType::UNIX,
hardware_id: None,
request_data: None,
autologon: false,
enable_audio_playback: false,
enable_audio_capture: false,
license_cache: None,
compression_type: None,
enable_server_pointer: false,
pointer_software_rendering: false,
multitransport_flags: None,
performance_flags: Default::default(),
timezone_info: Default::default(),
alternate_shell: String::new(),
work_dir: String::new(),
remote_application_mode: false,
rail_support_level: ironrdp_pdu::rdp::capability_sets::RailSupportLevel::SUPPORTED,
}
}

/// A client connector parked in `ConnectTimeAutoDetection` with a negotiated
/// message channel, ready to receive the first PDU of that phase.
fn connect_time_autodetect_connector() -> ClientConnector {
let mut connector = ClientConnector::new(test_config(), "127.0.0.1:12345".parse().unwrap());
let mut connector = ClientConnector::new(super::test_config(), "127.0.0.1:12345".parse().unwrap());
connector.state = ClientConnectorState::ConnectTimeAutoDetection {
io_channel_id: IO_CHANNEL_ID,
user_channel_id: USER_CHANNEL_ID,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
use ironrdp_connector::{ClientConnector, ClientConnectorState, Sequence as _};
use ironrdp_core::{WriteBuf, decode};
use ironrdp_pdu::gcc::ClientEarlyCapabilityFlags;
use ironrdp_pdu::mcs::ConnectInitial;
use ironrdp_pdu::nego::SecurityProtocol;
use ironrdp_pdu::x224::{X224, X224Data};

#[test]
fn dyn_vc_gfx_protocol_flag_matches_config() {
let early_capability_flags = |enabled| {
let mut config = super::test_config();
config.support_dyn_vc_gfx_protocol = enabled;

let mut connector = ClientConnector::new(config, "127.0.0.1:3389".parse().unwrap());
connector.state = ClientConnectorState::BasicSettingsExchangeSendInitial {
selected_protocol: SecurityProtocol::SSL,
};

let mut output = WriteBuf::new();
connector.step(&[], None, &mut output).unwrap();

let x224 = decode::<X224<X224Data<'_>>>(output.filled()).unwrap().0;
let connect_initial = decode::<ConnectInitial>(x224.data.as_ref()).unwrap();

connect_initial
.conference_create_request
.into_gcc_blocks()
.core
.optional_data
.early_capability_flags
.expect("the connector emits early capability flags")
};

let flag = ClientEarlyCapabilityFlags::SUPPORT_DYN_VC_GFX_PROTOCOL;
let without = early_capability_flags(false);
let with = early_capability_flags(true);

assert!(!without.contains(flag));
assert_eq!(with, without | flag);
}
53 changes: 53 additions & 0 deletions crates/ironrdp-testsuite-core/tests/connector/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,54 @@
use ironrdp_connector::{Credentials, DesktopSize};
use ironrdp_pdu::gcc;
use ironrdp_pdu::rdp::capability_sets::{MajorPlatformType, RailSupportLevel};

mod autodetect;
mod early_capabilities;

fn test_config() -> ironrdp_connector::Config {
ironrdp_connector::Config {
desktop_size: DesktopSize {
width: 1024,
height: 768,
},
monitor_layout: None,
desktop_scale_factor: 0,
enable_tls: true,
enable_credssp: false,
enable_standard_rdp_security: false,
credentials: Credentials::UsernamePassword {
username: "test".into(),
password: "test".into(),
},
domain: None,
client_build: 0,
client_name: "test".into(),
keyboard_type: gcc::KeyboardType::IBM_ENHANCED,
keyboard_subtype: 0,
keyboard_layout: 0,
keyboard_functional_keys_count: 12,
connection_type: gcc::ConnectionType::Lan,
ime_file_name: String::new(),
bitmap: None,
dig_product_id: String::new(),
client_dir: String::new(),
platform: MajorPlatformType::UNIX,
hardware_id: None,
request_data: None,
autologon: false,
enable_audio_playback: false,
enable_audio_capture: false,
license_cache: None,
compression_type: None,
enable_server_pointer: false,
pointer_software_rendering: false,
multitransport_flags: None,
support_dyn_vc_gfx_protocol: false,
performance_flags: Default::default(),
timezone_info: Default::default(),
alternate_shell: String::new(),
work_dir: String::new(),
remote_application_mode: false,
rail_support_level: RailSupportLevel::SUPPORTED,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ fn test_config() -> ironrdp_connector::Config {
enable_server_pointer: false,
pointer_software_rendering: false,
multitransport_flags: None,
support_dyn_vc_gfx_protocol: false,
performance_flags: Default::default(),
timezone_info: Default::default(),
alternate_shell: String::new(),
Expand Down
16 changes: 16 additions & 0 deletions crates/ironrdp-testsuite-extra/tests/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,21 @@ async fn test_client_server() {
.await
}

/// Advertising the Graphics Pipeline early-capability bit must not disturb connection establishment.
///
/// The core testsuite separately decodes the emitted Connect Initial PDU and verifies the capability flag.
#[tokio::test]
async fn test_client_server_advertising_dyn_vc_gfx_protocol() {
client_server(
connector::Config {
support_dyn_vc_gfx_protocol: true,
..default_client_config()
},
|stage, _activation_factory, framed, _display_tx| async { (stage, framed) },
)
.await
}

#[tokio::test]
async fn test_deactivation_reactivation() {
let client_config = default_client_config();
Expand Down Expand Up @@ -1073,6 +1088,7 @@ fn default_client_config() -> connector::Config {
enable_server_pointer: true,
pointer_software_rendering: true,
multitransport_flags: None,
support_dyn_vc_gfx_protocol: false,
performance_flags: Default::default(),
timezone_info: Default::default(),
alternate_shell: String::new(),
Expand Down
1 change: 1 addition & 0 deletions crates/ironrdp-web/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1486,6 +1486,7 @@ fn build_config(
request_data: None,
pointer_software_rendering: false,
multitransport_flags: None,
support_dyn_vc_gfx_protocol: false,
performance_flags: PerformanceFlags::default(),
desktop_scale_factor: 0,
hardware_id: None,
Expand Down
1 change: 1 addition & 0 deletions crates/ironrdp/examples/screenshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ fn build_config(
compression_type,
pointer_software_rendering: true,
multitransport_flags: None,
support_dyn_vc_gfx_protocol: false,
performance_flags: PerformanceFlags::default(),
desktop_scale_factor: 0,
hardware_id: None,
Expand Down
1 change: 1 addition & 0 deletions ffi/src/connector/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ pub mod ffi {
compression_type: None,
pointer_software_rendering: self.pointer_software_rendering.unwrap_or(false),
multitransport_flags: None,
support_dyn_vc_gfx_protocol: false,
performance_flags: self.performance_flags.ok_or("performance flag is missing")?,
desktop_scale_factor: 0,
hardware_id: None,
Expand Down
Loading