diff options
author | iphydf <iphydf@users.noreply.github.com> | 2016-09-21 18:57:17 +0100 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2016-09-22 11:22:32 +0100 |
commit | 78d77349e499fe4e62d2187c8c696c6714ba6663 (patch) | |
tree | ab9c04418f4b9273d54d0341e04dc128944b0672 /toxcore/TCP_server.c | |
parent | aa7670da5a7824c66ea062a523639e993f3c3163 (diff) |
Make TCP_Server opaque.
We should aim to make as many structures module-private as possible.
Diffstat (limited to 'toxcore/TCP_server.c')
-rw-r--r-- | toxcore/TCP_server.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/toxcore/TCP_server.c b/toxcore/TCP_server.c index 58efe51c..7e348fa5 100644 --- a/toxcore/TCP_server.c +++ b/toxcore/TCP_server.c | |||
@@ -32,6 +32,42 @@ | |||
32 | #include <sys/ioctl.h> | 32 | #include <sys/ioctl.h> |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | struct TCP_Server { | ||
36 | Onion *onion; | ||
37 | |||
38 | #ifdef TCP_SERVER_USE_EPOLL | ||
39 | int efd; | ||
40 | uint64_t last_run_pinged; | ||
41 | #endif | ||
42 | sock_t *socks_listening; | ||
43 | unsigned int num_listening_socks; | ||
44 | |||
45 | uint8_t public_key[crypto_box_PUBLICKEYBYTES]; | ||
46 | uint8_t secret_key[crypto_box_SECRETKEYBYTES]; | ||
47 | TCP_Secure_Connection incomming_connection_queue[MAX_INCOMMING_CONNECTIONS]; | ||
48 | uint16_t incomming_connection_queue_index; | ||
49 | TCP_Secure_Connection unconfirmed_connection_queue[MAX_INCOMMING_CONNECTIONS]; | ||
50 | uint16_t unconfirmed_connection_queue_index; | ||
51 | |||
52 | TCP_Secure_Connection *accepted_connection_array; | ||
53 | uint32_t size_accepted_connections; | ||
54 | uint32_t num_accepted_connections; | ||
55 | |||
56 | uint64_t counter; | ||
57 | |||
58 | BS_LIST accepted_key_list; | ||
59 | }; | ||
60 | |||
61 | const uint8_t *tcp_server_public_key(const TCP_Server *tcp_server) | ||
62 | { | ||
63 | return tcp_server->public_key; | ||
64 | } | ||
65 | |||
66 | size_t tcp_server_listen_count(const TCP_Server *tcp_server) | ||
67 | { | ||
68 | return tcp_server->num_listening_socks; | ||
69 | } | ||
70 | |||
35 | /* return 1 on success | 71 | /* return 1 on success |
36 | * return 0 on failure | 72 | * return 0 on failure |
37 | */ | 73 | */ |