Class AcknowledgementMessage
java.lang.Object
org.drasyl.handler.remote.protocol.AcknowledgementMessage
- All Implemented Interfaces:
FullReadMessage<AcknowledgementMessage>
,RemoteMessage
Acknowledges a
DiscoveryMessage
.-
Field Summary
Fields inherited from interface org.drasyl.handler.remote.protocol.RemoteMessage
MAGIC_NUMBER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionarm
(io.netty.buffer.ByteBuf byteBuf, Crypto cryptoInstance, SessionPair sessionPair) Returns an armed version (ArmedProtocolMessage
) of this message for sending it through untrustworthy channels.abstract long
getTime()
Returns theDiscoveryMessage.getTime()
value of the correspondingDiscoveryMessage
.Returns this message with incremented hop count.static AcknowledgementMessage
of
(int networkId, DrasylAddress recipient, IdentityPublicKey sender, ProofOfWork proofOfWork, long time) static AcknowledgementMessage
of
(HopCount hopCount, boolean isArmed, int networkId, Nonce nonce, DrasylAddress recipient, DrasylAddress sender, ProofOfWork proofOfWork, long time) Creates new acknowledgement message.protected void
writeBodyTo
(io.netty.buffer.ByteBuf out) protected void
writePrivateHeaderTo
(io.netty.buffer.ByteBuf out) protected void
writePublicHeaderTo
(io.netty.buffer.ByteBuf out) void
writeTo
(io.netty.buffer.ByteBuf out) Writes this message to the bufferout
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.drasyl.handler.remote.protocol.FullReadMessage
getRecipient
Methods inherited from interface org.drasyl.handler.remote.protocol.RemoteMessage
getArmed, getHopCount, getNetworkId, getNonce, getProofOfWork, getSender
-
Field Details
-
LENGTH
public static final int LENGTH- See Also:
-
-
Constructor Details
-
AcknowledgementMessage
public AcknowledgementMessage()
-
-
Method Details
-
getTime
public abstract long getTime()Returns theDiscoveryMessage.getTime()
value of the correspondingDiscoveryMessage
. -
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) -
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 countisArmed
-networkId
- the network idnonce
- the noncerecipient
- the public key of the recipientsender
- the public key of the senderproofOfWork
- the proof of work ofsender
- Throws:
NullPointerException
- ifnonce
,sender
,proofOfWork
,recipient
,hopCount
, orcorrespondingId
isnull
-
of
public static AcknowledgementMessage of(int networkId, DrasylAddress recipient, IdentityPublicKey sender, ProofOfWork proofOfWork, long time) - Parameters:
networkId
- the network idrecipient
- the public key of the recipientsender
- the public key of the senderproofOfWork
- the proof of work ofsender
- Throws:
NullPointerException
- ifsender
,proofOfWork
,recipient
, orcorrespondingId
isnull
-
arm
public ArmedProtocolMessage arm(io.netty.buffer.ByteBuf byteBuf, 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 interfaceFullReadMessage<T extends FullReadMessage<?>>
- Parameters:
byteBuf
- theByteBuf
to write throughcryptoInstance
- the crypto instance that should be usedsessionPair
- will be used for encryption- Returns:
- the armed version of this message
- Throws:
InvalidMessageFormatException
- if arming was not possible
-
writeTo
public void writeTo(io.netty.buffer.ByteBuf out) Description copied from interface:RemoteMessage
Writes this message to the bufferout
.- Specified by:
writeTo
in interfaceRemoteMessage
- Parameters:
out
- writes this envelope to this buffer
-
writePublicHeaderTo
protected void writePublicHeaderTo(io.netty.buffer.ByteBuf out)
-