From a60afaf0ecfac652e0e49a94609917378ca98045 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Tue, 21 Sep 2010 20:03:48 -0500 Subject: [PATCH] Use SOCK_RAW for ICMP sockets on windows --- basis/io/sockets/windows/windows.factor | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/basis/io/sockets/windows/windows.factor b/basis/io/sockets/windows/windows.factor index 3114b3aa83..473ad4b177 100755 --- a/basis/io/sockets/windows/windows.factor +++ b/basis/io/sockets/windows/windows.factor @@ -1,9 +1,10 @@ ! Copyright (C) 2007, 2009 Slava Pestov, Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: accessors alien alien.c-types alien.data classes.struct -combinators destructors io.backend io.ports io.files.windows -io.sockets io.sockets.private kernel libc math sequences system -windows.handles windows.kernel32 windows.types windows.winsock ; +combinators destructors io.backend io.files.windows io.ports +io.sockets io.sockets.icmp io.sockets.private kernel libc math +sequences system windows.handles windows.kernel32 windows.types +windows.winsock ; FROM: namespaces => get ; IN: io.sockets.windows @@ -79,8 +80,18 @@ M: object (server) ( addrspec -- handle ) dup handle>> listen-backlog listen winsock-return-check ] with-destructors ; +GENERIC: windows-socket-type ( obj -- n ) + +M: inet4 windows-socket-type drop SOCK_DGRAM ; + +M: inet6 windows-socket-type drop SOCK_DGRAM ; + +M: icmp4 windows-socket-type drop SOCK_RAW ; + +M: icmp6 windows-socket-type drop SOCK_RAW ; + M: windows (datagram) ( addrspec -- handle ) - [ SOCK_DGRAM server-socket ] with-destructors ; + [ dup windows-socket-type server-socket ] with-destructors ; : malloc-int ( n -- alien )