Commit bb8bbb29 authored by Paul Lalonde's avatar Paul Lalonde Committed by Nigel Tao

Windows: net, syscall: implement SetsockoptIPMReq(), move to winsock v2.2 for multicast support.

I don't know the protocol regarding the zsyscall files which appear to
be hand-generated, so I've re-done them and added them to the change.

R=rsc, alex.brainman, nigeltao
CC=golang-dev
https://golang.org/cl/4975060
parent fe89af74
......@@ -23,7 +23,7 @@ var initErr os.Error
func init() {
var d syscall.WSAData
e := syscall.WSAStartup(uint32(0x101), &d)
e := syscall.WSAStartup(uint32(0x202), &d)
if e != 0 {
initErr = os.NewSyscallError("WSAStartup", e)
}
......
......@@ -220,7 +220,7 @@ func NewCallback(fn interface{}) uintptr
//sys FlushViewOfFile(addr uintptr, length uintptr) (errno int)
//sys VirtualLock(addr uintptr, length uintptr) (errno int)
//sys VirtualUnlock(addr uintptr, length uintptr) (errno int)
//sys TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (errno int) = wsock32.TransmitFile
//sys TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (errno int) = mswsock.TransmitFile
// syscall interface implementation for other packages
......@@ -480,20 +480,20 @@ func Chmod(path string, mode uint32) (errno int) {
// net api calls
//sys WSAStartup(verreq uint32, data *WSAData) (sockerrno int) = wsock32.WSAStartup
//sys WSACleanup() (errno int) [failretval==-1] = wsock32.WSACleanup
//sys WSAStartup(verreq uint32, data *WSAData) (sockerrno int) = ws2_32.WSAStartup
//sys WSACleanup() (errno int) [failretval==-1] = ws2_32.WSACleanup
//sys WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (errno int) [failretval==-1] = ws2_32.WSAIoctl
//sys socket(af int32, typ int32, protocol int32) (handle Handle, errno int) [failretval==InvalidHandle] = wsock32.socket
//sys Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (errno int) [failretval==-1] = wsock32.setsockopt
//sys bind(s Handle, name uintptr, namelen int32) (errno int) [failretval==-1] = wsock32.bind
//sys connect(s Handle, name uintptr, namelen int32) (errno int) [failretval==-1] = wsock32.connect
//sys getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (errno int) [failretval==-1] = wsock32.getsockname
//sys getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (errno int) [failretval==-1] = wsock32.getpeername
//sys listen(s Handle, backlog int32) (errno int) [failretval==-1] = wsock32.listen
//sys shutdown(s Handle, how int32) (errno int) [failretval==-1] = wsock32.shutdown
//sys Closesocket(s Handle) (errno int) [failretval==-1] = wsock32.closesocket
//sys AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (errno int) = wsock32.AcceptEx
//sys GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, lrsa **RawSockaddrAny, lrsalen *int32, rrsa **RawSockaddrAny, rrsalen *int32) = wsock32.GetAcceptExSockaddrs
//sys socket(af int32, typ int32, protocol int32) (handle Handle, errno int) [failretval==InvalidHandle] = ws2_32.socket
//sys Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (errno int) [failretval==-1] = ws2_32.setsockopt
//sys bind(s Handle, name uintptr, namelen int32) (errno int) [failretval==-1] = ws2_32.bind
//sys connect(s Handle, name uintptr, namelen int32) (errno int) [failretval==-1] = ws2_32.connect
//sys getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (errno int) [failretval==-1] = ws2_32.getsockname
//sys getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (errno int) [failretval==-1] = ws2_32.getpeername
//sys listen(s Handle, backlog int32) (errno int) [failretval==-1] = ws2_32.listen
//sys shutdown(s Handle, how int32) (errno int) [failretval==-1] = ws2_32.shutdown
//sys Closesocket(s Handle) (errno int) [failretval==-1] = ws2_32.closesocket
//sys AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (errno int) = mswsock.AcceptEx
//sys GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, lrsa **RawSockaddrAny, lrsalen *int32, rrsa **RawSockaddrAny, rrsalen *int32) = mswsock.GetAcceptExSockaddrs
//sys WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (errno int) [failretval==-1] = ws2_32.WSARecv
//sys WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (errno int) [failretval==-1] = ws2_32.WSASend
//sys WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (errno int) [failretval==-1] = ws2_32.WSARecvFrom
......@@ -697,8 +697,8 @@ type Linger struct {
}
const (
IP_ADD_MEMBERSHIP = iota
IP_DROP_MEMBERSHIP
IP_ADD_MEMBERSHIP = 0xc
IP_DROP_MEMBERSHIP = 0xd
)
type IPMreq struct {
......@@ -711,8 +711,10 @@ type IPv6Mreq struct {
Interface uint32
}
func SetsockoptLinger(fd Handle, level, opt int, l *Linger) (errno int) { return EWINDOWS }
func SetsockoptIPMreq(fd Handle, level, opt int, mreq *IPMreq) (errno int) { return EWINDOWS }
func SetsockoptLinger(fd Handle, level, opt int, l *Linger) (errno int) { return EWINDOWS }
func SetsockoptIPMreq(fd Handle, level, opt int, mreq *IPMreq) (errno int) {
return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(mreq)), int32(unsafe.Sizeof(*mreq)))
}
func SetsockoptIPv6Mreq(fd Handle, level, opt int, mreq *IPv6Mreq) (errno int) { return EWINDOWS }
func BindToDevice(fd Handle, device string) (errno int) { return EWINDOWS }
......
......@@ -9,7 +9,7 @@ var (
modkernel32 = NewLazyDLL("kernel32.dll")
modadvapi32 = NewLazyDLL("advapi32.dll")
modshell32 = NewLazyDLL("shell32.dll")
modwsock32 = NewLazyDLL("wsock32.dll")
modmswsock = NewLazyDLL("mswsock.dll")
modws2_32 = NewLazyDLL("ws2_32.dll")
moddnsapi = NewLazyDLL("dnsapi.dll")
modiphlpapi = NewLazyDLL("iphlpapi.dll")
......@@ -79,21 +79,21 @@ var (
procFlushViewOfFile = modkernel32.NewProc("FlushViewOfFile")
procVirtualLock = modkernel32.NewProc("VirtualLock")
procVirtualUnlock = modkernel32.NewProc("VirtualUnlock")
procTransmitFile = modwsock32.NewProc("TransmitFile")
procWSAStartup = modwsock32.NewProc("WSAStartup")
procWSACleanup = modwsock32.NewProc("WSACleanup")
procTransmitFile = modmswsock.NewProc("TransmitFile")
procWSAStartup = modws2_32.NewProc("WSAStartup")
procWSACleanup = modws2_32.NewProc("WSACleanup")
procWSAIoctl = modws2_32.NewProc("WSAIoctl")
procsocket = modwsock32.NewProc("socket")
procsetsockopt = modwsock32.NewProc("setsockopt")
procbind = modwsock32.NewProc("bind")
procconnect = modwsock32.NewProc("connect")
procgetsockname = modwsock32.NewProc("getsockname")
procgetpeername = modwsock32.NewProc("getpeername")
proclisten = modwsock32.NewProc("listen")
procshutdown = modwsock32.NewProc("shutdown")
procclosesocket = modwsock32.NewProc("closesocket")
procAcceptEx = modwsock32.NewProc("AcceptEx")
procGetAcceptExSockaddrs = modwsock32.NewProc("GetAcceptExSockaddrs")
procsocket = modws2_32.NewProc("socket")
procsetsockopt = modws2_32.NewProc("setsockopt")
procbind = modws2_32.NewProc("bind")
procconnect = modws2_32.NewProc("connect")
procgetsockname = modws2_32.NewProc("getsockname")
procgetpeername = modws2_32.NewProc("getpeername")
proclisten = modws2_32.NewProc("listen")
procshutdown = modws2_32.NewProc("shutdown")
procclosesocket = modws2_32.NewProc("closesocket")
procAcceptEx = modmswsock.NewProc("AcceptEx")
procGetAcceptExSockaddrs = modmswsock.NewProc("GetAcceptExSockaddrs")
procWSARecv = modws2_32.NewProc("WSARecv")
procWSASend = modws2_32.NewProc("WSASend")
procWSARecvFrom = modws2_32.NewProc("WSARecvFrom")
......
......@@ -9,7 +9,7 @@ var (
modkernel32 = NewLazyDLL("kernel32.dll")
modadvapi32 = NewLazyDLL("advapi32.dll")
modshell32 = NewLazyDLL("shell32.dll")
modwsock32 = NewLazyDLL("wsock32.dll")
modmswsock = NewLazyDLL("mswsock.dll")
modws2_32 = NewLazyDLL("ws2_32.dll")
moddnsapi = NewLazyDLL("dnsapi.dll")
modiphlpapi = NewLazyDLL("iphlpapi.dll")
......@@ -79,21 +79,21 @@ var (
procFlushViewOfFile = modkernel32.NewProc("FlushViewOfFile")
procVirtualLock = modkernel32.NewProc("VirtualLock")
procVirtualUnlock = modkernel32.NewProc("VirtualUnlock")
procTransmitFile = modwsock32.NewProc("TransmitFile")
procWSAStartup = modwsock32.NewProc("WSAStartup")
procWSACleanup = modwsock32.NewProc("WSACleanup")
procTransmitFile = modmswsock.NewProc("TransmitFile")
procWSAStartup = modws2_32.NewProc("WSAStartup")
procWSACleanup = modws2_32.NewProc("WSACleanup")
procWSAIoctl = modws2_32.NewProc("WSAIoctl")
procsocket = modwsock32.NewProc("socket")
procsetsockopt = modwsock32.NewProc("setsockopt")
procbind = modwsock32.NewProc("bind")
procconnect = modwsock32.NewProc("connect")
procgetsockname = modwsock32.NewProc("getsockname")
procgetpeername = modwsock32.NewProc("getpeername")
proclisten = modwsock32.NewProc("listen")
procshutdown = modwsock32.NewProc("shutdown")
procclosesocket = modwsock32.NewProc("closesocket")
procAcceptEx = modwsock32.NewProc("AcceptEx")
procGetAcceptExSockaddrs = modwsock32.NewProc("GetAcceptExSockaddrs")
procsocket = modws2_32.NewProc("socket")
procsetsockopt = modws2_32.NewProc("setsockopt")
procbind = modws2_32.NewProc("bind")
procconnect = modws2_32.NewProc("connect")
procgetsockname = modws2_32.NewProc("getsockname")
procgetpeername = modws2_32.NewProc("getpeername")
proclisten = modws2_32.NewProc("listen")
procshutdown = modws2_32.NewProc("shutdown")
procclosesocket = modws2_32.NewProc("closesocket")
procAcceptEx = modmswsock.NewProc("AcceptEx")
procGetAcceptExSockaddrs = modmswsock.NewProc("GetAcceptExSockaddrs")
procWSARecv = modws2_32.NewProc("WSARecv")
procWSASend = modws2_32.NewProc("WSASend")
procWSARecvFrom = modws2_32.NewProc("WSARecvFrom")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment