Skip to content

Commit 35dbcba

Browse files
protocol feat.
1 parent b8af7d5 commit 35dbcba

File tree

18 files changed

+173
-2
lines changed

18 files changed

+173
-2
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

net/src/cryptography/mod.rs

Whitespace-only changes.

net/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@
1313
pub mod socket;
1414

1515

16-
pub mod protocol;
16+
pub mod protocol;
17+
18+
19+
pub mod cryptography;

net/src/protocol/data.rs

Whitespace-only changes.

net/src/protocol/interface.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,10 @@ pub enum MTPHeaderUnit {
406406
to: MessagePublish,
407407
},
408408

409+
//TODO
409410
QueueCreation{
410-
411+
name:String,
412+
access:QueueAccess
411413
}
412414
}
413415

net/src/socket/client/data.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pub struct ClientSocketData{
2+
3+
}
4+
5+
impl ClientSocketData{}

net/src/socket/data.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use crate::protocol::{error::ProtocolError, interface::{MessageTransferProtocol, MessageTransferProtocolPayload}};
2+
13
/// Represents different types of data with their associated values.
24
///
35
/// This enum is used to represent data in various formats, including
@@ -192,4 +194,9 @@ impl Data{
192194

193195
String::from_utf16_lossy(&utf16_encoded)
194196
}
197+
}
198+
199+
pub trait ProtocolParser {
200+
fn from_raw(&self, bytes:Vec<u8>)->Result<Self, ProtocolError> where Self: Sized;
201+
fn to_bytes(&self)->Result<Vec<u8>, ProtocolError>;
195202
}

server/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ edition = "2021"
55

66
[dependencies]
77
tokio = { version = "1", features = ["full"] }
8+
net = { path = "../net" }

server/src/core/mod.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
use crate::preface::prologue::{error::PrologueError, interface::Prologue};
2+
3+
struct CoreServer<P:Prologue>{
4+
prologue:P,
5+
}
6+
7+
impl <P:Prologue>CoreServer<P> {
8+
fn new(prologue:P)->Self
9+
where P:Prologue{
10+
Self{
11+
prologue
12+
}
13+
}
14+
15+
fn start(&self){
16+
self.prologue.open_socket().inspect_err(|err|{
17+
println!("Something went wrong {err}");
18+
});
19+
}
20+
}

server/src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
mod preface;
2+
mod security;
3+
mod core;
4+
15
use tokio::runtime::Runtime;
26

37
fn main() {

0 commit comments

Comments
 (0)