Coverage Report

Created: 2024-01-26 01:52

/work/toxcore/TCP_server.h
Line
Count
Source
1
/* SPDX-License-Identifier: GPL-3.0-or-later
2
 * Copyright © 2016-2018 The TokTok team.
3
 * Copyright © 2014 Tox project.
4
 */
5
6
/**
7
 * Implementation of the TCP relay server part of Tox.
8
 */
9
#ifndef C_TOXCORE_TOXCORE_TCP_SERVER_H
10
#define C_TOXCORE_TOXCORE_TCP_SERVER_H
11
12
#include "crypto_core.h"
13
#include "forwarding.h"
14
#include "onion.h"
15
16
1.25M
#define MAX_INCOMING_CONNECTIONS 256
17
18
35
#define TCP_MAX_BACKLOG MAX_INCOMING_CONNECTIONS
19
20
#define ARRAY_ENTRY_SIZE 6
21
22
typedef enum TCP_Status {
23
    TCP_STATUS_NO_STATUS,
24
    TCP_STATUS_CONNECTED,
25
    TCP_STATUS_UNCONFIRMED,
26
    TCP_STATUS_CONFIRMED,
27
} TCP_Status;
28
29
typedef struct TCP_Server TCP_Server;
30
31
non_null()
32
const uint8_t *tcp_server_public_key(const TCP_Server *tcp_server);
33
non_null()
34
size_t tcp_server_listen_count(const TCP_Server *tcp_server);
35
36
/** Create new TCP server instance. */
37
non_null(1, 2, 3, 4, 7, 8) nullable(9, 10)
38
TCP_Server *new_tcp_server(const Logger *logger, const Memory *mem, const Random *rng, const Network *ns,
39
                           bool ipv6_enabled, uint16_t num_sockets, const uint16_t *ports,
40
                           const uint8_t *secret_key, Onion *onion, Forwarding *forwarding);
41
42
/** Run the TCP_server */
43
non_null()
44
void do_tcp_server(TCP_Server *tcp_server, const Mono_Time *mono_time);
45
46
/** Kill the TCP server */
47
nullable(1)
48
void kill_tcp_server(TCP_Server *tcp_server);
49
50
51
#endif /* C_TOXCORE_TOXCORE_TCP_SERVER_H */