net.i2p.router.client
Class ClientManager

java.lang.Object
  extended by net.i2p.router.client.ClientManager

public class ClientManager
extends java.lang.Object

Coordinate connections and various tasks

Author:
jrandom

Constructor Summary
ClientManager(RouterContext context, int port)
           
 
Method Summary
 void destinationEstablished(ClientConnectionRunner runner)
          Add to the clients list.
(package private)  void distributeMessage(Destination fromDest, Destination toDest, Payload payload, MessageId msgId, long expiration)
           
 SessionConfig getClientSessionConfig(Destination dest)
          Return the client's current config, or null if not connected
 SessionKeyManager getClientSessionKeyManager(Hash dest)
          Return the client's SessionKeyManager Use this instead of the RouterContext.sessionKeyManager() to prevent correlation attacks across destinations
(package private)  ClientConnectionRunner getRunner(Destination dest)
           
(package private)  java.util.Set<Destination> getRunnerDestinations()
           
 boolean isAlive()
           
 boolean isLocal(Destination dest)
           
 boolean isLocal(Hash destHash)
           
 java.util.Set<Destination> listClients()
           
 void messageDeliveryStatusUpdate(Destination fromDest, MessageId id, boolean delivered)
           
 void messageReceived(ClientMessage msg)
           
 void registerConnection(ClientConnectionRunner runner)
           
 void renderStatusHTML(java.io.Writer out)
           
 void reportAbuse(Destination dest, java.lang.String reason, int severity)
           
 void requestLeaseSet(Destination dest, LeaseSet set, long timeout, Job onCreateJob, Job onFailedJob)
          Request that a particular client authorize the Leases contained in the LeaseSet, after which the onCreateJob is queued up.
 void requestLeaseSet(Hash dest, LeaseSet ls)
           
 void restart()
           
 boolean shouldPublishLeaseSet(Hash destHash)
           
 void shutdown()
           
 void unregisterConnection(ClientConnectionRunner runner)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientManager

public ClientManager(RouterContext context,
                     int port)
Method Detail

restart

public void restart()

shutdown

public void shutdown()

isAlive

public boolean isAlive()

registerConnection

public void registerConnection(ClientConnectionRunner runner)

unregisterConnection

public void unregisterConnection(ClientConnectionRunner runner)

destinationEstablished

public void destinationEstablished(ClientConnectionRunner runner)
Add to the clients list. Check for a dup destination.


distributeMessage

void distributeMessage(Destination fromDest,
                       Destination toDest,
                       Payload payload,
                       MessageId msgId,
                       long expiration)

requestLeaseSet

public void requestLeaseSet(Destination dest,
                            LeaseSet set,
                            long timeout,
                            Job onCreateJob,
                            Job onFailedJob)
Request that a particular client authorize the Leases contained in the LeaseSet, after which the onCreateJob is queued up. If that doesn't occur within the timeout specified, queue up the onFailedJob. This call does not block.

Parameters:
dest - Destination from which the LeaseSet's authorization should be requested
set - LeaseSet with requested leases - this object must be updated to contain the signed version (as well as any changed/added/removed Leases)
timeout - ms to wait before failing
onCreateJob - Job to run after the LeaseSet is authorized
onFailedJob - Job to run after the timeout passes without receiving authorization

requestLeaseSet

public void requestLeaseSet(Hash dest,
                            LeaseSet ls)

isLocal

public boolean isLocal(Destination dest)

isLocal

public boolean isLocal(Hash destHash)

shouldPublishLeaseSet

public boolean shouldPublishLeaseSet(Hash destHash)
Returns:
true if we don't know about this destination at all

listClients

public java.util.Set<Destination> listClients()

getRunner

ClientConnectionRunner getRunner(Destination dest)

getClientSessionConfig

public SessionConfig getClientSessionConfig(Destination dest)
Return the client's current config, or null if not connected


getClientSessionKeyManager

public SessionKeyManager getClientSessionKeyManager(Hash dest)
Return the client's SessionKeyManager Use this instead of the RouterContext.sessionKeyManager() to prevent correlation attacks across destinations


messageDeliveryStatusUpdate

public void messageDeliveryStatusUpdate(Destination fromDest,
                                        MessageId id,
                                        boolean delivered)

getRunnerDestinations

java.util.Set<Destination> getRunnerDestinations()

reportAbuse

public void reportAbuse(Destination dest,
                        java.lang.String reason,
                        int severity)

renderStatusHTML

public void renderStatusHTML(java.io.Writer out)
                      throws java.io.IOException
Throws:
java.io.IOException

messageReceived

public void messageReceived(ClientMessage msg)