java.lang.Object
net.i2p.router.tunnel.pool.BuildReplyHandler
Decrypt the layers of a tunnel build reply message, determining whether the individual hops agreed to participate in the tunnel, or if not, why not.
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis contains the result of decrypting the build request or reply record, including the decrypted properties field, if present.Field Summary
FieldsModifier and TypeFieldDescriptionprivate final I2PAppContextThe context handling the reply.private final LogLogger for this class.private static final BuildReplyHandler.ResultCached result for a build rejected for bandwidth.private static final BuildReplyHandler.ResultCached result for a failed build.private static final BuildReplyHandler.ResultCached result for a successful build.Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptiondecrypt(TunnelBuildReplyMessage reply, TunnelCreatorConfig cfg, List<Integer> recordOrder) Decrypt the tunnel build reply records.private BuildReplyHandler.ResultdecryptRecord(TunnelBuildReplyMessage reply, TunnelCreatorConfig cfg, int recordNum, int hop) Decrypt the record (removing the layers of reply encryption) and read out the status
Field Details
ctx
The context handling the reply.log
Logger for this class.RESULT_NG
Cached result for a failed build.RESULT_OK
Cached result for a successful build.RESULT_BW
Cached result for a build rejected for bandwidth.
Constructor Details
BuildReplyHandler
Create a new build reply handler.- Parameters:
context- the I2P app context
Method Details
decrypt
public BuildReplyHandler.Result[] decrypt(TunnelBuildReplyMessage reply, TunnelCreatorConfig cfg, List<Integer> recordOrder) Decrypt the tunnel build reply records. This overwrites the contents of the reply. Thread safe (no state).Note that this layer-decrypts the build records in-place. Do not call this more than once for a given message.
- Parameters:
reply- the tunnel build reply messagecfg- the tunnel creator configrecordOrder- the order of records- Returns:
- status for the records (in record order), or null if the replies were not valid. Fake records always have 0 as their value. If the array is non-null, all entries in the array are non-null.
decryptRecord
private BuildReplyHandler.Result decryptRecord(TunnelBuildReplyMessage reply, TunnelCreatorConfig cfg, int recordNum, int hop) Decrypt the record (removing the layers of reply encryption) and read out the statusNote that this layer-decrypts the build records in-place. Do not call this more than once for a given message. Do not call for blank hops.
- Parameters:
reply- the received reply message, decrypted in placecfg- the building tunnel's config, supplying the decryption layersrecordNum- index of the record to decrypthop- the hop whose key should finish the decryption- Returns:
- the status 0-255, or -1 on decrypt failure