|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmessage.Message
public abstract class Message
Basic abstract
class for all types of messages the
InputOutputHandler
is capable of transmitting.
Provides a byte array containing the message itself in an exchangeable form
(see byteMessage
) and several manipulable properties for
internal usage only (e. g. by a mix or client).
Field Summary | |
---|---|
private byte[] |
byteMessage
Byte representation of this message. |
private User |
channel
Reference on the user/channel. this message belongs to. |
private int |
CHANNEL_ID
Identifier of the channel/user this message belongs to. |
private static NetworkClockController |
clock
Reference on component NetworkClock (used to set variable
timeOfReceival ). |
private int |
messageID
Identifier for this message. |
private int |
NEXT_MIX_CHANNEL_ID
Identifier of the channel/user this message belongs to for the next mix of the cascade. |
private int |
payloadLength
Only a certain part of byteMessage must be transmitted to
the cascade's next mix (Some parts (e. g. the session key for the
corresponding mix) are not supposed to be sent). |
private int |
startIndexOfPayload
Only a certain part of byteMessage must be transmitted to
the cascade's next mix (Some parts (e. g. the session key for the
corresponding mix) are not supposed to be sent). |
private long |
timeOfReceival
Point of time (timestamp), this message was received by the corresponding mix. |
Constructor Summary | |
---|---|
Message(byte[] byteMesssage)
Message constructor used by client. |
|
Message(byte[] byteMesssage,
User channel,
int startIndexOfPayload,
int payloadLength)
Message constructor used by mix. |
Method Summary | |
---|---|
int |
compareTo(Message message)
Implements the Comparable interface's compareTo()
method. |
byte[] |
getByteMessage()
Returns the byte representation of this message ( byteMessage ). |
User |
getChannel()
Returns a reference on the channel/user this message belongs to. |
int |
getChannelID()
Returns an identifier for the channel/user this message belongs to. |
int |
getMessageID()
Returns an identifier for this message. |
int |
getNextMixChannelID()
Returns an identifier for the channel/user this message belongs to, used by the next mix of the cascade. |
long |
getTimeOfReceival()
Returns the point of time (timestamp), this message was received. |
void |
setByteMessage(byte[] byteMessage)
Sets the byte representation of this message ( byteMessage )
to the bypassed array. |
void |
setMessageID(int newIdentifier)
Sets this message's identifier to the bypassed value. |
void |
setPayloadRange(int startIndexOfPayload,
int payloadLength)
Only a certain part of the message array must be transmitted to the cascade's next mix (Some parts (e. g. the session key for the corresponding mix) are not supposed to be sent). |
void |
setTimeOfReceival(long newTimeOfReceival)
Sets the point of time (timestamp), this message was received to the bypassed value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final int CHANNEL_ID
private final int NEXT_MIX_CHANNEL_ID
private int messageID
private static NetworkClockController clock
NetworkClock
(used to set variable
timeOfReceival
).
timeOfReceival
private long timeOfReceival
private int startIndexOfPayload
byteMessage
must be transmitted to
the cascade's next mix (Some parts (e. g. the session key for the
corresponding mix) are not supposed to be sent). Which part is relevant
depends on the type of message.
This variable defines the offset for the part to be transmitted.
This variable must/can be set automatically in the constructor of any subclass.
payloadLength
private int payloadLength
byteMessage
must be transmitted to
the cascade's next mix (Some parts (e. g. the session key for the
corresponding mix) are not supposed to be sent). Which part is relevant
depends on the type of message.
This variable defines the length for the part to be transmitted.
This variable must/can be set automatically in the constructor of any subclass.
payloadLength
private User channel
private byte[] byteMessage
Constructor Detail |
---|
public Message(byte[] byteMesssage, User channel, int startIndexOfPayload, int payloadLength)
Constructs a new Message
with the submitted content (
byteMesssage
) for the bypassed user/channel.
byteMesssage
- Byte representation of the message (as
received from the client/previous mix).channel
- Reference on the user/channel this message
belongs to.startIndexOfPayload
- See instance variable
startIndexOfPayload
.payloadLength
- See instance variable
payloadLength
.public Message(byte[] byteMesssage)
Constructs a new Message
with the submitted content (
byteMesssage
).
byteMesssage
- Byte representation of the message (can be empty).Method Detail |
---|
public int getNextMixChannelID()
getNextMixChannelID
in interface BasicMessage
public int getChannelID()
getChannelID
in interface BasicMessage
public int getMessageID()
getMessageID
in interface BasicMessage
public void setMessageID(int newIdentifier)
setMessageID
in interface BasicMessage
newIdentifier
- Value this message's identifier shall be set to.public void setPayloadRange(int startIndexOfPayload, int payloadLength)
This method defines the offset and length of the part to be transmitted.
setPayloadRange
in interface BasicMessage
startIndexOfPayload
- Offset of the part to be transmitted.payloadLength
- Length of the part to be transmitted.public User getChannel()
getChannel
in interface BasicMessage
public long getTimeOfReceival()
getTimeOfReceival
in interface BasicMessage
public void setTimeOfReceival(long newTimeOfReceival)
setTimeOfReceival
in interface BasicMessage
newTimeOfReceival
- Point of time (timestamp), this message was
received.public byte[] getByteMessage()
byteMessage
).
getByteMessage
in interface BasicMessage
public void setByteMessage(byte[] byteMessage)
byteMessage
)
to the bypassed array.
setByteMessage
in interface BasicMessage
byteMessage
- New content for this message.public int compareTo(Message message)
Comparable
interface's compareTo()
method. Compares this Message
with the specified
Message
for order (criterion: alphabetic order of this
Message
's payload. Returns a negative integer, zero, or a
positive integer as this Message
is less than, equal to, or
greater than the specified Message
.
compareTo
in interface java.lang.Comparable<Message>
message
- The Message
to be compared.
Message
is less than,
equal to, or greater than the specified Message
.setPayloadRange(int, int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |