@Override protected String ipv4PrefixString(final Ipv4Prefix prefix) { return prefix.getValue(); }
public IpPrefix(Ipv4Prefix _ipv4Prefix) { super(); this._ipv4Prefix = _ipv4Prefix; this._ipv6Prefix = null; this._value = _ipv4Prefix.getValue().toString().toCharArray(); }
private static InetAddress inetAddressFrom(Ipv4Prefix source) { if (source != null) { String[] parts = source.getValue().split("/"); return InetAddresses.forString(parts[0]); } return null; }
public char[] getValue() { if (_value == null) { if (_ipv4Prefix != null) { _value = _ipv4Prefix.getValue().toString().toCharArray(); } else if (_ipv6Prefix != null) { _value = _ipv6Prefix.getValue().toString().toCharArray(); } } return _value == null ? null : _value.clone(); }
/** * TODO: why don't we use the default Ipv4Prefix.equals()? * * @param statsIpAddress * @param storedIpAddress * @return true if IPv4prefixes equals */ private static boolean IpAddressEquals(final Ipv4Prefix statsIpAddress, final Ipv4Prefix storedIpAddress) { final IntegerIpAddress statsIpAddressInt = StrIpToIntIp(statsIpAddress.getValue()); final IntegerIpAddress storedIpAddressInt = StrIpToIntIp(storedIpAddress.getValue()); if(IpAndMaskBasedMatch(statsIpAddressInt,storedIpAddressInt)){ return true; } if(IpBasedMatch(statsIpAddressInt,storedIpAddressInt)){ return true; } return false; }
public static String getStringIpPrefix(IpPrefix ipPrefix) { if (ipPrefix.getIpv4Prefix() != null) { return ipPrefix.getIpv4Prefix().getValue(); } return ipPrefix.getIpv6Prefix().getValue(); }
private void setOptionClasslessRoute(DHCP reply, DhcpInfo dhcpInfo) { List<HostRoutes> hostRoutes = dhcpInfo.getHostRoutes(); if(hostRoutes == null) { //we can't set this option, so return return; } ByteArrayOutputStream result = new ByteArrayOutputStream(); Iterator<HostRoutes> iter = hostRoutes.iterator(); while(iter.hasNext()) { HostRoutes hostRoute = iter.next(); if(hostRoute.getNexthop().getIpv4Address() == null || hostRoute.getDestination().getIpv4Prefix() == null ) { // we only deal with IPv4 addresses return; } String router = hostRoute.getNexthop().getIpv4Address().getValue(); String dest = hostRoute.getDestination().getIpv4Prefix().getValue(); try { result.write(convertToClasslessRouteOption(dest, router)); } catch (IOException | NullPointerException e) { LOG.debug("Exception {}",e.getMessage()); } } if (result.size() > 0) { reply.setOptionBytes(DHCPConstants.OPT_CLASSLESS_ROUTE , result.toByteArray()); } }
String propVal = retValue.getValue();
rule.getRemoteIpPrefix().getIpv4Prefix().getValue():rule.getRemoteIpPrefix().getIpv6Prefix().getValue());
rule.getRemoteIpPrefix().getIpv4Prefix().getValue():rule.getRemoteIpPrefix().getIpv6Prefix().getValue());