パッケージ org.pcap4j.core
クラス Pcaps
- java.lang.Object
-
- org.pcap4j.core.Pcaps
-
public final class Pcaps extends Object
- 導入されたバージョン:
- pcap4j 0.9.1
- 作成者:
- Kaito Yamada
-
-
メソッドの概要
-
-
-
メソッドの詳細
-
findAllDevs
public static List<PcapNetworkInterface> findAllDevs() throws PcapNativeException
Gets all devices.- 戻り値:
- a list of PcapNetworkInterfaces.
- 例外:
PcapNativeException- if an error occurs in the pcap native library.
-
getDevByAddress
public static PcapNetworkInterface getDevByAddress(InetAddress addr) throws PcapNativeException
Gets a device by IP address.- パラメータ:
addr- addr- 戻り値:
- a PcapNetworkInterface.
- 例外:
PcapNativeException- if an error occurs in the pcap native library.
-
getDevByName
public static PcapNetworkInterface getDevByName(String name) throws PcapNativeException
Gets a device by name.- パラメータ:
name- name- 戻り値:
- a PcapNetworkInterface.
- 例外:
PcapNativeException- if an error occurs in the pcap native library.
-
lookupDev
public static String lookupDev() throws PcapNativeException
- 戻り値:
- a name of a network interface.
- 例外:
PcapNativeException- if an error occurs in the pcap native library.
-
lookupNet
public static Inet4NetworkAddress lookupNet(String devName) throws PcapNativeException
- パラメータ:
devName- devName- 戻り値:
- an
Inet4NetworkAddressobject. - 例外:
PcapNativeException- if an error occurs in the pcap native library.
-
openOffline
public static PcapHandle openOffline(String filePath) throws PcapNativeException
- パラメータ:
filePath- "-" means stdin- 戻り値:
- a new PcapHandle object.
- 例外:
PcapNativeException- if an error occurs in the pcap native library.
-
openOffline
public static PcapHandle openOffline(String filePath, PcapHandle.TimestampPrecision precision) throws PcapNativeException
- パラメータ:
filePath- "-" means stdinprecision- precision- 戻り値:
- a new PcapHandle object.
- 例外:
PcapNativeException- if an error occurs in the pcap native library.
-
openDead
public static PcapHandle openDead(DataLinkType dlt, int snaplen) throws PcapNativeException
- パラメータ:
dlt- dltsnaplen- Snapshot length, which is the number of bytes captured for each packet.- 戻り値:
- a new PcapHandle object.
- 例外:
PcapNativeException- if an error occurs in the pcap native library.
-
openDead
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- precision- 戻り値:
- a new PcapHandle object.
- 例外:
PcapNativeException- if an error occurs in the pcap native library.
-
compileFilter
public static BpfProgram compileFilter(int snaplen, DataLinkType dlt, String bpfExpression, BpfProgram.BpfCompileMode mode, Inet4Address netmask) throws PcapNativeException
- パラメータ:
snaplen- snaplendlt- dltbpfExpression- bpfExpressionmode- modenetmask- netmask- 戻り値:
- a
BpfProgramobject. - 例外:
PcapNativeException- if an error occurs in the pcap native library.
-
dataLinkNameToVal
public static DataLinkType dataLinkNameToVal(String name) throws PcapNativeException
- パラメータ:
name- a data link type name, which is a DLT_ name with the DLT_ removed.- 戻り値:
- a
DataLinkTypeobject. - 例外:
PcapNativeException- if an error occurs in the pcap native library.
-
dataLinkTypeToName
public static String dataLinkTypeToName(DataLinkType dlt) throws PcapNativeException
- パラメータ:
dlt- dlt- 戻り値:
- data link type name
- 例外:
PcapNativeException- if an error occurs in the pcap native library.
-
dataLinkValToName
public static String dataLinkValToName(int dataLinkVal) throws PcapNativeException
- パラメータ:
dataLinkVal- dataLinkVal- 戻り値:
- data link type name
- 例外:
PcapNativeException- if an error occurs in the pcap native library.
-
dataLinkTypeToDescription
public static String dataLinkTypeToDescription(DataLinkType dlt) throws PcapNativeException
- パラメータ:
dlt- dlt- 戻り値:
- a short description of that data link type.
- 例外:
PcapNativeException- if an error occurs in the pcap native library.
-
dataLinkValToDescription
public static String dataLinkValToDescription(int dataLinkVal) throws PcapNativeException
- パラメータ:
dataLinkVal- dataLinkVal- 戻り値:
- a short description of that data link type.
- 例外:
PcapNativeException- if an error occurs in the pcap native library.
-
strError
public static String strError(int error)
- パラメータ:
error- error- 戻り値:
- an error message.
-
libVersion
public static String libVersion()
- 戻り値:
- a string giving information about the version of the libpcap library being used; note that it contains more information than just a version number.
-
toBpfString
public static String toBpfString(InetAddress inetAddr)
- パラメータ:
inetAddr- Inet4Address or Inet6Address- 戻り値:
- a string representation of an InetAddress for BPF.
-
toBpfString
public static String toBpfString(MacAddress macAddr)
- パラメータ:
macAddr- macAddr- 戻り値:
- a string representation of a MAC address for BPF.
-
-