/** * Determine the payload type for the given IP protocol number. * * @param proto The IP protocol number. * @return A class for the payload type. * {@code null} if no payload type is defined for the given * IP protocol number. */ static Class<? extends Packet> getPayloadClass(byte proto) { InetProtocols ipproto = InetProtocols.forValue(proto); return (ipproto == null) ? null : PAYLOAD_TYPES.get(ipproto); }
/** * Return an IP protocol number assigned to this protocol. * * @param ver An {@link IpVersion} instance which describes the * IP version. * @return 6 is always returned. */ public short getInetProtocol(IpVersion ver) { return InetProtocols.TCP.shortValue(); }
/** * Return an IP protocol number assigned to this protocol. * * @param ver An {@link IpVersion} instance which describes the * IP version. * @return 6 is always returned. */ public short getInetProtocol(IpVersion ver) { return InetProtocols.UDP.shortValue(); }
/** * Return an IP protocol number assigned to this protocol. * * @param ver An {@link IpVersion} instance which describes the * IP version. * @return An IP protocol number. * @throws IllegalStateException * {@code ver} is not {@link IpVersion#Ipv4}. */ @Override public short getInetProtocol(IpVersion ver) { checkIpVersion(ver); return InetProtocols.ICMP.shortValue(); }
put(InetProtocols.TCP.shortValue(), tcpMap). put(InetProtocols.UDP.shortValue(), tcpMap). put(InetProtocols.ICMP.shortValue(), icmpMap). build();