java.lang.Object
org.pcap4j.core.PcapNetworkInterface
- Since:
- pcap4j 0.9.1
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<PcapAddress> private final Stringprivate final List<LinkLayerAddress> private final booleanprivate static final org.slf4j.Loggerprivate final booleanprivate final Stringprivate static final intprivate static final intprivate static final intprivate final booleanprivate final boolean -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePcapNetworkInterface(NativeMappings.pcap_if pif, boolean local) -
Method Summary
Modifier and TypeMethodDescriptionbooleanprivate MacAddressgetMacAddress(String nifName) getName()inthashCode()booleanisLocal()booleanReturns if this network interface is loopback.booleanReturns if this network interface is running.booleanisUp()Returns if this network interface is up.(package private) static PcapNetworkInterfacenewInstance(NativeMappings.pcap_if pif, boolean local) openLive(int snaplen, PcapNetworkInterface.PromiscuousMode mode, int timeoutMillis) toString()
-
Field Details
-
logger
private static final org.slf4j.Logger logger -
PCAP_IF_LOOPBACK
private static final int PCAP_IF_LOOPBACK- See Also:
-
PCAP_IF_UP
private static final int PCAP_IF_UP- See Also:
-
PCAP_IF_RUNNING
private static final int PCAP_IF_RUNNING- See Also:
-
name
-
description
-
addresses
-
linkLayerAddresses
-
loopBack
private final boolean loopBack -
up
private final boolean up -
running
private final boolean running -
local
private final boolean local
-
-
Constructor Details
-
PcapNetworkInterface
-
-
Method Details
-
newInstance
-
getName
- Returns:
- name
-
getDescription
- Returns:
- description
-
getAddresses
- Returns:
- inet addresses
-
getLinkLayerAddresses
- Returns:
- link layer addresses
-
isLoopBack
public boolean isLoopBack()Returns if this network interface is loopback. This method may always return false on some environments.- Returns:
- true if the network interface represented by this object is a loop back interface; false otherwise.
-
isUp
public boolean isUp()Returns if this network interface is up. This method may always return false on some environments.- Returns:
- true if the network interface represented by this object is up; false otherwise.
-
isRunning
public boolean isRunning()Returns if this network interface is running. This method may always return false on some environments.- Returns:
- true if the network interface represented by this object is running; false otherwise.
-
isLocal
public boolean isLocal()- Returns:
- true if the network interface represented by this object is a local interface; false otherwise.
-
openLive
public PcapHandle openLive(int snaplen, PcapNetworkInterface.PromiscuousMode mode, int timeoutMillis) throws PcapNativeException - Parameters:
snaplen- Snapshot length, which is the number of bytes captured for each packet.mode- modetimeoutMillis- Read timeout. Most OSs buffer packets. The OSs pass the packets to Pcap4j after the buffer gets full or the read timeout expires. Must be non-negative. May be ignored by some OSs. 0 means disable buffering on Solaris. 0 means infinite on the other OSs. 1 through 9 means infinite on Solaris.- Returns:
- a new PcapHandle object.
- Throws:
PcapNativeException- if an error occurs in the pcap native library.
-
getMacAddress
-
toString
-
hashCode
public int hashCode() -
equals
-