blob: c1a64e0b5a5e98c97d10156ec10acf1962508989 (
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
|
#ifndef POTD_SERVER_H
#define POTD_SERVER_H 1
#include "socket.h"
#include "forward.h"
#define POTD_MAXFD 32
#define POTD_MAXEVENTS 64
typedef struct server_ctx {
forward_ctx *fwd_ctx;
psocket sock;
char host_buf[NI_MAXHOST], service_buf[NI_MAXSERV];
} server_ctx;
void server_init_ctx(server_ctx **ctx, forward_ctx *fwd_ctx);
int server_setup(server_ctx *ctx,
const char *listen_addr, const char *listen_port);
int server_validate_ctx(const server_ctx *ctx);
int server_setup_epoll(server_ctx *ctx[], size_t siz);
int server_mainloop_epoll(int epoll_fd, server_ctx *ctx[], size_t siz);
#endif
|