aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/tcp_server.h
blob: def7a171d0836ed7e296f20f2ec96b2969841123 (plain) (blame)
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
/*
 * Copyright (c) 2022 Egor Tensin <egor@tensin.name>
 * This file is part of the "cimple" project.
 * For details, see https://github.com/egor-tensin/cimple.
 * Distributed under the MIT License.
 */

#ifndef __TCP_SERVER_H__
#define __TCP_SERVER_H__

#include "event_loop.h"

struct tcp_server;

typedef int (*tcp_server_conn_handler)(int conn_fd, void* arg);

int tcp_server_create(
    struct tcp_server**,
    struct event_loop*,
    const char* port,
    tcp_server_conn_handler,
    void* arg
);
void tcp_server_destroy(struct tcp_server*);

int tcp_server_accept(struct tcp_server*);

#endif