Skip to content

Commit 42db2ba

Browse files
author
Isaiah Becker-Mayer
committed
naming, comment fixes
1 parent 4858c6a commit 42db2ba

File tree

5 files changed

+33
-32
lines changed

5 files changed

+33
-32
lines changed

crates/ironrdp-client/src/rdp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ async fn active_session(
193193
break 'outer;
194194
}
195195
RdpInputEvent::Clipboard(event) => {
196-
if let Some(cliprdr) = active_stage.get_svc_processor_downcast_ref::<ironrdp::cliprdr::Cliprdr>() {
196+
if let Some(cliprdr) = active_stage.get_svc_processor::<ironrdp::cliprdr::Cliprdr>() {
197197
if let Some(svc_messages) = match event {
198198
ClipboardMessage::SendInitiateCopy(formats) => {
199199
Some(cliprdr.initiate_copy(&formats)
@@ -212,7 +212,7 @@ async fn active_session(
212212
None
213213
}
214214
} {
215-
let frame = active_stage.process_svc_messages_w_processor(svc_messages)?;
215+
let frame = active_stage.process_svc_messages(svc_messages)?;
216216
// Send the messages to the server
217217
vec![ActiveStageOutput::ResponseFrame(frame)]
218218
} else {

crates/ironrdp-cliprdr/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ pub mod pdu;
88

99
use ironrdp_pdu::{decode, gcc::ChannelName, PduResult};
1010
use ironrdp_svc::{
11-
impl_as_any, ChannelFlags, CompressionCondition, StaticVirtualChannelProcessor, SvcMessage,
12-
SvcMessagesWithProcessor,
11+
impl_as_any, ChannelFlags, CompressionCondition, StaticVirtualChannelProcessor, SvcMessage, SvcMessagesForProcessor,
1312
};
1413
use pdu::{
1514
Capabilities, ClientTemporaryDirectory, ClipboardFormat, ClipboardFormatId, ClipboardGeneralCapabilityFlags,
@@ -23,7 +22,7 @@ use thiserror::Error;
2322
use tracing::{error, info};
2423

2524
/// PDUs for sending to the server on the CLIPRDR channel.
26-
pub type CliprdrSvcMessages = SvcMessagesWithProcessor<Cliprdr>;
25+
pub type CliprdrSvcMessages = SvcMessagesForProcessor<Cliprdr>;
2726

2827
#[derive(Debug, Error)]
2928
enum ClipboardError {

crates/ironrdp-session/src/active_stage.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::fast_path::UpdateKind;
88
use crate::image::DecodedImage;
99
use crate::x224::GfxHandler;
1010
use crate::{fast_path, x224, SessionResult};
11-
use ironrdp_svc::{StaticVirtualChannelProcessor, SvcMessagesWithProcessor};
11+
use ironrdp_svc::{StaticVirtualChannelProcessor, SvcMessagesForProcessor};
1212

1313
pub struct ActiveStage {
1414
x224_processor: x224::Processor,
@@ -94,7 +94,7 @@ impl ActiveStage {
9494
Ok(output)
9595
}
9696

97-
/// Process a frame received from the client.
97+
/// Process a frame received from the server.
9898
pub fn process(
9999
&mut self,
100100
image: &mut DecodedImage,
@@ -151,21 +151,21 @@ impl ActiveStage {
151151
self.x224_processor.encode_static(output, pdu)
152152
}
153153

154-
pub fn get_svc_processor_downcast_ref<T: StaticVirtualChannelProcessor + 'static>(&mut self) -> Option<&T> {
155-
self.x224_processor.get_svc_processor_downcast_ref()
154+
pub fn get_svc_processor<T: StaticVirtualChannelProcessor + 'static>(&mut self) -> Option<&T> {
155+
self.x224_processor.get_svc_processor()
156156
}
157157

158-
pub fn get_svc_processor_downcast_mut<T: StaticVirtualChannelProcessor + 'static>(&mut self) -> Option<&mut T> {
159-
self.x224_processor.get_svc_processor_downcast_mut()
158+
pub fn get_svc_processor_mut<T: StaticVirtualChannelProcessor + 'static>(&mut self) -> Option<&mut T> {
159+
self.x224_processor.get_svc_processor_mut()
160160
}
161161

162162
/// Completes user's SVC request with data, required to sent it over the network and returns
163163
/// a buffer with encoded data.
164-
pub fn process_svc_messages_w_processor<C: StaticVirtualChannelProcessor + 'static>(
164+
pub fn process_svc_messages<C: StaticVirtualChannelProcessor + 'static>(
165165
&self,
166-
request: SvcMessagesWithProcessor<C>,
166+
request: SvcMessagesForProcessor<C>,
167167
) -> SessionResult<Vec<u8>> {
168-
self.x224_processor.process_svc_messages_w_processor(request)
168+
self.x224_processor.process_svc_messages(request)
169169
}
170170
}
171171

crates/ironrdp-session/src/x224/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use ironrdp_pdu::rdp::vc::dvc;
1414
use ironrdp_pdu::write_buf::WriteBuf;
1515
use ironrdp_pdu::{encode_buf, mcs};
1616
use ironrdp_svc::{
17-
StaticChannelSet, StaticVirtualChannel, StaticVirtualChannelProcessor, SvcMessage, SvcMessagesWithProcessor,
17+
StaticChannelSet, StaticVirtualChannel, StaticVirtualChannelProcessor, SvcMessage, SvcMessagesForProcessor,
1818
};
1919

2020
pub use self::gfx::GfxHandler;
@@ -62,23 +62,23 @@ impl Processor {
6262
}
6363
}
6464

65-
pub fn get_svc_processor_downcast_ref<T: StaticVirtualChannelProcessor + 'static>(&mut self) -> Option<&T> {
65+
pub fn get_svc_processor<T: StaticVirtualChannelProcessor + 'static>(&mut self) -> Option<&T> {
6666
self.static_channels
6767
.get_by_type::<T>()
6868
.and_then(|svc| svc.channel_processor_downcast_ref())
6969
}
7070

71-
pub fn get_svc_processor_downcast_mut<T: StaticVirtualChannelProcessor + 'static>(&mut self) -> Option<&mut T> {
71+
pub fn get_svc_processor_mut<T: StaticVirtualChannelProcessor + 'static>(&mut self) -> Option<&mut T> {
7272
self.static_channels
7373
.get_by_type_mut::<T>()
7474
.and_then(|svc| svc.channel_processor_downcast_mut())
7575
}
7676

7777
/// Completes user's SVC request with data, required to sent it over the network and returns
7878
/// a buffer with encoded data.
79-
pub fn process_svc_messages_w_processor<C: StaticVirtualChannelProcessor + 'static>(
79+
pub fn process_svc_messages<C: StaticVirtualChannelProcessor + 'static>(
8080
&self,
81-
request: SvcMessagesWithProcessor<C>,
81+
request: SvcMessagesForProcessor<C>,
8282
) -> SessionResult<Vec<u8>> {
8383
let channel_id = self
8484
.static_channels

crates/ironrdp-svc/src/lib.rs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ use std::marker::PhantomData;
2323
pub type StaticChannelId = u16;
2424

2525
/// SVC data to be sent to the server. See [`SvcMessage`] for more information.
26+
///
2627
/// Usually returned by the channel-specific methods.
27-
pub struct SvcMessagesWithProcessor<P: StaticVirtualChannelProcessor> {
28+
pub struct SvcMessagesForProcessor<P: StaticVirtualChannelProcessor> {
2829
messages: Vec<SvcMessage>,
2930
_channel: PhantomData<P>,
3031
}
3132

32-
impl<P: StaticVirtualChannelProcessor> SvcMessagesWithProcessor<P> {
33+
impl<P: StaticVirtualChannelProcessor> SvcMessagesForProcessor<P> {
3334
pub fn new(messages: Vec<SvcMessage>) -> Self {
3435
Self {
3536
messages,
@@ -38,20 +39,21 @@ impl<P: StaticVirtualChannelProcessor> SvcMessagesWithProcessor<P> {
3839
}
3940
}
4041

41-
impl<P: StaticVirtualChannelProcessor> From<Vec<SvcMessage>> for SvcMessagesWithProcessor<P> {
42+
impl<P: StaticVirtualChannelProcessor> From<Vec<SvcMessage>> for SvcMessagesForProcessor<P> {
4243
fn from(messages: Vec<SvcMessage>) -> Self {
4344
Self::new(messages)
4445
}
4546
}
4647

47-
impl<P: StaticVirtualChannelProcessor> From<SvcMessagesWithProcessor<P>> for Vec<SvcMessage> {
48-
fn from(request: SvcMessagesWithProcessor<P>) -> Self {
48+
impl<P: StaticVirtualChannelProcessor> From<SvcMessagesForProcessor<P>> for Vec<SvcMessage> {
49+
fn from(request: SvcMessagesForProcessor<P>) -> Self {
4950
request.messages
5051
}
5152
}
5253

5354
/// Encodable PDU to be sent over a static virtual channel.
54-
/// Additional SVC header flags could be added via [`SvcMessage::with_flags`] method.
55+
///
56+
/// Additional SVC header flags can be added via [`SvcMessage::with_flags`] method.
5557
pub struct SvcMessage {
5658
pdu: Box<dyn PduEncode>,
5759
flags: ChannelFlags,
@@ -146,7 +148,7 @@ impl StaticVirtualChannel {
146148
/// There are at most 31 (optional) static virtual channels that can be created for a single connection, for a
147149
/// total of 32 static channels when accounting for the non-optional I/O channel.
148150
pub trait StaticVirtualChannelProcessor: AsAny + fmt::Debug + Send + Sync {
149-
/// Returns the name of the `StaticVirtualChannelProcessor`
151+
/// Returns the name of the static virtual channel corresponding to this processor.
150152
fn channel_name(&self) -> ChannelName;
151153

152154
/// Defines which compression flag should be sent along the [`ChannelDef`] Definition Structure (`CHANNEL_DEF`)
@@ -336,8 +338,8 @@ macro_rules! impl_as_any {
336338
};
337339
}
338340

339-
/// A set holding at most one [`StaticVirtualChannel`] for any given static channel and
340-
/// its corresponding [`ChunkProcessor`].
341+
/// A set holding at most one [`StaticVirtualChannel`] for any given type
342+
/// implementing [`StaticVirtualChannelProcessor`].
341343
///
342344
/// To ensure uniqueness, each trait object is associated to the [`TypeId`] of it’s original type.
343345
/// Once joined, channels may have their ID attached using [`Self::attach_channel_id()`], effectively
@@ -373,22 +375,22 @@ impl StaticChannelSet {
373375
self.channels.insert(TypeId::of::<T>(), StaticVirtualChannel::new(val))
374376
}
375377

376-
/// Gets a reference to a [`StaticVirtualChannel`] by looking up its [`TypeId`].
378+
/// Gets a reference to a [`StaticVirtualChannel`] by looking up its internal [`StaticVirtualChannelProcessor`]'s [`TypeId`].
377379
pub fn get_by_type_id(&self, type_id: TypeId) -> Option<&StaticVirtualChannel> {
378380
self.channels.get(&type_id)
379381
}
380382

381-
/// Gets a mutable reference to a [`StaticVirtualChannel`] by looking up its [`TypeId`].
383+
/// Gets a mutable reference to a [`StaticVirtualChannel`] by looking up its internal [`StaticVirtualChannelProcessor`]'s [`TypeId`].
382384
pub fn get_by_type_id_mut(&mut self, type_id: TypeId) -> Option<&mut StaticVirtualChannel> {
383385
self.channels.get_mut(&type_id)
384386
}
385387

386-
/// Gets a reference to a [`StaticVirtualChannel`] by looking up its [`TypeId`].
388+
/// Gets a reference to a [`StaticVirtualChannel`] by looking up its internal [`StaticVirtualChannelProcessor`]'s [`TypeId`].
387389
pub fn get_by_type<T: StaticVirtualChannelProcessor + 'static>(&self) -> Option<&StaticVirtualChannel> {
388390
self.get_by_type_id(TypeId::of::<T>())
389391
}
390392

391-
/// Gets a mutable reference to a [`StaticVirtualChannel`] by looking up its [`TypeId`].
393+
/// Gets a mutable reference to a [`StaticVirtualChannel`] by looking up its internal [`StaticVirtualChannelProcessor`]'s [`TypeId`].
392394
pub fn get_by_type_mut<T: StaticVirtualChannelProcessor + 'static>(&mut self) -> Option<&mut StaticVirtualChannel> {
393395
self.get_by_type_id_mut(TypeId::of::<T>())
394396
}

0 commit comments

Comments
 (0)