Interface RemoteMessage
- All Known Subinterfaces:
FullReadMessage<T>,PartialReadMessage
- All Known Implementing Classes:
AcknowledgementMessage,ApplicationMessage,ArmedProtocolMessage,HelloMessage,UnarmedProtocolMessage,UniteMessage
public interface RemoteMessage
Describes a message that is sent to remote peers via UDP/TCP.
Each message is made up of several parts:
- A fixed-length magic number used to identity if message belongs to the drasyl protocol.
- A fixed-length public header with partly authenticated information required for routing the message to its destination.
- An armed-dependent fixed-length private header with encrypted information only readable by the recipient.
- A variable-length body with message type specific (encrypted) information.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Magic Number (4 Bytes) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| PublicHeader (PublicHeader.LENGTH Bytes) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| PrivateHeader (PrivateHeader.LENGTH or |
| PrivateHeader.ARMED_LENGTH Bytes) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/ Body (HelloMessage, ApplicationMessage, /
\ AcknowledgementMessage, or UniteMessage) \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleangetArmed()intgetNonce()Returns a copy of this message with incrementedgetHopCount().voidwriteTo(io.netty.buffer.ByteBuf out) Writes this message to the bufferout.
-
Field Details
-
MAGIC_NUMBER
static final int MAGIC_NUMBER- See Also:
-
-
Method Details
-
getNonce
Nonce getNonce() -
getNetworkId
int getNetworkId() -
getSender
DrasylAddress getSender() -
getProofOfWork
ProofOfWork getProofOfWork() -
getRecipient
DrasylAddress getRecipient() -
getHopCount
HopCount getHopCount() -
getArmed
boolean getArmed() -
incrementHopCount
RemoteMessage incrementHopCount()Returns a copy of this message with incrementedgetHopCount().- Returns:
- message with incremented hop count
- Throws:
IllegalStateException- if incremented hop count is greater thenHopCount.MAX_HOP_COUNT
-
writeTo
void writeTo(io.netty.buffer.ByteBuf out) Writes this message to the bufferout.- Parameters:
out- writes this envelope to this buffer
-