Package org.pcap4j.core
Class PcapNetworkInterface
- java.lang.Object
-
- org.pcap4j.core.PcapNetworkInterface
-
public final class PcapNetworkInterface extends java.lang.Object
- Since:
- pcap4j 0.9.1
- Author:
- Kaito Yamada
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PcapNetworkInterface.PromiscuousMode
-
Method Summary
Modifier and Type Method Description boolean
equals(java.lang.Object obj)
java.util.List<PcapAddress>
getAddresses()
java.lang.String
getDescription()
java.util.ArrayList<LinkLayerAddress>
getLinkLayerAddresses()
java.lang.String
getName()
int
hashCode()
boolean
isLocal()
boolean
isLoopBack()
Returns if this network interface is loopback.boolean
isRunning()
Returns if this network interface is running.boolean
isUp()
Returns if this network interface is up.PcapHandle
openLive(int snaplen, PcapNetworkInterface.PromiscuousMode mode, int timeoutMillis)
java.lang.String
toString()
-
-
-
Method Detail
-
getName
public java.lang.String getName()
- Returns:
- name
-
getDescription
public java.lang.String getDescription()
- Returns:
- description
-
getAddresses
public java.util.List<PcapAddress> getAddresses()
- Returns:
- inet addresses
-
getLinkLayerAddresses
public java.util.ArrayList<LinkLayerAddress> 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.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-