org.teleal.cling.transport.impl
Class NetworkAddressFactoryImpl

java.lang.Object
  extended by org.teleal.cling.transport.impl.NetworkAddressFactoryImpl
All Implemented Interfaces:
NetworkAddressFactory

public class NetworkAddressFactoryImpl
extends Object
implements NetworkAddressFactory

Supports only IPv4! Ignores the "vmnet*" interfaces!


Field Summary
protected  List<InetAddress> bindAddresses
           
static int DEFAULT_TCP_HTTP_LISTEN_PORT
           
protected  List<NetworkInterface> networkInterfaces
           
protected  int streamListenPort
           
protected  Set<String> useAddresses
           
protected  Set<String> useInterfaces
           
 
Fields inherited from interface org.teleal.cling.transport.spi.NetworkAddressFactory
SYSTEM_PROPERTY_NET_ADDRESSES, SYSTEM_PROPERTY_NET_IFACES
 
Constructor Summary
NetworkAddressFactoryImpl()
           
NetworkAddressFactoryImpl(int streamListenPort)
           
 
Method Summary
protected  void discoverBindAddresses()
           
protected  void discoverNetworkInterfaces()
           
 InetAddress[] getBindAddresses()
           
protected  InetAddress getBindAddressInSubnetOf(InetAddress inetAddress)
           
 InetAddress getBroadcastAddress(InetAddress inetAddress)
           
 byte[] getHardwareAddress(InetAddress inetAddress)
           
protected  List<InetAddress> getInetAddresses(NetworkInterface networkInterface)
           
protected  List<InterfaceAddress> getInterfaceAddresses(NetworkInterface networkInterface)
           
 InetAddress getLocalAddress(NetworkInterface networkInterface, boolean isIPv6, InetAddress remoteAddress)
           
 InetAddress getMulticastGroup()
           
 int getMulticastPort()
           
 NetworkInterface[] getNetworkInterfaces()
           
 int getStreamListenPort()
           
protected  boolean isInSubnet(byte[] ip, byte[] network, short prefix)
           
protected  boolean isUsableAddress(NetworkInterface networkInterface, InetAddress address)
           
protected  boolean isUsableNetworkInterface(NetworkInterface iface)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TCP_HTTP_LISTEN_PORT

public static final int DEFAULT_TCP_HTTP_LISTEN_PORT
See Also:
Constant Field Values

useInterfaces

protected Set<String> useInterfaces

useAddresses

protected Set<String> useAddresses

networkInterfaces

protected List<NetworkInterface> networkInterfaces

bindAddresses

protected List<InetAddress> bindAddresses

streamListenPort

protected int streamListenPort
Constructor Detail

NetworkAddressFactoryImpl

public NetworkAddressFactoryImpl()
                          throws InitializationException
Throws:
InitializationException

NetworkAddressFactoryImpl

public NetworkAddressFactoryImpl(int streamListenPort)
                          throws InitializationException
Throws:
InitializationException
Method Detail

getMulticastGroup

public InetAddress getMulticastGroup()
Specified by:
getMulticastGroup in interface NetworkAddressFactory

getMulticastPort

public int getMulticastPort()
Specified by:
getMulticastPort in interface NetworkAddressFactory

getStreamListenPort

public int getStreamListenPort()
Specified by:
getStreamListenPort in interface NetworkAddressFactory

getNetworkInterfaces

public NetworkInterface[] getNetworkInterfaces()
Specified by:
getNetworkInterfaces in interface NetworkAddressFactory

getBindAddresses

public InetAddress[] getBindAddresses()
Specified by:
getBindAddresses in interface NetworkAddressFactory

getHardwareAddress

public byte[] getHardwareAddress(InetAddress inetAddress)
Specified by:
getHardwareAddress in interface NetworkAddressFactory

getBroadcastAddress

public InetAddress getBroadcastAddress(InetAddress inetAddress)
Specified by:
getBroadcastAddress in interface NetworkAddressFactory

getLocalAddress

public InetAddress getLocalAddress(NetworkInterface networkInterface,
                                   boolean isIPv6,
                                   InetAddress remoteAddress)
Specified by:
getLocalAddress in interface NetworkAddressFactory

getInterfaceAddresses

protected List<InterfaceAddress> getInterfaceAddresses(NetworkInterface networkInterface)

getInetAddresses

protected List<InetAddress> getInetAddresses(NetworkInterface networkInterface)

getBindAddressInSubnetOf

protected InetAddress getBindAddressInSubnetOf(InetAddress inetAddress)

isInSubnet

protected boolean isInSubnet(byte[] ip,
                             byte[] network,
                             short prefix)

discoverNetworkInterfaces

protected void discoverNetworkInterfaces()
                                  throws InitializationException
Throws:
InitializationException

isUsableNetworkInterface

protected boolean isUsableNetworkInterface(NetworkInterface iface)
                                    throws Exception
Throws:
Exception

discoverBindAddresses

protected void discoverBindAddresses()
                              throws InitializationException
Throws:
InitializationException

isUsableAddress

protected boolean isUsableAddress(NetworkInterface networkInterface,
                                  InetAddress address)


Copyright © 2010 Teleal GmbH, Switzerland. All Rights Reserved.