apIConnectionMechanism

  • At network\core\public\apIConnectionMechanism.idl.
  • Derived from nsISupports.
  • Purpose of this interface is to asynchronously establish connection to a specified peer and notify about its failure. MFP implementation has to open new flow using existing session or by creating new one. Result is apISocketWrapper wrapping this flow.
  • The component implementing this interface lives only through the process of connection creation.

Methods

capability

PRInt32 capability(in apIHostInfoStructure thisHost, in apIHostInfoStructure remoteHost);

Returns capability of the connection through the mechanism implementation. The method is called during search of suitable mechanism to connect to the peer specified by ‘remoteHost’ structure and has to decide on usability of the mechanism based on given informations.

remoteHost:: apIHostInfoStructure This structure holds information such as global/local ip address, introducer server and other info. thisHost:: apIHostInfoStructure Structure holding information about current network situation which is discovered by some network protocol during process of connection to AllPeers virtual network.

‘Returns :

  • ‘0’ if this mechanism cannot be used to to connect to such a peer,
  • ‘1’ in case this mechanism might be used.

clone

apIConnectionMechanism clone();

Creates new uninitialized instance of the mechanism. There is no state copying. Used by the managers to establish connection.

establish

void establish(in apINetworkContext networkContext,
               in apIHostInfoStructure thisHost,
               in apIHostInfoStructure remoteHost,
               in apIConnectionMechanismListener listener);

Starts asynchronous process of connection establishment.

networkContext:: apINetworkContext Network context where to create this connection. thisHost:: apIHostInfoStructure Host information structure related to this computer. remoteHost:: apIHostInfoStructure Host information structure related to the remote computer you want to connect to. listener:: apIConnectionMechanismListener A target for information notification. Its method have to be called in case of success and also in case of failure. There is no time limit for connection process, but it should not take more than tens of seconds.

initiate

void initiate(in apINetworkContext networkContext);

Called by upper level services to allow mechanism do additional actions need for its succesfull functionality e.g. registration of some kind of service protocol. This method is called during initiation of the network core with reference to the apINetworkContext instance. It might be used to initiate services needed for the mechanism to work.

Attributes

getName

ACString getName();

‘Returns :’ name of the mechanism. This is type in the COM contract id of the component. For instance “@allpeers.com/network/connection-mechanism;1?name=mfp” is CID and ‘getName’ has to return “mfp” string.

 
src/hack/apiconnectionmechanism.txt · Last modified: 2007/02/22 17:00 by ondrej
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki