From 7e22acda5988e86ec2dd5805cdbb250b2495317f Mon Sep 17 00:00:00 2001 From: red binder Date: Mon, 13 Apr 2026 00:27:30 +0200 Subject: [PATCH] Basic test for SMM functionality --- rnex-core/src/nex/datastore.rs | 31 ++++++++++ rnex-core/src/nex/mod.rs | 1 + rnex-core/src/rmc/protocols/datastore.rs | 74 ++++++++++++++++++++++++ rnex-core/src/rmc/protocols/mod.rs | 1 + 4 files changed, 107 insertions(+) create mode 100644 rnex-core/src/nex/datastore.rs create mode 100644 rnex-core/src/rmc/protocols/datastore.rs diff --git a/rnex-core/src/nex/datastore.rs b/rnex-core/src/nex/datastore.rs new file mode 100644 index 0000000..c24f75c --- /dev/null +++ b/rnex-core/src/nex/datastore.rs @@ -0,0 +1,31 @@ +use rnex_core::rmc::protocols::datastore::DataStore; +// use crate::define_rmc_proto; +// use macros::rmc_struct; +use rnex_core::prudp::socket_addr::PRUDPSockAddr; +use std::sync::{Weak}; +use rnex_core::PID; +use crate::nex::remote_console::RemoteConsole; +use rnex_core::rmc::response::ErrorCode; +use rnex_core::rmc::protocols::datastore::{GetMetaInfo, GetMetaParam}; + +pub struct User { + pub pid: PID, + pub ip: PRUDPSockAddr, + pub this: Weak, + pub remote: RemoteConsole, +} + +impl DataStore for User { + async fn get_meta(&self, metaparam: GetMetaParam) -> Result { + // // bogus + // let info: GetMetaInfo = GetMetaInfo { + // dataid: 10, + // owner: 1121, + // size: 1024, + // name: "idk" + // } + + // just trying to see what methods it tries to use + Err(rnex_core::rmc::response::ErrorCode::DataStore_NotFound) + } +} \ No newline at end of file diff --git a/rnex-core/src/nex/mod.rs b/rnex-core/src/nex/mod.rs index 0f52c13..2f628cd 100644 --- a/rnex-core/src/nex/mod.rs +++ b/rnex-core/src/nex/mod.rs @@ -5,3 +5,4 @@ pub mod friends_handler; pub mod matchmake; pub mod remote_console; pub mod user; +pub mod datastore; \ No newline at end of file diff --git a/rnex-core/src/rmc/protocols/datastore.rs b/rnex-core/src/rmc/protocols/datastore.rs new file mode 100644 index 0000000..796281d --- /dev/null +++ b/rnex-core/src/rmc/protocols/datastore.rs @@ -0,0 +1,74 @@ +use macros::{method_id, rmc_proto, RmcSerialize, rmc_struct}; +use crate::rmc::response::ErrorCode; +use rnex_core::rmc::structures::qbuffer::QBuffer; + +use rnex_core::kerberos::KerberosDateTime; +use rnex_core::PID; + +#[derive(RmcSerialize, Clone)] +#[rmc_struct(0)] +pub struct PersistenceTarget { + pub owner: PID, + pub persistence_slot_id: u16, +} + +#[derive(RmcSerialize, Clone)] +#[rmc_struct(0)] +pub struct Permission { + pub permission: u8, + pub recipient_ids: Vec, +} + +#[derive(RmcSerialize, Clone)] +#[rmc_struct(0)] +pub struct RatingInfoWithSlot { + pub slot: i8, + pub rating: RatingInfo, +} + +#[derive(RmcSerialize, Clone)] +#[rmc_struct(0)] +pub struct RatingInfo { + pub total_value: i64, + pub count: u32, + pub initial_value: i64, +} + +#[derive(RmcSerialize, Clone)] +#[rmc_struct(0)] +pub struct GetMetaParam { + pub dataid: u64, + pub persistence_target: PersistenceTarget, + pub result_option: u8, + pub access_password: u64, +} + +#[derive(RmcSerialize, Clone)] +#[rmc_struct(0)] +pub struct GetMetaInfo { + pub dataid: u64, + pub owner: PID, + pub size: u32, + pub name: &'static str, + pub data_type: u16, + pub meta_binary: QBuffer, + pub permission: Permission, + pub del_permission: Permission, + pub created_time: KerberosDateTime, + pub updated_time: KerberosDateTime, + pub period: u16, + pub status: u8, + pub reffered_count: u32, + pub refer_dat_id: u32, + pub flag: u32, + pub referred_time: KerberosDateTime, + pub expire_time: KerberosDateTime, + pub tags: Vec<&'static str>, + pub ratings: Vec, +} + +#[rmc_proto(115)] +pub trait DataStore{ + #[method_id(8)] + async fn get_meta(&self, metaparam: GetMetaParam) -> Result; +} \ No newline at end of file diff --git a/rnex-core/src/rmc/protocols/mod.rs b/rnex-core/src/rmc/protocols/mod.rs index 8feb2f3..e3f1364 100644 --- a/rnex-core/src/rmc/protocols/mod.rs +++ b/rnex-core/src/rmc/protocols/mod.rs @@ -10,6 +10,7 @@ pub mod nat_traversal; pub mod notifications; pub mod ranking; pub mod secure; +pub mod datastore; use crate::result::ResultExtension; use crate::rmc::message::RMCMessage;