Subversion Repositories Games.Carmageddon

Rev

Rev 1 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 pmbaty 1
/*
2
 * Inspiration taken from https://github.com/TheAssemblyArmada/Vanilla-Conquer/blob/vanilla/common/sockets.h
3
 */
4
 
5
#ifndef HARNESS_WINSOCK_H
6
#define HARNESS_WINSOCK_H
7
 
8
#include <assert.h>
9
 
10
#ifdef _WIN32
11
#define _WINSOCK_DEPRECATED_NO_WARNINGS
12
#include <winsock2.h>
13
#include <ws2tcpip.h>
14
 
15
#else /* Assume posix style sockets on non-windows */
16
 
17
#include <arpa/inet.h>
18
#include <errno.h>
19
#include <fcntl.h>
20
#include <netdb.h> // for getaddrinfo() and freeaddrinfo()
21
#include <sys/ioctl.h>
22
#include <sys/socket.h>
23
#include <sys/types.h>
24
#include <unistd.h> // for close()
8 pmbaty 25
#include <netinet/in.h> // Pierre-Marie Baty -- POSIX location of struct sockaddr_in
1 pmbaty 26
 
27
#define closesocket(x) close(x)
28
#define WSAEISCONN EISCONN
29
#define WSAEINPROGRESS EINPROGRESS
30
#define WSAEALREADY EALREADY
31
#define WSAEADDRINUSE EADDRINUSE
32
#define WSAEADDRNOTAVAIL EADDRNOTAVAIL
33
#define WSAEBADF EBADF
34
#define WSAECONNREFUSED ECONNREFUSED
35
#define WSAEINTR EINTR
36
#define WSAENOTSOCK ENOTSOCK
37
#define WSAEWOULDBLOCK EWOULDBLOCK
38
#define WSAEINVAL EINVAL
39
#define WSAETIMEDOUT ETIMEDOUT
40
 
41
#define MAKEWORD(x, y) ((y) << 8 | (x))
42
 
43
typedef struct WSADATA {
44
} WSADATA;
45
 
46
int WSAStartup(int version, WSADATA* data);
47
int WSAGetLastError(void);
48
int WSACleanup(void);
49
int ioctlsocket(int handle, long cmd, unsigned long* argp);
50
 
51
#endif /* _WIN32 */
52
 
53
#endif