org.jnetpcap
Class PcapIf

java.lang.Object
  extended by org.jnetpcap.PcapIf

public class PcapIf
extends java.lang.Object

Class peered with native pcap_if_t structure. Addresses is replaced as a list to simulate a linked list of address structures. This is not a JNI peering class, and is only a read-only object.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Constructor Summary
PcapIf()
           
 
Method Summary
 java.util.List<PcapAddr> getAddresses()
          A list of addresses for this field.
 java.lang.String getDescription()
          pcap_if.description field.
 int getFlags()
          pcap_if.flags field.
 byte[] getHardwareAddress()
          Retrieves the hardware address of this network interface.
 java.lang.String getName()
          pcap_if.name field.
 java.lang.String toString()
          Debug string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PcapIf

public PcapIf()
Method Detail

getName

public final java.lang.String getName()
pcap_if.name field.

Returns:
the name

getDescription

public final java.lang.String getDescription()
pcap_if.description field.

Returns:
the description

getAddresses

public final java.util.List<PcapAddr> getAddresses()
A list of addresses for this field. The native C linked list of pcap_if structures is turned into a java List for convenience.

Returns:
the addresses

getFlags

public final int getFlags()
pcap_if.flags field.

Returns:
the flags

getHardwareAddress

public byte[] getHardwareAddress()
                          throws java.io.IOException
Retrieves the hardware address of this network interface. The native OS is queried via the appropriate OS calls to retrive the hardware address of the interface (MAC address). This is a direct call, not cached data.

Returns:
hardware address as an array of bytes; this method returns null if interface doesn't have or is incapable of having a hardware address such as loopback interfaces and others
Throws:
java.io.IOException - if there was a problem retrieving the address

toString

public java.lang.String toString()
Debug string.

Overrides:
toString in class java.lang.Object
Returns:
debug string