summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2001-07-19 17:37:46 +0000
committerMartin v. Löwis <martin@v.loewis.de>2001-07-19 17:37:46 +0000
commit552c8a068102c208a5b6229086539f2060b6062f (patch)
tree265cfafb20e24eaa1cd120cd3d9098ab4144cc30
parent0a443cadad35f157a4afeab3cf707063e7255227 (diff)
downloadcpython-552c8a068102c208a5b6229086539f2060b6062f.tar.gz
Port getaddrinfo to MSVC++.
-rw-r--r--Modules/addrinfo.h4
-rw-r--r--Modules/getaddrinfo.c14
-rw-r--r--Modules/socketmodule.c12
3 files changed, 15 insertions, 15 deletions
diff --git a/Modules/addrinfo.h b/Modules/addrinfo.h
index 0782afeac0..6d0991dee3 100644
--- a/Modules/addrinfo.h
+++ b/Modules/addrinfo.h
@@ -105,7 +105,7 @@ struct addrinfo {
*/
#define _SS_MAXSIZE 128
#ifdef HAVE_LONG_LONG
-#define _SS_ALIGNSIZE (sizeof(long long))
+#define _SS_ALIGNSIZE (sizeof(LONG_LONG))
#else
#define _SS_ALIGNSIZE (sizeof(double))
#endif
@@ -122,7 +122,7 @@ struct sockaddr_storage {
#endif
char __ss_pad1[_SS_PAD1SIZE];
#ifdef HAVE_LONG_LONG
- long long __ss_align; /* force desired structure storage alignment */
+ LONG_LONG __ss_align; /* force desired structure storage alignment */
#else
double __ss_align; /* force desired structure storage alignment */
#endif
diff --git a/Modules/getaddrinfo.c b/Modules/getaddrinfo.c
index a188bdd134..a1f4c14096 100644
--- a/Modules/getaddrinfo.c
+++ b/Modules/getaddrinfo.c
@@ -117,6 +117,17 @@ static struct gai_afd {
#define PTON_MAX 4
#endif
+#ifndef IN_MULTICAST
+#define IN_MULTICAST(i) (((i) & 0xf0000000U) == 0xe0000000U)
+#endif
+
+#ifndef IN_EXPERIMENTAL
+#define IN_EXPERIMENTAL(i) (((i) & 0xe0000000U) == 0xe0000000U)
+#endif
+
+#ifndef IN_LOOPBACKNET
+#define IN_LOOPBACKNET 127
+#endif
static int get_name Py_PROTO((const char *, struct gai_afd *,
struct addrinfo **, char *, struct addrinfo *,
@@ -527,7 +538,8 @@ get_addr(hostname, af, res, pai, port0)
struct gai_afd *gai_afd;
int i, error = 0, h_error;
char *ap;
-#ifndef INET6
+#if !defined(INET6) && !defined(MS_WIN32)
+ /* In winsock.h, h_errno is #defined as a function call. */
extern int h_errno;
#endif
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 962fbfa374..72b141c8a4 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -195,12 +195,7 @@ Socket methods:
#include <GUSI.h>
#endif
-/* XXX 24-Jun-2000 Tim: I have no idea what the code inside this block is
- trying to do, and don't have time to look. Looks like Unix-specific code
- in those files, though, which will never compile on Windows. */
-#ifndef MS_WINDOWS
#include "addrinfo.h"
-#endif /* ifndef MS_WINDOWS hack */
#ifdef USE_SSL
#include "openssl/rsa.h"
@@ -211,11 +206,6 @@ Socket methods:
#include "openssl/err.h"
#endif /* USE_SSL */
-/* XXX 24-Jun-2000 Tim: I have no idea what the code inside this block is
- trying to do, and don't have time to look. Looks like Unix-specific code
- in those files, though, which will never compile on Windows. */
-#ifndef MS_WINDOWS
-
#ifndef HAVE_INET_PTON
int inet_pton (int af, char *src, void *dst);
char *inet_ntop(int af, void *src, char *dst, socklen_t size);
@@ -229,8 +219,6 @@ char *inet_ntop(int af, void *src, char *dst, socklen_t size);
#include "getnameinfo.c"
#endif
-#endif /* ifndef MS_WINDOWS hack */
-
#if defined(MS_WINDOWS) || defined(__BEOS__)
/* BeOS suffers from the same socket dichotomy as Win32... - [cjh] */
/* seem to be a few differences in the API */