|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmessage.Message
message.ChannelMessage
public final class ChannelMessage
ExternalMessage
used to transmit data on an existing channel.
The parts this message consists of are defined in the enumeration
ChannelMessagePart
. A pair of set and get methods
is present for each defined part.
Field Summary | |
---|---|
static byte |
IDENTIFIER
Identifier for this type of message. |
private static InternalInformationPortController |
internalInformationPort
Reference on component InternalInformationPort . |
private static java.util.logging.Logger |
LOGGER
Logger used to log and display information. |
private int |
NUMBER_OF_FURTHER_HOPS
Number of further hops (= mixes), this message must pass to reach its destination. |
Constructor Summary | |
---|---|
ChannelMessage(byte[] byteMesssage,
int numberOfFurtherHops)
Message constructor used by client. |
|
ChannelMessage(byte[] byteMesssage,
User channel,
int numberOfFurtherHops)
Message constructor used by a mix. |
Method Summary | |
---|---|
byte[] |
getMAC()
Returns the MessagePart MAC = The Message
Authentication Code (MAC) of this message. |
int |
getMessageID()
Returns the MessagePart MESSAGE_ID = An
identifieing number, which is the same for every envelope of a mix
message. |
private byte[] |
getPart(ChannelMessagePart messagePart)
Returns a byte representation of a MessagePart . |
Payload |
getPayload()
Returns the MessagePart PAYLOAD . |
byte[] |
getSignedData()
Returns the MessagePart SIGNED_DATA . |
void |
setMAC(byte[] mac)
Sets the MessagePart MAC to the
bypassed value. |
void |
setMessageID(int newID)
Sets the MessagePart MESSAGE_ID to the
bypassed value. |
private void |
setPart(ChannelMessagePart messagePart,
byte[] data)
Saves a byte representation of a MessagePart . |
void |
setPayload(Payload newPayload)
Sets the MessagePart PAYLOAD to the
bypassed value. |
void |
setSignedData(byte[] newSignedData)
Sets the MessagePart SIGNED_DATA to the
bypassed value. |
java.lang.String |
toString()
Returns a simple String representation of this class featuring several message parts. |
Methods inherited from class message.Message |
---|
compareTo, getByteMessage, getChannel, getChannelID, getNextMixChannelID, getTimeOfReceival, setByteMessage, setPayloadRange, setTimeOfReceival |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface message.BasicMessage |
---|
getByteMessage, getChannel, getChannelID, getNextMixChannelID, getTimeOfReceival, setByteMessage, setPayloadRange, setTimeOfReceival |
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
public static final byte IDENTIFIER
instanceOf
operator.
private final int NUMBER_OF_FURTHER_HOPS
MessagePart
's position in the
byteMessage
which has (a) dynamic start- and/or
end-position(s). Note: Message length isn't constant in a cascade.
Message.byteMessage
,
ChannelEstablishMessagePart
Constructor Detail |
---|
public ChannelMessage(byte[] byteMesssage, User channel, int numberOfFurtherHops)
Constructs a new ChannelMessage
with the submitted
content (byteMesssage
) for the specified user/channel.
byteMesssage
- Byte representation of the message (as
received from the client/previous mix).channel
- User/channel the message shall be created
for.numberOfFurtherHops
- Number of further hops (= mixes), this
message must pass.public ChannelMessage(byte[] byteMesssage, int numberOfFurtherHops)
Constructs a new ChannelMessage
with the submitted content
(byteMesssage
).
byteMesssage
- Byte representation of the message (can be
empty).numberOfFurtherHops
- Number of mixes in the cascade.Method Detail |
---|
public byte[] getMAC()
MessagePart
MAC
= The Message
Authentication Code (MAC) of this message.
MessagePart
MAC
.ChannelMessagePart
,
ChannelMessagePart.MAC
public void setMAC(byte[] mac) throws MessagePartHasWrongSizeException
MessagePart
MAC
to the
bypassed value.
mac
- The Message Authentication Code (MAC) of this message.
MessagePartHasWrongSizeException
ChannelMessagePart
,
ChannelMessagePart.MAC
public int getMessageID()
MessagePart
MESSAGE_ID
= An
identifieing number, which is the same for every envelope of a mix
message. Used to trace messages for debugging. Can only be read
correctly, when current envelope is decrypted! Note: For testing only
(MAKES MIX INSECURE)!
getMessageID
in interface BasicMessage
getMessageID
in class Message
MessagePart
MESSAGE_ID
.ChannelMessagePart
,
ChannelMessagePart.MESSAGE_ID
public void setMessageID(int newID)
MessagePart
MESSAGE_ID
to the
bypassed value.
setMessageID
in interface BasicMessage
setMessageID
in class Message
newID
- An identifieing number, which is the same for every
envelope of a mix message. Used to trace messages for
debugging. Can only be set correctly, when current envelope
is decrypted! Note: For testing only (MAKES MIX INSECURE)!ChannelMessagePart
,
ChannelMessagePart.MESSAGE_ID
public Payload getPayload()
MessagePart
PAYLOAD
.
MessagePart
PAYLOAD
.ChannelMessagePart
,
ChannelMessagePart.PAYLOAD
public void setPayload(Payload newPayload) throws MessagePartHasWrongSizeException
MessagePart
PAYLOAD
to the
bypassed value.
newPayload
- Payload to be set.
MessagePartHasWrongSizeException
ChannelMessagePart
,
ChannelMessagePart.PAYLOAD
public byte[] getSignedData()
MessagePart
SIGNED_DATA
.
MessagePart
SIGNED_DATA
.ChannelMessagePart
,
ChannelMessagePart.SIGNED_DATA
public void setSignedData(byte[] newSignedData) throws MessagePartHasWrongSizeException
MessagePart
SIGNED_DATA
to the
bypassed value.
newSignedData
- The signed data to be set.
MessagePartHasWrongSizeException
ChannelMessagePart
,
ChannelMessagePart.SIGNED_DATA
private byte[] getPart(ChannelMessagePart messagePart)
MessagePart
. Example of
usage: getPart(ChannelMessagePart.NAME_OF_ENUM_CONSTANT);
messagePart
- Enum constant who's byte representation shall be
retrieved (= "type" of the part).
MessagePart
suiting the bypassed enum constant.ChannelMessagePart
private void setPart(ChannelMessagePart messagePart, byte[] data) throws MessagePartHasWrongSizeException
MessagePart
. Example of
usage:
setPart(ChannelMessagePart.NAME_OF_ENUM_CONSTANT, data);
messagePart
- Enum constant who's byte representation shall be
saved.data
- Byte representation of the MessagePart
to be saved.
MessagePartHasWrongSizeException
- Thrown when a
MessagePart
that shall be assigned is of
wrong size.ChannelMessagePart
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 |