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.Pcaplive(PcapLive pcapLive)Open live capture handle.static pcap.common.net.Inet4AddresslookupInet4Addres(pcap.spi.Interface source)LookupInet4AddressfromInterface.static pcap.common.net.Inet6AddresslookupInet6Address(pcap.spi.Interface source)LookupInet6AddressfromInterface.static pcap.spi.InterfacelookupInterface()Lookup interface can be used to openPcaplive handle.static pcap.spi.InterfacelookupInterface(java.lang.String name)Find interface by name.static pcap.spi.InterfacelookupInterfaces()Find all interfaces on your system.static pcap.common.net.MacAddresslookupMacAddress(pcap.spi.Interface source)Get mac address for givenInterface.static pcap.spi.Pcapoffline(PcapOffline pcapOffline)Open offline handle.static java.lang.Stringversion()Get native pcap library version.
-
Constructor Details
-
Pcaps
public Pcaps()
-
-
Method Details
-
offline
public static pcap.spi.Pcap offline(PcapOffline pcapOffline) throws pcap.spi.exception.ErrorExceptionOpen offline handle.- Parameters:
pcapOffline- pcap offline option.- Returns:
- returns
Pcaplive 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.TimestampPrecisionNotSupportedExceptionOpen live capture handle.- Parameters:
pcapLive- pcap live option.- Returns:
- returns
Pcapoffline 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.ErrorExceptionFind 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.ErrorExceptionFind 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.ErrorExceptionLookup interface can be used to openPcaplive 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.ErrorExceptionGet mac address for givenInterface.- 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.ErrorExceptionLookupInet4AddressfromInterface.- 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.ErrorExceptionLookupInet6AddressfromInterface.- 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.
-