mirror of
https://github.com/Devolutions/IronRDP.git
synced 2025-12-23 12:26:46 +00:00
feat(cliprdr-native): add stub
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
parent
119b0d33c2
commit
f8a982dbda
3 changed files with 99 additions and 2 deletions
|
|
@ -16,11 +16,13 @@ categories.workspace = true
|
|||
doctest = false
|
||||
test = false
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
[dependencies]
|
||||
ironrdp-cliprdr.workspace = true
|
||||
ironrdp-svc.workspace = true
|
||||
thiserror.workspace = true
|
||||
tracing.workspace = true
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
thiserror.workspace = true
|
||||
windows = { version = "0.48", features = [
|
||||
"Win32_Foundation",
|
||||
"Win32_System_DataExchange",
|
||||
|
|
|
|||
|
|
@ -14,3 +14,6 @@
|
|||
mod windows;
|
||||
#[cfg(windows)]
|
||||
pub use crate::windows::{WinClipboard, WinCliprdrError, WinCliprdrResult};
|
||||
|
||||
mod stub;
|
||||
pub use crate::stub::StubClipboard;
|
||||
|
|
|
|||
92
crates/ironrdp-cliprdr-native/src/stub.rs
Normal file
92
crates/ironrdp-cliprdr-native/src/stub.rs
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
use ironrdp_cliprdr::backend::{CliprdrBackend, CliprdrBackendFactory};
|
||||
use ironrdp_cliprdr::pdu::{
|
||||
ClipboardFormat, ClipboardGeneralCapabilityFlags, FileContentsRequest, FileContentsResponse, FormatDataRequest,
|
||||
FormatDataResponse, LockDataId,
|
||||
};
|
||||
use ironrdp_svc::impl_as_any;
|
||||
|
||||
use tracing::debug;
|
||||
|
||||
pub struct StubClipboard {}
|
||||
|
||||
impl StubClipboard {
|
||||
pub fn new() -> Self {
|
||||
Self {}
|
||||
}
|
||||
|
||||
pub fn backend_factory(&self) -> Box<dyn CliprdrBackendFactory + Send> {
|
||||
Box::new(StubCliprdrBackendFactory {})
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for StubClipboard {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
struct StubCliprdrBackendFactory {}
|
||||
|
||||
impl CliprdrBackendFactory for StubCliprdrBackendFactory {
|
||||
fn build_cliprdr_backend(&self) -> Box<dyn CliprdrBackend> {
|
||||
Box::new(StubCliprdrBackend::new())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct StubCliprdrBackend {}
|
||||
|
||||
impl_as_any!(StubCliprdrBackend);
|
||||
|
||||
impl StubCliprdrBackend {
|
||||
pub(crate) fn new() -> Self {
|
||||
Self {}
|
||||
}
|
||||
}
|
||||
|
||||
impl CliprdrBackend for StubCliprdrBackend {
|
||||
fn temporary_directory(&self) -> &str {
|
||||
".cliprdr"
|
||||
}
|
||||
|
||||
fn client_capabilities(&self) -> ClipboardGeneralCapabilityFlags {
|
||||
// No additional capabilities yet
|
||||
ClipboardGeneralCapabilityFlags::empty()
|
||||
}
|
||||
|
||||
fn on_process_negotiated_capabilities(&mut self, capabilities: ClipboardGeneralCapabilityFlags) {
|
||||
debug!(?capabilities);
|
||||
}
|
||||
|
||||
fn on_remote_copy(&mut self, available_formats: &[ClipboardFormat]) {
|
||||
debug!(?available_formats);
|
||||
}
|
||||
|
||||
fn on_format_data_request(&mut self, request: FormatDataRequest) {
|
||||
debug!(?request);
|
||||
}
|
||||
|
||||
fn on_format_data_response(&mut self, response: FormatDataResponse<'_>) {
|
||||
debug!(?response);
|
||||
}
|
||||
|
||||
fn on_file_contents_request(&mut self, request: FileContentsRequest) {
|
||||
debug!(?request);
|
||||
}
|
||||
|
||||
fn on_file_contents_response(&mut self, response: FileContentsResponse<'_>) {
|
||||
debug!(?response);
|
||||
}
|
||||
|
||||
fn on_lock(&mut self, data_id: LockDataId) {
|
||||
debug!(?data_id);
|
||||
}
|
||||
|
||||
fn on_unlock(&mut self, data_id: LockDataId) {
|
||||
debug!(?data_id);
|
||||
}
|
||||
|
||||
fn on_request_format_list(&mut self) {
|
||||
debug!("on_request_format_list");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue