2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2014, Dave Pare, Jeff Bailey, Thomas Ruschak,
4 * Ken Stevens, Steve McClure, Markus Armbruster
6 * Empire is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 * See files README, COPYING and CREDITS in the root of the source
22 * tree for related information and legal notices. It is expected
23 * that future projects/authors will amend these files as needed.
27 * sys/socket.h: POSIX socket emulation for WIN32
29 * Known contributors to this file:
30 * Ron Koenderink, 2007
31 * Markus Armbruster, 2009-2013
40 typedef unsigned short sa_family_t;
41 typedef int socklen_t;
43 #define accept(fd, addr, addrlen) \
44 w32_accept((fd), (addr), (addrlen))
45 #define bind(fd, name, namelen) \
46 w32_bind((fd), (name), (namelen))
47 #define connect(fd, addr, addrlen) \
48 w32_connect((fd), (addr), (addrlen))
49 #define listen(fd, backlog) \
50 w32_listen((fd), (backlog))
51 #define setsockopt(fd, level, optname, optval, optlen) \
52 w32_setsockopt((fd), (level), (optname), (optval), (optlen))
53 #define shutdown(fd, how) \
54 w32_shutdown((fd), (how))
55 #define socket(domain, type, protocol) \
56 w32_socket((domain), (type), (protocol))
58 extern int w32_accept(int fd, struct sockaddr *addr, socklen_t *addrlen);
59 extern int w32_bind(int fd, const struct sockaddr *name, socklen_t namelen);
60 extern int w32_connect(int fd, const struct sockaddr *addr, socklen_t addrlen);
61 extern int w32_listen(int fd, int backlog);
62 extern int w32_setsockopt(int fd, int level, int optname,
63 const void *optval, socklen_t optlen);
64 extern int w32_shutdown(int fd, int how);
65 extern int w32_socket(int domain, int type, int protocol);
67 /* Low-level stuff specific to the emulation */
68 extern SOCKET w32_fd2socket(int fd);
69 extern void w32_set_winsock_errno(void);
70 extern int w32_socket_init(void);
73 #define SHUT_WR SD_SEND
76 #endif /* SYS_SOCKET_H */