def next_ip(options=nil)
known_args = [:Bitstep, :Objectify, :Short]
bitstep = 1
objectify = false
short = 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?(:Bitstep) )
bitstep = options[:Bitstep]
end
if( options.has_key?(:Short) && options[:Short] == true )
short = true
end
if( options.has_key?(:Objectify) && options[:Objectify] == true )
objectify = true
end
end
next_ip = @network + @hostmask + bitstep
if (next_ip > @all_f)
raise BoundaryError, "Returned IP is out of bounds for IPv#{@version}."
end
if (!objectify)
next_ip = NetAddr.ip_int_to_str(next_ip, @version)
next_ip = NetAddr.shorten(next_ip) if (short && @version == 6)
else
next_ip = NetAddr.cidr_build(@version,next_ip)
end
return(next_ip)
end