Module org.jnetpcap

Enum Class PcapCode

java.lang.Object
java.lang.Enum<PcapCode>
org.jnetpcap.constant.PcapCode
All Implemented Interfaces:
Serializable, Comparable<PcapCode>, Constable, IntSupplier

public enum PcapCode extends Enum<PcapCode> implements IntSupplier
Libppcap error and warning status codes.
Author:
Sly Technologies, repos@slytechs.com
  • Enum Constant Details

    • OK

      public static final PcapCode OK
      ok.
    • ERROR

      public static final PcapCode ERROR
      generic error full.
    • ERROR_BREAK

      public static final PcapCode ERROR_BREAK
      loop terminated by pcap_breakloop.
    • ERROR_NOT_ACTIVATED

      public static final PcapCode ERROR_NOT_ACTIVATED
      the capture needs to be activated.
    • ERROR_ACTIVATED

      public static final PcapCode ERROR_ACTIVATED
      the operation can't be performed on already activated captures.
    • ERROR_NO_SUCH_DEVICE

      public static final PcapCode ERROR_NO_SUCH_DEVICE
      no such device exists.
    • ERROR_RFMON_NOTSUP

      public static final PcapCode ERROR_RFMON_NOTSUP
      this device doesn't support rfmon (monitor) mode.
    • ERROR_NOT_RFMON

      public static final PcapCode ERROR_NOT_RFMON
      operation supported only in monitor mode.
    • ERROR_PERM_DENIED

      public static final PcapCode ERROR_PERM_DENIED
      no permission to open the device.
    • ERROR_IFACE_NOT_UP

      public static final PcapCode ERROR_IFACE_NOT_UP
      interface isn't up.
    • ERROR_CANTSET_TSTAMP_TYPE

      public static final PcapCode ERROR_CANTSET_TSTAMP_TYPE
      this device doesn't support setting the time stamp type.
    • ERROR_PROMISC_PERM_DENIED

      public static final PcapCode ERROR_PROMISC_PERM_DENIED
      you don't have permission to capture in promiscuous mode.
    • ERROR_TSTAMP_PRECISION_NOTSUP

      public static final PcapCode ERROR_TSTAMP_PRECISION_NOTSUP
      the requested time stamp precision is not supported.
    • WARNING

      public static final PcapCode WARNING
      generic warning.
    • WARNING_PROMISC_NOTSUP

      public static final PcapCode WARNING_PROMISC_NOTSUP
      this device doesn't support promiscuous mode.
    • WARNING_TSTAMP_TYPE_NOTSUP

      public static final PcapCode WARNING_TSTAMP_TYPE_NOTSUP
      the requested time stamp type is not supported.
  • Field Details

    • PCAP_OK

      public static final int PCAP_OK
      ok.
      See Also:
    • PCAP_ERROR

      public static final int PCAP_ERROR
      generic error full.
      See Also:
    • PCAP_ERROR_BREAK

      public static final int PCAP_ERROR_BREAK
      loop terminated by pcap_breakloop.
      See Also:
    • PCAP_ERROR_NOT_ACTIVATED

      public static final int PCAP_ERROR_NOT_ACTIVATED
      the capture needs to be activated.
      See Also:
    • PCAP_ERROR_ACTIVATED

      public static final int PCAP_ERROR_ACTIVATED
      the operation can't be performed on already activated captures.
      See Also:
    • PCAP_ERROR_NO_SUCH_DEVICE

      public static final int PCAP_ERROR_NO_SUCH_DEVICE
      no such device exists.
      See Also:
    • PCAP_ERROR_RFMON_NOTSUP

      public static final int PCAP_ERROR_RFMON_NOTSUP
      this device doesn't support rfmon (monitor) mode.
      See Also:
    • PCAP_ERROR_NOT_RFMON

      public static final int PCAP_ERROR_NOT_RFMON
      operation supported only in monitor mode.
      See Also:
    • PCAP_ERROR_PERM_DENIED

      public static final int PCAP_ERROR_PERM_DENIED
      no permission to open the device.
      See Also:
    • PCAP_ERROR_IFACE_NOT_UP

      public static final int PCAP_ERROR_IFACE_NOT_UP
      interface isn't up.
      See Also:
    • PCAP_ERROR_CANTSET_TSTAMP_TYPE

      public static final int PCAP_ERROR_CANTSET_TSTAMP_TYPE
      this device doesn't support setting the time stamp type.
      See Also:
    • PCAP_ERROR_PROMISC_PERM_DENIED

      public static final int PCAP_ERROR_PROMISC_PERM_DENIED
      you don't have permission to capture in promiscuous mode.
      See Also:
    • PCAP_ERROR_TSTAMP_PRECISION_NOTSUP

      public static final int PCAP_ERROR_TSTAMP_PRECISION_NOTSUP
      the requested time stamp precision is not supported.
      See Also:
    • PCAP_WARNING

      public static final int PCAP_WARNING
      generic warning.
      See Also:
    • PCAP_WARNING_PROMISC_NOTSUP

      public static final int PCAP_WARNING_PROMISC_NOTSUP
      this device doesn't support promiscuous mode.
      See Also:
    • PCAP_WARNING_TSTAMP_TYPE_NOTSUP

      public static final int PCAP_WARNING_TSTAMP_TYPE_NOTSUP
      the requested time stamp type is not supported.
      See Also:
  • Method Details

    • values

      public static PcapCode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static PcapCode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • toString

      public static String toString(int code)
      Converts an integer Pcap error code to a string.
      Parameters:
      code - the code
      Returns:
      the error code string or description
    • valueOf

      public static PcapCode valueOf(int code) throws IllegalArgumentException
      Converts an integer Pcap error code to a constant.
      Parameters:
      code - pcap error code
      Returns:
      the matching constant or null if not found
      Throws:
      IllegalArgumentException - thrown if not found
    • toEnum

      public static Optional<PcapCode> toEnum(int code)
      Converts an integer Pcap error code to a constant.
      Parameters:
      code - pcap error code
      Returns:
      the matching constant or null if not found
    • getAsInt

      public int getAsInt()
      Gets the as int.
      Specified by:
      getAsInt in interface IntSupplier
      Returns:
      the as int
      See Also:
    • getMessage

      public String getMessage()
      Gets the message associated with this error code.
      Returns:
      the error code message
    • getMessage

      public static String getMessage(int code)
      Looks up the error message for a give code.
      Parameters:
      code - the pcap code to lookup
      Returns:
      the error code message
    • isError

      public boolean isError()
      Checks if this code is an pcap error. For example, code < 0
      Returns:
      true, if is error
    • isOk

      public boolean isOk()
      Checks if this code is pcap status OK. For example, code == 0
      Returns:
      true, if is ok
    • isWarning

      public boolean isWarning()
      Checks if this code is pcap status warning. For example, code > 0
      Returns:
      true, if it is a wraning