LimeWire Consolidated API

com.limegroup.gnutella
Class NetworkManagerImpl

java.lang.Object
  extended by com.limegroup.gnutella.NetworkManagerImpl
All Implemented Interfaces:
NetworkManager, Service, ListenerSupport<AddressEvent>, TLSManager

public class NetworkManagerImpl
extends Object
implements NetworkManager


Constructor Summary
NetworkManagerImpl(com.google.inject.Provider<UDPService> udpService, com.google.inject.Provider<Acceptor> acceptor, com.google.inject.Provider<DHTManager> dhtManager, com.google.inject.Provider<ConnectionManager> connectionManager, OutOfBandStatistics outOfBandStatistics, NetworkInstanceUtils networkInstanceUtils, com.google.inject.Provider<CapabilitiesVMFactory> capabilitiesVMFactory, com.google.inject.Provider<ByteBufferCache> bbCache, ApplicationServices applicationServices)
           
 
Method Summary
 boolean acceptedIncomingConnection()
          Returns true if this has accepted an incoming connection, and hence probably isn't firewalled.
 void addListener(EventListener<AddressEvent> listener)
          Adds the listener.
 boolean addressChanged()
          Notifies components that this' IP address has changed.
 boolean canDoFWT()
           
 boolean canReceiveSolicited()
           
 boolean canReceiveUnsolicited()
           
 void externalAddressChanged()
          used to notify the NetworkManager of a change in the external IP.
 byte[] getAddress()
          Returns the raw IP address for this host.
 byte[] getExternalAddress()
          Returns the external IP address for this host.
 byte[] getNonForcedAddress()
          Returns the Non-Forced IP address for this host.
 int getNonForcedPort()
          Returns the Non-Forced port for this host.
 int getPort()
          Returns the port used for downloads and messaging connections.
 Connectable getPublicAddress()
          Returns the external, public address of this peer.
 String getServiceName()
           
 GUID getSolicitedGUID()
           
 int getStableUDPPort()
           
 GUID getUDPConnectBackGUID()
           
 boolean incomingStatusChanged()
          Notification that we've either just set or unset acceptedIncoming.
 void initialize()
           
 boolean isGUESSCapable()
          Returns whether or not this node is capable of sending its own GUESS queries.
 boolean isIncomingTLSEnabled()
          Whether or not incoming TLS is allowed.
 boolean isIpPortValid()
           
 boolean isOOBCapable()
          Returns whether or not this node is capable of performing OOB queries.
 boolean isOutgoingTLSEnabled()
          Whether or not outgoing TLS is allowed.
 boolean isPrivateAddress(byte[] addr)
           
 boolean isTLSSupported()
          Returns true if TLS is disabled for this session.
 void newPushProxies(Set<Connectable> pushProxies)
          used to notify the NetworkManager of a new MediatorAddress (i.e., push proxy)
 void portChanged()
          used to notify the NetworkManager of a change in the port.
 boolean removeListener(EventListener<AddressEvent> listener)
          Returns true if the listener was removed.
 void setIncomingTLSEnabled(boolean enabled)
           
 void setListeningPort(int port)
          Sets the port on which to listen for incoming connections.
 void setOutgoingTLSEnabled(boolean enabled)
           
 void start()
           
 void stop()
           
 int supportsFWTVersion()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetworkManagerImpl

@Inject
public NetworkManagerImpl(com.google.inject.Provider<UDPService> udpService,
                                 com.google.inject.Provider<Acceptor> acceptor,
                                 com.google.inject.Provider<DHTManager> dhtManager,
                                 com.google.inject.Provider<ConnectionManager> connectionManager,
                                 OutOfBandStatistics outOfBandStatistics,
                                 NetworkInstanceUtils networkInstanceUtils,
                                 com.google.inject.Provider<CapabilitiesVMFactory> capabilitiesVMFactory,
                                 com.google.inject.Provider<ByteBufferCache> bbCache,
                                 ApplicationServices applicationServices)
Method Detail

start

public void start()
Specified by:
start in interface Service

stop

public void stop()
Specified by:
stop in interface Service

initialize

public void initialize()
Specified by:
initialize in interface Service

getServiceName

public String getServiceName()
Specified by:
getServiceName in interface Service

isIpPortValid

public boolean isIpPortValid()
Specified by:
isIpPortValid in interface NetworkManager
Returns:
true if your IP and port information is valid.

getUDPConnectBackGUID

public GUID getUDPConnectBackGUID()
Specified by:
getUDPConnectBackGUID in interface NetworkManager

isOOBCapable

public boolean isOOBCapable()
Description copied from interface: NetworkManager
Returns whether or not this node is capable of performing OOB queries.

Specified by:
isOOBCapable in interface NetworkManager

isGUESSCapable

public boolean isGUESSCapable()
Description copied from interface: NetworkManager
Returns whether or not this node is capable of sending its own GUESS queries. This would not be the case only if this node has not successfully received an incoming UDP packet.

Specified by:
isGUESSCapable in interface NetworkManager
Returns:
true if this node is capable of running its own GUESS queries, false otherwise

getNonForcedPort

public int getNonForcedPort()
Description copied from interface: NetworkManager
Returns the Non-Forced port for this host.

Specified by:
getNonForcedPort in interface NetworkManager
Returns:
the non-forced port for this host

getPort

public int getPort()
Description copied from interface: NetworkManager
Returns the port used for downloads and messaging connections. Used to fill out the My-Address header in ManagedConnection.

Specified by:
getPort in interface NetworkManager
See Also:
Acceptor.getPort(boolean)

getNonForcedAddress

public byte[] getNonForcedAddress()
Description copied from interface: NetworkManager
Returns the Non-Forced IP address for this host.

Specified by:
getNonForcedAddress in interface NetworkManager
Returns:
the non-forced IP address for this host

getAddress

public byte[] getAddress()
Description copied from interface: NetworkManager
Returns the raw IP address for this host.

Specified by:
getAddress in interface NetworkManager
Returns:
the raw IP address for this host

getExternalAddress

public byte[] getExternalAddress()
Description copied from interface: NetworkManager
Returns the external IP address for this host.

Specified by:
getExternalAddress in interface NetworkManager

incomingStatusChanged

public boolean incomingStatusChanged()
Description copied from interface: NetworkManager
Notification that we've either just set or unset acceptedIncoming.

Specified by:
incomingStatusChanged in interface NetworkManager

addressChanged

public boolean addressChanged()
Description copied from interface: NetworkManager
Notifies components that this' IP address has changed.

Specified by:
addressChanged in interface NetworkManager

externalAddressChanged

public void externalAddressChanged()
Description copied from interface: NetworkManager
used to notify the NetworkManager of a change in the external IP.

Specified by:
externalAddressChanged in interface NetworkManager

portChanged

public void portChanged()
Description copied from interface: NetworkManager
used to notify the NetworkManager of a change in the port.

Specified by:
portChanged in interface NetworkManager

newPushProxies

public void newPushProxies(Set<Connectable> pushProxies)
Description copied from interface: NetworkManager
used to notify the NetworkManager of a new MediatorAddress (i.e., push proxy)

Specified by:
newPushProxies in interface NetworkManager

getPublicAddress

public Connectable getPublicAddress()
Description copied from interface: NetworkManager
Returns the external, public address of this peer. Will return an invalid address if no address is known yet.

Will return the external address whether the peer is firewalled or not.

Specified by:
getPublicAddress in interface NetworkManager

acceptedIncomingConnection

public boolean acceptedIncomingConnection()
Description copied from interface: NetworkManager
Returns true if this has accepted an incoming connection, and hence probably isn't firewalled. (This is useful for colorizing search results in the GUI.)

Specified by:
acceptedIncomingConnection in interface NetworkManager

setListeningPort

public void setListeningPort(int port)
                      throws IOException
Description copied from interface: NetworkManager
Sets the port on which to listen for incoming connections. If that fails, this is not modified and IOException is thrown. If port==0, tells this to stop listening to incoming connections.

Specified by:
setListeningPort in interface NetworkManager
Throws:
IOException

canReceiveUnsolicited

public boolean canReceiveUnsolicited()
Specified by:
canReceiveUnsolicited in interface NetworkManager

canReceiveSolicited

public boolean canReceiveSolicited()
Specified by:
canReceiveSolicited in interface NetworkManager

canDoFWT

public boolean canDoFWT()
Specified by:
canDoFWT in interface NetworkManager

getStableUDPPort

public int getStableUDPPort()
Specified by:
getStableUDPPort in interface NetworkManager

getSolicitedGUID

public GUID getSolicitedGUID()
Specified by:
getSolicitedGUID in interface NetworkManager

supportsFWTVersion

public int supportsFWTVersion()
Specified by:
supportsFWTVersion in interface NetworkManager

isPrivateAddress

public boolean isPrivateAddress(byte[] addr)

isTLSSupported

public boolean isTLSSupported()
Returns true if TLS is disabled for this session.

Specified by:
isTLSSupported in interface TLSManager

isIncomingTLSEnabled

public boolean isIncomingTLSEnabled()
Whether or not incoming TLS is allowed.

Specified by:
isIncomingTLSEnabled in interface TLSManager

setIncomingTLSEnabled

public void setIncomingTLSEnabled(boolean enabled)
Specified by:
setIncomingTLSEnabled in interface TLSManager

isOutgoingTLSEnabled

public boolean isOutgoingTLSEnabled()
Whether or not outgoing TLS is allowed.

Specified by:
isOutgoingTLSEnabled in interface TLSManager

setOutgoingTLSEnabled

public void setOutgoingTLSEnabled(boolean enabled)
Specified by:
setOutgoingTLSEnabled in interface TLSManager

addListener

public void addListener(EventListener<AddressEvent> listener)
Description copied from interface: ListenerSupport
Adds the listener.

Specified by:
addListener in interface ListenerSupport<AddressEvent>

removeListener

public boolean removeListener(EventListener<AddressEvent> listener)
Description copied from interface: ListenerSupport
Returns true if the listener was removed.

Specified by:
removeListener in interface ListenerSupport<AddressEvent>

LimeWire Consolidated API

Copyright © 2009. All Rights Reserved.