diff --git a/src/lib.rs b/src/lib.rs index d4e8e2a..9753107 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -65,4 +65,14 @@ pub enum RegisterRequestDataPositions { DATA = (SALT_AND_IV_SIZE + RegisterRequestDataPositions::IV as u8) as isize, // after this there will be id and sockaddr in string or encrypted form after } +#[allow(non_camel_case_types)] +pub enum GetResponseDataPositions { + ENCRYPTED = 1, // this feeld should be 0 if not encrypted + ID_LEN = 2, + NUM_OF_CLIENTS = 3, + SALT = 4, + CLIENTS = (SALT_AND_IV_SIZE + RegisterRequestDataPositions::SALT as u8) as isize, + // after this there will be blocks of this sturcture: one byte size of sockaddr than there will be IV that is SALT_AND_IV_SIZE long and after that there will be sockaddr this repeats until the end of packet +} + pub mod shared; diff --git a/src/server/net.rs b/src/server/net.rs index 796d3fb..0ab1db2 100644 --- a/src/server/net.rs +++ b/src/server/net.rs @@ -9,7 +9,7 @@ use rayon::prelude::*; use std::sync::Arc; use std::u8; pub async fn handle_request( - mut buf: [u8; BUFFER_SIZE], + buf: [u8; BUFFER_SIZE], socket: std::sync::Arc, src: core::net::SocketAddr, data_len: usize, diff --git a/src/server/types.rs b/src/server/types.rs index 16a8539..15784fa 100644 --- a/src/server/types.rs +++ b/src/server/types.rs @@ -1,6 +1,7 @@ use pea_2_pea::*; use std::sync::{Arc, atomic::Ordering}; +#[derive(Clone)] #[readonly::make] pub struct Client { #[readonly] @@ -19,7 +20,7 @@ impl Client { } } } - +#[derive(Clone)] #[readonly::make] pub struct Registration { #[readonly]