mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
feat: add native session handlers
This commit is contained in:
24
src/plugin/native_handlers/mod.rs
Normal file
24
src/plugin/native_handlers/mod.rs
Normal file
@@ -0,0 +1,24 @@
|
||||
use std::ffi::{c_void, c_ulonglong, c_ulong};
|
||||
|
||||
use serde_json::Map;
|
||||
|
||||
pub mod session;
|
||||
|
||||
pub type NR = super::native::NativeReturnValue;
|
||||
pub type PluginNativeHandlerRegistrar = NativeHandlerRegistrar<dyn PluginNativeHandler>;
|
||||
|
||||
pub struct NativeHandlerRegistrar<H>{
|
||||
handlers: Vec<H>
|
||||
}
|
||||
|
||||
pub(crate) trait PluginNativeHandler {
|
||||
/// Try to handle the method with the given data.
|
||||
///
|
||||
/// Returns: None for the message does not be handled by this handler.
|
||||
fn on_message(method: &String, data: &Map<String, serde_json::Value>) -> Option<NR>;
|
||||
|
||||
/// Try to handle the method with the given data and extra void binary data.
|
||||
///
|
||||
/// Returns: None for the message does not be handled by this handler.
|
||||
fn on_message_raw(method: &String, data: &Map<String, serde_json::Value>, raw: *const c_void, raw_len: usize) -> Option<NR>;
|
||||
}
|
||||
28
src/plugin/native_handlers/session.rs
Normal file
28
src/plugin/native_handlers/session.rs
Normal file
@@ -0,0 +1,28 @@
|
||||
use super::PluginNativeHandler;
|
||||
|
||||
|
||||
/// Session related handler for librustdesk core.
|
||||
pub struct PluginNativeSessionHandler;
|
||||
|
||||
|
||||
impl PluginNativeHandler for PluginNativeSessionHandler {
|
||||
fn on_message(method: &String, data: &serde_json::Map<String, serde_json::Value>) -> Option<super::NR> {
|
||||
None
|
||||
}
|
||||
|
||||
fn on_message_raw(method: &String, data: &serde_json::Map<String, serde_json::Value>, raw: *const std::ffi::c_void, raw_len: usize) -> Option<super::NR> {
|
||||
None
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl PluginNativeSessionHandler {
|
||||
fn create_session() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
fn add_session_hook() {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user