public boolean isProtocolValid(String protocol) { IPProtocols proto = IPProtocols.fromString(protocol); return (proto != null); }
public static short getProtocolNumberShort(String name) { IPProtocols p = fromString(name); if (p != null) { return p.shortValue(); } //This method should be called after validation only throw new IllegalArgumentException("Illegal IP protocol value: " + name); }
public static byte getProtocolNumberByte(String name) { IPProtocols p = fromString(name); if (p != null) { return p.byteValue(); } //This method should be called after validation only throw new IllegalArgumentException("Illegal IP protocol value: " + name); }
public static int getProtocolNumberInt(String name) { IPProtocols p = fromString(name); if (p != null) { return p.intValue(); } //This method should be called after validation only throw new IllegalArgumentException("Illegal IP protocol value: " + name); }
match.setField(MatchType.NW_DST, ip, mask); if (IPProtocols.fromString(this.protocol) != IPProtocols.ANY) { match.setField(MatchType.NW_PROTO, IPProtocols.getProtocolNumberByte(this.protocol));