airmash_protocol/v5/
client.rs

1use crate::client::*;
2use crate::v5::*;
3use crate::ClientPacket;
4
5decl_serde! {
6  struct Login {
7    protocol,
8    name => { serialize_text_small, deserialize_text_small },
9    session => { serialize_text_small, deserialize_text_small },
10    horizon_x,
11    horizon_y,
12    flag => { serialize_text_small, deserialize_text_small }
13  }
14
15  struct Backup {
16    token => { serialize_text_small, deserialize_text_small },
17  }
18
19  struct Horizon {
20    horizon_x,
21    horizon_y,
22  }
23
24  struct Pong {
25    num,
26  }
27
28  struct Key {
29    seq,
30    key,
31    state
32  }
33
34  struct Command {
35    com => { serialize_text_small, deserialize_text_small },
36    data => { serialize_text_small, deserialize_text_small }
37  }
38
39  struct Chat {
40    text => { serialize_text_small, deserialize_text_small }
41  }
42
43  struct Whisper {
44    id,
45    text => { serialize_text_small, deserialize_text_small },
46  }
47
48  struct Say {
49    text => { serialize_text_small, deserialize_text_small },
50  }
51
52  struct TeamChat {
53    text => { serialize_text_small, deserialize_text_small },
54  }
55
56  struct VoteMute {
57    id
58  }
59
60  struct LocalPing {
61    auth
62  }
63}
64
65decl_consts! {
66  const Login = 0;
67  const Backup = 1;
68  const Horizon = 2;
69  const Ack = 5;
70  const Pong = 6;
71  const Key = 10;
72  const Command = 11;
73  const ScoreDetailed = 12;
74  const Chat = 20;
75  const Whisper = 21;
76  const Say = 22;
77  const TeamChat = 23;
78  const VoteMute = 25;
79  const LocalPing = 225;
80}
81
82packet_serde! {
83  enum ClientPacket {
84    Login(x),
85    Backup(x),
86    Horizon(x),
87    Ack,
88    Pong(x),
89    Key(x),
90    Command(x),
91    ScoreDetailed,
92    Chat(x),
93    TeamChat(x),
94    Whisper(x),
95    Say(x),
96    VoteMute(x),
97    LocalPing(x)
98  }
99}