aboutsummaryrefslogtreecommitdiff
path: root/src/tsocket.h
blob: 4e782ca7677b15eeed1125f3c06d8f0338185701 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <netinet/in.h>

#ifndef __TSOCKET_H
#define __TSOCKET_H

struct tsocket {
    int fd;
    const char *addr;
    int port;
};
typedef struct tsocket tsocket_t;

struct tsocket *tsocket_create();
int tsocket_bind(struct tsocket *sock, const char *addr, int hostport);
int tsocket_listen(struct tsocket *sock);
struct tsocket *tsocket_accept(struct tsocket *sock);
void tsocket_destroy(struct tsocket *sock);

int tsocket_fd(tsocket_t *sock);

#endif