sockopt_asmreq_windows.go 570 B

123456789101112131415161718192021
  1. // Copyright 2013 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. package ipv6
  5. import (
  6. "net"
  7. "os"
  8. "syscall"
  9. "unsafe"
  10. )
  11. func setsockoptIPMreq(fd syscall.Handle, opt *sockOpt, ifi *net.Interface, grp net.IP) error {
  12. var mreq sysIPv6Mreq
  13. copy(mreq.Multiaddr[:], grp)
  14. if ifi != nil {
  15. mreq.setIfindex(ifi.Index)
  16. }
  17. return os.NewSyscallError("setsockopt", syscall.Setsockopt(fd, int32(opt.level), int32(opt.name), (*byte)(unsafe.Pointer(&mreq)), sysSizeofIPv6Mreq))
  18. }