diff options
Diffstat (limited to 'core/src/net')
-rw-r--r-- | core/src/net/mod.rs | 9 | ||||
-rw-r--r-- | core/src/net/request/mod.rs | 12 | ||||
-rw-r--r-- | core/src/net/response/mod.rs | 12 | ||||
-rw-r--r-- | core/src/net/session_token/mod.rs | 10 |
4 files changed, 43 insertions, 0 deletions
diff --git a/core/src/net/mod.rs b/core/src/net/mod.rs new file mode 100644 index 0000000..f1d7f0d --- /dev/null +++ b/core/src/net/mod.rs @@ -0,0 +1,9 @@ +// Copyright 2022-2024 Gabriel Bjørnager Jensen. + +use crate::use_mod; +use_mod!(pub request); +use_mod!(pub response); +use_mod!(pub session_token); + +// HIP 37279, a.k.a. Procyon. +pub const DEFAULT_SERVER_PORT: u16 = 37279; diff --git a/core/src/net/request/mod.rs b/core/src/net/request/mod.rs new file mode 100644 index 0000000..ed803ac --- /dev/null +++ b/core/src/net/request/mod.rs @@ -0,0 +1,12 @@ +// Copyright 2022-2024 Gabriel Bjørnager Jensen. + +use crate::net::SessionToken; + +use bzipper::{Deserialise, FixedString, Serialise}; + +#[derive(Debug, Deserialise, Serialise)] +pub enum Request { + PlayerJoin { username: FixedString<0x10> }, + + PlayerQuit { token: SessionToken }, +} diff --git a/core/src/net/response/mod.rs b/core/src/net/response/mod.rs new file mode 100644 index 0000000..9c9a4cb --- /dev/null +++ b/core/src/net/response/mod.rs @@ -0,0 +1,12 @@ +// Copyright 2022-2024 Gabriel Bjørnager Jensen. + +use crate::net::{Request, SessionToken}; + +use bzipper::{Deserialise, FixedString, Serialise}; + +#[derive(Debug, Deserialise, Serialise)] +pub enum Response { + PlayerJoinAccepted { token: SessionToken }, + + RequestDenied { request: Request, reason: FixedString<0x20> }, +} diff --git a/core/src/net/session_token/mod.rs b/core/src/net/session_token/mod.rs new file mode 100644 index 0000000..cb3ab8c --- /dev/null +++ b/core/src/net/session_token/mod.rs @@ -0,0 +1,10 @@ +// Copyright 2022-2024 Gabriel Bjørnager Jensen. + +use bzipper::{Deserialise, Serialise}; + +#[derive(Debug, Deserialise, Serialise)] +#[repr(align(0x10))] +pub struct SessionToken { + pub time: u64, + pub key: u64, +} |