Package pcap.api

Class Pcaps

java.lang.Object
pcap.api.Pcaps
Direct Known Subclasses:
PcapLive, PcapOffline

@Inclubating
public abstract class Pcaps
extends java.lang.Object
Author:
Ardika Rommy Sanjaya
  • Constructor Summary

    Constructors 
    Constructor Description
    Pcaps()  
  • Method Summary

    Modifier and Type Method Description
    static pcap.spi.Pcap live​(PcapLive pcapLive)
    Open live capture handle.
    static pcap.common.net.Inet4Address lookupInet4Addres​(pcap.spi.Interface source)
    Lookup Inet4Address from Interface.
    static pcap.common.net.Inet6Address lookupInet6Address​(pcap.spi.Interface source)
    Lookup Inet6Address from Interface.
    static pcap.spi.Interface lookupInterface()
    Lookup interface can be used to open Pcap live handle.
    static pcap.spi.Interface lookupInterface​(java.lang.String name)
    Find interface by name.
    static pcap.spi.Interface lookupInterfaces()
    Find all interfaces on your system.
    static pcap.common.net.MacAddress lookupMacAddress​(pcap.spi.Interface source)
    Get mac address for given Interface.
    static pcap.spi.Pcap offline​(PcapOffline pcapOffline)
    Open offline handle.
    static java.lang.String version()
    Get native pcap library version.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • offline

      public static pcap.spi.Pcap offline​(PcapOffline pcapOffline) throws pcap.spi.exception.ErrorException
      Open offline handle.
      Parameters:
      pcapOffline - pcap offline option.
      Returns:
      returns Pcap live handle.
      Throws:
      pcap.spi.exception.ErrorException
    • live

      public static pcap.spi.Pcap live​(PcapLive pcapLive) throws pcap.spi.exception.error.InterfaceNotSupportTimestampTypeException, pcap.spi.exception.error.InterfaceNotUpException, pcap.spi.exception.error.RadioFrequencyModeNotSupportedException, pcap.spi.exception.error.ActivatedException, pcap.spi.exception.error.PermissionDeniedException, pcap.spi.exception.error.NoSuchDeviceException, pcap.spi.exception.error.PromiscuousModePermissionDeniedException, pcap.spi.exception.ErrorException, pcap.spi.exception.error.TimestampPrecisionNotSupportedException
      Open live capture handle.
      Parameters:
      pcapLive - pcap live option.
      Returns:
      returns Pcap offline handle.
      Throws:
      pcap.spi.exception.error.InterfaceNotSupportTimestampTypeException - timestamp type not supported by interface.
      pcap.spi.exception.error.InterfaceNotUpException - interface is not up.
      pcap.spi.exception.error.RadioFrequencyModeNotSupportedException - radio frequency mode is not supported.
      pcap.spi.exception.error.ActivatedException - a handle is already activated or need to activated.
      pcap.spi.exception.error.PermissionDeniedException - you have no permission to open live handle with current user.
      pcap.spi.exception.error.NoSuchDeviceException - no such device can be use to open live handle.
      pcap.spi.exception.error.PromiscuousModePermissionDeniedException - you have no permission to enable promiscuous mode.
      pcap.spi.exception.ErrorException - generic error.
      pcap.spi.exception.error.TimestampPrecisionNotSupportedException - timestamp precision not supported.
    • lookupInterfaces

      public static pcap.spi.Interface lookupInterfaces() throws pcap.spi.exception.ErrorException
      Find all interfaces on your system.
      Returns:
      returns iterable Interface's.
      Throws:
      pcap.spi.exception.ErrorException - generic error.
    • lookupInterface

      public static pcap.spi.Interface lookupInterface​(java.lang.String name) throws pcap.spi.exception.ErrorException
      Find interface by name.
      Parameters:
      name - interface name.
      Returns:
      returns Interface.
      Throws:
      pcap.spi.exception.ErrorException - interface not found.
    • lookupInterface

      public static pcap.spi.Interface lookupInterface() throws pcap.spi.exception.ErrorException
      Lookup interface can be used to open Pcap live handle.
      Returns:
      returns Interface.
      Throws:
      pcap.spi.exception.ErrorException - generic error.
    • lookupMacAddress

      public static pcap.common.net.MacAddress lookupMacAddress​(pcap.spi.Interface source) throws pcap.spi.exception.ErrorException
      Get mac address for given Interface.
      Parameters:
      source - interface.
      Returns:
      returns MacAddress.
      Throws:
      pcap.spi.exception.ErrorException - generic error.
    • lookupInet4Addres

      public static pcap.common.net.Inet4Address lookupInet4Addres​(pcap.spi.Interface source) throws pcap.spi.exception.ErrorException
      Lookup Inet4Address from Interface.
      Parameters:
      source - Interface.
      Returns:
      returns Inet4Address.
      Throws:
      pcap.spi.exception.ErrorException - address not found.
    • lookupInet6Address

      public static pcap.common.net.Inet6Address lookupInet6Address​(pcap.spi.Interface source) throws pcap.spi.exception.ErrorException
      Lookup Inet6Address from Interface.
      Parameters:
      source - Interface.
      Returns:
      returns Inet6Address.
      Throws:
      pcap.spi.exception.ErrorException - address not found.
    • version

      public static java.lang.String version()
      Get native pcap library version.
      Returns:
      returns native pcap library version.