net.i2p.router
Class CommSystemFacade

java.lang.Object
  extended by net.i2p.router.CommSystemFacade
All Implemented Interfaces:
Service
Direct Known Subclasses:
CommSystemFacadeImpl, VMCommSystem

public abstract class CommSystemFacade
extends Object
implements Service

Manages the communication subsystem between peers, including connections, listeners, transports, connection keys, etc.


Nested Class Summary
static class CommSystemFacade.Status
          Since the codes may change.
 
Field Summary
static short STATUS_DIFFERENT
          We are behind a symmetric NAT which will make our 'from' address look differently when we talk to multiple people
static short STATUS_DISCONNECTED
          We have no network interface at all enabled transports
static short STATUS_HOSED
          Our detection system is broken (SSU bind port failed)
static short STATUS_IPV4_DISABLED_IPV6_FIREWALLED
          We have an IPv6 transport enabled and a public IPv6 address.
static short STATUS_IPV4_DISABLED_IPV6_OK
          We have an IPv6 transport enabled and a public IPv6 address.
static short STATUS_IPV4_DISABLED_IPV6_UNKNOWN
          We have an IPv6 transport enabled and a public IPv6 address.
static short STATUS_IPV4_FIREWALLED_IPV6_OK
          We have an IPv6 transport enabled and a public IPv6 address.
static short STATUS_IPV4_FIREWALLED_IPV6_UNKNOWN
          We have an IPv6 transport enabled and a public IPv6 address.
static short STATUS_IPV4_OK_IPV6_FIREWALLED
          We have an IPv6 transport enabled and a public IPv6 address.
static short STATUS_IPV4_OK_IPV6_UNKNOWN
          We have an IPv6 transport enabled and a public IPv6 address.
static short STATUS_IPV4_SNAT_IPV6_OK
          We are behind a symmetric NAT which will make our 'from' address look differently when we talk to multiple people We can receive unsolicited connections on IPv6.
static short STATUS_IPV4_SNAT_IPV6_UNKNOWN
          We are behind a symmetric NAT which will make our 'from' address look differently when we talk to multiple people We might be able to receive unsolicited connections on IPv6.
static short STATUS_IPV4_UNKNOWN_IPV6_FIREWALLED
          We have an IPv6 transport enabled and a public IPv6 address.
static short STATUS_IPV4_UNKNOWN_IPV6_OK
          We have an IPv6 transport enabled and a public IPv6 address.
static short STATUS_OK
          These must be increasing in "badness" (see TransportManager.java), but UNKNOWN must be last.
static short STATUS_REJECT_UNSOLICITED
          We are able to talk to peers that we initiate communication with, but cannot receive unsolicited connections, i.e.
static short STATUS_UNKNOWN
          Our reachability is unknown on all
 
Constructor Summary
CommSystemFacade()
           
 
Method Summary
 int countActivePeers()
          How many peers are we currently connected to, that we have sent a message to or received a message from in the last five minutes.
 int countActiveSendPeers()
          How many peers are we currently connected to, that we have sent a message to in the last minute.
 List<RouterAddress> createAddresses()
          Create the list of RouterAddress structures based on the router's config
 String getCountry(Hash peer)
           
 String getCountryName(String code)
           
 DHSessionKeyBuilder.Factory getDHFactory()
          Hook for pluggable transport creation.
 long getFramedAveragePeerClockSkew(int percentToInclude)
          Return framed average clock skew of connected peers in seconds, or null if we cannot answer.
 byte[] getIP(Hash dest)
           
 Long getMedianPeerClockSkew()
          Median clock skew of connected peers in seconds, or null if we cannot answer.
 List getMostRecentErrorMessages()
           
 String getOurCountry()
           
 short getReachabilityStatus()
          Deprecated. use getStatus()
 CommSystemFacade.Status getStatus()
          Determine under what conditions we are remotely reachable.
 boolean haveHighOutboundCapacity()
           
 boolean haveInboundCapacity(int pct)
           
 boolean haveOutboundCapacity(int pct)
           
 boolean isBacklogged(Hash dest)
           
 boolean isDummy()
           
 boolean isEstablished(Hash dest)
           
 boolean isInBadCountry()
           
 boolean isInBadCountry(Hash peer)
           
 boolean isInBadCountry(RouterInfo ri)
           
 void notifyRemoveAddress(boolean ipv6)
          Tell other transports our address changed
 void notifyRemoveAddress(RouterAddress address)
          Tell other transports our address changed
 void notifyReplaceAddress(RouterAddress address)
          Tell other transports our address changed
abstract  void processMessage(OutNetMessage msg)
           
 void queueLookup(byte[] ip)
           
 void recheckReachability()
          Deprecated. unused
 void registerTransport(Transport t)
          Pluggable transport
 String renderPeerHTML(Hash peer)
           
 void renderStatusHTML(Writer out)
           
 void renderStatusHTML(Writer out, String urlBase, int sortFlags)
           
 void unregisterTransport(Transport t)
          Pluggable transport
 boolean wasUnreachable(Hash dest)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.i2p.router.Service
restart, shutdown, startup
 

Field Detail

STATUS_OK

public static final short STATUS_OK
These must be increasing in "badness" (see TransportManager.java), but UNKNOWN must be last. We are able to receive unsolicited connections on all enabled transports

See Also:
Constant Field Values

STATUS_IPV4_OK_IPV6_UNKNOWN

public static final short STATUS_IPV4_OK_IPV6_UNKNOWN
We have an IPv6 transport enabled and a public IPv6 address. We can receive unsolicited connections on IPv4. We might be able to receive unsolicited connections on IPv6.

Since:
0.9.20
See Also:
Constant Field Values

STATUS_IPV4_OK_IPV6_FIREWALLED

public static final short STATUS_IPV4_OK_IPV6_FIREWALLED
We have an IPv6 transport enabled and a public IPv6 address. We can receive unsolicited connections on IPv4. We cannot receive unsolicited connections on IPv6.

Since:
0.9.20
See Also:
Constant Field Values

STATUS_IPV4_UNKNOWN_IPV6_OK

public static final short STATUS_IPV4_UNKNOWN_IPV6_OK
We have an IPv6 transport enabled and a public IPv6 address. We may be able to receive unsolicited connections on IPv4. We can receive unsolicited connections on IPv6.

Since:
0.9.20
See Also:
Constant Field Values

STATUS_IPV4_FIREWALLED_IPV6_OK

public static final short STATUS_IPV4_FIREWALLED_IPV6_OK
We have an IPv6 transport enabled and a public IPv6 address. We cannot receive unsolicited connections on IPv4. We can receive unsolicited connections on IPv6.

Since:
0.9.20
See Also:
Constant Field Values

STATUS_IPV4_DISABLED_IPV6_OK

public static final short STATUS_IPV4_DISABLED_IPV6_OK
We have an IPv6 transport enabled and a public IPv6 address. IPv4 is disabled. We can receive unsolicited connections on IPv6.

Since:
0.9.20
See Also:
Constant Field Values

STATUS_IPV4_SNAT_IPV6_OK

public static final short STATUS_IPV4_SNAT_IPV6_OK
We are behind a symmetric NAT which will make our 'from' address look differently when we talk to multiple people We can receive unsolicited connections on IPv6.

Since:
0.9.20
See Also:
Constant Field Values

STATUS_DIFFERENT

public static final short STATUS_DIFFERENT
We are behind a symmetric NAT which will make our 'from' address look differently when we talk to multiple people

See Also:
Constant Field Values

STATUS_IPV4_SNAT_IPV6_UNKNOWN

public static final short STATUS_IPV4_SNAT_IPV6_UNKNOWN
We are behind a symmetric NAT which will make our 'from' address look differently when we talk to multiple people We might be able to receive unsolicited connections on IPv6.

Since:
0.9.20
See Also:
Constant Field Values

STATUS_IPV4_FIREWALLED_IPV6_UNKNOWN

public static final short STATUS_IPV4_FIREWALLED_IPV6_UNKNOWN
We have an IPv6 transport enabled and a public IPv6 address. We cannot receive unsolicited connections on IPv4. We might be able to receive unsolicited connections on IPv6.

Since:
0.9.20
See Also:
Constant Field Values

STATUS_REJECT_UNSOLICITED

public static final short STATUS_REJECT_UNSOLICITED
We are able to talk to peers that we initiate communication with, but cannot receive unsolicited connections, i.e. Firewalled, on all enabled transports.

See Also:
Constant Field Values

STATUS_IPV4_UNKNOWN_IPV6_FIREWALLED

public static final short STATUS_IPV4_UNKNOWN_IPV6_FIREWALLED
We have an IPv6 transport enabled and a public IPv6 address. We may be able to receive unsolicited connections on IPv4. We cannot receive unsolicited connections on IPv6.

Since:
0.9.20
See Also:
Constant Field Values

STATUS_IPV4_DISABLED_IPV6_UNKNOWN

public static final short STATUS_IPV4_DISABLED_IPV6_UNKNOWN
We have an IPv6 transport enabled and a public IPv6 address. IPv4 is disabled. We might be able to receive unsolicited connections on IPv6.

Since:
0.9.20
See Also:
Constant Field Values

STATUS_IPV4_DISABLED_IPV6_FIREWALLED

public static final short STATUS_IPV4_DISABLED_IPV6_FIREWALLED
We have an IPv6 transport enabled and a public IPv6 address. IPv4 is disabled. We can receive unsolicited connections on IPv6.

Since:
0.9.20
See Also:
Constant Field Values

STATUS_DISCONNECTED

public static final short STATUS_DISCONNECTED
We have no network interface at all enabled transports

Since:
0.9.4
See Also:
Constant Field Values

STATUS_HOSED

public static final short STATUS_HOSED
Our detection system is broken (SSU bind port failed)

See Also:
Constant Field Values

STATUS_UNKNOWN

public static final short STATUS_UNKNOWN
Our reachability is unknown on all

See Also:
Constant Field Values
Constructor Detail

CommSystemFacade

public CommSystemFacade()
Method Detail

processMessage

public abstract void processMessage(OutNetMessage msg)

renderStatusHTML

public void renderStatusHTML(Writer out,
                             String urlBase,
                             int sortFlags)
                      throws IOException
Throws:
IOException

renderStatusHTML

public void renderStatusHTML(Writer out)
                      throws IOException
Specified by:
renderStatusHTML in interface Service
Throws:
IOException

createAddresses

public List<RouterAddress> createAddresses()
Create the list of RouterAddress structures based on the router's config


countActivePeers

public int countActivePeers()
How many peers are we currently connected to, that we have sent a message to or received a message from in the last five minutes.


countActiveSendPeers

public int countActiveSendPeers()
How many peers are we currently connected to, that we have sent a message to in the last minute. Unused for anything, to be removed.


haveInboundCapacity

public boolean haveInboundCapacity(int pct)

haveOutboundCapacity

public boolean haveOutboundCapacity(int pct)

haveHighOutboundCapacity

public boolean haveHighOutboundCapacity()

getMostRecentErrorMessages

public List getMostRecentErrorMessages()

getMedianPeerClockSkew

public Long getMedianPeerClockSkew()
Median clock skew of connected peers in seconds, or null if we cannot answer. CommSystemFacadeImpl overrides this.


getFramedAveragePeerClockSkew

public long getFramedAveragePeerClockSkew(int percentToInclude)
Return framed average clock skew of connected peers in seconds, or null if we cannot answer. CommSystemFacadeImpl overrides this.


getReachabilityStatus

public short getReachabilityStatus()
Deprecated. use getStatus()

Determine under what conditions we are remotely reachable. For internal use only. Not recommended for plugins or embedded applications, as the integer codes may change. Use getStatus() instead.


getStatus

public CommSystemFacade.Status getStatus()
Determine under what conditions we are remotely reachable.

Since:
0.9.20

recheckReachability

public void recheckReachability()
Deprecated. unused


isBacklogged

public boolean isBacklogged(Hash dest)

wasUnreachable

public boolean wasUnreachable(Hash dest)

isEstablished

public boolean isEstablished(Hash dest)

getIP

public byte[] getIP(Hash dest)

queueLookup

public void queueLookup(byte[] ip)

getOurCountry

public String getOurCountry()
Since:
0.8.11

isInBadCountry

public boolean isInBadCountry()
Since:
0.8.13

isInBadCountry

public boolean isInBadCountry(Hash peer)
Since:
0.9.16

isInBadCountry

public boolean isInBadCountry(RouterInfo ri)
Since:
0.9.16

getCountry

public String getCountry(Hash peer)

getCountryName

public String getCountryName(String code)

renderPeerHTML

public String renderPeerHTML(Hash peer)

isDummy

public boolean isDummy()
Since:
0.8.13

notifyReplaceAddress

public void notifyReplaceAddress(RouterAddress address)
Tell other transports our address changed


notifyRemoveAddress

public void notifyRemoveAddress(RouterAddress address)
Tell other transports our address changed

Since:
0.9.20

notifyRemoveAddress

public void notifyRemoveAddress(boolean ipv6)
Tell other transports our address changed

Since:
0.9.20

registerTransport

public void registerTransport(Transport t)
Pluggable transport

Since:
0.9.16

unregisterTransport

public void unregisterTransport(Transport t)
Pluggable transport

Since:
0.9.16

getDHFactory

public DHSessionKeyBuilder.Factory getDHFactory()
Hook for pluggable transport creation.

Since:
0.9.16