summaryrefslogtreecommitdiff
path: root/ot_tcp.h
blob: 96b6ec1b36c8a6d337c8068f64ce673b505fb0db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
   It is considered beerware. Prost. Skol. Cheers or whatever.

   $id$ */

#ifndef OT_TCP_H__
#define OT_TCP_H__

#include <stdint.h>

#include "trackerlogic.h"

/* Take whatever connections are waiting on a listening socket and answer
   them, each on this thread's stack, handing a connection that cannot be
   finished to the event loop */
void tcp_accept(const int64_t serversocket, struct ot_workstruct *ws);

/* Handler connections in the event loop has become readable or writable */
void tcp_read(const int64_t sock, struct ot_workstruct *ws);
void tcp_write(const int64_t sock);

/* One thread accepting on one socket. Called once per worker. */
void tcp_worker_install(int64_t sock);

/* Stop every worker installed above and wait for it to be gone */
void tcp_workers_deinit(void);

#endif