ostore.network
Class AuthenticationMsg

java.lang.Object
  |
  +--ostore.network.NetworkMessage
        |
        +--ostore.network.AuthenticationMsg
All Implemented Interfaces:
Cloneable, QueueElementIF, QuickSerializable

public class AuthenticationMsg
extends NetworkMessage

The first message sent across a new connection in YANetwork. Replaces IdentityMessage.

This message informs the receiver of the sender's primary contact id. The receiver can then eliminate redundant connections. This message is required because outgoing connections do not in general come from the sender's listen port, and also because virtual node ids may listen on several ports in addition to their "primary" port.

This message also optionally includes certificates mapping virtual node ids to the primary contact id. These certificates are included if and only if the sending node hosts multiple virtual nodes.

Eventually the content of this message will be signed by the sender, and the sender's key will be bound to its NodeId using some sort of certificate authority. The message should also include some sort of timestamp or counter to prevent replay attacks. Only then will the message securely authenticate the sender.

Version:
$Id: AuthenticationMsg.java,v 1.1 2003/02/07 00:11:34 geels Exp $
Author:
Dennis Geels

Field Summary
 
Fields inherited from class ostore.network.NetworkMessage
comp_q, est_rtt_ms, inbound, peer, sender, tries, user_data, wait_ms
 
Constructor Summary
AuthenticationMsg(InputBuffer buffer)
          Constructs an AuthenticationMsg from its serialized form.
AuthenticationMsg(NodeId peer, NodeId local_contact_id, NodeId this_connection_id, VirtualizedNetCert[] certs)
          Creates a message mapping the sender's InetAddress and port number for a specific connection to the sender's primary contact NodeId.
 
Method Summary
 Object clone()
           
 NodeId get_connection_id()
          Returns the address and port used by this specific connection, which may be different from the sender's contact id.
 NodeId get_contact_id()
          Returns the primary id to use to contact the sender of this message.
 VirtualizedNetCert[] get_virtualized_net_certs()
          Returns an array of VirtualizedNetCert objects.
 void serialize(OutputBuffer buffer)
          Add the object to the buffer.
 String toString()
          Returns a human-readable representation of this message.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AuthenticationMsg

public AuthenticationMsg(NodeId peer,
                         NodeId local_contact_id,
                         NodeId this_connection_id,
                         VirtualizedNetCert[] certs)
Creates a message mapping the sender's InetAddress and port number for a specific connection to the sender's primary contact NodeId.


AuthenticationMsg

public AuthenticationMsg(InputBuffer buffer)
                  throws QSException
Constructs an AuthenticationMsg from its serialized form.

Method Detail

get_contact_id

public NodeId get_contact_id()
Returns the primary id to use to contact the sender of this message.


get_connection_id

public NodeId get_connection_id()
Returns the address and port used by this specific connection, which may be different from the sender's contact id.


get_virtualized_net_certs

public VirtualizedNetCert[] get_virtualized_net_certs()
Returns an array of VirtualizedNetCert objects. Each declares that the specified virtual node can be contacted at the primary id.

Returning the whole array is not as safe as cloning it, so be careful not to modify the array itself.


serialize

public void serialize(OutputBuffer buffer)
Description copied from interface: QuickSerializable
Add the object to the buffer.

Specified by:
serialize in interface QuickSerializable
Overrides:
serialize in class NetworkMessage
Parameters:
buffer - the output buffer to add the object to

clone

public Object clone()
             throws CloneNotSupportedException
Overrides:
clone in class NetworkMessage
CloneNotSupportedException

toString

public String toString()
Returns a human-readable representation of this message.

Overrides:
toString in class NetworkMessage