diff options
author | irungentoo <irungentoo@gmail.com> | 2014-03-29 22:19:03 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2014-03-29 22:19:03 -0400 |
commit | 98cba889a70c62847da9127832e3aece8722e235 (patch) | |
tree | e202670f64c706b63e4a9d59b6c69da1388058c4 /toxcore/TCP_server.h | |
parent | 8aaa5fe996e44a0c68c069b8e70649264f5e8a56 (diff) |
TCP server now has onion functionality.
All the IP/Port related structs now have __attribute__ ((__packed__))
Diffstat (limited to 'toxcore/TCP_server.h')
-rw-r--r-- | toxcore/TCP_server.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/toxcore/TCP_server.h b/toxcore/TCP_server.h index 4814d407..7461fe5d 100644 --- a/toxcore/TCP_server.h +++ b/toxcore/TCP_server.h | |||
@@ -21,6 +21,7 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include "net_crypto.h" | 23 | #include "net_crypto.h" |
24 | #include "onion.h" | ||
24 | 25 | ||
25 | #define MAX_INCOMMING_CONNECTIONS 32 | 26 | #define MAX_INCOMMING_CONNECTIONS 32 |
26 | 27 | ||
@@ -46,6 +47,8 @@ | |||
46 | 47 | ||
47 | #define ARRAY_ENTRY_SIZE 6 | 48 | #define ARRAY_ENTRY_SIZE 6 |
48 | 49 | ||
50 | #define TCP_ONION_FAMILY (AF_INET6 + 1) | ||
51 | |||
49 | enum { | 52 | enum { |
50 | TCP_STATUS_NO_STATUS, | 53 | TCP_STATUS_NO_STATUS, |
51 | TCP_STATUS_CONNECTED, | 54 | TCP_STATUS_CONNECTED, |
@@ -70,10 +73,13 @@ typedef struct TCP_Secure_Connection { | |||
70 | uint8_t last_packet[2 + MAX_PACKET_SIZE]; | 73 | uint8_t last_packet[2 + MAX_PACKET_SIZE]; |
71 | uint16_t last_packet_length; | 74 | uint16_t last_packet_length; |
72 | uint16_t last_packet_sent; | 75 | uint16_t last_packet_sent; |
76 | |||
77 | uint64_t identifier; | ||
73 | } TCP_Secure_Connection; | 78 | } TCP_Secure_Connection; |
74 | 79 | ||
75 | 80 | ||
76 | typedef struct { | 81 | typedef struct { |
82 | Onion *onion; | ||
77 | sock_t *socks_listening; | 83 | sock_t *socks_listening; |
78 | unsigned int num_listening_socks; | 84 | unsigned int num_listening_socks; |
79 | 85 | ||
@@ -87,12 +93,14 @@ typedef struct { | |||
87 | TCP_Secure_Connection *accepted_connection_array; | 93 | TCP_Secure_Connection *accepted_connection_array; |
88 | uint32_t size_accepted_connections; | 94 | uint32_t size_accepted_connections; |
89 | uint32_t num_accepted_connections; | 95 | uint32_t num_accepted_connections; |
96 | |||
97 | uint64_t counter; | ||
90 | } TCP_Server; | 98 | } TCP_Server; |
91 | 99 | ||
92 | /* Create new TCP server instance. | 100 | /* Create new TCP server instance. |
93 | */ | 101 | */ |
94 | TCP_Server *new_TCP_server(uint8_t ipv6_enabled, uint16_t num_sockets, uint16_t *ports, uint8_t *public_key, | 102 | TCP_Server *new_TCP_server(uint8_t ipv6_enabled, uint16_t num_sockets, uint16_t *ports, uint8_t *public_key, |
95 | uint8_t *secret_key); | 103 | uint8_t *secret_key, Onion *onion); |
96 | 104 | ||
97 | /* Run the TCP_server | 105 | /* Run the TCP_server |
98 | */ | 106 | */ |