/** * This method may be used to determine if the specified IP address is * contained within the IP address range. * * @param ipAddr * IP address (String) to compare * * @return 'true' if the specified IP address falls within the IP address * range. 'false' otherwise. */ boolean contains(String ipAddr) throws java.net.UnknownHostException { return InetAddressUtils.isInetAddressInRange(ipAddr, m_begin, m_end); }
/** * This method may be used to determine if the specified IP address is * contained within the IP address range. * * @param ipAddr * IP address (InetAddress) to compare * * @return 'true' if the specified IP address falls within the IP address * range. 'false' otherwise. */ boolean contains(InetAddress ipAddr) { return InetAddressUtils.isInetAddressInRange(ipAddr.getAddress(), m_begin, m_end); }
public static boolean isInetAddressInRange(final String ipAddr, final byte[] begin, final byte[] end) { return isInetAddressInRange(InetAddressUtils.toIpAddrBytes(ipAddr), begin, end); }
public static boolean isInetAddressInRange(final byte[] laddr, final String beginString, final String endString) { final byte[] begin = InetAddressUtils.toIpAddrBytes(beginString); final byte[] end = InetAddressUtils.toIpAddrBytes(endString); return isInetAddressInRange(laddr, begin, end); }
@Override public void visitRanges(List<Range> ranges) { // if we've already matched a specific, don't bother with the ranges if (!shouldTryToMatch()) return; for (final Range range : ranges) { final byte[] addr = m_address.getAddress(); final byte[] begin = InetAddressUtils.toIpAddrBytes(range.getBegin()); final byte[] end = InetAddressUtils.toIpAddrBytes(range.getEnd()); final boolean inRange; if (BYTE_ARRAY_COMPARATOR.compare(begin, end) <= 0) { inRange = InetAddressUtils.isInetAddressInRange(addr, begin, end); } else { LOG.warn("{} has an 'end' that is earlier than its 'beginning'!", range); inRange = InetAddressUtils.isInetAddressInRange(addr, end, begin); } if (inRange) { handleMatch(); return; } } }
/** * <p>isExcluded</p> * * @param address a {@link java.net.InetAddress} object. * @return a boolean. */ @Override public boolean isExcluded(final InetAddress address) { getReadLock().lock(); try { final List<ExcludeRange> excludeRange = getConfiguration().getExcludeRanges(); if (excludeRange != null) { final byte[] laddr = address.getAddress(); for (final ExcludeRange range : excludeRange) { if (InetAddressUtils.isInetAddressInRange(laddr, range.getBegin(), range.getEnd())) { return true; } } } return false; } finally { getReadLock().unlock(); } }
for (IncludeRange range : includeRangeCollection) { if (InetAddressUtils.isInetAddressInRange(laddr, range.getBegin(), range.getEnd())) {
if (isInetAddressInRange(iface, rng.getBegin(), rng.getEnd())) { has_range_include = true; break; if (isInetAddressInRange(iface, rng.getBegin(), rng.getEnd())) { has_range_exclude = true; break;
if (isInetAddressInRange(iface, rng.getBegin(), rng.getEnd())) { has_range_include = true; break; if (isInetAddressInRange(iface, rng.getBegin(), rng.getEnd())) { has_range_exclude = true; break;
if (isInetAddressInRange(iface, rng.getBegin(), rng.getEnd())) { has_range_include = true; break; if (isInetAddressInRange(iface, rng.getBegin(), rng.getEnd())) { has_range_exclude = true; break;
if (isInetAddressInRange(iface, rng.getBegin(), rng.getEnd())) { has_range_include = true; break; if (isInetAddressInRange(iface, rng.getBegin(), rng.getEnd())) { has_range_exclude = true; break;
if (isInetAddressInRange(iface, rng.getBegin(), rng.getEnd())) { has_range_include = true; break; if (isInetAddressInRange(iface, rng.getBegin(), rng.getEnd())) { has_range_exclude = true; break;
@Override public Definition getAgentConfig(InetAddress agentInetAddress) { Objects.requireNonNull(agentInetAddress); for (Definition def : getConfig().getDefinition()) { // Check the specifics first for (String saddr : def.getSpecific()) { InetAddress addr = InetAddressUtils.addr(saddr); if (addr.equals(agentInetAddress)) { return def; } } // Check the ranges for (Range rng : def.getRange()) { if (InetAddressUtils.isInetAddressInRange(InetAddressUtils.str(agentInetAddress), rng.getBegin(), rng.getEnd())) { return def; } } // Check the matching IP expressions for (String ipMatch : def.getIpMatch()) { if (IPLike.matches(InetAddressUtils.str(agentInetAddress), ipMatch)) { return def; } } } // No definition references the given agent address, use the defaults return new Definition(getConfig()); }
@Override public Definition getAgentConfig(InetAddress agentInetAddress) { Objects.requireNonNull(agentInetAddress); for (Definition def : getConfig().getDefinition()) { // Check the specifics first for (String saddr : def.getSpecific()) { InetAddress addr = InetAddressUtils.addr(saddr); if (addr.equals(agentInetAddress)) { return def; } } // Check the ranges for (Range rng : def.getRange()) { if (InetAddressUtils.isInetAddressInRange(InetAddressUtils.str(agentInetAddress), rng.getBegin(), rng.getEnd())) { return def; } } // Check the matching IP expressions for (String ipMatch : def.getIpMatch()) { if (IPLike.matches(InetAddressUtils.str(agentInetAddress), ipMatch)) { return def; } } } // No definition references the given agent address, use the defaults return new Definition(getConfig()); }
if (InetAddressUtils.isInetAddressInRange(InetAddressUtils.str(agentConfig.getAddress().orElse(null)), rng.getBegin(), rng.getEnd())) { setAmiAgentConfig(agentConfig, def ); break DEFLOOP;
if (InetAddressUtils.isInetAddressInRange(InetAddressUtils.str(agentConfig.getAddress()), rng.getBegin(), rng.getEnd())) { setWmiAgentConfig(agentConfig, def ); break DEFLOOP;
if (InetAddressUtils.isInetAddressInRange(InetAddressUtils.str(agentConfig.getAddress()), rng.getBegin(), rng.getEnd())) { setNSClientAgentConfig(agentConfig, def); break DEFLOOP;
if (InetAddressUtils.isInetAddressInRange(InetAddressUtils.str(agentConfig.getAddress()), rng.getBegin(), rng.getEnd())) { setNSClientAgentConfig(agentConfig, def); break DEFLOOP;