Skip to content

Commit

Permalink
get rid of dead_code
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaiah Becker-Mayer committed Aug 21, 2023
1 parent 34ec2d4 commit 925c420
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions crates/ironrdp-rdpdr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! [[MS-RDPEFS]: Remote Desktop Protocol: File System Virtual Channel Extension](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpefs/34d9de58-b2b5-40b6-b970-f82d4603bdb5)

mod pdu;
use crate::pdu::efs::{ClientNameRequest, Component, PacketId, SharedHeader, VersionAndIdPdu, VersionAndIdPduKind};
use crate::pdu::efs::{ClientNameRequest, Component, PacketId, SharedHeader, VersionAndIdPdu, VersionAndIdPduKind, ClientNameRequestUnicodeFlag};
use ironrdp_pdu::{cursor::ReadCursor, gcc::ChannelName, PduEncode, PduResult};
use ironrdp_svc::{AsAny, CompressionCondition, StaticVirtualChannel};
use std::{any::Any, vec};
Expand Down Expand Up @@ -44,7 +44,8 @@ impl Rdpdr {
};
trace!("sending {:?}", client_announce_reply);

let client_name_request = ClientNameRequest::Unicode(self.computer_name.clone());
let client_name_request =
ClientNameRequest::new(self.computer_name.clone(), ClientNameRequestUnicodeFlag::Unicode);
trace!("sending {:?}", client_name_request);

Ok(vec![Box::new(client_announce_reply), Box::new(client_name_request)])
Expand Down
9 changes: 7 additions & 2 deletions crates/ironrdp-rdpdr/src/pdu/efs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,17 @@ impl PduEncode for VersionAndIdPdu {
/// [2.2.2.4 Client Name Request (DR_CORE_CLIENT_NAME_REQ)](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpefs/902497f1-3b1c-4aee-95f8-1668f9b7b7d2)
#[derive(Debug)]
pub enum ClientNameRequest {
#[allow(dead_code)]
Ascii(String),
Unicode(String),
}

impl ClientNameRequest {
pub fn new(computer_name: String, kind: ClientNameRequestUnicodeFlag) -> Self {
match kind {
ClientNameRequestUnicodeFlag::Ascii => ClientNameRequest::Ascii(computer_name),
ClientNameRequestUnicodeFlag::Unicode => ClientNameRequest::Unicode(computer_name),
}
}
fn header(&self) -> SharedHeader {
SharedHeader {
component: Component::RDPDR_CTYP_CORE,
Expand Down Expand Up @@ -216,7 +221,7 @@ impl PduEncode for ClientNameRequest {

#[repr(u32)]
#[derive(Debug, Clone, Copy)]
enum ClientNameRequestUnicodeFlag {
pub enum ClientNameRequestUnicodeFlag {
Ascii = 0x0,
Unicode = 0x1,
}
Expand Down

0 comments on commit 925c420

Please sign in to comment.