IPv6 support for mswin

ruby-dev MLe$B$N3’MM!"$O$8$a$^$7$F!#e(B
e$B>.DM$H$$$$$^$9!#e(B

e$B8=:_!“e(B1.8e$B7O!“e(B1.9e$B7O6&$K!“e([email protected]!$G$Oe(BIPv6e$B$,e(B
e$B$&$^$/;H$($:e(B(e$B%X%C%@$,ITE,@Z$J$?$ae(Bipv6e$B$NM-L5$,>o$K<:GT$9$ke(B)
e$BHa$7$$;W$$$r$7$F$$$^$9!#e(B
e$B0J2<$N$h$&$JJQ99$GDL$k$h$&$K$J$k$H;W$$$^$9$,!”$I$&$G$7$g$&$+!#e(B
(e$BB>$N%W%i%C%H%U%)!<%`$GIT6q9g$,$”$k$+$I$&$+L$8!>Z$G$9!#e(B
e$B$”$H!“e(BWinXPe$B$G:n$C$?%P%$%J%j$,e(B2ke$B$GF0$+$J$/$J$k$H$+$”$k$+$b$G$9e(B)

Index: ext/socket/extconf.rb

— ext/socket/extconf.rb (revision 16197)
+++ ext/socket/extconf.rb (working copy)
@@ -30,9 +30,24 @@
end

ipv6 = false
-default_ipv6 = /cygwin/ !~ RUBY_PLATFORM
-if enable_config(“ipv6”, default_ipv6)

  • if checking_for(“ipv6”) {try_link(<<EOF)}
    +case RUBY_PLATFORM
    +when /bccwin32|mswin32|mingw/
  • if enable_config(“ipv6”, true)
  • if checking_for(“ipv6”) {try_link(<<EOF)}
    +#{COMMON_HEADERS}
    +main()
    +{
  • socket(AF_INET6, SOCK_STREAM, 0);
    +}
    +EOF
  •  $defs << "-DENABLE_IPV6" << "-DINET6"
    
  •  ipv6 = true
    
  • end
  • end
    +else
  • default_ipv6 = /cygwin/ !~ RUBY_PLATFORM
  • if enable_config(“ipv6”, default_ipv6)
  • if checking_for(“ipv6”) {try_link(<<EOF)}
    #include <sys/types.h>
    #include <sys/socket.h>
    main()
    @@ -40,8 +55,9 @@
    socket(AF_INET6, SOCK_STREAM, 0);
    }
    EOF
  • $defs << “-DENABLE_IPV6” << “-DINET6”
  • ipv6 = true
  •  $defs << "-DENABLE_IPV6" << "-DINET6"
    
  •  ipv6 = true
    
  • end
    end
    end

@@ -105,7 +121,13 @@
end

getaddr_info_ok = enable_config(“wide-getaddrinfo”) do

  • wsastartup = <<EOF if $mswin or $bccwin or $mingw
  • WSADATA wsaData;
  • if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0)
  • goto bad;
    +EOF
    checking_for(“wide getaddrinfo”) {try_run(<<EOF)}
    +#{COMMON_HEADERS}
    #{cpp_include(headers)}
    #include <stdlib.h>

@@ -123,8 +145,9 @@
main()
{
int passive, gaierr, inet4 = 0, inet6 = 0;

  • struct addrinfo hints, *ai, *aitop;
  • struct addrinfo hints, *ai, *aitop = NULL;
    char straddr[INET6_ADDRSTRLEN], strport[16];
    +#{wsastartup}

    for (passive = 0; passive <= 1; passive++) {
    memset(&hints, 0, sizeof(hints));
    @@ -234,7 +257,7 @@

$objs = [“socket.#{$OBJEXT}”]

-unless getaddr_info_ok and have_func(“getnameinfo”, “netdb.h”) and
have_func(“getaddrinfo”, “netdb.h”)
+unless getaddr_info_ok and have_func(“getnameinfo”, headers) and
have_func(“getaddrinfo”, headers)
if have_struct_member(“struct in6_addr”, “s6_addr8”, headers)
$defs[-1] = “-DHAVE_ADDR8”
end
Index: include/ruby/win32.h

— include/ruby/win32.h (revision 16197)
+++ include/ruby/win32.h (working copy)
@@ -28,6 +28,7 @@
// #include <stdarg.h> conflict with varargs.h?
#if !defined(WSAAPI)
#include <winsock2.h>
+#include <ws2tcpip.h>
#endif

#define NT 1 /* deprecated */
Index: win32/Makefile.sub

— win32/Makefile.sub (revision 16197)
+++ win32/Makefile.sub (working copy)
@@ -260,7 +260,7 @@
COMMON_MACROS = WIN32_LEAN_AND_MEAN WIN32
!endif
!ifndef COMMON_HEADERS
-COMMON_HEADERS = winsock2.h windows.h
+COMMON_HEADERS = winsock2.h ws2tcpip.h windows.h
!endif

arch_hdrdir = $(EXTOUT)/include/$(arch)

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:34517] IPv6 support for mswin”
on Apr.26,2008 15:17:24, [email protected] wrote:

e$B8=:_!"e(B1.8e$B7O!"e(B1.9e$B7O6&$K!“e([email protected]!$G$Oe(BIPv6e$B$,e(B
e$B$&$^$/;H$($:e(B(e$B%X%C%@$,ITE,@Z$J$?$ae(Bipv6e$B$NM-L5$,>o$K<:GT$9$ke(B)
e$BHa$7$$;W$$$r$7$F$$$^$9!#e(B
e$B0J2<$N$h$&$JJQ99$GDL$k$h$&$K$J$k$H;W$$$^$9$,!”$I$&$G$7$g$&$+!#e(B

e$B;d$N<j85$K$b;w$?$h$&$J%Q%C%A$,$"$j$^$9!#e(B

(e$BB>$N%W%i%C%H%U%)!<%`$GIT6q9g$,$"$k$+$I$&$+L$8!>Z$G$9!#e(B
e$B$"$H!“e(BWinXPe$B$G:n$C$?%P%$%J%j$,e(B2ke$B$GF0$+$J$/$J$k$H$+$”$k$+$b$G$9e(B)

IPv6e$BM-8z$H$7$F:n$C$?e(Bsocket.soe$B$Oe(BIPv6e$B$,L58z$J4D6-$GF0$-$^$;$s!#e(B
e$B$H!"$$$&LdBj$,$"$k$N$Ge(Bcommite$B$7$F$J$$>uBV$G$9!#e(B
e$B$I$&$7$?$b$s$G$9$+$M$(!#e(B
IPv6e$B<+BN$OBP1~$5$;$F!"%G%U%)%k%He(Bdisablee$B$K$J$k$h$&$K$7$F$*$1$Pe(B
e$B$$$$$N$+$J$"!#e(B

e$B$=$l$G$O!#e(B

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:34534] Re: IPv6 support for mswin”
on Apr.28,2008 16:56:49, [email protected] wrote:

IPv6e$BM-8z$H$7$F:n$C$?e(Bsocket.soe$B$Oe(BIPv6e$B$,L58z$J4D6-$GF0$-$^$;$s!#e(B
e$B$H!"$$$&LdBj$,$"$k$N$Ge(Bcommite$B$7$F$J$$>uBV$G$9!#e(B
e$B$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M-8z$H$7$F:n$C$?e(Bsocket.soe$B$Oe(BIPv6e$B$,L58z$J4D6-$GF0$-$^$;$s!#e(B
e$B$H!"$$$&LdBj$,$"$k$N$Ge(Bcommite$B$7$F$J$$>uBV$G$9!#e(B
e$B$I$&$7$?$b$s$G$9$+$M$(!#e(B
IPv6e$B<+BN$OBP1~$5$;$F!"%G%U%)%k%He(Bdisablee$B$K$J$k$h$&$K$7$F$*$1$Pe(B
e$B$$$$$N$+$J$"!#e(B
e$B$"$l!#e(BXPe$B0J9_$G$O!"e(Bws2_32.dlle$B$Ke(Bgetaddrinfo()e$B$,0\F0$7$F$$$k$N$G!"e(B
IPv6e$BM-8z$Je(Bsocket.soe$B$re(BIPv6e$BL58z$J4D6-$K$b$C$F$$$C$F$b$&$4$/$h$&$J!#e(B
e$B0J2<!"e(BIPv6e$BL58z2=$7$?e(BXPSP2e$B$G$NF0:n$G$9!#e(B

e$B!a!ae(B
C:\Documents and Settings\kozuka>ipv6 if
Could not access IPv6 protocol stack - the stack is not installed.
To install, please use ‘ipv6 install’.

C:\Documents and Settings\kozuka>\ruby19\bin\ruby -rsocket
-e “p udp=UDPSocket.new(Socket::AF_INET)”
#UDPSocket:0xc05904
e$B!a!ae(B

w2ke$B$Ne(BIPv6
Previewe$B$N;[email protected]$H!“e(Bgetaddrinfo()e$B$,e(Bwship6.dlle$B$K$”$C$F!"e(B
e$B$=$C$A$r%j%s%/$7$J$$$H$$$1$J$+$C$?$N$G!“e([email protected]$He(B
e$B$&$4$+$J$/$J$k$H$$$&$3$H$O$”$j$^$7$?$,!"e(BXPe$B0J9_$G$O$=$NLdBj$Oe(B
e$B$J$$$O$:$G$9!#e(B

IPv6e$BM-8z2=$7$?e(Bsocket.soe$B$Oe(BXP or 2003e$B0JA0$Ne(BWine$B$G$Oe(B
e$BF0$+$J$/$J$k$H$O;W$$$^$9$,!"$$$^$5$i$$$j$^$9$+$M$'e(B?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs