Skip to content

Commit

Permalink
First part of review
Browse files Browse the repository at this point in the history
Signed-off-by: Leo Siepel <[email protected]>
  • Loading branch information
lsiepel committed Oct 7, 2024
1 parent ad0d496 commit fcaf99a
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ public static String networkPrefixLengthToNetmask(int prefixLength) {
/**
* Get the network address a specific ip address is in
*
* @param ipAddressString ipv4 address of the device (i.e. 192.168.5.1)
* @param ipAddressString IPv4 address of the device (i.e. 192.168.5.1)
* @param netMask netmask in bits (i.e. 24)
* @return network a device is in (i.e. 192.168.5.0)
* @throws IllegalArgumentException if parameters are wrong
Expand Down Expand Up @@ -424,7 +424,7 @@ public static String getIpv4NetAddress(String ipAddressString, short netMask) {
/**
* Get the network broadcast address of the subnet a specific ip address is in
*
* @param ipAddressString ipv4 address of the device (i.e. 192.168.5.1)
* @param ipAddressString IPv4 address of the device (i.e. 192.168.5.1)
* @param prefix network prefix in bits (i.e. 24)
* @return network broadcast address of the network the device is in (i.e. 192.168.5.255)
* @throws IllegalArgumentException if parameters are wrong
Expand Down Expand Up @@ -599,7 +599,7 @@ private boolean getConfigParameter(Map<String, Object> parameters, String parame
}

/**
* For all network interfaces (except loopback) all Ipv4 addresses are returned.
* For all network interfaces (except loopback) all IPv4 addresses are returned.
* This list can for example, be used to scan the network for available devices.
*
* @return A full list of IP {@link InetAddress} (except network and broadcast)
Expand All @@ -616,15 +616,17 @@ public static List<InetAddress> getFullRangeOfAddressesToScan() {
}

/**
* For the given {@link CidrAddress} all Ipv4 addresses are returned.
* This list can for example, be used to scan the network for available devices.
* For the given {@link CidrAddress} all IPv4 addresses are returned.
* This list can, for example, be used to scan the network for available devices.
*
* @param iFaceAddress The {@link CidrAddress} of the network interface
* @param maxPrefixLength Control the prefix length of the network (e.g. 24 for class C)
* @param maxAllowedPrefixLength Control the maximum allowed prefix length of the network (e.g. 24 for class C).
* iFaceAddress's with a larger prefix are ignored and return an empty result.
* @return A full list of IP {@link InetAddress} (except network and broadcast)
*/
public static List<InetAddress> getAddressesRangeByCidrAddress(CidrAddress iFaceAddress, int maxPrefixLength) {
if (!(iFaceAddress.getAddress() instanceof Inet4Address) || iFaceAddress.getPrefix() < maxPrefixLength) {
public static List<InetAddress> getAddressesRangeByCidrAddress(CidrAddress iFaceAddress,
int maxAllowedPrefixLength) {
if (!(iFaceAddress.getAddress() instanceof Inet4Address) || iFaceAddress.getPrefix() < maxAllowedPrefixLength) {
return List.of();
}

Expand Down

0 comments on commit fcaf99a

Please sign in to comment.