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