summaryrefslogtreecommitdiff
path: root/core/packets.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/packets.h')
-rw-r--r--core/packets.h30
1 files changed, 17 insertions, 13 deletions
diff --git a/core/packets.h b/core/packets.h
index b6d3d364..222b1425 100644
--- a/core/packets.h
+++ b/core/packets.h
@@ -6,28 +6,32 @@
6 */ 6 */
7 7
8typedef struct { 8typedef struct {
9 uint8_t id[CLIENT_ID_SIZE]; 9 uint8_t id[CLIENT_ID_SIZE];
10
10} __attribute__((packed)) clientid_t; 11} __attribute__((packed)) clientid_t;
11 12
12typedef enum { 13typedef enum {
13 PACKET_PING_REQ = 0, 14 PACKET_PING_REQ = 0,
14 PACKET_PING_RES = 1 15 PACKET_PING_RES = 1
16
15} packetid_t; 17} packetid_t;
16 18
17// Ping packet 19// Ping packet
18typedef struct { 20typedef struct {
19 uint8_t magic; 21 uint8_t magic;
20 clientid_t client_id; 22 clientid_t client_id;
21 uint8_t nonce[crypto_box_NONCEBYTES]; 23 uint8_t nonce[crypto_box_NONCEBYTES];
22 uint64_t ping_id; 24 uint64_t ping_id;
23 uint8_t padding[ENCRYPTION_PADDING]; 25 uint8_t padding[ENCRYPTION_PADDING];
26
24} __attribute__((packed)) pingreq_t; 27} __attribute__((packed)) pingreq_t;
25 28
26// Pong packet 29// Pong packet
27typedef struct { 30typedef struct {
28 uint8_t magic; 31 uint8_t magic;
29 clientid_t client_id; 32 clientid_t client_id;
30 uint8_t nonce[crypto_box_NONCEBYTES]; 33 uint8_t nonce[crypto_box_NONCEBYTES];
31 uint64_t ping_id; 34 uint64_t ping_id;
32 uint8_t padding[ENCRYPTION_PADDING]; 35 uint8_t padding[ENCRYPTION_PADDING];
36
33} __attribute__((packed)) pingres_t; 37} __attribute__((packed)) pingres_t;