public final class Pcaps extends Object
public static List<PcapNetworkInterface> findAllDevs() throws PcapNativeException
PcapNativeException - if an error occurs in the pcap native library.public static PcapNetworkInterface getDevByAddress(InetAddress addr) throws PcapNativeException
addr - addrPcapNativeException - if an error occurs in the pcap native library.public static PcapNetworkInterface getDevByName(String name) throws PcapNativeException
name - namePcapNativeException - if an error occurs in the pcap native library.public static String lookupDev() throws PcapNativeException
PcapNativeException - if an error occurs in the pcap native library.public static Inet4NetworkAddress lookupNet(String devName) throws PcapNativeException
devName - devNameInet4NetworkAddress object.PcapNativeException - if an error occurs in the pcap native library.public static PcapHandle openOffline(String filePath) throws PcapNativeException
filePath - "-" means stdinPcapNativeException - if an error occurs in the pcap native library.public static PcapHandle openOffline(String filePath, PcapHandle.TimestampPrecision precision) throws PcapNativeException
filePath - "-" means stdinprecision - precisionPcapNativeException - if an error occurs in the pcap native library.public static PcapHandle openDead(DataLinkType dlt, int snaplen) throws PcapNativeException
dlt - dltsnaplen - Snapshot length, which is the number of bytes captured for each packet.PcapNativeException - if an error occurs in the pcap native library.public static PcapHandle openDead(DataLinkType dlt, int snaplen, PcapHandle.TimestampPrecision precision) throws PcapNativeException
dlt - dltsnaplen - Snapshot length, which is the number of bytes captured for each packet.precision - precisionPcapNativeException - if an error occurs in the pcap native library.public static BpfProgram compileFilter(int snaplen, DataLinkType dlt, String bpfExpression, BpfProgram.BpfCompileMode mode, Inet4Address netmask) throws PcapNativeException
snaplen - snaplendlt - dltbpfExpression - bpfExpressionmode - modenetmask - netmaskBpfProgram object.PcapNativeException - if an error occurs in the pcap native library.public static DataLinkType dataLinkNameToVal(String name) throws PcapNativeException
name - a data link type name, which is a DLT_ name with the DLT_ removed.DataLinkType object.PcapNativeException - if an error occurs in the pcap native library.public static String dataLinkTypeToName(DataLinkType dlt) throws PcapNativeException
dlt - dltPcapNativeException - if an error occurs in the pcap native library.public static String dataLinkValToName(int dataLinkVal) throws PcapNativeException
dataLinkVal - dataLinkValPcapNativeException - if an error occurs in the pcap native library.public static String dataLinkTypeToDescription(DataLinkType dlt) throws PcapNativeException
dlt - dltPcapNativeException - if an error occurs in the pcap native library.public static String dataLinkValToDescription(int dataLinkVal) throws PcapNativeException
dataLinkVal - dataLinkValPcapNativeException - if an error occurs in the pcap native library.public static String strError(int error)
error - errorpublic static String libVersion()
public static String toBpfString(InetAddress inetAddr)
inetAddr - Inet4Address or Inet6Addresspublic static String toBpfString(MacAddress macAddr)
macAddr - macAddrCopyright © 2011–2016 Pcap4J.org. All rights reserved.