// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build unix || windows

package net

import (
	
	
)

func joinIPv4Group( *netFD,  *Interface,  IP) error {
	 := &syscall.IPMreq{Multiaddr: [4]byte{[0], [1], [2], [3]}}
	if  := setIPv4MreqToInterface(, );  != nil {
		return 
	}
	 := .pfd.SetsockoptIPMreq(syscall.IPPROTO_IP, syscall.IP_ADD_MEMBERSHIP, )
	runtime.KeepAlive()
	return wrapSyscallError("setsockopt", )
}

func setIPv6MulticastInterface( *netFD,  *Interface) error {
	var  int
	if  != nil {
		 = .Index
	}
	 := .pfd.SetsockoptInt(syscall.IPPROTO_IPV6, syscall.IPV6_MULTICAST_IF, )
	runtime.KeepAlive()
	return wrapSyscallError("setsockopt", )
}

func setIPv6MulticastLoopback( *netFD,  bool) error {
	 := .pfd.SetsockoptInt(syscall.IPPROTO_IPV6, syscall.IPV6_MULTICAST_LOOP, boolint())
	runtime.KeepAlive()
	return wrapSyscallError("setsockopt", )
}

func joinIPv6Group( *netFD,  *Interface,  IP) error {
	 := &syscall.IPv6Mreq{}
	copy(.Multiaddr[:], )
	if  != nil {
		.Interface = uint32(.Index)
	}
	 := .pfd.SetsockoptIPv6Mreq(syscall.IPPROTO_IPV6, syscall.IPV6_JOIN_GROUP, )
	runtime.KeepAlive()
	return wrapSyscallError("setsockopt", )
}