summaryrefslogtreecommitdiff
path: root/toxcore/TCP_server.h
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2014-04-06 20:51:03 -0400
committerirungentoo <irungentoo@gmail.com>2014-04-06 20:51:03 -0400
commitbd0d24fc9cad83d77cdf4bfd335ee5e25954c8ce (patch)
tree9776a8dea2573c866610a66d195f319652c84b27 /toxcore/TCP_server.h
parentef744ebbc29a3dc1ebc6c626b83c90ead15bb391 (diff)
Added TCP_client.
Some work done on the TCP part.
Diffstat (limited to 'toxcore/TCP_server.h')
-rw-r--r--toxcore/TCP_server.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/toxcore/TCP_server.h b/toxcore/TCP_server.h
index e8101cc2..3ae0eba4 100644
--- a/toxcore/TCP_server.h
+++ b/toxcore/TCP_server.h
@@ -20,9 +20,16 @@
20* 20*
21*/ 21*/
22 22
23#ifndef TCP_SERVER_H
24#define TCP_SERVER_H
25
23#include "net_crypto.h" 26#include "net_crypto.h"
24#include "onion.h" 27#include "onion.h"
25 28
29#if defined(_WIN32) || defined(__WIN32__) || defined (WIN32)
30#define MSG_NOSIGNAL 0
31#endif
32
26#define MAX_INCOMMING_CONNECTIONS 32 33#define MAX_INCOMMING_CONNECTIONS 32
27 34
28#define TCP_MAX_BACKLOG MAX_INCOMMING_CONNECTIONS 35#define TCP_MAX_BACKLOG MAX_INCOMMING_CONNECTIONS
@@ -116,3 +123,21 @@ void do_TCP_server(TCP_Server *TCP_server);
116/* Kill the TCP server 123/* Kill the TCP server
117 */ 124 */
118void kill_TCP_server(TCP_Server *TCP_server); 125void kill_TCP_server(TCP_Server *TCP_server);
126
127/* Read the next two bytes in TCP stream then convert them to
128 * length (host byte order).
129 *
130 * return length on success
131 * return 0 if nothing has been read from socket.
132 * return ~0 on failure.
133 */
134uint16_t read_TCP_length(sock_t sock);
135
136/* Read length bytes from socket.
137 *
138 * return length on success
139 * return -1 on failure/no data in buffer.
140 */
141int read_TCP_packet(sock_t sock, uint8_t *data, uint16_t length);
142
143#endif