]> git.stg.codes - stg.git/blob - include/stg/rs_packets.h
Replace echo -e with printf
[stg.git] / include / stg / rs_packets.h
1 #ifndef RS_PACKETSH
2 #define RS_PACKETSH
3
4 #define RS_MAGIC_LEN        (6)
5 #define RS_PROTO_VER_LEN    (2)
6 #define RS_MAX_PACKET_LEN   (1048)
7 #define RS_LOGIN_LEN        (32)
8 #define RS_PARAMS_LEN       (979)
9
10 #define RS_ALIVE_PACKET      (0)
11 #define RS_CONNECT_PACKET    (1)
12 #define RS_DISCONNECT_PACKET (2)
13
14 #define RS_ID "RSP00"
15
16 #include "os_int.h"
17
18 struct RS_PACKET_HEADER
19 {
20 int8_t              magic[RS_MAGIC_LEN];
21 int8_t              protoVer[RS_PROTO_VER_LEN];
22 int8_t              packetType;
23 uint32_t            ip;
24 uint32_t            id;
25 int8_t              login[RS_LOGIN_LEN];
26 int8_t              padding[7];
27 } __attribute__((__packed__)); // 48 bytes, 6 blocks
28
29 struct RS_PACKET_TAIL
30 {
31 int8_t              magic[RS_MAGIC_LEN];
32 int8_t              params[RS_PARAMS_LEN];
33 int8_t              padding[7];
34 } __attribute__((__packed__)); // 992 bytes, 124 blocks
35
36 #endif