plugin_framework, block_input, ready to debug
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
71d64a2def
commit
c05e87b3b6
@ -3,7 +3,7 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
use super::*;
|
||||
use std::{ffi::c_void, ptr::null, str::FromStr};
|
||||
use std::{ffi::c_void, ptr::null};
|
||||
|
||||
const EXT_SUPPORT_BLOCK_INPUT: &str = "block-input";
|
||||
|
||||
@ -18,21 +18,17 @@ pub(super) fn ext_support_callback(
|
||||
// let supported = supported_plugins.contains(&id);
|
||||
let supported = true;
|
||||
if supported {
|
||||
match bool::from_str(&msg.data) {
|
||||
Ok(block) => {
|
||||
if crate::server::plugin_block_input(peer, block) == block {
|
||||
null()
|
||||
} else {
|
||||
make_return_code_msg(
|
||||
errno::ERR_CALLBACK_FAILED,
|
||||
"Failed to block input",
|
||||
)
|
||||
}
|
||||
}
|
||||
Err(err) => make_return_code_msg(
|
||||
if msg.data.len() != 1 {
|
||||
return make_return_code_msg(
|
||||
errno::ERR_CALLBACK_INVALID_ARGS,
|
||||
&format!("Failed to parse data: {}", err),
|
||||
),
|
||||
"Invalid data length",
|
||||
);
|
||||
}
|
||||
let block = msg.data[0] != 0;
|
||||
if crate::server::plugin_block_input(peer, block) == block {
|
||||
null()
|
||||
} else {
|
||||
make_return_code_msg(errno::ERR_CALLBACK_FAILED, "Failed to block input")
|
||||
}
|
||||
} else {
|
||||
make_return_code_msg(
|
||||
|
@ -56,7 +56,7 @@ struct MsgToConfig {
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct MsgToExtSupport {
|
||||
pub r#type: String,
|
||||
pub data: String,
|
||||
pub data: Vec<u8>,
|
||||
}
|
||||
|
||||
macro_rules! cb_msg_field {
|
||||
|
@ -10,13 +10,18 @@ pub const ERR_RUSTDESK_HANDLE_BASE: i32 = 10000;
|
||||
// not loaded
|
||||
pub const ERR_PLUGIN_LOAD: i32 = 10001;
|
||||
// not initialized
|
||||
pub const ERR_PLUGIN_MSG_CB: i32 = 10101;
|
||||
pub const ERR_PLUGIN_MSG_INIT: i32 = 10101;
|
||||
pub const ERR_PLUGIN_MSG_INIT_INVALID: i32 = 10102;
|
||||
pub const ERR_PLUGIN_MSG_GET_LOCAL_PEER_ID: i32 = 10103;
|
||||
// invalid
|
||||
pub const ERR_CALL_INVALID_METHOD: i32 = 10201;
|
||||
pub const ERR_CALL_NOT_SUPPORTED_METHOD: i32 = 10202;
|
||||
pub const ERR_CALL_UNIMPLEMENTED: i32 = 10201;
|
||||
pub const ERR_CALL_INVALID_METHOD: i32 = 10202;
|
||||
pub const ERR_CALL_NOT_SUPPORTED_METHOD: i32 = 10203;
|
||||
pub const ERR_CALL_INVALID_PEER: i32 = 10204;
|
||||
// failed on calling
|
||||
pub const ERR_CALL_INVALID_ARGS: i32 = 10301;
|
||||
pub const ERR_PEER_ID_MISMATCH: i32 = 10302;
|
||||
pub const ERR_CALL_CONFIG_VALUE: i32 = 10303;
|
||||
// no handlers on calling
|
||||
pub const ERR_NOT_HANDLED: i32 = 10401;
|
||||
|
||||
@ -38,6 +43,6 @@ pub const ERR_CALLBACK_FAILED: i32 = 21001;
|
||||
|
||||
pub const ERR_PLUGIN_HANDLE_BASE: i32 = 30000;
|
||||
|
||||
pub const EER_CALL_FAILED: i32 = 300021;
|
||||
pub const EER_CALL_FAILED: i32 = 30021;
|
||||
pub const ERR_PEER_ON_FAILED: i32 = 40012;
|
||||
pub const ERR_PEER_OFF_FAILED: i32 = 40012;
|
||||
|
Loading…
x
Reference in New Issue
Block a user