forked from rofl0r/microsocks
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserver.h
More file actions
35 lines (26 loc) · 696 Bytes
/
server.h
File metadata and controls
35 lines (26 loc) · 696 Bytes
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
29
30
31
32
33
34
#ifndef SERVER_H
#define SERVER_H
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200809L
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
//RcB: DEP "server.c"
union sockaddr_union {
struct sockaddr_in v4;
struct sockaddr_in6 v6;
};
struct client {
union sockaddr_union addr;
int fd;
};
struct server {
union sockaddr_union bindaddr;
int fd;
socklen_t bindaddrsz;
};
int resolve(const char *host, unsigned short port, struct addrinfo** addr);
int server_bindtoip(const struct server *server, int fd);
int server_waitclient(struct server *server, struct client* client);
int server_setup(struct server *server, const char* listenip, unsigned short port);
#endif