net.i2p.router.client
Class ClientManager

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

 class ClientManager
extends 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, int flags)
          Distribute message to a local or remote destination.
 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)  Set<Destination> getRunnerDestinations()
           
 I2CPMessageQueue internalConnect()
          The InternalClientManager interface.
 boolean isAlive()
           
 boolean isLocal(Destination dest)
           
 boolean isLocal(Hash destHash)
           
 Set<Destination> listClients()
           
 void messageDeliveryStatusUpdate(Destination fromDest, MessageId id, boolean delivered)
           
 void messageReceived(ClientMessage msg)
           
 void registerConnection(ClientConnectionRunner runner)
           
 void renderStatusHTML(Writer out)
          Deprecated. unused
 void reportAbuse(Destination dest, 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()

internalConnect

public I2CPMessageQueue internalConnect()
                                 throws I2PSessionException
The InternalClientManager interface. Connects to the router, receiving a message queue to talk to the router with.

Throws:
I2PSessionException - if the router isn't ready
Since:
0.8.3

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,
                       int flags)
Distribute message to a local or remote destination.

Parameters:
flags - ignored for local

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 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

Set<Destination> getRunnerDestinations()

reportAbuse

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

renderStatusHTML

public void renderStatusHTML(Writer out)
                      throws IOException
Deprecated. unused

Throws:
IOException

messageReceived

public void messageReceived(ClientMessage msg)