summaryrefslogtreecommitdiff
path: root/core/packets.h
blob: 4f410fb3d4c1513392df9202ffacc2a34d34f006 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
 * 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 {
    uint8_t    packet_id;
    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    packet_id;
    clientid_t client_id;
    uint8_t    nonce[crypto_box_NONCEBYTES];
    uint64_t   ping_id;
    uint8_t    padding[ENCRYPTION_PADDING];

} __attribute__((packed)) pingres_t;