| 1 |
/* |
| 2 |
** JNetLib |
| 3 |
** Copyright (C) 2000-2001 Nullsoft, Inc. |
| 4 |
** Author: Justin Frankel |
| 5 |
** File: netinc.h - network includes and portability defines (used internally) |
| 6 |
** License: see License.txt |
| 7 |
** |
| 8 |
** Unicode support by Jim Park -- 08/24/2007 |
| 9 |
*/ |
| 10 |
|
| 11 |
#ifndef _NETINC_H_ |
| 12 |
#define _NETINC_H_ |
| 13 |
|
| 14 |
#include <windows.h> |
| 15 |
#include "util.h" |
| 16 |
|
| 17 |
#define strcasecmp(x,y) stricmp(x,y) |
| 18 |
#define ERRNO (WSAGetLastError()) |
| 19 |
#define SET_SOCK_BLOCK(s,block) { unsigned long __i=block?0:1; ioctlsocket(s,FIONBIO,&__i); } |
| 20 |
#ifndef EWOULDBLOCK |
| 21 |
#define EWOULDBLOCK WSAEWOULDBLOCK |
| 22 |
#endif |
| 23 |
#ifndef EINPROGRESS |
| 24 |
#define EINPROGRESS WSAEWOULDBLOCK |
| 25 |
#endif |
| 26 |
#define memset mini_memset |
| 27 |
#define memcpy mini_memcpy |
| 28 |
// Jim Park: For Unicode support, we need to distinguish whether we are working on |
| 29 |
// Unicode or ANSI. |
| 30 |
#define strcpy lstrcpyA |
| 31 |
#define strncpy lstrcpynA |
| 32 |
#define strcat lstrcatA |
| 33 |
#define strlen lstrlenA |
| 34 |
#define malloc(x) (new char[x]) |
| 35 |
#define free(x) {delete [] x;} |
| 36 |
typedef int socklen_t; |
| 37 |
|
| 38 |
#ifndef INADDR_NONE |
| 39 |
#define INADDR_NONE 0xffffffff |
| 40 |
#endif |
| 41 |
|
| 42 |
#ifndef INADDR_ANY |
| 43 |
#define INADDR_ANY 0 |
| 44 |
#endif |
| 45 |
|
| 46 |
#ifndef SHUT_RDWR |
| 47 |
#define SHUT_RDWR 2 |
| 48 |
#endif |
| 49 |
|
| 50 |
#ifndef INVALID_SOCKET |
| 51 |
#define INVALID_SOCKET -1 |
| 52 |
#endif |
| 53 |
|
| 54 |
#define PORTABLE_SOCKET SOCKET |
| 55 |
|
| 56 |
#endif //_NETINC_H_ |