Rice Pastry API

org.mpisws.p2p.transport.peerreview
Class PeerReviewImpl<Handle extends RawSerializable,Identifier extends RawSerializable>

java.lang.Object
  extended by org.mpisws.p2p.transport.peerreview.PeerReviewImpl<Handle,Identifier>
Type Parameters:
Handle - (Usually a NodeHandle)
Identifier - (Permanent Identifier), can get an Identifier from a Handle
All Implemented Interfaces:
HashProvider, CertificateManager<Handle,Identifier>, IdentityTransport<Handle,Identifier>, IdentityTransportCallback<Handle,Identifier>, StatusChangeListener<Identifier>, PeerReview<Handle,Identifier>, PeerReviewConstants, StatusConstants, TransportLayer<Handle,java.nio.ByteBuffer>, TransportLayerCallback<Handle,java.nio.ByteBuffer>, Destructable

public class PeerReviewImpl<Handle extends RawSerializable,Identifier extends RawSerializable>
extends java.lang.Object
implements TransportLayerCallback<Handle,java.nio.ByteBuffer>, PeerReview<Handle,Identifier>, StatusChangeListener<Identifier>

Author:
Jeff Hoye

Field Summary
protected  AuditProtocol<Handle,Identifier> auditProtocol
           
protected  AuthenticatorStore<Identifier> authCacheStore
           
protected  AuthenticatorSerializer authenticatorSerialilzer
           
protected  AuthenticatorStore<Identifier> authInStore
           
protected  AuthenticatorStore<Identifier> authOutStore
           
protected  AuthenticatorStore<Identifier> authPendingStore
           
protected  AuthenticatorPushProtocol<Handle,Identifier> authPushProtocol
           
protected  PeerReviewCallback<Handle,Identifier> callback
           
protected  ChallengeResponseProtocol<Handle,Identifier> challengeProtocol
           
protected  CommitmentProtocol<Handle,Identifier> commitmentProtocol
           
protected  Environment env
           
protected  EvidenceSerializer evidenceSerializer
           
protected  EvidenceTool<Handle,Identifier> evidenceTool
           
protected  EvidenceTransferProtocol<Handle,Identifier> evidenceTransferProtocol
           
protected  Serializer<Handle> handleSerializer
           
protected  SecureHistory history
           
protected  SecureHistoryFactory historyFactory
           
protected  IdentifierExtractor<Handle,Identifier> identifierExtractor
           
protected  Serializer<Identifier> idSerializer
           
protected  PeerInfoStore<Handle,Identifier> infoStore
           
protected  Logger logger
           
protected  RandomSource random
           
protected  StatementProtocolImpl<Handle,Identifier> statementProtocol
           
protected  IdStrTranslator<Identifier> stringTranslator
           
protected  long timeToleranceMillis
           
protected  IdentityTransport<Handle,Identifier> transport
           
protected  VerifierFactory<Handle,Identifier> verifierFactory
           
 
Fields inherited from interface org.mpisws.p2p.transport.peerreview.PeerReview
DONT_COMMIT, PEER_REVIEW_COMMIT, PEER_REVIEW_PASSTHROUGH, RELEVANT_LENGTH
 
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
PeerReviewImpl(IdentityTransport<Handle,Identifier> transport, Environment env, Serializer<Handle> handleSerializer, Serializer<Identifier> idSerializer, IdentifierExtractor<Handle,Identifier> identifierExtractor, IdStrTranslator<Identifier> stringTranslator)
           
 
Method Summary
 void acceptMessages(boolean b)
          Toggle accepting incoming messages.
 void acceptSockets(boolean b)
          Toggle accepting new sockets.
 boolean addAuthenticatorIfValid(AuthenticatorStore<Identifier> store, Identifier subject, Authenticator auth)
          Helper function called internally from the library.
 void challengeSuspectedNode(Handle handle)
           
 void destroy()
           
protected  void doAuthPush()
          Periodic timer for pushing batches of authenticators to the witnesses
protected  void doCheckpoint()
          Periodic timer for writing checkpoints
protected  void doMaintenance()
          Periodic maintenance timer; used to garbage-collect old authenticators
 Authenticator extractAuthenticator(Identifier id, long seq, short entryType, byte[] entryHash, byte[] hTopMinusOne, byte[] signature)
           
 Authenticator extractAuthenticator(long seq, short entryType, byte[] entryHash, byte[] hTopMinusOne, byte[] signature)
          A helper function that extracts an authenticator from an incoming message and adds it to our local store.
 PeerReviewCallback<Handle,Identifier> getApp()
           
 AuthenticatorSerializer getAuthenticatorSerializer()
           
 byte[] getEmptyHash()
           
 Environment getEnvironment()
           
 long getEvidenceSeq()
           
 EvidenceSerializer getEvidenceSerializer()
           
 EvidenceTool<Handle,Identifier> getEvidenceTool()
           
 Serializer<Handle> getHandleSerializer()
           
 short getHashSizeBytes()
           
 int getHashSizeInBytes()
           
 SecureHistory getHistory()
           
 SecureHistoryFactory getHistoryFactory()
           
 IdentifierExtractor<Handle,Identifier> getIdentifierExtractor()
           
 Serializer<Identifier> getIdSerializer()
           
 Handle getLocalHandle()
           
 Identifier getLocalId()
           
 Handle getLocalIdentifier()
          The local node.
 RandomSource getRandomSource()
           
protected  SecureHistoryFactory getSecureHistoryFactory(IdentityTransport<Handle,Identifier> transport, Environment env)
           
 short getSignatureSizeBytes()
           
 int getSignatureSizeInBytes()
           
static java.lang.String getStatusString(int status)
           
 long getTime()
          Current time in millis, however, we depend on there being a timesource that is more discritized than the "wall" clock.
 long getTimeToleranceMillis()
           
 VerifierFactory<Handle,Identifier> getVerifierFactory()
           
 boolean hasCertificate(Identifier id)
           
 byte[] hash(java.nio.ByteBuffer... hashMe)
           
 byte[] hash(long seq, short type, byte[] nodeHash, byte[] contentHash)
           
 void incomingSocket(P2PSocket<Handle> s)
          Notification of a new socket.
 void init(java.lang.String dirname)
           
 void messageReceived(Handle handle, java.nio.ByteBuffer message, java.util.Map<java.lang.String,java.lang.Object> options)
          Called when a new message is received.
 void notifyCertificateAvailable(Identifier id)
           
 void notifyStatusChange(Identifier id, int newStatus)
           
 SocketRequestHandle<Handle> openSocket(Handle i, SocketCallback<Handle> deliverSocketToMe, java.util.Map<java.lang.String,java.lang.Object> options)
          Open a socket to the Identifier
 Cancellable requestCertificate(Handle source, Identifier certHolder)
           
 Cancellable requestCertificate(Handle source, Identifier certHolder, Continuation<java.security.cert.X509Certificate,java.lang.Exception> c, java.util.Map<java.lang.String,java.lang.Object> options)
           
 void sendEvidence(Handle dest, Identifier evidenceAgainst)
           
 void sendEvidenceToWitnesses(Identifier subject, long evidenceSeq, Evidence evidence)
          Called internally by other classes if they have found evidence against one of our peers.
 MessageRequestHandle<Handle,java.nio.ByteBuffer> sendMessage(Handle target, java.nio.ByteBuffer message, MessageCallback<Handle,java.nio.ByteBuffer> deliverAckToMe, java.util.Map<java.lang.String,java.lang.Object> options)
          Send the message to the identifier
 void setApp(PeerReviewCallback<Handle,Identifier> callback)
           
 void setCallback(TransportLayerCallback<Handle,java.nio.ByteBuffer> callback)
          Set the callback for incoming sockets/messages
 void setErrorHandler(ErrorHandler<Handle> handler)
          To be notified of problems not related to an outgoing messaage/socket.
 void setTimeToleranceMillis(long timeToleranceMicros)
          PeerReview checks the timestamps on messages against the local clock, and ignores them if the timestamp is too far out of sync.
 byte[] sign(byte[] bytes)
           
 void transmit(Handle dest, PeerReviewMessage message, MessageCallback<Handle,java.nio.ByteBuffer> deliverAckToMe, java.util.Map<java.lang.String,java.lang.Object> options)
          Note, must include PEER_REVIEW_COMMIT and the type
protected  void updateLogTime()
           
 boolean verify(Identifier id, Authenticator auth)
          Throws exception if called w/o the cert for the subject
 int verify(Identifier id, byte[] msg, byte[] signature)
           
 void writeCheckpoint()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

callback

protected PeerReviewCallback<Handle extends RawSerializable,Identifier extends RawSerializable> callback

transport

protected IdentityTransport<Handle extends RawSerializable,Identifier extends RawSerializable> transport

handleSerializer

protected Serializer<Handle extends RawSerializable> handleSerializer

idSerializer

protected Serializer<Identifier extends RawSerializable> idSerializer

identifierExtractor

protected IdentifierExtractor<Handle extends RawSerializable,Identifier extends RawSerializable> identifierExtractor

stringTranslator

protected IdStrTranslator<Identifier extends RawSerializable> stringTranslator

evidenceSerializer

protected EvidenceSerializer evidenceSerializer

authenticatorSerialilzer

protected AuthenticatorSerializer authenticatorSerialilzer

evidenceTool

protected EvidenceTool<Handle extends RawSerializable,Identifier extends RawSerializable> evidenceTool

env

protected Environment env

logger

protected Logger logger

authInStore

protected AuthenticatorStore<Identifier extends RawSerializable> authInStore

authOutStore

protected AuthenticatorStore<Identifier extends RawSerializable> authOutStore

authCacheStore

protected AuthenticatorStore<Identifier extends RawSerializable> authCacheStore

authPendingStore

protected AuthenticatorStore<Identifier extends RawSerializable> authPendingStore

infoStore

protected PeerInfoStore<Handle extends RawSerializable,Identifier extends RawSerializable> infoStore

historyFactory

protected SecureHistoryFactory historyFactory

history

protected SecureHistory history

verifierFactory

protected VerifierFactory<Handle extends RawSerializable,Identifier extends RawSerializable> verifierFactory

commitmentProtocol

protected CommitmentProtocol<Handle extends RawSerializable,Identifier extends RawSerializable> commitmentProtocol

evidenceTransferProtocol

protected EvidenceTransferProtocol<Handle extends RawSerializable,Identifier extends RawSerializable> evidenceTransferProtocol

authPushProtocol

protected AuthenticatorPushProtocol<Handle extends RawSerializable,Identifier extends RawSerializable> authPushProtocol

auditProtocol

protected AuditProtocol<Handle extends RawSerializable,Identifier extends RawSerializable> auditProtocol

challengeProtocol

protected ChallengeResponseProtocol<Handle extends RawSerializable,Identifier extends RawSerializable> challengeProtocol

statementProtocol

protected StatementProtocolImpl<Handle extends RawSerializable,Identifier extends RawSerializable> statementProtocol

random

protected RandomSource random

timeToleranceMillis

protected long timeToleranceMillis
Constructor Detail

PeerReviewImpl

public PeerReviewImpl(IdentityTransport<Handle,Identifier> transport,
                      Environment env,
                      Serializer<Handle> handleSerializer,
                      Serializer<Identifier> idSerializer,
                      IdentifierExtractor<Handle,Identifier> identifierExtractor,
                      IdStrTranslator<Identifier> stringTranslator)
Method Detail

getRandomSource

public RandomSource getRandomSource()
Specified by:
getRandomSource in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

getSecureHistoryFactory

protected SecureHistoryFactory getSecureHistoryFactory(IdentityTransport<Handle,Identifier> transport,
                                                       Environment env)

setTimeToleranceMillis

public void setTimeToleranceMillis(long timeToleranceMicros)
PeerReview checks the timestamps on messages against the local clock, and ignores them if the timestamp is too far out of sync. The definition of 'too far' can be controlled with this method.


getEvidenceSeq

public long getEvidenceSeq()
Specified by:
getEvidenceSeq in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

updateLogTime

protected void updateLogTime()

sendMessage

public MessageRequestHandle<Handle,java.nio.ByteBuffer> sendMessage(Handle target,
                                                                    java.nio.ByteBuffer message,
                                                                    MessageCallback<Handle,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

Specified by:
sendMessage in interface TransportLayer<Handle extends RawSerializable,java.nio.ByteBuffer>
Parameters:
target - the destination
message - 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

setApp

public void setApp(PeerReviewCallback<Handle,Identifier> callback)
Specified by:
setApp in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

setCallback

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

Specified by:
setCallback in interface TransportLayer<Handle extends RawSerializable,java.nio.ByteBuffer>
Parameters:
callback - the callback for incoming sockets/messages

messageReceived

public void messageReceived(Handle handle,
                            java.nio.ByteBuffer message,
                            java.util.Map<java.lang.String,java.lang.Object> options)
                     throws java.io.IOException
Description copied from interface: TransportLayerCallback
Called when a new message is received.

Specified by:
messageReceived in interface TransportLayerCallback<Handle extends RawSerializable,java.nio.ByteBuffer>
Parameters:
handle - The node it is coming from
message - the message
options - describe how the message arrived (udp/tcp, encrypted etc)
Throws:
java.io.IOException - if there is a problem decoding the message

getStatusString

public static java.lang.String getStatusString(int status)

addAuthenticatorIfValid

public boolean addAuthenticatorIfValid(AuthenticatorStore<Identifier> store,
                                       Identifier subject,
                                       Authenticator auth)
Helper function called internally from the library. It takes a (potentially new) authenticator and adds it to our local store if (a) it hasn't been recorded before, and (b) its signature is valid.

Specified by:
addAuthenticatorIfValid in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

requestCertificate

public Cancellable requestCertificate(Handle source,
                                      Identifier certHolder,
                                      Continuation<java.security.cert.X509Certificate,java.lang.Exception> c,
                                      java.util.Map<java.lang.String,java.lang.Object> options)
Specified by:
requestCertificate in interface CertificateManager<Handle extends RawSerializable,Identifier extends RawSerializable>

requestCertificate

public Cancellable requestCertificate(Handle source,
                                      Identifier certHolder)
Specified by:
requestCertificate in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

notifyCertificateAvailable

public void notifyCertificateAvailable(Identifier id)
Specified by:
notifyCertificateAvailable in interface IdentityTransportCallback<Handle extends RawSerializable,Identifier extends RawSerializable>

writeCheckpoint

public void writeCheckpoint()
                     throws java.io.IOException
Throws:
java.io.IOException

doAuthPush

protected void doAuthPush()
Periodic timer for pushing batches of authenticators to the witnesses


doMaintenance

protected void doMaintenance()
Periodic maintenance timer; used to garbage-collect old authenticators


doCheckpoint

protected void doCheckpoint()
Periodic timer for writing checkpoints


notifyStatusChange

public void notifyStatusChange(Identifier id,
                               int newStatus)
Specified by:
notifyStatusChange in interface StatusChangeListener<Identifier extends RawSerializable>

init

public void init(java.lang.String dirname)
          throws java.io.IOException
Specified by:
init in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>
Throws:
java.io.IOException

getApp

public PeerReviewCallback<Handle,Identifier> getApp()
Specified by:
getApp in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

openSocket

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

Specified by:
openSocket in interface TransportLayer<Handle extends RawSerializable,java.nio.ByteBuffer>
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

incomingSocket

public void incomingSocket(P2PSocket<Handle> s)
                    throws java.io.IOException
Description copied from interface: TransportLayerCallback
Notification of a new socket.

Specified by:
incomingSocket in interface TransportLayerCallback<Handle extends RawSerializable,java.nio.ByteBuffer>
Parameters:
s - the incoming socket
Throws:
java.io.IOException

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

Specified by:
acceptMessages in interface TransportLayer<Handle extends RawSerializable,java.nio.ByteBuffer>

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

Specified by:
acceptSockets in interface TransportLayer<Handle extends RawSerializable,java.nio.ByteBuffer>

getLocalId

public Identifier getLocalId()
Specified by:
getLocalId in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

getLocalHandle

public Handle getLocalHandle()
Specified by:
getLocalHandle in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

getLocalIdentifier

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

Specified by:
getLocalIdentifier in interface TransportLayer<Handle extends RawSerializable,java.nio.ByteBuffer>
Returns:
The local node.

setErrorHandler

public void setErrorHandler(ErrorHandler<Handle> 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.

Specified by:
setErrorHandler in interface TransportLayer<Handle extends RawSerializable,java.nio.ByteBuffer>
Parameters:
handler - to be notified of problems not related to a specific messaage/socket.

destroy

public void destroy()
Specified by:
destroy in interface Destructable

getAuthenticatorSerializer

public AuthenticatorSerializer getAuthenticatorSerializer()
Specified by:
getAuthenticatorSerializer in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

getEnvironment

public Environment getEnvironment()
Specified by:
getEnvironment in interface IdentityTransport<Handle extends RawSerializable,Identifier extends RawSerializable>
Specified by:
getEnvironment in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

getIdSerializer

public Serializer<Identifier> getIdSerializer()
Specified by:
getIdSerializer in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

getTime

public long getTime()
Description copied from interface: PeerReview
Current time in millis, however, we depend on there being a timesource that is more discritized than the "wall" clock. It is only advanced on a timeout or a message receipt.

Specified by:
getTime in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>
Returns:

extractAuthenticator

public Authenticator extractAuthenticator(long seq,
                                          short entryType,
                                          byte[] entryHash,
                                          byte[] hTopMinusOne,
                                          byte[] signature)
A helper function that extracts an authenticator from an incoming message and adds it to our local store.

Specified by:
extractAuthenticator in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

extractAuthenticator

public Authenticator extractAuthenticator(Identifier id,
                                          long seq,
                                          short entryType,
                                          byte[] entryHash,
                                          byte[] hTopMinusOne,
                                          byte[] signature)
Specified by:
extractAuthenticator in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

getHandleSerializer

public Serializer<Handle> getHandleSerializer()
Specified by:
getHandleSerializer in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

getHashSizeInBytes

public int getHashSizeInBytes()
Specified by:
getHashSizeInBytes in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

getSignatureSizeInBytes

public int getSignatureSizeInBytes()
Specified by:
getSignatureSizeInBytes in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

getIdentifierExtractor

public IdentifierExtractor<Handle,Identifier> getIdentifierExtractor()
Specified by:
getIdentifierExtractor in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

challengeSuspectedNode

public void challengeSuspectedNode(Handle handle)
Specified by:
challengeSuspectedNode in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

sendEvidenceToWitnesses

public void sendEvidenceToWitnesses(Identifier subject,
                                    long evidenceSeq,
                                    Evidence evidence)
Called internally by other classes if they have found evidence against one of our peers. We ask the EvidenceTransferProtocol to send it to the corresponding witness set.

Specified by:
sendEvidenceToWitnesses in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>
Parameters:
subject - the "bad" guy

transmit

public void transmit(Handle dest,
                     PeerReviewMessage message,
                     MessageCallback<Handle,java.nio.ByteBuffer> deliverAckToMe,
                     java.util.Map<java.lang.String,java.lang.Object> options)
Note, must include PEER_REVIEW_COMMIT and the type

Specified by:
transmit in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>
Parameters:
dest -
message -
deliverAckToMe -
options -

hasCertificate

public boolean hasCertificate(Identifier id)
Specified by:
hasCertificate in interface CertificateManager<Handle extends RawSerializable,Identifier extends RawSerializable>
Specified by:
hasCertificate in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

sign

public byte[] sign(byte[] bytes)
Specified by:
sign in interface CertificateManager<Handle extends RawSerializable,Identifier extends RawSerializable>

getSignatureSizeBytes

public short getSignatureSizeBytes()
Specified by:
getSignatureSizeBytes in interface CertificateManager<Handle extends RawSerializable,Identifier extends RawSerializable>

verify

public boolean verify(Identifier id,
                      Authenticator auth)
Description copied from interface: PeerReview
Throws exception if called w/o the cert for the subject

Specified by:
verify in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>
Returns:

verify

public int verify(Identifier id,
                  byte[] msg,
                  byte[] signature)
Specified by:
verify in interface CertificateManager<Handle extends RawSerializable,Identifier extends RawSerializable>

getEmptyHash

public byte[] getEmptyHash()
Specified by:
getEmptyHash in interface HashProvider

getHashSizeBytes

public short getHashSizeBytes()
Specified by:
getHashSizeBytes in interface HashProvider

hash

public byte[] hash(long seq,
                   short type,
                   byte[] nodeHash,
                   byte[] contentHash)
Specified by:
hash in interface HashProvider

hash

public byte[] hash(java.nio.ByteBuffer... hashMe)
Specified by:
hash in interface HashProvider

getEvidenceSerializer

public EvidenceSerializer getEvidenceSerializer()

getEvidenceTool

public EvidenceTool<Handle,Identifier> getEvidenceTool()
Specified by:
getEvidenceTool in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

getHistoryFactory

public SecureHistoryFactory getHistoryFactory()
Specified by:
getHistoryFactory in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

getVerifierFactory

public VerifierFactory<Handle,Identifier> getVerifierFactory()
Specified by:
getVerifierFactory in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

getHistory

public SecureHistory getHistory()
Specified by:
getHistory in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

getTimeToleranceMillis

public long getTimeToleranceMillis()
Specified by:
getTimeToleranceMillis in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

sendEvidence

public void sendEvidence(Handle dest,
                         Identifier evidenceAgainst)
Specified by:
sendEvidence in interface PeerReview<Handle extends RawSerializable,Identifier extends RawSerializable>

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection