Interface RemoteMessage

All Known Subinterfaces:
FullReadMessage<T>, PartialReadMessage
All Known Implementing Classes:
AcknowledgementMessage, ApplicationMessage, ArmedProtocolMessage, HelloMessage, UnarmedProtocolMessage, UniteMessage

@UnstableApi 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 Details

  • 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 incremented getHopCount().
      Returns:
      message with incremented hop count
      Throws:
      IllegalStateException - if incremented hop count is greater then HopCount.MAX_HOP_COUNT
    • writeTo

      void writeTo(io.netty.buffer.ByteBuf out)
      Writes this message to the buffer out.
      Parameters:
      out - writes this envelope to this buffer
    • getLength

      int getLength()