|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--net.vattp.data.SendThread
Field Summary | |
private static int |
HASH_BLOCK_SIZE
|
private static int |
MAX_AGGRAGATION
|
private Hashtable |
myAddressesTried
A Hashtable of the InetAddresses tried which failed due to host related problems. |
private int |
myAggragateLength
|
private byte[] |
myAggragation
|
private int |
myAggragationCount
|
private DataPath |
myDataPath
|
private boolean |
myIsAggragating
|
private boolean |
myIsCompressingMsgLengths
|
private boolean |
myIsDoingHMAC
|
private boolean |
myIsDoingMac
|
private boolean |
myIsStandardCBC
|
private NetAddr |
myLocalAddr
|
private byte[] |
myMACKey
|
private int |
myMacLen
|
private Object |
myNotifications
|
private OutputStream |
myOutputStream
|
private SynchQueue |
myReader
|
private String |
myRemoteAddr
|
private byte[] |
mySequence
|
private MessageDigest |
mySHA1
|
private Socket |
mySocket
|
private long |
myTotalTime
|
private MsgTransformer |
myTransform
|
private Vat |
myVat
|
private static int |
NOTIFY_EVERY
Notify DataPath every NOTIFY_EVERY bytes of send progress |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
(package private) |
SendThread(Socket socket,
DataPath path,
SynchQueue reader,
Vat vat)
Make a new SendThread for an incoming socket. |
(package private) |
SendThread(String remoteAddr,
DataPath path,
SynchQueue reader,
Vat vat,
Hashtable addressesTried)
Make a new SendThread for an outgoing connection. |
Method Summary | |
private void |
addElement(Object elem)
Add an element to the aggrated message being constructed. |
private void |
callDataPath(DataCommThunk thunk)
Call a method in our DataPath |
private byte[] |
computeMAC(byte[] b,
int off,
int len,
byte[] lenField)
|
private void |
flushElements()
|
private byte[] |
getSequence()
Get the current Sequence for authentication |
private void |
increment(byte[] value)
|
private byte[] |
md5Hash(int pad,
byte[] data,
MessageDigest md5)
Calculate the MD5 hash of some data with a specific padding. |
(package private) static int |
msgLength(int len,
byte[] buf,
int off,
boolean compressed)
Calculate the message length field for a message. |
private void |
noticeProblem(Exception e)
Inform the DataPath about a problem |
private static void |
replicate(byte[] a,
byte v)
replicate - Copy a single byte to all elements of a byte array. |
void |
run()
Body of the thread. |
private void |
sendBytes(byte[] b,
int off,
int len,
byte[] lenField,
int rawLength)
Perform compression, authentication, mac calculation, and send the message |
private void |
sendBytesWithLength(byte[] b)
Send an aggrating mode message with only a single element in the message. |
private void |
setSHA1()
Get an instance of the SHA1 message digest. |
private void |
writeAndRecordProgress(byte[] b,
int off,
int len)
Write a message in chunks and inform the datapath of progress in the write. |
private static void |
xor(byte[] a,
byte[] b)
xor - Exclusive OR two byte arrays. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final int NOTIFY_EVERY
private OutputStream myOutputStream
private Socket mySocket
private NetAddr myLocalAddr
private final String myRemoteAddr
private DataPath myDataPath
private final SynchQueue myReader
private final Vat myVat
private Hashtable myAddressesTried
private static final int MAX_AGGRAGATION
private boolean myIsAggragating
private int myAggragateLength
private final byte[] myAggragation
private int myAggragationCount
private Object myNotifications
private MsgTransformer myTransform
private boolean myIsStandardCBC
private static final int HASH_BLOCK_SIZE
private boolean myIsDoingMac
private boolean myIsDoingHMAC
private byte[] myMACKey
private MessageDigest mySHA1
private int myMacLen
private byte[] mySequence
private boolean myIsCompressingMsgLengths
private long myTotalTime
Constructor Detail |
SendThread(String remoteAddr, DataPath path, SynchQueue reader, Vat vat, Hashtable addressesTried)
remoteAddr
- is the IP:port address to connect to.path
- is the DataPath object that receives notifications
as messages are sent and error occur.reader
- is the SynchQueue object to get messages from.vat
- is the Vat object to synchronize with before
calling methods in the connection DataPath objectaddressesTried
- is a Hashtable of the InetAddresses already
tried to locate the vat which failed due to host,
rather than port related problems, and are not to be
tried again.SendThread(Socket socket, DataPath path, SynchQueue reader, Vat vat)
socket
- is the Socket for the new incoming connection.path
- is the DataPath object that receives notifications
as messages are sent and error occur.reader
- is the SynchQueue object to get messages from.vat
- is the Vat object to synchronize with before
calling methods in the connection DataPath objectMethod Detail |
private void addElement(Object elem) throws IOException
elem
- is the element to be added.
IOException
private void callDataPath(DataCommThunk thunk)
thunk
- a Thunk that will perform the call. The thunk will
be called after the Vat lock is obtained.private byte[] computeMAC(byte[] b, int off, int len, byte[] lenField)
private void flushElements() throws IOException
IOException
private byte[] getSequence()
private void increment(byte[] value)
private static void xor(byte[] a, byte[] b)
a
- is the input and output array.b
- is the array which is XORed with a.private static void replicate(byte[] a, byte v)
a
- is the byte array.v
- is the byte to be replicated.private byte[] md5Hash(int pad, byte[] data, MessageDigest md5)
The padding allows different values to be obtained from the same data by varing the padding value. We use it to get the different authentication values from the same Diffie Hellman shared secret.
pad
- The int (treated as a byte) to be used to pad the MD5 calculation.data
- The data to be hashed.md5
- The message digest object to be used.
static int msgLength(int len, byte[] buf, int off, boolean compressed) throws IOException
len
- is the length of the message to have it's length encoded.buf
- is the output buffer for the encoded length.off
- is the offset in the buffer for where to place the encoded
length.compressed
- is true if compressed lengths are to be used.
IOException
private void noticeProblem(Exception e)
public void run()
run
in interface Runnable
run
in class Thread
java.lang.Thread#start()
,
java.lang.Thread#stop()
,
java.lang.Thread#Thread(java.lang.ThreadGroup,
java.lang.Runnable, java.lang.String)
,
java.lang.Runnable#run()
private void sendBytes(byte[] b, int off, int len, byte[] lenField, int rawLength) throws IOException
b
- The byte array to sendoff
- The offset in b to send fromlen
- The length to sendlenField
- The compressed length field for the messagerawLength
- The length to use for comm statistics
IOException
private void sendBytesWithLength(byte[] b) throws IOException
b
- is the byte array which is the data of the message
IOException
private void setSHA1()
private void writeAndRecordProgress(byte[] b, int off, int len) throws IOException
IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |