Class AcknowledgementMessage

java.lang.Object
org.drasyl.handler.remote.protocol.AcknowledgementMessage
All Implemented Interfaces:
FullReadMessage<AcknowledgementMessage>, RemoteMessage

public abstract class AcknowledgementMessage extends Object
Acknowledges a HelloMessage. The message's body is structured as follows:

This is an immutable object.

  • Field Details

  • Constructor Details

    • AcknowledgementMessage

      public AcknowledgementMessage()
  • Method Details

    • of

      public static AcknowledgementMessage of(HopCount hopCount, boolean isArmed, int networkId, Nonce nonce, DrasylAddress recipient, DrasylAddress sender, ProofOfWork proofOfWork, long time)
      Creates new acknowledgement message.
      Parameters:
      hopCount - the hop count
      isArmed -
      networkId - the network id
      nonce - the nonce
      recipient - the public key of the recipient
      sender - the public key of the sender
      proofOfWork - the proof of work of sender
      Throws:
      NullPointerException - if nonce, sender, proofOfWork, recipient, hopCount, or correspondingId is null
    • of

      public static AcknowledgementMessage of(int networkId, DrasylAddress recipient, IdentityPublicKey sender, ProofOfWork proofOfWork, long time)
      Creates new acknowledgement message with random Nonce, and minimal HopCount.
      Parameters:
      networkId - the network id
      recipient - the public key of the recipient
      sender - the public key of the sender
      proofOfWork - the proof of work of sender
      Throws:
      NullPointerException - if sender, proofOfWork, recipient, or correspondingId is null
    • getTime

      public abstract long getTime()
      Returns the HelloMessage.getTime() value of the corresponding HelloMessage.
    • incrementHopCount

      public AcknowledgementMessage incrementHopCount()
      Description copied from interface: FullReadMessage
      Returns this message with incremented hop count.
      Returns:
      this message with incremented hop count.
    • writePrivateHeaderTo

      protected void writePrivateHeaderTo(io.netty.buffer.ByteBuf out)
    • writeBodyTo

      protected void writeBodyTo(io.netty.buffer.ByteBuf out)
    • getLength

      public int getLength()
    • arm

      public ArmedProtocolMessage arm(io.netty.buffer.ByteBufAllocator alloc, Crypto cryptoInstance, SessionPair sessionPair) throws InvalidMessageFormatException
      Description copied from interface: FullReadMessage
      Returns an armed version (ArmedProtocolMessage) of this message for sending it through untrustworthy channels.
      Specified by:
      arm in interface FullReadMessage<T extends FullReadMessage<?>>
      cryptoInstance - the crypto instance that should be used
      sessionPair - will be used for encryption
      Returns:
      the armed version of this message
      Throws:
      InvalidMessageFormatException - if arming was not possible
    • encodeMessage

      public io.netty.buffer.ByteBuf encodeMessage(io.netty.buffer.ByteBufAllocator alloc)
      Description copied from interface: RemoteMessage
      Writes this message to a buffer created by alloc.
      Specified by:
      encodeMessage in interface RemoteMessage
      Returns:
      the buffer written to
    • writePublicHeaderTo

      protected void writePublicHeaderTo(io.netty.buffer.ByteBuf out)