Skip to content

Commit 9d2a0d3

Browse files
committed
feat(dvc): expose dynamic channel accessors
Add mutable dynamic channel lookup APIs for drdynvc client / server. Signed-off-by: uchouT <i@uchout.moe>
1 parent 9046144 commit 9d2a0d3

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

crates/ironrdp-dvc/src/client.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ impl DrdynvcClient {
161161
self.dynamic_channels.get_by_channel_id(channel_id)
162162
}
163163

164+
pub fn get_dvc_by_channel_id_mut(&mut self, channel_id: u32) -> Option<&mut DynamicVirtualChannel> {
165+
self.dynamic_channels.get_by_channel_id_mut(channel_id)
166+
}
167+
164168
fn create_capabilities_response(&mut self, server_version: CapsVersion) -> SvcMessage {
165169
let caps_response = DrdynvcClientPdu::Capabilities(CapabilitiesResponsePdu::new(server_version));
166170
debug!("Send DVC Capabilities Response PDU: {caps_response:?}");

crates/ironrdp-dvc/src/server.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,18 @@ impl DrdynvcServer {
186186
.ok_or_else(|| invalid_field_err!("DRDYNVC", "", "invalid channel id"))
187187
}
188188

189+
pub fn dvc_by_id<T: DvcServerProcessor>(&self, id: u32) -> Option<&T> {
190+
self.dynamic_channels
191+
.get(id)
192+
.and_then(|w| w.processor.as_any().downcast_ref())
193+
}
194+
195+
pub fn dvc_by_id_mut<T: DvcServerProcessor>(&mut self, id: u32) -> Option<&mut T> {
196+
self.dynamic_channels
197+
.get_mut(id)
198+
.and_then(|c| c.processor.as_any_mut().downcast_mut())
199+
}
200+
189201
/// Creates a new DVC, returns CreateRequest PDU to send to client.
190202
///
191203
/// # Panics

0 commit comments

Comments
 (0)