]> git.pond.sub.org Git - empserver/blobdiff - src/lib/w32/sys/socket.h
Update copyright notice
[empserver] / src / lib / w32 / sys / socket.h
index 81f2902085c380c8f56b3e50d45e8add972c2869..a97e060be8f6162365a5da07e8592f7cd6fe54a0 100644 (file)
@@ -1,11 +1,11 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2007, Dave Pare, Jeff Bailey, Thomas Ruschak,
- *                           Ken Stevens, Steve McClure
+ *  Copyright (C) 1986-2013, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *                Ken Stevens, Steve McClure, Markus Armbruster
  *
- *  This program is free software; you can redistribute it and/or modify
+ *  Empire is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
+ *  the Free Software Foundation, either version 3 of the License, or
  *  (at your option) any later version.
  *
  *  This program is distributed in the hope that it will be useful,
@@ -14,8 +14,7 @@
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  *  ---
  *
@@ -26,7 +25,7 @@
  *  ---
  *
  *  sys/socket.h: POSIX socket emulation for WIN32
- * 
+ *
  *  Known contributors to this file:
  *     Ron Koenderink, 2007
  */
 #include <winsock2.h>
 #undef NS_ALL
 
+typedef int socklen_t;
+
+#define accept(fd, addr, addrlen) \
+    w32_accept((fd), (addr), (addrlen))
+#define bind(fd, name, namelen) \
+    w32_bind((fd), (name), (namelen))
+#define connect(fd, addr, addrlen) \
+    w32_connect((fd), (addr), (addrlen))
+#define listen(fd, backlog) \
+    w32_listen((fd), (backlog))
+#define setsockopt(fd, level, optname, optval, optlen) \
+    w32_setsockopt((fd), (level), (optname), (optval), (optlen))
+#define shutdown(fd, how) \
+    w32_shutdown((fd), (how))
+#define socket(domain, type, protocol) \
+    w32_socket((domain), (type), (protocol))
+
+extern int w32_accept(int fd, struct sockaddr *addr, socklen_t *addrlen);
+extern int w32_bind(int fd, const struct sockaddr *name, socklen_t namelen);
+extern int w32_connect(int fd, const struct sockaddr *addr, socklen_t addrlen);
+extern int w32_listen(int fd, int backlog);
+extern int w32_setsockopt(int fd, int level, int optname,
+                         const void *optval, socklen_t optlen);
+extern int w32_shutdown(int fd, int how);
+extern int w32_socket(int domain, int type, int protocol);
+
+/* Low-level stuff specific to the emulation */
+extern SOCKET w32_fd2socket(int fd);
+extern void w32_set_winsock_errno(void);
+extern int w32_socket_init(void);
+
+#ifndef SHUT_WR
+#define SHUT_WR SD_SEND
+#endif
+
 #endif /* SYS_SOCKET_H */