net.vattp.data
Class VatTPMgr

The VatTPMgr acts as the focal point for managing the
TCP connections from a particular vat. It uses the public/private
key pair for the vat, which defines the vat's identity.

The important method(s) are getConnection(...) which returns a
VatTPConnection to a remote vat, and addNewConnectionReactor
which lets the higher layers connect themselves to connections
which have completed the startup protocol.

removeDataConnection(String vatID)
Remove an existing VatTPConnection object that can or will be able to
be used for data transfer (That is, one that is not dying or dead)
from the hash table which holds it and return it.

myReactor

myUnidentifiedConnections

The unidentified connections which haven't completed the
start up protocol. The key is the DataPath object. The value is
the DataPath object if this entry is for an incoming connections,
or the Resolver if the path was created for a connectToVatAt
connection.

VatTPMgr

Each VatTPMgr made will have a different ID. The VatTPMgr is
associated with one vat.

This constructor gets the Vat for that vat via the static method
Vat.getCurrentVat(). The rest of the VatTP system gets
access to that Vat by having the reference explicitly passed
during construction. Therefore, if it is necessary to have a
VatTP system work with a different Vat, the constructor
which accepts the Vat as a specific parameter should be used.

Parameters:

identityKeys - is the KeyPair which defines the identity of this
vat.

netConfig - holds the configuration parameters for configuring
how we interact with the network.

getConnection

Enabled: Return a VatTPConnection to the remote vat given its vatID and
search path.

Parameters:

vatID - is the vatID for the remote vat wanted. The
process of setting up the physical connection will verify that the
vatID is indeed the hash of the public key of the remote vat,
and that the other end of the connection holds the associated private
key.

searchList - is a list of Strings each of which is the IP
address and port number of a place to look for the remote vat.
The IP address can be a DNS name or a dot repsentation of the
32 bit IP number. Most commonly, the Strings will be the
location of the Vat Location Servers (VLSs) with which the
remote vat is believed to register. It may be useful under
special circumstances to include the actual address where the
remote vat may be listening in the list.

Returns:

a VatTPConnection object to the remote vat or null. This is
either an existing VatTPConnection object or a newly created one. If
the VatTPConnection object is newly created, then it has been asked to
initiate the connection startup protocol. This method returns null if
the request is to connect the vat to itself.

moveIdentifiedPath

Move a path from the unidentified list to the identified but not
connected path list. This also handles forwarding to the promise
returned by connectToVatAt for that type of connection.

Parameters:

path - is the DataPath object which has been identified.

remoteVatID - is the identified remote vat's vatID.

isIncoming - says whether this is an incoming connection (true)
or an outgoing connection (false).

Returns:

LIVES_CONTINUE - Continue setting up this connection
LIVES_DUP - This connection is a duplicate, discard it.
LIVES_NOTIFY - Notify the other end of a duplicate connection.
The other end must decide which
connection to keep.

newConnectionIdentified

Register a DataPath for an connection where the remote vat has been
identified

Parameters:

path - the new DataPath

remoteVatID - is the vat ID of the remote vat.

localVatID - is the vat ID of this vat.

isIncoming - is true if this is an inbound connection, false if
it is an outbound connection.

Returns:

LIVES_CONTINUE - Continue setting up this connection
LIVES_DUP - This connection is a duplicate, discard it.
LIVES_NOTIFY - Notify the other end of a duplicate connection.
The other end must decide which
connection to keep.

addNewConnectionReactor

Enabled: Register an object to notice a new connection which has
successfully completed the startup protocol. This object is
expected to connect up MsgHandlers for all the messages
processed by higher layers in the protocol. Note that a
maximum of one NewConnectionReactor may be registered.

This notification is for all DataConnections, whether the
connection was initiated from this end or from the other end.