def multicast_mac(options=nil)
known_args = [:Objectify]
objectify = false
if (options)
if (!options.kind_of? Hash)
raise ArgumentError, "Expected Hash, but #{options.class} provided."
end
NetAddr.validate_args(options.keys,known_args)
if (options.has_key?(:Objectify) && options[:Objectify] == true)
objectify = true
end
end
if (@version == 4)
if (@ip & 0xf0000000 == 0xe0000000)
mac = @ip & 0x007fffff | 0x01005e000000
else
raise ValidationError, "#{self.ip} is not a valid multicast address. IPv4 multicast " +
"addresses should be in the range 224.0.0.0/4."
end
else
if (@ip & (0xff << 120) == 0xff << 120)
mac = @ip & (2**32-1) | 0x333300000000
else
raise ValidationError, "#{self.ip} is not a valid multicast address. IPv6 multicast " +
"addresses should be in the range ff00::/8."
end
end
eui = NetAddr::EUI48.new(mac)
eui = eui.address if (!objectify)
return(eui)
end