Class PrivateHeader
java.lang.Object
org.drasyl.handler.remote.protocol.PrivateHeader
This class models the private header of a drasyl protocol message. If the
PublicHeader.getArmed() flag is set, this header is fully encrypted. The header is structured as
follows:
- Type: The 1 byte type value. Indicates the message type.
- ArmedLength: The 2 bytes armed length value. Indicates, the length of the encrypted portion of the message without AEAD tag.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract UnsignedShortstatic UnsignedShortgetArmedLength(io.netty.buffer.ByteBuf byteBuf) abstract PrivateHeader.MessageTypegetType()static PrivateHeaderof(io.netty.buffer.ByteBuf byteBuf) static PrivateHeaderof(PrivateHeader.MessageType type, UnsignedShort armedLength) voidwriteTo(io.netty.buffer.ByteBuf byteBuf) Writes this header to the bufferbyteBuf.
-
Field Details
-
LENGTH
public static final int LENGTH- See Also:
-
ARMED_LENGTH
public static final int ARMED_LENGTH- See Also:
-
-
Constructor Details
-
PrivateHeader
public PrivateHeader()
-
-
Method Details
-
getType
- Returns:
- the message type
-
getArmedLength
- Returns:
- the armed length
-
writeTo
public void writeTo(io.netty.buffer.ByteBuf byteBuf) Writes this header to the bufferbyteBuf.- Parameters:
byteBuf- writes this header to the given buffer
-
getArmedLength
-
of
public static PrivateHeader of(io.netty.buffer.ByteBuf byteBuf) throws InvalidMessageFormatException - Throws:
InvalidMessageFormatException
-
of
-