2013-08-06 06:04:38 +08:00
|
|
|
/*
|
|
|
|
* 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;
|
|
|
|
|
|
|
|
// Ping packet
|
|
|
|
typedef struct {
|
2013-08-21 15:55:43 +08:00
|
|
|
uint8_t packet_id;
|
2013-08-06 06:04:38 +08:00
|
|
|
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 {
|
2013-08-21 15:55:43 +08:00
|
|
|
uint8_t packet_id;
|
2013-08-06 06:04:38 +08:00
|
|
|
clientid_t client_id;
|
|
|
|
uint8_t nonce[crypto_box_NONCEBYTES];
|
|
|
|
uint64_t ping_id;
|
|
|
|
uint8_t padding[ENCRYPTION_PADDING];
|
|
|
|
|
|
|
|
} __attribute__((packed)) pingres_t;
|