All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pcap.codec.icmp.icmp4.Icmp4ParameterProblem Maven / Gradle / Ivy

There is a newer version: 1.5.1
Show newest version
/** This code is licenced under the GPL version 2. */
package pcap.codec.icmp.icmp4;

import pcap.codec.icmp.Icmp;
import pcap.common.annotation.Inclubating;

/** @author Ardika Rommy Sanjaya */
@Inclubating
public class Icmp4ParameterProblem extends Icmp.IcmpTypeAndCode {

  public static final Icmp4ParameterProblem POINTER_INDICATES_THE_ERROR =
      new Icmp4ParameterProblem((byte) 0, "Pointer indicates the error");

  public static final Icmp4ParameterProblem MISSING_REQUIRED_OPTION =
      new Icmp4ParameterProblem((byte) 1, "Missing a required option");

  public static final Icmp4ParameterProblem BAD_LENGTH =
      new Icmp4ParameterProblem((byte) 2, "Bad length");

  public Icmp4ParameterProblem(Byte code, String name) {
    super((byte) 12, code, name);
  }

  /**
   * Add new {@link Icmp4ParameterProblem} to registry.
   *
   * @param code icmp type code.
   * @param name icmp type name.
   * @return returns {@link Icmp4ParameterProblem}.
   */
  public static Icmp4ParameterProblem register(Byte code, String name) {
    return new Icmp4ParameterProblem(code, name);
  }

  @Override
  public String toString() {
    return super.toString();
  }

  static {
    Icmp.IcmpTypeAndCode.ICMP4_REGISTRY.add(POINTER_INDICATES_THE_ERROR);
    Icmp.IcmpTypeAndCode.ICMP4_REGISTRY.add(MISSING_REQUIRED_OPTION);
    Icmp.IcmpTypeAndCode.ICMP4_REGISTRY.add(BAD_LENGTH);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy