channel-switch: use sys/ioctl.h instead of stropts.h
[rofl0r-MacGeiger.git] / server.h
blobcb42b6dbffdcb82b9b4919279024d75972849b9a
1 #ifndef SERVER_H
2 #define SERVER_H
4 #undef _POSIX_C_SOURCE
5 #define _POSIX_C_SOURCE 200809L
7 #include <sys/socket.h>
8 #include <netdb.h>
10 #pragma RcB2 DEP "server.c"
12 union sockaddr_union {
13 struct sockaddr_in v4;
14 struct sockaddr_in6 v6;
17 struct client {
18 union sockaddr_union addr;
19 int fd;
22 struct server {
23 union sockaddr_union bindaddr;
24 int fd;
25 socklen_t bindaddrsz;
28 int resolve(const char *host, unsigned short port, struct addrinfo** addr);
29 int server_bindtoip(const struct server *server, int fd);
30 int server_waitclient(struct server *server, struct client* client);
31 int server_setup(struct server *server, const char* listenip, unsigned short port);
33 #endif