Rice Pastry API

org.mpisws.p2p.transport.peerreview.replay.playback
Class ReplayLayer<Identifier>

java.lang.Object
  extended by org.mpisws.p2p.transport.peerreview.replay.playback.ReplayVerifier<Identifier>
      extended by org.mpisws.p2p.transport.peerreview.replay.playback.ReplayLayer<Identifier>
All Implemented Interfaces:
PeerReviewConstants, Verifier<Identifier>, StatusConstants, TransportLayer<Identifier,java.nio.ByteBuffer>, Destructable

public class ReplayLayer<Identifier>
extends ReplayVerifier<Identifier>


Field Summary
 
Fields inherited from class org.mpisws.p2p.transport.peerreview.replay.playback.ReplayVerifier
hashProv, history, localHandle, logger, serializer
 
Fields inherited from interface org.mpisws.p2p.transport.peerreview.PeerReviewConstants
AUTH_CACHE_INTERVAL, CERT_MISSING, CHAL_AUDIT, CHAL_SEND, DEFAULT_AUDIT_INTERVAL_MILLIS, DEFAULT_AUTH_PUSH_INTERVAL_MILLIS, DEFAULT_CHECKPOINT_INTERVAL_MILLIS, DEFAULT_LOG_DOWNLOAD_TIMEOUT, DEFAULT_TIME_TOLERANCE_MILLIS, EVT_ACK, EVT_CHECKPOINT, EVT_CHOOSE_Q, EVT_CHOOSE_RAND, EVT_INIT, EVT_MAX_RESERVED, EVT_MAX_SOCKET_EVT, EVT_MIN_SOCKET_EVT, EVT_RECV, EVT_SEND, EVT_SENDSIGN, EVT_SIGN, EVT_SOCKET_CAN_READ, EVT_SOCKET_CAN_RW, EVT_SOCKET_CAN_WRITE, EVT_SOCKET_CLOSE, EVT_SOCKET_CLOSED, EVT_SOCKET_EXCEPTION, EVT_SOCKET_OPEN_INCOMING, EVT_SOCKET_OPEN_OUTGOING, EVT_SOCKET_OPENED_OUTGOING, EVT_SOCKET_READ, EVT_SOCKET_SHUTDOWN_OUTPUT, EVT_SOCKET_WRITE, EVT_VRF, EX_TYPE_ClosedChannel, EX_TYPE_IO, EX_TYPE_Unknown, FLAG_FULL_MESSAGES_ALL, FLAG_FULL_MESSAGES_SENDER, FLAG_INCLUDE_CHECKPOINT, INVALID, INVESTIGATION_INTERVAL_MILLIS, MAINTENANCE_INTERVAL_MILLIS, MAX_ACTIVE_AUDITS, MAX_ACTIVE_INVESTIGATIONS, MAX_ENTRIES_BETWEEN_CHECKPOINTS, MAX_STATUS_INFO, MAX_WITNESSED_NODES, MSG_ACCUSATION, MSG_ACK, MSG_AUTHPUSH, MSG_AUTHREQ, MSG_AUTHRESP, MSG_CHALLENGE, MSG_RESPONSE, MSG_USERDATA, MSG_USERDGRAM, NO_CERTIFICATE, PROGRESS_INTERVAL_MILLIS, PROOF_INCONSISTENT, PROOF_NONCONFORMANT, RESP_AUDIT, RESP_SEND, SIGNATURE_BAD, SIGNATURE_OK, STATE_SEND_AUDIT, STATE_WAIT_FOR_LOG, TI_AUTH_PUSH, TI_CHECKPOINT, TI_MAINTENANCE, TI_MAKE_PROGRESS, TI_MAX_RESERVED, TI_START_AUDITS, TI_STATUS_INFO, VALID
 
Fields inherited from interface org.mpisws.p2p.transport.peerreview.StatusConstants
STATUS_EXPOSED, STATUS_SUSPECTED, STATUS_TRUSTED
 
Constructor Summary
ReplayLayer(Serializer<Identifier> serializer, HashProvider hashProv, SecureHistory history, Identifier localHandle, Environment environment)
           
 
Method Summary
 void acceptMessages(boolean b)
          Toggle accepting incoming messages.
 void acceptSockets(boolean b)
          Toggle accepting new sockets.
 void destroy()
           
static Environment generateEnvironment(java.lang.String name, long startTime, long randSeed, LogManager lm2)
           
 Environment getEnvironment()
           
 Identifier getLocalIdentifier()
          The local node.
protected  void incomingSocket(Identifier from, int socketId)
          Callback when a socket comes in from a remote node.
 SocketRequestHandle<Identifier> openSocket(Identifier i, SocketCallback<Identifier> deliverSocketToMe, java.util.Map<java.lang.String,java.lang.Object> options)
          Open a socket to the Identifier
protected  void receive(Identifier from, java.nio.ByteBuffer msg)
          Callback when a message has arrived.
 MessageRequestHandle<Identifier,java.nio.ByteBuffer> sendMessage(Identifier i, java.nio.ByteBuffer m, MessageCallback<Identifier,java.nio.ByteBuffer> deliverAckToMe, java.util.Map<java.lang.String,java.lang.Object> options)
          Send the message to the identifier
 void setCallback(TransportLayerCallback<Identifier,java.nio.ByteBuffer> callback)
          Set the callback for incoming sockets/messages
 void setErrorHandler(ErrorHandler<Identifier> handler)
          To be notified of problems not related to an outgoing messaage/socket.
protected  void socketException(int socketId, java.io.IOException ioe)
           
protected  void socketIO(int socketId, boolean canRead, boolean canWrite)
          Callback when a socket is ready to read/write.
protected  void socketOpened(int socketId)
           
 
Methods inherited from class org.mpisws.p2p.transport.peerreview.replay.playback.ReplayVerifier
close, deserializeException, fetchNextEvent, generatedSocketException, getNextEvent, getNextEventTime, isSuccess, makeProgress, openSocket, readSocket, registerEvent, registerEvent, send, setApplication, shutdownOutput, verifiedOK, writeSocket
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReplayLayer

public ReplayLayer(Serializer<Identifier> serializer,
                   HashProvider hashProv,
                   SecureHistory history,
                   Identifier localHandle,
                   Environment environment)
            throws java.io.IOException
Throws:
java.io.IOException
Method Detail

openSocket

public SocketRequestHandle<Identifier> openSocket(Identifier i,
                                                  SocketCallback<Identifier> deliverSocketToMe,
                                                  java.util.Map<java.lang.String,java.lang.Object> options)
Description copied from interface: TransportLayer
Open a socket to the Identifier

Parameters:
i - who to open the socket to
deliverSocketToMe - the callback when the socket is opened
options - options on how to open the socket (don't source route, encrypt etc) (may not be respected if layer cannot provide service)
Returns:
an object to cancel opening the socket if it takes to long, or is no longer relevant

sendMessage

public MessageRequestHandle<Identifier,java.nio.ByteBuffer> sendMessage(Identifier i,
                                                                        java.nio.ByteBuffer m,
                                                                        MessageCallback<Identifier,java.nio.ByteBuffer> deliverAckToMe,
                                                                        java.util.Map<java.lang.String,java.lang.Object> options)
Description copied from interface: TransportLayer
Send the message to the identifier

Parameters:
i - the destination
m - the message
deliverAckToMe - layer dependent notification when the message is sent (can indicate placed on the wire, point-to-point acknowledgment, or end-to-end acknowledgement)
options - delivery options (don't source route, encrypt etc) (may not be respected if layer cannot provide service)
Returns:
ability to cancel the message if no longer relevant

getLocalIdentifier

public Identifier getLocalIdentifier()
Description copied from interface: TransportLayer
The local node.

Returns:
The local node.

setCallback

public void setCallback(TransportLayerCallback<Identifier,java.nio.ByteBuffer> callback)
Description copied from interface: TransportLayer
Set the callback for incoming sockets/messages

Parameters:
callback - the callback for incoming sockets/messages

setErrorHandler

public void setErrorHandler(ErrorHandler<Identifier> handler)
Description copied from interface: TransportLayer
To be notified of problems not related to an outgoing messaage/socket. Or to be notified if a callback isn't provided.

Parameters:
handler - to be notified of problems not related to a specific messaage/socket.

destroy

public void destroy()

acceptMessages

public void acceptMessages(boolean b)
Description copied from interface: TransportLayer
Toggle accepting incoming messages. Useful in flow control if overwhelmed by incoming sockets. Default: true


acceptSockets

public void acceptSockets(boolean b)
Description copied from interface: TransportLayer
Toggle accepting new sockets. Useful in flow control if overwhelmed by incoming sockets. Default: true


receive

protected void receive(Identifier from,
                       java.nio.ByteBuffer msg)
                throws java.io.IOException
Description copied from class: ReplayVerifier
Callback when a message has arrived.

Specified by:
receive in class ReplayVerifier<Identifier>
Throws:
java.io.IOException

socketIO

protected void socketIO(int socketId,
                        boolean canRead,
                        boolean canWrite)
                 throws java.io.IOException
Description copied from class: ReplayVerifier
Callback when a socket is ready to read/write. Note that the simulated node should have already registered for this event, even though it is not logged. If the node is not registred for the event, it is an error.

Specified by:
socketIO in class ReplayVerifier<Identifier>
Throws:
java.io.IOException

incomingSocket

protected void incomingSocket(Identifier from,
                              int socketId)
                       throws java.io.IOException
Description copied from class: ReplayVerifier
Callback when a socket comes in from a remote node.

Specified by:
incomingSocket in class ReplayVerifier<Identifier>
Throws:
java.io.IOException

generateEnvironment

public static Environment generateEnvironment(java.lang.String name,
                                              long startTime,
                                              long randSeed,
                                              LogManager lm2)

socketOpened

protected void socketOpened(int socketId)
                     throws java.io.IOException
Specified by:
socketOpened in class ReplayVerifier<Identifier>
Throws:
java.io.IOException

socketException

protected void socketException(int socketId,
                               java.io.IOException ioe)
                        throws java.io.IOException
Specified by:
socketException in class ReplayVerifier<Identifier>
Throws:
java.io.IOException

getEnvironment

public Environment getEnvironment()

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection