diff options
author | irungentoo <irungentoo@gmail.com> | 2015-04-07 20:19:30 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2015-04-07 20:19:30 -0400 |
commit | 3e9c4e80f0fb9c419f25b90335fd9cb6d2c98712 (patch) | |
tree | 4f80464918dc2e6ac3118bbecb98e66d0982dc48 /toxcore/TCP_connection.h | |
parent | cf436fde1273afa5f526b89189f91eebde65365e (diff) |
TCP_connection started.
The plan is to move some of the TCP stuff from net_crypto into it.
Diffstat (limited to 'toxcore/TCP_connection.h')
-rw-r--r-- | toxcore/TCP_connection.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/toxcore/TCP_connection.h b/toxcore/TCP_connection.h new file mode 100644 index 00000000..ef33aeae --- /dev/null +++ b/toxcore/TCP_connection.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* TCP_connection.h | ||
2 | * | ||
3 | * Handles TCP relay connections between two Tox clients. | ||
4 | * | ||
5 | * Copyright (C) 2015 Tox project All Rights Reserved. | ||
6 | * | ||
7 | * This file is part of Tox. | ||
8 | * | ||
9 | * Tox is free software: you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation, either version 3 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * Tox is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with Tox. If not, see <http://www.gnu.org/licenses/>. | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #ifndef TCP_CONNECTION_H | ||
25 | #define TCP_CONNECTION_H | ||
26 | |||
27 | #include "TCP_client.h" | ||
28 | |||
29 | #define TCP_CONN_STATUS_NONE 0 | ||
30 | |||
31 | typedef struct { | ||
32 | uint8_t status; | ||
33 | uint8_t dht_public_key[crypto_box_PUBLICKEYBYTES]; /* The dht public key of the peer */ | ||
34 | } TCP_Connection_to; | ||
35 | |||
36 | typedef struct { | ||
37 | uint8_t status; | ||
38 | TCP_Client_Connection *connection; | ||
39 | uint32_t lock_count; | ||
40 | } TCP_con; | ||
41 | |||
42 | typedef struct { | ||
43 | DHT *dht; | ||
44 | |||
45 | TCP_Connection_to *connections; | ||
46 | uint32_t connections_length; /* Length of connections array. */ | ||
47 | |||
48 | TCP_con *tcp_connections; | ||
49 | uint32_t tcp_connections_length; /* Length of tcp_connections array. */ | ||
50 | |||
51 | |||
52 | } TCP_Connections; | ||
53 | |||
54 | |||
55 | |||
56 | TCP_Connections *new_tcp_connections(DHT *dht); | ||
57 | void do_tcp_connections(TCP_Connections *tcp_c); | ||
58 | void kill_tcp_connections(TCP_Connections *tcp_c); | ||
59 | |||
60 | #endif | ||
61 | |||