diff options
Diffstat (limited to 'toxcore/packets.h')
-rw-r--r-- | toxcore/packets.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/toxcore/packets.h b/toxcore/packets.h new file mode 100644 index 00000000..4f410fb3 --- /dev/null +++ b/toxcore/packets.h | |||
@@ -0,0 +1,31 @@ | |||
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 | // Ping packet | ||
14 | typedef struct { | ||
15 | uint8_t packet_id; | ||
16 | clientid_t client_id; | ||
17 | uint8_t nonce[crypto_box_NONCEBYTES]; | ||
18 | uint64_t ping_id; | ||
19 | uint8_t padding[ENCRYPTION_PADDING]; | ||
20 | |||
21 | } __attribute__((packed)) pingreq_t; | ||
22 | |||
23 | // Pong packet | ||
24 | typedef struct { | ||
25 | uint8_t packet_id; | ||
26 | clientid_t client_id; | ||
27 | uint8_t nonce[crypto_box_NONCEBYTES]; | ||
28 | uint64_t ping_id; | ||
29 | uint8_t padding[ENCRYPTION_PADDING]; | ||
30 | |||
31 | } __attribute__((packed)) pingres_t; | ||