/** * Accepts a collection of IPv4 addresses as integers and returns a single * String useful in toString method's containing collections of IP * addresses. * * @param ipAddresses * collection * @return ip addresses in comma-separated string form */ public static String fromIPv4AddressCollection( final Collection<Integer> ipAddresses) { if (ipAddresses == null) { return "null"; } final StringBuilder sb = new StringBuilder(); sb.append("["); for (final Integer ip : ipAddresses) { sb.append(IPv4.fromIPv4Address(ip)); sb.append(","); } sb.replace(sb.length() - 1, sb.length(), "]"); return sb.toString(); }
final ARP p = (ARP) pkt; sb.append("\nnw_src: "); sb.append(IPv4.fromIPv4Address(IPv4.toIPv4Address(p .getSenderProtocolAddress()))); sb.append("\nnw_dst: "); sb.append(IPv4.fromIPv4Address(IPv4.toIPv4Address(p .getTargetProtocolAddress()))); } else if (pkt instanceof LLDP) { final IPv4 p = (IPv4) pkt; sb.append("\nnw_src: "); sb.append(IPv4.fromIPv4Address(p.getSourceAddress())); sb.append("\nnw_dst: "); sb.append(IPv4.fromIPv4Address(p.getDestinationAddress())); sb.append("\nnw_tos: "); sb.append(p.getDiffServ());