golang.org/x/net@v0.25.1-0.20240516223405-c87a5b62e243/internal/socket/sys_windows.go (about) 1 // Copyright 2017 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package socket 6 7 import ( 8 "net" 9 "syscall" 10 "unsafe" 11 12 "golang.org/x/sys/windows" 13 ) 14 15 func probeProtocolStack() int { 16 var p uintptr 17 return int(unsafe.Sizeof(p)) 18 } 19 20 const ( 21 sysAF_UNSPEC = windows.AF_UNSPEC 22 sysAF_INET = windows.AF_INET 23 sysAF_INET6 = windows.AF_INET6 24 25 sysSOCK_RAW = windows.SOCK_RAW 26 27 sizeofSockaddrInet4 = 0x10 28 sizeofSockaddrInet6 = 0x1c 29 ) 30 31 func getsockopt(s uintptr, level, name int, b []byte) (int, error) { 32 l := uint32(len(b)) 33 err := syscall.Getsockopt(syscall.Handle(s), int32(level), int32(name), (*byte)(unsafe.Pointer(&b[0])), (*int32)(unsafe.Pointer(&l))) 34 return int(l), err 35 } 36 37 func setsockopt(s uintptr, level, name int, b []byte) error { 38 return syscall.Setsockopt(syscall.Handle(s), int32(level), int32(name), (*byte)(unsafe.Pointer(&b[0])), int32(len(b))) 39 } 40 41 func recvmsg(s uintptr, buffers [][]byte, oob []byte, flags int, network string) (n, oobn int, recvflags int, from net.Addr, err error) { 42 return 0, 0, 0, nil, errNotImplemented 43 } 44 45 func sendmsg(s uintptr, buffers [][]byte, oob []byte, to net.Addr, flags int) (int, error) { 46 return 0, errNotImplemented 47 } 48 49 func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 50 return 0, errNotImplemented 51 } 52 53 func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 54 return 0, errNotImplemented 55 }