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 Pcaplive(PcapLive pcapLive)Open live capture handle.static Inet4AddresslookupInet4Addres(Interface source)LookupInet4AddressfromInterface.static Inet6AddresslookupInet6Address(Interface source)LookupInet6AddressfromInterface.static InterfacelookupInterface()Lookup interface can be used to openPcaplive handle.static InterfacelookupInterface(java.lang.String name)Find interface by name.static InterfacelookupInterfaces()Find all interfaces on your system.static MacAddresslookupMacAddress(Interface source)Get mac address for givenInterface.static Pcapoffline(PcapOffline pcapOffline)Open offline handle.static java.lang.Stringversion()Get native pcap library version.
-
Constructor Details
-
Pcaps
public Pcaps()
-
-
Method Details
-
offline
Open offline handle.- Parameters:
pcapOffline- pcap offline option.- Returns:
- returns
Pcaplive handle. - Throws:
ErrorException
-
live
public static Pcap live(PcapLive pcapLive) throws InterfaceNotSupportTimestampTypeException, InterfaceNotUpException, RadioFrequencyModeNotSupportedException, ActivatedException, PermissionDeniedException, NoSuchDeviceException, PromiscuousModePermissionDeniedException, ErrorException, TimestampPrecisionNotSupportedExceptionOpen live capture handle.- Parameters:
pcapLive- pcap live option.- Returns:
- returns
Pcapoffline handle. - Throws:
InterfaceNotSupportTimestampTypeException- timestamp type not supported by interface.InterfaceNotUpException- interface is not up.RadioFrequencyModeNotSupportedException- radio frequency mode is not supported.ActivatedException- a handle is already activated or need to activated.PermissionDeniedException- you have no permission to open live handle with current user.NoSuchDeviceException- no such device can be use to open live handle.PromiscuousModePermissionDeniedException- you have no permission to enable promiscuous mode.ErrorException- generic error.TimestampPrecisionNotSupportedException- timestamp precision not supported.
-
lookupInterfaces
Find all interfaces on your system.- Returns:
- returns iterable
Interface's. - Throws:
ErrorException- generic error.
-
lookupInterface
Find interface by name.- Parameters:
name- interface name.- Returns:
- returns
Interface. - Throws:
ErrorException- interface not found.
-
lookupInterface
Lookup interface can be used to openPcaplive handle.- Returns:
- returns
Interface. - Throws:
ErrorException- generic error.
-
lookupMacAddress
Get mac address for givenInterface.- Parameters:
source- interface.- Returns:
- returns
MacAddress. - Throws:
ErrorException- generic error.
-
lookupInet4Addres
LookupInet4AddressfromInterface.- Parameters:
source-Interface.- Returns:
- returns
Inet4Address. - Throws:
ErrorException- address not found.
-
lookupInet6Address
LookupInet6AddressfromInterface.- Parameters:
source-Interface.- Returns:
- returns
Inet6Address. - Throws:
ErrorException- address not found.
-
version
public static java.lang.String version()Get native pcap library version.- Returns:
- returns native pcap library version.
-