diff options
Diffstat (limited to 'core/packets.h')
-rw-r--r-- | core/packets.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/core/packets.h b/core/packets.h new file mode 100644 index 00000000..222b1425 --- /dev/null +++ b/core/packets.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * packet.h -- Packet structure | ||
3 | * | ||
4 | * This file is donated to the Tox Project. | ||
5 | * Copyright 2013 plutooo | ||
6 | */ | ||
7 | |||
8 | typedef struct { | ||
9 | uint8_t id[CLIENT_ID_SIZE]; | ||
10 | |||
11 | } __attribute__((packed)) clientid_t; | ||
12 | |||
13 | typedef enum { | ||
14 | PACKET_PING_REQ = 0, | ||
15 | PACKET_PING_RES = 1 | ||
16 | |||
17 | } packetid_t; | ||
18 | |||
19 | // Ping packet | ||
20 | typedef struct { | ||
21 | uint8_t magic; | ||
22 | clientid_t client_id; | ||
23 | uint8_t nonce[crypto_box_NONCEBYTES]; | ||
24 | uint64_t ping_id; | ||
25 | uint8_t padding[ENCRYPTION_PADDING]; | ||
26 | |||
27 | } __attribute__((packed)) pingreq_t; | ||
28 | |||
29 | // Pong packet | ||
30 | typedef struct { | ||
31 | uint8_t magic; | ||
32 | clientid_t client_id; | ||
33 | uint8_t nonce[crypto_box_NONCEBYTES]; | ||
34 | uint64_t ping_id; | ||
35 | uint8_t padding[ENCRYPTION_PADDING]; | ||
36 | |||
37 | } __attribute__((packed)) pingres_t; | ||