From e71413d8f1fab4928be0e024821d58147f6f1b0e Mon Sep 17 00:00:00 2001 From: plutooo Date: Mon, 5 Aug 2013 15:04:38 -0700 Subject: core: Move send ping packets functions to ping.c --- core/packets.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 core/packets.h (limited to 'core/packets.h') 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 @@ +/* + * packet.h -- Packet structure + * + * This file is donated to the Tox Project. + * Copyright 2013 plutooo + */ + +typedef struct { + uint8_t id[CLIENT_ID_SIZE]; + +} __attribute__((packed)) clientid_t; + +typedef enum { + PACKET_PING_REQ = 0, + PACKET_PING_RES = 1 + +} packetid_t; + +// Ping packet +typedef struct { + uint8_t magic; + clientid_t client_id; + uint8_t nonce[crypto_box_NONCEBYTES]; + uint64_t ping_id; + uint8_t padding[ENCRYPTION_PADDING]; + +} __attribute__((packed)) pingreq_t; + +// Pong packet +typedef struct { + uint8_t magic; + clientid_t client_id; + uint8_t nonce[crypto_box_NONCEBYTES]; + uint64_t ping_id; + uint8_t padding[ENCRYPTION_PADDING]; + +} __attribute__((packed)) pingres_t; -- cgit v1.2.3