aboutsummaryrefslogtreecommitdiff
path: root/src/server_dev/room/cmd
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-04-26 13:26:53 -0700
committerFuwn <[email protected]>2021-04-26 13:26:53 -0700
commit7318396b45a64ed1336d50a5694303e849e0bfd4 (patch)
tree362223bfc517989590918a1ff5b32e1f02ab4165 /src/server_dev/room/cmd
parentetc: Prepend license identifier to *most* files (diff)
downloadwhirl-7318396b45a64ed1336d50a5694303e849e0bfd4.tar.xz
whirl-7318396b45a64ed1336d50a5694303e849e0bfd4.zip
etc: Remove legacy server module
Diffstat (limited to 'src/server_dev/room/cmd')
-rw-r--r--src/server_dev/room/cmd/mod.rs2
-rw-r--r--src/server_dev/room/cmd/property.rs37
-rw-r--r--src/server_dev/room/cmd/session.rs20
3 files changed, 59 insertions, 0 deletions
diff --git a/src/server_dev/room/cmd/mod.rs b/src/server_dev/room/cmd/mod.rs
new file mode 100644
index 0000000..1d123c0
--- /dev/null
+++ b/src/server_dev/room/cmd/mod.rs
@@ -0,0 +1,2 @@
+pub mod property;
+pub mod session;
diff --git a/src/server_dev/room/cmd/property.rs b/src/server_dev/room/cmd/property.rs
new file mode 100644
index 0000000..3135d0a
--- /dev/null
+++ b/src/server_dev/room/cmd/property.rs
@@ -0,0 +1,37 @@
+pub fn create_property_update_command() -> [u8; 161] {
+ // Vec<u8>
+ // let mut property = Vec::with_capacity(2);
+ // property.push(0x01); // ?
+ // property.push(0x10); // Command type
+ //
+ // // Meaningful Data
+ // property.push(); // Property ID
+ // property.push(); // Flags
+ // property.push(); // Access
+ //
+ // // Insert data length as first byte.
+ // property.insert(0, property.len() as u8 + 1); // ^
+ //
+ // property // Return created array
+
+ [
+ 0xA1, 0xFF, 0x10, 0x08, 0x80, 0x01, 0x07, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x1B, 0x80,
+ 0x01, 0x0C, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x73, 0x33, 0x64, 0x2E, 0x63, 0x6F, 0x6D, 0x1A, 0x80,
+ 0x01, 0x15, 0x6D, 0x61, 0x69, 0x6C, 0x2E, 0x75, 0x73, 0x2E, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x73,
+ 0x2E, 0x6E, 0x65, 0x74, 0x3A, 0x32, 0x35, 0x19, 0x80, 0x01, 0x28, 0x68, 0x74, 0x74, 0x70, 0x3A,
+ 0x2F, 0x2F, 0x77, 0x77, 0x77, 0x2D, 0x64, 0x79, 0x6E, 0x61, 0x6D, 0x69, 0x63, 0x2E, 0x75, 0x73,
+ 0x2E, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x73, 0x2E, 0x6E, 0x65, 0x74, 0x2F, 0x63, 0x67, 0x69, 0x2D,
+ 0x62, 0x69, 0x6E, 0x18, 0x80, 0x01, 0x1F, 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F, 0x2F, 0x77, 0x77,
+ 0x77, 0x2D, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x2E, 0x75, 0x73, 0x2E, 0x77, 0x6F, 0x72, 0x6C,
+ 0x64, 0x73, 0x2E, 0x6E, 0x65, 0x74, 0x0F, 0x80, 0x01, 0x01, 0x33, 0x03, 0x80, 0x01, 0x02, 0x32,
+ 0x34, 0x01, 0x80, 0x01, 0x0C, 0x57, 0x4F, 0x52, 0x4C, 0x44, 0x53, 0x4D, 0x41, 0x53, 0x54, 0x45,
+ 0x52,
+ ]: [u8; 161]
+}
+
+pub fn create_property_request_command() -> [u8; 22] {
+ [
+ 0x16, 0x01, 0x06, 0x04, 0x01, 0x30, 0x0f, 0x01, 0x33, 0x08, 0x07, 0x31, 0x30, 0x30, 0x30, 0x30,
+ 0x30, 0x30, 0x03, 0x02, 0x32, 0x34,
+ ]: [u8; 22]
+}
diff --git a/src/server_dev/room/cmd/session.rs b/src/server_dev/room/cmd/session.rs
new file mode 100644
index 0000000..dee3931
--- /dev/null
+++ b/src/server_dev/room/cmd/session.rs
@@ -0,0 +1,20 @@
+use std::str::from_utf8;
+
+use bytes::BytesMut;
+
+use crate::server::cmd::session::SessionInitializationCommand;
+
+pub fn parse_session_initialization_command(command: BytesMut) -> SessionInitializationCommand {
+ SessionInitializationCommand {
+ // protocol: command.get(4..4 + command.get(4)).unwrap().to_owned() as usize,
+ // client: "".to_string(),
+ username: from_utf8(
+ command
+ .get(25..(24 + command.get(24).unwrap().to_owned() as usize + 1))
+ .unwrap(),
+ )
+ .unwrap()
+ .to_string(),
+ // password: "".to_string()
+ }
+}