com.eurotech.framework.core.net
Class AbstractNetInterface<T extends NetInterfaceAddress>

java.lang.Object
  extended by com.eurotech.framework.core.net.AbstractNetInterface<T>
All Implemented Interfaces:
NetInterface<T>
Direct Known Subclasses:
EthernetInterfaceImpl, LoopbackInterfaceImpl, ModemInterfaceImpl, WifiInterfaceImpl

public abstract class AbstractNetInterface<T extends NetInterfaceAddress>
extends Object
implements NetInterface<T>


Constructor Summary
protected AbstractNetInterface(NetInterface<? extends NetInterfaceAddress> other)
           
protected AbstractNetInterface(String name)
           
 
Method Summary
 String getDriver()
          The driver handling the device.
 String getDriverVersion()
          The version of the driver handling the device.
 String getFirmwareVersion()
          The firmware version for the device.
 byte[] getHardwareAddress()
          Returns the hardware address (usually MAC) of the interface if it has one.
 int getMTU()
          Returns the Maximum Transmission Unit (MTU) of this interface - Design speed of the device, in megabits/second (Mb/s).
 String getName()
          Returns the name of this NetworkInterface.
 List<T> getNetInterfaceAddresses()
          Returns a List of all InterfaceAddresses of this network interface.
 NetInterfaceState getState()
          The current state of the device.
 UsbDevice getUsbDevice()
          Returns the UsbDevice which provided this NetworkInterface to the system if any.
 boolean isAutoConnect()
          Returns whether a network interface will auto connect.
 boolean isLoopback()
          Returns whether a network interface is a loopback interface.
 boolean isPointToPoint()
          Returns whether a network interface is a point to point interface.
 boolean isUp()
          Returns whether a network interface is up and running.
 boolean isVirtual()
          Returns whether this interface is a virtual interface (also called subinterface).
 void setAutoConnect(boolean autoConnect)
           
 void setDriver(String driver)
           
 void setDriverVersion(String driverVersion)
           
 void setFirmwareVersion(String firmwareVersion)
           
 void setHardwareAddress(byte[] hardwareAddress)
           
 void setLoopback(boolean loopback)
           
 void setMTU(int mtu)
           
 void setName(String name)
           
 void setNetInterfaceAddresses(List<T> interfaceAddresses)
           
 void setPointToPoint(boolean pointToPoint)
           
 void setState(NetInterfaceState state)
           
 void setSupportsMulticast(boolean supportsMulticast)
           
 void setUp(boolean up)
           
 void setUsbDevice(UsbDevice usbDevice)
           
 void setVirtual(boolean virtual)
           
 boolean supportsMulticast()
          Returns whether a network interface supports multicasting or not.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.eurotech.framework.net.NetInterface
getType
 

Constructor Detail

AbstractNetInterface

protected AbstractNetInterface(String name)

AbstractNetInterface

protected AbstractNetInterface(NetInterface<? extends NetInterfaceAddress> other)
Method Detail

getName

public String getName()
Description copied from interface: NetInterface
Returns the name of this NetworkInterface.

Specified by:
getName in interface NetInterface<T extends NetInterfaceAddress>
Returns:
interface name

setName

public void setName(String name)

getHardwareAddress

public byte[] getHardwareAddress()
Description copied from interface: NetInterface
Returns the hardware address (usually MAC) of the interface if it has one.

Specified by:
getHardwareAddress in interface NetInterface<T extends NetInterfaceAddress>
Returns:
a byte array containing the address or null if the address doesn't exist

isLoopback

public boolean isLoopback()
Description copied from interface: NetInterface
Returns whether a network interface is a loopback interface.

Specified by:
isLoopback in interface NetInterface<T extends NetInterfaceAddress>
Returns:
true if the interface is a loopback interface.

isPointToPoint

public boolean isPointToPoint()
Description copied from interface: NetInterface
Returns whether a network interface is a point to point interface. A typical point to point interface would be a PPP connection through a modem.

Specified by:
isPointToPoint in interface NetInterface<T extends NetInterfaceAddress>
Returns:
true if the interface is a point to point interface.

isVirtual

public boolean isVirtual()
Description copied from interface: NetInterface
Returns whether this interface is a virtual interface (also called subinterface). Virtual interfaces are, on some systems, interfaces created as a child of a physical interface and given different settings (like address or MTU). Usually the name of the interface will the name of the parent followed by a colon (:) and a number identifying the child since there can be several virtual interfaces attached to a single physical interface.

Specified by:
isVirtual in interface NetInterface<T extends NetInterfaceAddress>
Returns:
true if this interface is a virtual interface.

supportsMulticast

public boolean supportsMulticast()
Description copied from interface: NetInterface
Returns whether a network interface supports multicasting or not.

Specified by:
supportsMulticast in interface NetInterface<T extends NetInterfaceAddress>
Returns:
true if the interface supports Multicasting.

isUp

public boolean isUp()
Description copied from interface: NetInterface
Returns whether a network interface is up and running.

Specified by:
isUp in interface NetInterface<T extends NetInterfaceAddress>
Returns:
true if the interface is up and running.

getMTU

public int getMTU()
Description copied from interface: NetInterface
Returns the Maximum Transmission Unit (MTU) of this interface - Design speed of the device, in megabits/second (Mb/s).

Specified by:
getMTU in interface NetInterface<T extends NetInterfaceAddress>
Returns:
the value of the MTU for that interface.

setMTU

public void setMTU(int mtu)

getDriver

public String getDriver()
Description copied from interface: NetInterface
The driver handling the device.

Specified by:
getDriver in interface NetInterface<T extends NetInterfaceAddress>
Returns:

setDriver

public void setDriver(String driver)

getDriverVersion

public String getDriverVersion()
Description copied from interface: NetInterface
The version of the driver handling the device.

Specified by:
getDriverVersion in interface NetInterface<T extends NetInterfaceAddress>
Returns:

setDriverVersion

public void setDriverVersion(String driverVersion)

getFirmwareVersion

public String getFirmwareVersion()
Description copied from interface: NetInterface
The firmware version for the device.

Specified by:
getFirmwareVersion in interface NetInterface<T extends NetInterfaceAddress>
Returns:

setFirmwareVersion

public void setFirmwareVersion(String firmwareVersion)

getState

public NetInterfaceState getState()
Description copied from interface: NetInterface
The current state of the device.

Specified by:
getState in interface NetInterface<T extends NetInterfaceAddress>
Returns:

setState

public void setState(NetInterfaceState state)

getUsbDevice

public UsbDevice getUsbDevice()
Description copied from interface: NetInterface
Returns the UsbDevice which provided this NetworkInterface to the system if any.

Specified by:
getUsbDevice in interface NetInterface<T extends NetInterfaceAddress>
Returns:
the UsbDevice providing this NetworkInterface to the system or null if this NetworkInterface is not provided by a USB device

setHardwareAddress

public void setHardwareAddress(byte[] hardwareAddress)

setLoopback

public void setLoopback(boolean loopback)

setPointToPoint

public void setPointToPoint(boolean pointToPoint)

setVirtual

public void setVirtual(boolean virtual)

setSupportsMulticast

public void setSupportsMulticast(boolean supportsMulticast)

setUp

public void setUp(boolean up)

setUsbDevice

public void setUsbDevice(UsbDevice usbDevice)

isAutoConnect

public boolean isAutoConnect()
Description copied from interface: NetInterface
Returns whether a network interface will auto connect.

Specified by:
isAutoConnect in interface NetInterface<T extends NetInterfaceAddress>
Returns:
true if the interface will auto connect.

setAutoConnect

public void setAutoConnect(boolean autoConnect)

getNetInterfaceAddresses

public List<T> getNetInterfaceAddresses()
Description copied from interface: NetInterface
Returns a List of all InterfaceAddresses of this network interface.

Specified by:
getNetInterfaceAddresses in interface NetInterface<T extends NetInterfaceAddress>
Returns:
a List object with all or a subset of the InterfaceAddresss of this network interface

setNetInterfaceAddresses

public void setNetInterfaceAddresses(List<T> interfaceAddresses)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.