|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Objectjava.lang.Enum<ChannelMessagePart>
message.ChannelMessagePart
public enum ChannelMessagePart
Defines the message format/message parts of a ChannelMessage
.
Common message parts are for example "message authentication code" and
"payload". The entire message format can be specified within the enum fields.
Any ChannelMessagePart
can be retrieved or manipulated using the
methods getPart(ChannelMessagePart messagePart)
and
setPart(ChannelMessagePart messagePart, byte[] data)
in class
ChannelMessage
.
Overlapping message parts are supported (e. g. a field "signed data",
which consists of several message parts itself). If a
ChannelMessagePart
is of dynamic length (= its length depends on
the current mix' position in the cascade (Note: Message length isn't constant
in a cascade)), the correct length is calculated automatically.
Note: A MessagePart
is "dynamic", when its start and/or end
position (=index) is/are equal to, or behind the end position of the last
mix' payload (since the payload's size differs from mix to mix (and
therefore is a dynamic part as well)).
Each MessagePart
provides the following information: It's start
offset (= index), it's end offset and whether the part is "part of the
header" or not. A MessagePart
is considered a "part of the
header", when it is exclusive for each mix of the cascade and therefore will
be dropped by the corresponding mix. For example a "message authentication
code" is "part of the header", since it must be different for each mix and
secret to all others (and therefore won't be sent forward). In contrast, the
"payload" is not "part of the header", since it is sent from one mix to
another (after recoding). Overlapping message parts can't be headers, of
course.
See Enum Types Tutorial for information on how to use enumerations in Java.
Note: This enumeration contains the field "MESSAGE_ID" which makes messages TRACEABLE (for debugging)!
Message
Enum Constant Summary | |
---|---|
MAC
The message authentication code (MAC) of this message. |
|
MESSAGE_ID
Note: For testing only (MAKES MIX INSECURE): An identifieing number, which is the same for every envelope of a mix message. |
|
PAYLOAD
The payload. |
|
RESERVED
Reserved space (used to fill up header's size to a multiple of the block size). |
|
SIGNED_DATA
The signed data of this message. |
Field Summary | |
---|---|
private int |
basicEndPosition
Basic end position (= offset) of this MessagePart . |
private static int |
basicEndPositionOfPayload
The end position (=index) of the last mix' payload (Note: Message length isn't constant in a cascade). |
private int |
basicLength
Basic length of this MessagePart in byte. |
private static int |
basicMessageLength
The length of a mix message, as it arrives at the last mix of a cascade (in byte). |
private int |
basicStartPosition
Basic start position (= offset) of this MessagePart . |
private boolean |
hasDynamicEndPosition
Indicates whether this MessagePart 's end position depends
on the calling mix' position in the cascade or not. |
private boolean |
hasDynamicStartPosition
Indicates whether this MessagePart 's start position depends
on the calling mix' position in the cascade or not. |
private static int |
headerLength
The length of a Message 's header as defined above (in
byte). |
private static InternalInformationPortController |
internalInformationPort
Reference on component InternalInformationPort . |
private boolean |
isDynamicPart
Indicates whether this MessagePart 's length or position
depends on the calling mix' position in the cascade or not. |
private boolean |
isPartOfHeader
Indicates whether this MessagePart is part of a mix
message's header or not (used to calculate appropriate message lengths
for a mix' cascade position). |
private static java.util.logging.Logger |
LOGGER
Logger used to log and display information. |
Method Summary | |
---|---|
int |
getBasicLength()
Returns the "basic" length of this MessagePart in byte. |
int |
getEndPosition(int numberOfFurtherHops)
Returns this MessagePart 's (possibly dynamic) end position
(= offset), according to the number of further hops (=number of mixes
this MessagePart 's Message still must come to
pass). |
static int |
getHeaderLength()
Returns the length of a Message 's header as defined above
(see static initializer) in byte. |
int |
getLength(int numberOfFurtherHops)
Returns the length of this (possibly dynamic) MessagePart
(in byte), according to the number of further hops (=number of mixes
this MessagePart 's Message still must come to
pass). |
static int |
getMessageLength(int numberOfFurtherHops)
Returns the (dynamic) length of a mix message, according to the specified mix position in the cascade (in byte). |
int |
getStartPosition(int numberOfFurtherHops)
Returns this MessagePart 's (possibly dynamic) start
position (= offset), according to the number of further hops (=number of
mixes this MessagePart 's Message still must
come to pass). |
static ChannelMessagePart |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. |
static ChannelMessagePart[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final ChannelMessagePart MAC
public static final ChannelMessagePart MESSAGE_ID
public static final ChannelMessagePart RESERVED
public static final ChannelMessagePart PAYLOAD
Payload
public static final ChannelMessagePart SIGNED_DATA
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 final int basicEndPositionOfPayload
basicEndPositionOfPayload + (numberOfMixesInCascade *
hesaderSize)
should be smaller than the Maximum Transmission Unit
of the underlying network for performance reasons!
private static final int basicMessageLength
private static final int headerLength
Message
's header as defined above (in
byte). Used as incrementation factor to calculate a calling mix' message
length according to it's position in the cascade (Note: there's no fixed
message length in a cascade).
private final int basicStartPosition
MessagePart
.
"Basic" means, the start position is only valid for the last mix of a
cascade. Dynamic MessagePart
s need additional calculation
(which is done automatically).
private final int basicEndPosition
MessagePart
. "Basic"
means, the end position is only valid for the last mix of a cascade.
Dynamic MessagePart
s need additional calculation (which is
done automatically).
private final int basicLength
MessagePart
in byte. "Basic" means,
the length is only valid for the last mix of a cascade. Dynamic
MessagePart
s need additional calculation (which is done
automatically).
getLength(int)
,
hasDynamicStartPosition
,
hasDynamicEndPosition
private final boolean isPartOfHeader
MessagePart
is part of a mix
message's header or not (used to calculate appropriate message lengths
for a mix' cascade position).
A MessagePart
is considered as "part of the header", when
it is exclusive for each mix of the cascade and therefore will be
dropped by the corresponding mix. For example a "message authentication
code" is "part of the header", since it must be different for each mix
and secret to all others (and therefore won't be sent forward). In
contrast, the "payload" is not "part of the header", since it is sent
from one mix to another (after recoding). Overlapping message parts
can't be headers, of course.
private final boolean hasDynamicStartPosition
MessagePart
's start position depends
on the calling mix' position in the cascade or not. Note: there's no
fixed message length in a cascade).
private final boolean hasDynamicEndPosition
MessagePart
's end position depends
on the calling mix' position in the cascade or not. Note: there's no
fixed message length in a cascade).
private final boolean isDynamicPart
MessagePart
's length or position
depends on the calling mix' position in the cascade or not. Note:
there's no fixed message length in a cascade).
hasDynamicStartPosition
,
hasDynamicEndPosition
Method Detail |
---|
public static ChannelMessagePart[] values()
for (ChannelMessagePart c : ChannelMessagePart.values()) System.out.println(c);
public static ChannelMessagePart valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.
java.lang.IllegalArgumentException
- if this enum type has no constant
with the specified name
java.lang.NullPointerException
- if the argument is nullpublic int getStartPosition(int numberOfFurtherHops)
MessagePart
's (possibly dynamic) start
position (= offset), according to the number of further hops (=number of
mixes this MessagePart
's Message
still must
come to pass).
Note: Every further hop needs it's own header. Therefore, the message size is not constant.
numberOfFurtherHops
- The number of further hops (=number of
mixes this MessagePart
's
Message
still must come to
pass).
MessagePart
's start
position (= offset).public int getEndPosition(int numberOfFurtherHops)
MessagePart
's (possibly dynamic) end position
(= offset), according to the number of further hops (=number of mixes
this MessagePart
's Message
still must come to
pass).
Note: Every further hop needs it's own header. Therefore, the message size is not constant.
numberOfFurtherHops
- The number of further hops (=number of
mixes this MessagePart
's
Message
still must come to
pass).
MessagePart
's end
position (= offset).public int getLength(int numberOfFurtherHops)
MessagePart
(in byte), according to the number of further hops (=number of mixes
this MessagePart
's Message
still must come to
pass). Note: Every further hop needs it's own header. Therefore, the
message size is not constant.
numberOfFurtherHops
- The number of further hops (=number of
mixes this MessagePart
's
Message
still must come to
pass).
MessagePart
in byte.public int getBasicLength()
MessagePart
in byte.
"Basic" means, the length is only valid for the last mix of a cascade.
MessagePart
in byte.public static int getMessageLength(int numberOfFurtherHops)
numberOfFurtherHops
- The number of further hops (=number of
mixes this MessagePart
's
Message
still must come to
pass).
public static int getHeaderLength()
Message
's header as defined above
(see static initializer) in byte. Used as incrementation factor to
calculate a calling mix' message length according to it's position in
the cascade (Note: there's no fixed message length in a cascade).
Message
's header (in byte).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |