aboutsummaryrefslogtreecommitdiff
path: root/src/server_dev/auto/cmd/session.rs
blob: 19969dc3654071cb25027e473d292f89b4ee5714 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use std::str::from_utf8;

use bytes::BytesMut;

use crate::server::cmd::session::SessionInitializationCommand;

struct _SessionInitializationCommandServer {
  pub error:       usize,
  pub app_name:    String,
  pub protocol:    usize,
  pub server_type: usize,
  pub serial:      String,
  pub private:     usize,
  pub channel:     String,
}

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(21..(20 + command.get(20).unwrap().to_owned() as usize + 1))
        .unwrap(),
    )
    .unwrap()
    .to_string(),
    // password: "".to_string()
  }
}

// pub fn create_session_initialization_command() ->
// SessionInitializationCommandServer { 	SessionInitializationCommandServer {
//
// 	}
// }