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
7 changes: 7 additions & 0 deletions ffi/src/clipboard/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub mod ffi {
pub struct ClipboardMessage(pub ironrdp::cliprdr::backend::ClipboardMessage);

impl ClipboardMessage {
#[diplomat::attr(auto, getter = "message_type")]
pub fn get_message_type(&self) -> ClipboardMessageType {
match &self.0 {
ironrdp::cliprdr::backend::ClipboardMessage::SendInitiateCopy(_) => {
Expand All @@ -30,6 +31,7 @@ pub mod ffi {
}
}

#[diplomat::attr(auto, getter = "send_initiate_copy")]
pub fn get_send_initiate_copy(&self) -> Option<Box<ClipboardFormatIterator>> {
match &self.0 {
ironrdp::cliprdr::backend::ClipboardMessage::SendInitiateCopy(val) => Some(val.clone()),
Expand All @@ -39,6 +41,7 @@ pub mod ffi {
.map(Box::new)
}

#[diplomat::attr(auto, getter = "send_format_data")]
pub fn get_send_format_data(&self) -> Option<Box<FormatDataResponse>> {
match &self.0 {
ironrdp::cliprdr::backend::ClipboardMessage::SendFormatData(val) => Some(val.clone()),
Expand All @@ -49,6 +52,7 @@ pub mod ffi {
.map(Box::new)
}

#[diplomat::attr(auto, getter = "send_initiate_paste")]
pub fn get_send_initiate_paste(&self) -> Option<Box<ClipboardFormatId>> {
match &self.0 {
ironrdp::cliprdr::backend::ClipboardMessage::SendInitiatePaste(val) => Some(*val),
Expand All @@ -58,6 +62,7 @@ pub mod ffi {
.map(Box::new)
}

#[diplomat::attr(auto, getter = "send_file_contents_request")]
pub fn get_send_file_contents_request(&self) -> Option<Box<FfiFileContentsRequest>> {
match &self.0 {
ironrdp::cliprdr::backend::ClipboardMessage::SendFileContentsRequest(val) => Some(val.clone()),
Expand All @@ -67,6 +72,7 @@ pub mod ffi {
.map(Box::new)
}

#[diplomat::attr(auto, getter = "send_file_contents_response")]
pub fn get_send_file_contents_response(&self) -> Option<Box<FfiFileContentsResponse>> {
match &self.0 {
ironrdp::cliprdr::backend::ClipboardMessage::SendFileContentsResponse(val) => Some(val.clone()),
Expand All @@ -76,6 +82,7 @@ pub mod ffi {
.map(Box::new)
}

#[diplomat::attr(auto, getter = "error")]
pub fn get_error(&self) -> Option<Box<IronRdpError>> {
match &self.0 {
ironrdp::cliprdr::backend::ClipboardMessage::Error(e) => {
Expand Down
13 changes: 13 additions & 0 deletions ffi/src/connector/activation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub mod ffi {
);

impl ConnectionActivationSequence {
#[diplomat::attr(auto, getter = "state")]
pub fn get_state(&self) -> Box<ConnectionActivationState> {
Box::new(ConnectionActivationState {
state: self.0.connection_activation_state(),
Expand All @@ -36,10 +37,12 @@ pub mod ffi {
Ok(res)
}

#[diplomat::attr(auto, getter = "io_channel_id")]
pub fn get_io_channel_id(&self) -> u16 {
self.0.io_channel_id()
}

#[diplomat::attr(auto, getter = "user_channel_id")]
pub fn get_user_channel_id(&self) -> u16 {
self.0.user_channel_id()
}
Expand All @@ -58,6 +61,7 @@ pub mod ffi {
}

impl ConnectionActivationState {
#[diplomat::attr(auto, getter = "type")]
pub fn get_type(&self) -> ConnectionActivationStateType {
match self.state {
ironrdp::connector::connection_activation::ConnectionActivationState::Consumed => {
Expand All @@ -75,6 +79,7 @@ pub mod ffi {
}
}

#[diplomat::attr(auto, getter = "connection_finalization")]
pub fn get_connection_finalization(
&self,
) -> Result<Box<ConnectionActivationStateConnectionFinalization>, Box<IronRdpError>> {
Expand All @@ -95,6 +100,7 @@ pub mod ffi {
}
}

#[diplomat::attr(auto, getter = "finalized")]
pub fn get_finalized(&self) -> Result<Box<ConnectionActivationStateFinalized>, Box<IronRdpError>> {
match &self.state {
ironrdp::connector::connection_activation::ConnectionActivationState::Finalized {
Expand Down Expand Up @@ -128,6 +134,7 @@ pub mod ffi {
}

impl ConnectionActivationStateConnectionFinalization {
#[diplomat::attr(auto, getter = "desktop_size")]
pub fn get_desktop_size(&self) -> Box<DesktopSize> {
Box::new(DesktopSize(self.desktop_size))
}
Expand All @@ -144,28 +151,34 @@ pub mod ffi {
}

impl ConnectionActivationStateFinalized {
#[diplomat::attr(auto, getter = "share_id")]
pub fn get_share_id(&self) -> u32 {
self.share_id
}

#[diplomat::attr(auto, getter = "desktop_size")]
pub fn get_desktop_size(&self) -> Box<DesktopSize> {
Box::new(DesktopSize(self.desktop_size))
}

#[diplomat::attr(auto, getter = "enable_server_pointer")]
pub fn get_enable_server_pointer(&self) -> bool {
self.enable_server_pointer
}

#[diplomat::attr(auto, getter = "pointer_software_rendering")]
pub fn get_pointer_software_rendering(&self) -> bool {
self.pointer_software_rendering
}

#[diplomat::attr(auto, getter = "static_channel_chunk_size")]
pub fn get_static_channel_chunk_size(&self) -> usize {
self.static_channel_chunk_size
}

/// Returns -1 when Window List support was not negotiated, otherwise
/// the negotiated Window List support level.
#[diplomat::attr(auto, getter = "window_support_level")]
pub fn get_window_support_level(&self) -> i8 {
match self.window_support_level {
None => -1,
Expand Down
21 changes: 21 additions & 0 deletions ffi/src/connector/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pub mod ffi {
Box::<ConfigBuilder>::default()
}

#[diplomat::attr(auto, getter = "dvc_pipe_proxy")]
pub fn get_dvc_pipe_proxy(&self) -> Option<Box<DvcPipeProxyConfig>> {
self.dvc_pipe_proxy.as_ref().map(|dvc| Box::new(dvc.clone()))
}
Expand Down Expand Up @@ -88,10 +89,12 @@ pub mod ffi {
pub struct DesktopSize(pub ironrdp::connector::DesktopSize);

impl DesktopSize {
#[diplomat::attr(auto, getter = "width")]
pub fn get_width(&self) -> u16 {
self.0.width
}

#[diplomat::attr(auto, getter = "height")]
pub fn get_height(&self) -> u16 {
self.0.height
}
Expand All @@ -109,38 +112,47 @@ pub mod ffi {
});
}

#[diplomat::attr(auto, setter = "domain")]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[skeptical] Annotations are inert under pinned Diplomat and no in-repo mechanism validates coverage or naming — low 🟡 — The PR adds 105 per-accessor #[diplomat::attr(auto, ...)] annotations, but ffi/Cargo.toml pins diplomat 0.7, whose macro strips these attributes, so the CI regeneration check cannot detect a wrong or missing attribute name and generates identical output. Correctness is established only by the follow-up regeneration in #2165 cited in a PR comment. Nothing enforces the convention going forward: a future get_/set_ accessor added without an attribute will silently lose its property binding at the next generator bump, recreating the regression this PR fixes. Consider landing with the generator bump or adding an xtask check that fails when a property-eligible accessor lacks the attribute. Low severity: the annotations are correct today and the risk only materializes at a future upgrade.

pub fn set_domain(&mut self, domain: &str) {
self.domain = Some(domain.to_owned());
}

#[diplomat::attr(auto, setter = "enable_tls")]
pub fn set_enable_tls(&mut self, enable_tls: bool) {
self.enable_tls = Some(enable_tls);
}

#[diplomat::attr(auto, setter = "enable_credssp")]
pub fn set_enable_credssp(&mut self, enable_credssp: bool) {
self.enable_credssp = Some(enable_credssp);
}

#[diplomat::attr(auto, setter = "keyboard_layout")]
pub fn set_keyboard_layout(&mut self, keyboard_layout: u32) {
self.keyboard_layout = Some(keyboard_layout);
}

#[diplomat::attr(auto, setter = "keyboard_type")]
pub fn set_keyboard_type(&mut self, keyboard_type: KeyboardType) {
self.keyboard_type = Some(keyboard_type.into());
}

#[diplomat::attr(auto, setter = "keyboard_subtype")]
pub fn set_keyboard_subtype(&mut self, keyboard_subtype: u32) {
self.keyboard_subtype = Some(keyboard_subtype);
}

#[diplomat::attr(auto, setter = "keyboard_functional_keys_count")]
pub fn set_keyboard_functional_keys_count(&mut self, keyboard_functional_keys_count: u32) {
self.keyboard_functional_keys_count = Some(keyboard_functional_keys_count);
}

#[diplomat::attr(auto, setter = "ime_file_name")]
pub fn set_ime_file_name(&mut self, ime_file_name: &str) {
self.ime_file_name = Some(ime_file_name.to_owned());
}

#[diplomat::attr(auto, setter = "dig_product_id")]
pub fn set_dig_product_id(&mut self, dig_product_id: &str) {
self.dig_product_id = Some(dig_product_id.to_owned());
}
Expand All @@ -149,6 +161,7 @@ pub mod ffi {
self.desktop_size = Some(ironrdp::connector::DesktopSize { width, height });
}

#[diplomat::attr(auto, setter = "performance_flags")]
pub fn set_performance_flags(&mut self, performance_flags: &PerformanceFlags) {
self.performance_flags = Some(performance_flags.0);
}
Expand All @@ -157,34 +170,42 @@ pub mod ffi {
// self.timezone_info = timezone_info;
// }

#[diplomat::attr(auto, setter = "bitmap_config")]
pub fn set_bitmap_config(&mut self, bitmap: &BitmapConfig) {
self.bitmap = Some(bitmap.0.clone());
}

#[diplomat::attr(auto, setter = "client_build")]
pub fn set_client_build(&mut self, client_build: u32) {
self.client_build = Some(client_build);
}

#[diplomat::attr(auto, setter = "client_name")]
pub fn set_client_name(&mut self, client_name: &str) {
self.client_name = Some(client_name.to_owned());
}

#[diplomat::attr(auto, setter = "client_dir")]
pub fn set_client_dir(&mut self, client_dir: &str) {
self.client_dir = Some(client_dir.to_owned());
}

#[diplomat::attr(auto, setter = "enable_server_pointer")]
pub fn set_enable_server_pointer(&mut self, enable_server_pointer: bool) {
self.enable_server_pointer = Some(enable_server_pointer);
}

#[diplomat::attr(auto, setter = "autologon")]
pub fn set_autologon(&mut self, autologon: bool) {
self.autologon = Some(autologon);
}

#[diplomat::attr(auto, setter = "pointer_software_rendering")]
pub fn set_pointer_software_rendering(&mut self, pointer_software_rendering: bool) {
self.pointer_software_rendering = Some(pointer_software_rendering);
}

#[diplomat::attr(auto, setter = "dvc_pipe_proxy")]
pub fn set_dvc_pipe_proxy(&mut self, dvc_pipe_proxy: &DvcPipeProxyConfig) {
self.dvc_pipe_proxy = Some(dvc_pipe_proxy.clone());
}
Expand Down
2 changes: 2 additions & 0 deletions ffi/src/connector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ pub mod ffi {
Ok(connector.next_pdu_hint().map(PduHint).map(Box::new))
}

#[diplomat::attr(auto, getter = "dyn_state")]
pub fn get_dyn_state(&self) -> Result<Box<DynState<'_>>, Box<IronRdpError>> {
let Some(connector) = self.0.as_ref() else {
return Err(ValueConsumedError::for_item("connector").into());
Expand Down Expand Up @@ -265,6 +266,7 @@ pub mod ffi {
pub struct DynState<'a>(pub &'a dyn ironrdp::connector::State);

impl<'a> DynState<'a> {
#[diplomat::attr(auto, getter = "name")]
Comment thread
irvingoujAtDevolution marked this conversation as resolved.
pub fn get_name(&'a self, writeable: &'a mut DiplomatWriteable) -> Result<(), Box<IronRdpError>> {
let name = self.0.name();
write!(writeable, "{name}")?;
Expand Down
8 changes: 8 additions & 0 deletions ffi/src/connector/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ pub mod ffi {
}

impl Written {
#[diplomat::attr(auto, getter = "written_type")]
pub fn get_written_type(&self) -> WrittenType {
match &self.0 {
ironrdp::connector::Written::Size(_) => WrittenType::Size,
ironrdp::connector::Written::Nothing => WrittenType::Nothing,
}
}

#[diplomat::attr(auto, getter = "size")]
pub fn get_size(&self) -> Box<OptionalUsize> {
match &self.0 {
ironrdp::connector::Written::Size(size) => Box::new(OptionalUsize(Some(size.get()))),
Expand All @@ -33,6 +35,7 @@ pub mod ffi {
pub struct ConnectionResult(pub Option<ironrdp::connector::ConnectionResult>);

impl ConnectionResult {
#[diplomat::attr(auto, getter = "io_channel_id")]
pub fn get_io_channel_id(&self) -> Result<u16, Box<IronRdpError>> {
Ok(self
.0
Expand All @@ -41,6 +44,7 @@ pub mod ffi {
.io_channel_id)
}

#[diplomat::attr(auto, getter = "user_channel_id")]
pub fn get_user_channel_id(&self) -> Result<u16, Box<IronRdpError>> {
Ok(self
.0
Expand All @@ -49,6 +53,7 @@ pub mod ffi {
.user_channel_id)
}

#[diplomat::attr(auto, getter = "share_id")]
pub fn get_share_id(&self) -> Result<u32, Box<IronRdpError>> {
Ok(self
.0
Expand All @@ -57,6 +62,7 @@ pub mod ffi {
.share_id)
}

#[diplomat::attr(auto, getter = "desktop_size")]
pub fn get_desktop_size(&self) -> Result<Box<DesktopSize>, Box<IronRdpError>> {
Ok(Box::new(DesktopSize(
self.0
Expand All @@ -66,6 +72,7 @@ pub mod ffi {
)))
}

#[diplomat::attr(auto, getter = "enable_server_pointer")]
pub fn get_enable_server_pointer(&self) -> Result<bool, Box<IronRdpError>> {
Ok(self
.0
Expand All @@ -74,6 +81,7 @@ pub mod ffi {
.enable_server_pointer)
}

#[diplomat::attr(auto, getter = "pointer_software_rendering")]
pub fn get_pointer_software_rendering(&self) -> Result<bool, Box<IronRdpError>> {
Ok(self
.0
Expand Down
1 change: 1 addition & 0 deletions ffi/src/connector/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub mod ffi {
}

impl ClientConnectorState {
#[diplomat::attr(auto, getter = "enum_type")]
pub fn get_enum_type(&self) -> Result<ClientConnectorStateType, Box<IronRdpError>> {
let res = match &self
.0
Expand Down
6 changes: 6 additions & 0 deletions ffi/src/credssp/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@ pub mod ffi {
matches!(self.0, CredsspGeneratorState::Completed(_))
}

#[diplomat::attr(auto, getter = "network_request_if_suspended")]
pub fn get_network_request_if_suspended<'a>(&'a self) -> Option<Box<NetworkRequest<'a>>> {
match &self.0 {
CredsspGeneratorState::Suspended(request) => Some(Box::new(NetworkRequest(request))),
_ => None,
}
}

#[diplomat::attr(auto, getter = "client_state_if_completed")]
pub fn get_client_state_if_completed(&self) -> Result<Box<ClientState>, Box<IronRdpError>> {
match &self.0 {
CredsspGeneratorState::Completed(Ok(res)) => Ok(Box::new(ClientState(res.clone()))),
Expand All @@ -77,6 +79,7 @@ pub mod ffi {
matches!(self.0, sspi::credssp::ClientState::FinalMessage(_))
}

#[diplomat::attr(auto, getter = "ts_request")]
pub fn get_ts_request(&self) -> Result<Box<TsRequest>, Box<IronRdpError>> {
match &self.0 {
sspi::credssp::ClientState::ReplyNeeded(ts_request) => Ok(Box::new(TsRequest(ts_request.clone()))),
Expand All @@ -86,14 +89,17 @@ pub mod ffi {
}

impl<'a> NetworkRequest<'a> {
#[diplomat::attr(auto, getter = "data")]
pub fn get_data(&self) -> Box<VecU8> {
Box::new(VecU8(self.0.data.clone()))
}

#[diplomat::attr(auto, getter = "protocol")]
pub fn get_protocol(&self) -> NetworkRequestProtocol {
self.0.protocol.into()
}

#[diplomat::attr(auto, getter = "url")]
pub fn get_url(&self, writeable: &mut diplomat_runtime::DiplomatWriteable) -> Result<(), Box<IronRdpError>> {
use core::fmt::Write as _;
let url: &str = self.0.url.as_ref();
Expand Down
Loading
Loading