-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for dydynvc (#419)
- Loading branch information
Isaiah Becker-Mayer
authored
Mar 29, 2024
1 parent
a1d8bb2
commit 1e53669
Showing
60 changed files
with
1,741 additions
and
2,806 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
use crate::{ | ||
pdu::{DisplayControlMonitorLayout, DisplayControlPdu, MonitorLayoutEntry}, | ||
CHANNEL_NAME, | ||
}; | ||
use ironrdp_dvc::{encode_dvc_messages, DvcClientProcessor, DvcMessage, DvcProcessor}; | ||
use ironrdp_pdu::PduResult; | ||
use ironrdp_svc::{impl_as_any, ChannelFlags, SvcMessage}; | ||
use tracing::debug; | ||
|
||
/// A client for the Display Control Virtual Channel. | ||
pub struct DisplayControlClient {} | ||
|
||
impl_as_any!(DisplayControlClient); | ||
|
||
impl DvcProcessor for DisplayControlClient { | ||
fn channel_name(&self) -> &str { | ||
CHANNEL_NAME | ||
} | ||
|
||
fn start(&mut self, _channel_id: u32) -> PduResult<Vec<DvcMessage>> { | ||
Ok(Vec::new()) | ||
} | ||
|
||
fn process(&mut self, _channel_id: u32, payload: &[u8]) -> PduResult<Vec<DvcMessage>> { | ||
// TODO: We can parse the payload here for completeness sake, | ||
// in practice we don't need to do anything with the payload. | ||
debug!("Got Display PDU of length: {}", payload.len()); | ||
Ok(Vec::new()) | ||
} | ||
} | ||
|
||
impl DvcClientProcessor for DisplayControlClient {} | ||
|
||
impl DisplayControlClient { | ||
pub fn new() -> Self { | ||
Self {} | ||
} | ||
|
||
/// Fully encodes a [`MonitorLayoutPdu`] with the given monitors. | ||
pub fn encode_monitors(&self, channel_id: u32, monitors: Vec<MonitorLayoutEntry>) -> PduResult<Vec<SvcMessage>> { | ||
let pdu: DisplayControlPdu = DisplayControlMonitorLayout::new(&monitors)?.into(); | ||
encode_dvc_messages(channel_id, vec![Box::new(pdu)], ChannelFlags::empty()) | ||
} | ||
} | ||
|
||
impl Default for DisplayControlClient { | ||
fn default() -> Self { | ||
Self::new() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
#![doc = include_str!("../README.md")] | ||
|
||
pub const CHANNEL_NAME: &str = "Microsoft::Windows::RDS::DisplayControl"; | ||
|
||
pub mod client; | ||
pub mod pdu; | ||
pub mod server; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use ironrdp_dvc::{DvcMessage, DvcProcessor, DvcServerProcessor}; | ||
use ironrdp_pdu::{decode, PduResult}; | ||
use ironrdp_svc::impl_as_any; | ||
use tracing::debug; | ||
|
||
use crate::{ | ||
pdu::{DisplayControlCapabilities, DisplayControlPdu}, | ||
CHANNEL_NAME, | ||
}; | ||
|
||
/// A server for the Display Control Virtual Channel. | ||
pub struct DisplayControlServer {} | ||
|
||
impl_as_any!(DisplayControlServer); | ||
|
||
impl DvcProcessor for DisplayControlServer { | ||
fn channel_name(&self) -> &str { | ||
CHANNEL_NAME | ||
} | ||
|
||
fn start(&mut self, _channel_id: u32) -> PduResult<Vec<DvcMessage>> { | ||
let pdu: DisplayControlPdu = DisplayControlCapabilities::new(1, 3840, 2400)?.into(); | ||
|
||
Ok(vec![Box::new(pdu)]) | ||
} | ||
|
||
fn process(&mut self, _channel_id: u32, payload: &[u8]) -> PduResult<Vec<DvcMessage>> { | ||
match decode(payload)? { | ||
DisplayControlPdu::MonitorLayout(layout) => { | ||
debug!(?layout); | ||
} | ||
DisplayControlPdu::Caps(caps) => { | ||
debug!(?caps); | ||
} | ||
} | ||
Ok(Vec::new()) | ||
} | ||
} | ||
|
||
impl DvcServerProcessor for DisplayControlServer {} |
Oops, something went wrong.