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
/// Crate for containing common commands for client and daemon
/// Example:
/// let command = CommandType::Status;
use serde::{Serialize, Deserialize};
pub const PORT: u16 = 3000; // now it connects to 3000

#[derive(Serialize, Deserialize, Debug)]
pub enum Command_Type {
share(String),
    scan,
    ls,
    download(String, String),
    status,
}

/* Client gets enum from a daemon what is below.
   Any request from a client could end with access or failure.
   In success a client gets enum with 1 or 2 or 3 field. Depends from what client was requested.
   If error - enum with 4th field.*/

#[derive(Serialize, Deserialize, Debug)]
pub enum Response_type {
    share_scan,
    ls_status(String),
    download(bool),
    Error(String)
}