github.com/Andyfoo/golang/x/net@v0.0.0-20190901054642-57c1bf301704/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 "syscall" 9 "unsafe" 10 11 "github.com/Andyfoo/golang/x/sys/windows" 12 ) 13 14 func probeProtocolStack() int { 15 var p uintptr 16 return int(unsafe.Sizeof(p)) 17 } 18 19 const ( 20 sysAF_UNSPEC = windows.AF_UNSPEC 21 sysAF_INET = windows.AF_INET 22 sysAF_INET6 = windows.AF_INET6 23 24 sysSOCK_RAW = windows.SOCK_RAW 25 ) 26 27 type sockaddrInet struct { 28 Family uint16 29 Port uint16 30 Addr [4]byte /* in_addr */ 31 Zero [8]uint8 32 } 33 34 type sockaddrInet6 struct { 35 Family uint16 36 Port uint16 37 Flowinfo uint32 38 Addr [16]byte /* in6_addr */ 39 Scope_id uint32 40 } 41 42 const ( 43 sizeofSockaddrInet = 0x10 44 sizeofSockaddrInet6 = 0x1c 45 ) 46 47 func getsockopt(s uintptr, level, name int, b []byte) (int, error) { 48 l := uint32(len(b)) 49 err := syscall.Getsockopt(syscall.Handle(s), int32(level), int32(name), (*byte)(unsafe.Pointer(&b[0])), (*int32)(unsafe.Pointer(&l))) 50 return int(l), err 51 } 52 53 func setsockopt(s uintptr, level, name int, b []byte) error { 54 return syscall.Setsockopt(syscall.Handle(s), int32(level), int32(name), (*byte)(unsafe.Pointer(&b[0])), int32(len(b))) 55 } 56 57 func recvmsg(s uintptr, h *msghdr, flags int) (int, error) { 58 return 0, errNotImplemented 59 } 60 61 func sendmsg(s uintptr, h *msghdr, flags int) (int, error) { 62 return 0, errNotImplemented 63 } 64 65 func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 66 return 0, errNotImplemented 67 } 68 69 func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 70 return 0, errNotImplemented 71 }