]> git.pond.sub.org Git - empserver/blob - src/client/sysdep_w32.h
Update copyright notice
[empserver] / src / client / sysdep_w32.h
1 /*
2  *  Empire - A multi-player, client/server Internet based war game.
3  *  Copyright (C) 1986-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
4  *                           Ken Stevens, Steve McClure
5  *
6  *  This program 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 2 of the License, or
9  *  (at your option) any later version.
10  *
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.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  *  ---
21  *
22  *  See files README, COPYING and CREDITS in the root of the source
23  *  tree for related information and legal notices.  It is expected
24  *  that future projects/authors will amend these files as needed.
25  *
26  *  ---
27  *
28  *  sysdep_w32.h: system dependent support for WIN32 environments
29  *
30  *  Known contributors to this file:
31  *     Ron Koenderink, 2007
32  */
33
34 #ifndef _SYSDEF_W32_H
35 #include <winsock2.h>
36 #include <ws2tcpip.h>
37 #include <windows.h>
38 #include <signal.h>
39
40 extern int getopt(int, char * const[], const char *);
41 extern char *optarg;
42 extern int optind, opterr, optopt;
43
44 #ifdef _MSC_VER
45 typedef int __w64 ssize_t;
46 #endif
47
48 struct passwd {
49     char *pw_name;
50 };
51
52 struct iovec {
53     void *iov_base;
54     size_t iov_len;
55 };
56
57 struct sigaction {
58     int sa_flags;
59     void (*sa_handler)(int sig);
60 };
61
62 extern int w32_recv(int socket, char *buffer,
63                            size_t buf_size, int flags);
64 extern int w32_send(int socket, char *buffer,
65                             size_t buf_size, int flags);
66 extern int w32_close_socket(int fd);
67 extern int w32_socket(int family, int sock_type, int protocol);
68 extern int w32_connect(int sock, struct sockaddr *addr, int addrlen);
69 extern int w32_close_handle(int fd);
70 extern ssize_t w32_readv_handle(int fd, const struct iovec *iov,
71                                 int iovcnt);
72 extern ssize_t w32_writev_socket(int fd, const struct iovec *iov,
73                                  int iovcnt);
74 extern int w32_openfd(const char *fname, int oflag, ...);
75 extern int w32_openhandle(const char *fname, int oflag);
76
77 extern struct passwd *w32_getpw(void);
78 extern char *getpass(char *prompt);
79 extern void sysdep_init(void);
80
81 #define recv(sock, buffer, buf_size, flags) \
82     w32_recv((sock), (buffer), (buf_size), (flags))
83 #define socket(family, sock_type, protocol) \
84     w32_socket((family), (sock_type), (protocol))
85 #define connect(sock, addr, addrlen) \
86     w32_connect((sock), (addr), (addrlen))
87
88 #define pclose _pclose
89 #define popen _popen
90 #define snprintf _snprintf
91 #define getsose() ((void)0)
92 #define putso() ((void)0)
93 #define putse() ((void)0)
94 #endif /* sysdef_w32.h */