diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-05-13 11:29:32 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-05-13 11:29:32 +0000 |
commit | cb3fcdcdc3eeb4612c78d1fac10438214184642f (patch) | |
tree | e11b430371e7297b09e60f021bcc80016c4233b2 /include/ruby | |
parent | f1eadb0fb446418ac7b607a609cf19d9fd943f83 (diff) | |
download | ruby-cb3fcdcdc3eeb4612c78d1fac10438214184642f.tar.gz |
* win32/win32.c, include/ruby/win32.h (getipaddrs): [experimental]
emulate getipaddrs(3) on Unix.
* win32/Makefile.sub, configure.in (LIBS): need iphlpapi.lib for above
function.
* include/ruby/win32.h (socketpair): rb_w32_socketpair() doesn't
substitute for any function, so use non-prefixed name.
* ext/socket/extconf.rb (socketpair); follow above change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include/ruby')
-rw-r--r-- | include/ruby/win32.h | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/include/ruby/win32.h b/include/ruby/win32.h index 8a1bf6fb8a..0392aad108 100644 --- a/include/ruby/win32.h +++ b/include/ruby/win32.h @@ -37,6 +37,7 @@ extern "C++" { /* template without extern "C++" */ #endif #include <winsock2.h> #include <ws2tcpip.h> +#include <iphlpapi.h> #if defined(__cplusplus) && defined(_MSC_VER) } #endif @@ -225,6 +226,26 @@ struct msghdr { int msg_flags; }; +/* for getifaddrs() and others */ +struct ifaddrs { + struct ifaddrs *ifa_next; + char *ifa_name; + u_int ifa_flags; + struct sockaddr *ifa_addr; + struct sockaddr *ifa_netmask; + struct sockaddr *ifa_broadaddr; + struct sockaddr *ifa_dstaddr; + void *ifa_data; +}; +#ifdef IF_NAMESIZE +#define IFNAMSIZ IF_NAMESIZE +#else +#define IFNAMSIZ 256 +#endif +#ifdef IFF_POINTTOPOINT +#define IFF_POINTOPOINT IFF_POINTTOPOINT +#endif + extern DWORD rb_w32_osid(void); extern int rb_w32_cmdvector(const char *, char ***); extern rb_pid_t rb_w32_pipe_exec(const char *, const char *, int, int *, int *); @@ -260,7 +281,9 @@ extern struct protoent *WSAAPI rb_w32_getprotobyname(const char *); extern struct protoent *WSAAPI rb_w32_getprotobynumber(int); extern struct servent *WSAAPI rb_w32_getservbyname(const char *, const char *); extern struct servent *WSAAPI rb_w32_getservbyport(int, const char *); -extern int rb_w32_socketpair(int, int, int, int *); +extern int socketpair(int, int, int, int *); +extern int getifaddrs(struct ifaddrs **); +extern void freeifaddrs(struct ifaddrs *); extern char * rb_w32_getcwd(char *, int); extern char * rb_w32_ugetenv(const char *); extern char * rb_w32_getenv(const char *); @@ -658,9 +681,6 @@ extern char *rb_w32_strerror(int); #undef getservbyport #define getservbyport(p, pr) rb_w32_getservbyport(p, pr) -#undef socketpair -#define socketpair(a, t, p, s) rb_w32_socketpair(a, t, p, s) - #undef get_osfhandle #define get_osfhandle(h) rb_w32_get_osfhandle(h) |