summaryrefslogtreecommitdiff
path: root/core/packets.h
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-08-06 13:53:38 -0400
committerirungentoo <irungentoo@gmail.com>2013-08-06 13:53:38 -0400
commitfc5a2f53df06bfba185ad9868970e1fecfa0fc06 (patch)
tree549191f8bd33eabefabf6387ec1cf5aabfe49f59 /core/packets.h
parenteacd12385fc775c3c246a1586047d6c2e0166977 (diff)
parent6e610749ebfc0bfe153ab88bcf76f4f9b24ff3fa (diff)
Merge branch 'master' of https://github.com/plutooo/ProjectTox-Core into plutooo-master
Conflicts: core/ping.c core/util.c
Diffstat (limited to 'core/packets.h')
-rw-r--r--core/packets.h37
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
8typedef struct {
9 uint8_t id[CLIENT_ID_SIZE];
10
11} __attribute__((packed)) clientid_t;
12
13typedef enum {
14 PACKET_PING_REQ = 0,
15 PACKET_PING_RES = 1
16
17} packetid_t;
18
19// Ping packet
20typedef 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
30typedef 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;