|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectuserDatabase.User
public final class User
Data structure used to store user-specific data (for example identifiers, session keys or buffers).
| Field Summary | |
|---|---|
private java.nio.ByteBuffer |
clientReadBuffer
ByteBuffer used to cache fragments of a message received
from the User's Client. |
private java.nio.ByteBuffer |
clientWriteBuffer
ByteBuffer used to cache messages that shall be sent to
this User's Client.Needed for non-blocking I/O. |
private static NetworkClockController |
clock
Reference on component NetworkClock. |
private javax.crypto.Cipher |
decryptCipher
Cipher used to decrypt this User's
Requests (ChannelMessages and symmetric part
of ChannelEstablishMessages). |
private javax.crypto.Cipher |
encryptCipher
Cipher used to encrypt this User's
Replyies. |
private boolean |
hasMessageInCurrentBatch
Indicates whether a Request of this User is
already in batch or not (used to prevent flooding attacks). |
private boolean |
hasMessageInCurrentReplyBatch
Indicates whether a Reply for this User is
already in batch or not (used to prevent flooding attacks). |
private java.lang.Integer |
IDENTIFIER
A (local) identifier for this User. |
private java.lang.Integer |
IDENTIFIER_FOR_NEXT_MIX
An identifier for this User, used by the next mix of the
cascade. |
private static InternalInformationPortController |
internalInformationPort
Reference on component InternalInformationPort. |
private boolean |
isChannelEstablished
Indicates whether a channel (used to transmit ChannelMessages) has been establish for/by this
User or not. |
private boolean |
isPutInProxyReadBufferWaiting
Indicates whether putInProxyReadBuffer(byte[]) is waiting
for free space in proxyReadBuffer or not (used for
synchronization). |
private long |
lastActivity
Timestamp of this User's last activity. |
private static java.util.logging.Logger |
LOGGER
Logger used to log and display information. |
private javax.crypto.SecretKey |
macKey
SecretKey used for message authentication codes. |
private static int |
MAX_REPLY_LENGTH
Maximum size of a Reply in byte (used to initialize
buffers). |
private static int |
MAX_REQUEST_LENGTH
Maximum size of a Request in byte (used to initialize
buffers). |
private java.nio.ByteBuffer |
proxyReadBuffer
ByteBuffer used to cache data received from proxy server. |
private java.nio.ByteBuffer |
proxyWriteBuffer
ByteBuffer used to cache messages that shall be sent to
this User's Client. |
private static java.security.SecureRandom |
secureRandom
Random number generator used to generate IDENTIFIER_FOR_NEXT_MIX. |
private java.nio.channels.SocketChannel |
socketChannel
Reference on User's SocketChannel. |
| Constructor Summary | |
|---|---|
User(int identifier)
Creates a new User using the bypassed identifier. |
|
| Method Summary | |
|---|---|
int |
availableDataInProxyReadBuffer()
Returns the number of bytes currently available in proxyReadBuffer, which contains data received from proxy
server for this User. |
int |
availableDataInProxyWriteBuffer()
Returns the number of bytes currently available in proxyWriteBuffer, which contains data that shall be sent to
the proxy server. |
java.nio.ByteBuffer |
getClientReadBuffer()
Returns this User's ByteBuffer used for
caching fragments of a message received from the corresponding
Client. |
java.nio.ByteBuffer |
getClientWriteBuffer()
Returns this User's ByteBuffer used for
caching messages that shall be sent to the corresponding
Client. |
javax.crypto.Cipher |
getDecryptCipher()
Returns this User's decryptCipher, used to
decrypt Requests. |
javax.crypto.Cipher |
getEncryptCipher()
Returns this User's encryptCipher, used to
encrypt Replyies. |
byte[] |
getFromProxyReadBuffer(int limit)
Used to read data from proxyReadBuffer, which contains
data received from proxy server for this User. |
byte[] |
getFromProxyWriteBuffer(int limit)
Used to read data from proxyWriteBuffer, which contains
data that shall be sent to the proxy server. |
boolean |
getHasMessageInCurrentBatch()
Returns whether a Request of this User is
already in batch or not (used to prevent flooding attacks). |
boolean |
getHasMessageInCurrentReplyBatch()
Returns whether a Reply of this User is
already in batch or not (used to prevent flooding attacks). |
java.lang.Integer |
getIdentifier()
Returns this Users (local) identifier (used to distinguish
between Users). |
java.lang.Integer |
getIdentifierForNextMix()
Returns this User's identifier, used by the next mix of the
cascade (used to distinguish between Users). |
boolean |
getIsChannelEstablished()
Returns whether a channel (used to transmit ChannelMessages) has been establish for/by this
User or not. |
javax.crypto.SecretKey |
getMacKey()
Returns the SecretKey, used for validating message
authentication codes by this User. |
java.nio.channels.SocketChannel |
getSocketChannel()
Returns this User's SocketChannel. |
long |
getTimestampOfLastActivity()
Returns a timestamp of this User's last activity. |
void |
initializeClientBuffers(java.nio.channels.SocketChannel socketChannel)
Allocates space for the buffers used to communicate with this User's corresponding Client (needed for
non-blocking I/O). |
void |
initializeProxyBuffers()
Allocates space for the buffers used to communicate with this User's corresponding proxy server (needed for
non-blocking I/O). |
boolean |
isStillValid(long timeout)
Indicates whether this User's last activity took place
during the last timeout ms or not (used to detect outdated
Users). |
void |
putInProxyReadBuffer(byte[] data)
Used to add data received from proxy server for this User. |
void |
putInProxyWriteBuffer(byte[] data)
Used to add data, that shall be sent to proxy server. |
void |
setDecryptCipher(javax.crypto.Cipher decryptCipher)
Makes this User use the bypassed Cipher for
decrypting Requests |
void |
setEncryptCipher(javax.crypto.Cipher encryptCipher)
Makes this User use the bypassed Cipher for
encrypting Replyies. |
void |
setHasMessageInCurrentBatch(boolean newValue)
Used to indicate, whether a Request of this
User is already in batch or not (used to prevent flooding
attacks). |
void |
setHasMessageInCurrentReplyBatch(boolean newValue)
Used to indicate, whether a Reply for this
User is already in batch or not (used to prevent flooding
attacks). |
void |
setIsChannelEstablished(boolean newValue)
Sets variable isChannelEstablished to the bypassed value
(indicates whether a channel (used to transmit
ChannelMessages) has been establish for/by this
User or not). |
void |
setMacKey(javax.crypto.SecretKey newMacKey)
Makes this User use the bypassed SecretKey for
validating message authentication codes. |
void |
setTimestampOfLastActivity()
Must be called when User sends a Message
(Used to detect inactive Users). |
java.lang.String |
toString()
Returns a simple String representation of this class. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static InternalInformationPortController internalInformationPort
InternalInformationPort.
Used to display and/or log data and read general settings.
private static final java.util.logging.Logger LOGGER
private static int MAX_REQUEST_LENGTH
Request in byte (used to initialize
buffers).
private static int MAX_REPLY_LENGTH
Reply in byte (used to initialize
buffers).
private static java.security.SecureRandom secureRandom
IDENTIFIER_FOR_NEXT_MIX.
IDENTIFIER_FOR_NEXT_MIXprivate static NetworkClockController clock
NetworkClock.
private final java.lang.Integer IDENTIFIER
User.
private final java.lang.Integer IDENTIFIER_FOR_NEXT_MIX
User, used by the next mix of the
cascade. Note: Different identifiers must be used to prevent
linkability.
private long lastActivity
User's last activity.
private boolean isChannelEstablished
ChannelMessages) has been establish for/by this
User or not.
private java.nio.ByteBuffer clientReadBuffer
ByteBuffer used to cache fragments of a message received
from the User's Client. Needed for
non-blocking I/O.
ClientConnectionHandlerprivate java.nio.ByteBuffer clientWriteBuffer
ByteBuffer used to cache messages that shall be sent to
this User's Client.Needed for non-blocking I/O.
ClientConnectionHandlerprivate java.nio.ByteBuffer proxyReadBuffer
ByteBuffer used to cache data received from proxy server.
Needed for non-blocking I/O.
private java.nio.ByteBuffer proxyWriteBuffer
ByteBuffer used to cache messages that shall be sent to
this User's Client. Needed for non-blocking
I/O.
ClientConnectionHandlerprivate javax.crypto.SecretKey macKey
SecretKey used for message authentication codes.
private java.nio.channels.SocketChannel socketChannel
User's SocketChannel. Needed for
non-blocking I/O.
private boolean hasMessageInCurrentBatch
Request of this User is
already in batch or not (used to prevent flooding attacks).
private boolean hasMessageInCurrentReplyBatch
Reply for this User is
already in batch or not (used to prevent flooding attacks).
private javax.crypto.Cipher encryptCipher
Cipher used to encrypt this User's
Replyies.
private javax.crypto.Cipher decryptCipher
Cipher used to decrypt this User's
Requests (ChannelMessages and symmetric part
of ChannelEstablishMessages).
private boolean isPutInProxyReadBufferWaiting
putInProxyReadBuffer(byte[]) is waiting
for free space in proxyReadBuffer or not (used for
synchronization).
| Constructor Detail |
|---|
public User(int identifier)
User using the bypassed identifier.
identifier - A (local) identifier for this User
used to distinguish between Users.| Method Detail |
|---|
public java.lang.Integer getIdentifier()
Users (local) identifier (used to distinguish
between Users).
Users (local) identifier.public java.lang.Integer getIdentifierForNextMix()
User's identifier, used by the next mix of the
cascade (used to distinguish between Users). Note:
Different identifiers must be used to prevent linkability.
Users identifier, used by the next mix of the
cascadepublic boolean getIsChannelEstablished()
ChannelMessages) has been establish for/by this
User or not.
ChannelMessages) has been establish for/by this
User or not.public void setIsChannelEstablished(boolean newValue)
isChannelEstablished to the bypassed value
(indicates whether a channel (used to transmit
ChannelMessages) has been establish for/by this
User or not).
newValue - Value isChannelEstablished variable shall
be set to.public boolean isStillValid(long timeout)
User's last activity took place
during the last timeout ms or not (used to detect outdated
Users).
timeout - Period of time to be taken in account.
User's last activity took
place during the last timeout ms or not.public long getTimestampOfLastActivity()
User's last activity.
User's last activity.public void setTimestampOfLastActivity()
User sends a Message
(Used to detect inactive Users).
public javax.crypto.Cipher getEncryptCipher()
User's encryptCipher, used to
encrypt Replyies.
User's encryptCipher, used to
encrypt Replyies.public void setEncryptCipher(javax.crypto.Cipher encryptCipher)
User use the bypassed Cipher for
encrypting Replyies.
encryptCipher - Cipher, that shall be used for
encrypting Replyies.public javax.crypto.Cipher getDecryptCipher()
User's decryptCipher, used to
decrypt Requests.
User's decryptCipher, used to
decrypt Requests.public void setDecryptCipher(javax.crypto.Cipher decryptCipher)
User use the bypassed Cipher for
decrypting Requests
decryptCipher - Cipher, that shall be used for
decrypting Requestspublic javax.crypto.SecretKey getMacKey()
SecretKey, used for validating message
authentication codes by this User.
SecretKey, used for validating message
authentication codes by this User.public void setMacKey(javax.crypto.SecretKey newMacKey)
User use the bypassed SecretKey for
validating message authentication codes.
newMacKey - SecretKey, that shall be used for
validating message authentication codes.public boolean getHasMessageInCurrentBatch()
Request of this User is
already in batch or not (used to prevent flooding attacks).
Request of this User is
already in batch or not (used to prevent flooding attacks).public void setHasMessageInCurrentBatch(boolean newValue)
Request of this
User is already in batch or not (used to prevent flooding
attacks).
newValue - Whether a Request of this
User is already in batch or not.public boolean getHasMessageInCurrentReplyBatch()
Reply of this User is
already in batch or not (used to prevent flooding attacks).
Reply of this User is
already in batch or not (used to prevent flooding attacks).public void setHasMessageInCurrentReplyBatch(boolean newValue)
Reply for this
User is already in batch or not (used to prevent flooding
attacks).
newValue - Whether a Reply for this
User is already in batch or not.public java.nio.ByteBuffer getClientReadBuffer()
User's ByteBuffer used for
caching fragments of a message received from the corresponding
Client. Needed for non-blocking I/O.
User's ByteBuffer used for
caching fragments of a message received from the corresponding
Client.public java.nio.ByteBuffer getClientWriteBuffer()
User's ByteBuffer used for
caching messages that shall be sent to the corresponding
Client. Needed for non-blocking I/O.
User's ByteBuffer used for
caching messages that shall be sent to the corresponding
Client.public java.nio.channels.SocketChannel getSocketChannel()
User's SocketChannel. Needed for
non-blocking I/O.
User's SocketChannel.public void putInProxyReadBuffer(byte[] data)
User.
Puts the bypassed data in this User's
proxyReadBuffer, from where it will be taken to generate
Replyies.
Blocks until all data is written.
data - Data for this User, received from proxy server.public byte[] getFromProxyReadBuffer(int limit)
proxyReadBuffer, which contains
data received from proxy server for this User.
Reads as much bytes as available (until limit).
limit - Maximum number of bytes to be returned.
public int availableDataInProxyReadBuffer()
proxyReadBuffer, which contains data received from proxy
server for this User.
Assures that AT LEAST @return bytes can be read from
proxyReadBuffer until next call of
getFromProxyReadBuffer(int).
proxyReadBufferpublic void putInProxyWriteBuffer(byte[] data)
User's proxyWriteBuffer, from
where it will be sent to the corresponding proxy server.
Blocks until all data is written.
data - Data, that shall be sent to proxy server.public byte[] getFromProxyWriteBuffer(int limit)
proxyWriteBuffer, which contains
data that shall be sent to the proxy server.
Reads as much bytes as available (until limit).
limit - Maximum number of bytes to be returned.
public int availableDataInProxyWriteBuffer()
proxyWriteBuffer, which contains data that shall be sent to
the proxy server.
Assures that AT LEAST @return bytes can be read from
proxyWriteBuffer until next call of
getFromProxyWriteBuffer(int).
proxyWriteBufferpublic void initializeClientBuffers(java.nio.channels.SocketChannel socketChannel)
User's corresponding Client (needed for
non-blocking I/O).
Used by first mix of cascade only.
socketChannel - SocketChannel to read/write data
from/to.public void initializeProxyBuffers()
User's corresponding proxy server (needed for
non-blocking I/O).
Used by last mix of cascade only.
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||