- All Known Implementing Classes:
EstablishmentManager.HPCallback, InboundEstablishState2, OutboundEstablishState2, PeerState2, PeerStateDestroyed, PeerTestManager.PTCallback
- Enclosing class:
SSU2Payload
public static interface SSU2Payload.PayloadCallback
For all callbacks, recommend throwing exceptions only from the handshake. Exceptions will get thrown out of
SSU2Payload.processPayload(I2PAppContext, SSU2Payload.PayloadCallback, byte[], int, int, boolean, RemoteHostId) and prevent processing of succeeding blocks.Method Summary
All MethodsModifier and TypeMethodDescriptionvoidgotACK(long ackThru, int acks, byte[] ranges) Receive an acknowledgment block.voidgotAddress(byte[] ip, int port) Receive an address block.voidgotDateTime(long time) Receive a date/time synchronization block.voidgotFragment(byte[] data, int off, int len, long messageID, int frag, boolean isLast) Receive a fragment of a fragmented message.voidgotI2NP(I2NPMessage msg) Receive an I2NP message block.voidgotOptions(byte[] options, boolean isHandshake) Receive a session options block.voidgotPathChallenge(RemoteHostId from, byte[] data) Receive a path challenge block.voidgotPathResponse(RemoteHostId from, byte[] data) Receive a path response block.voidgotPeerTest(int msg, int status, Hash h, byte[] data) Receive a peer test block.voidgotRelayIntro(Hash aliceHash, byte[] data) Receive a relay introduction.voidgotRelayRequest(byte[] data) Receive a relay request.voidgotRelayResponse(int status, byte[] data) Receive a relay response.voidgotRelayTag(long tag) Receive a relay tag.voidReceive a relay tag request.voidgotRI(RouterInfo ri, boolean isHandshake, boolean flood) Receive a complete RouterInfo block.voidgotRIFragment(byte[] data, boolean isHandshake, boolean flood, boolean isGzipped, int frag, int totalFrags) Receive a fragment of a RouterInfo block.voidgotTermination(int reason, long lastReceived) Receive a session termination block.voidgotToken(long token, long expires) Receive a new session token.
Method Details
gotDateTime
Receive a date/time synchronization block.- Parameters:
time- time in milliseconds since epoch- Throws:
DataFormatException- if the block is malformed
gotI2NP
Receive an I2NP message block.- Parameters:
msg- the parsed I2NP message- Throws:
I2NPMessageException- if the message cannot be handled
gotFragment
void gotFragment(byte[] data, int off, int len, long messageID, int frag, boolean isLast) throws DataFormatException Receive a fragment of a fragmented message. Data must be copied out in this method. Data starts at the 9 byte header for fragment 0.- Parameters:
data- buffer containing fragment dataoff- offset in datalen- length of data to copymessageID- unique message identifierfrag- fragment number (0-based)isLast- whether this is the last fragment- Throws:
DataFormatException- if the fragment is malformed
gotACK
void gotACK(long ackThru, int acks, byte[] ranges) Receive an acknowledgment block.- Parameters:
ackThru- highest contiguous sequence number acknowledgedacks- number of additional acknowledgments beyond ackThruranges- null if none
gotOptions
Receive a session options block.- Parameters:
options- the option dataisHandshake- true only for message 3 part 2- Throws:
DataFormatException- if the options are malformed
gotRI
Receive a complete RouterInfo block.- Parameters:
ri- will already be validatedisHandshake- true only for message 3 part 2flood- true if this is a floodfill router- Throws:
DataFormatException- if the RouterInfo block is malformed
gotRIFragment
void gotRIFragment(byte[] data, boolean isHandshake, boolean flood, boolean isGzipped, int frag, int totalFrags) Receive a fragment of a RouterInfo block.- Parameters:
data- is first gzipped and then fragmentedisHandshake- true only for message 3 part 2flood- true if this is a floodfill routerisGzipped- true if the data is gzippedfrag- fragment number (0-based)totalFrags- total number of fragments
gotAddress
void gotAddress(byte[] ip, int port) Receive an address block.- Parameters:
ip- IP address bytesport- the port number to send
gotRelayTagRequest
void gotRelayTagRequest()Receive a relay tag request.gotRelayTag
void gotRelayTag(long tag) Receive a relay tag.- Parameters:
tag- the relay tag
gotRelayRequest
void gotRelayRequest(byte[] data) Receive a relay request.- Parameters:
data- excludes flag, includes signature
gotRelayResponse
void gotRelayResponse(int status, byte[] data) Receive a relay response.- Parameters:
status- 0 = accept, 1-255 = rejectdata- excludes flag, includes signature
gotRelayIntro
Receive a relay introduction.- Parameters:
aliceHash- hash of the introducerdata- excludes flag, includes signature
gotPeerTest
Receive a peer test block.- Parameters:
msg- 1-7status- 0 = accept, 1-255 = rejecth- Alice or Charlie hash for msg 2 and 4, null for msg 1, 3, 5-7data- excludes flag, includes signature
gotToken
void gotToken(long token, long expires) Receive a new session token.- Parameters:
token- the session token to attach to the next peer testexpires- token expiration time in milliseconds
gotTermination
void gotTermination(int reason, long lastReceived) Receive a session termination block.- Parameters:
reason- termination reason codelastReceived- in theory could wrap around to negative, but very unlikely
gotPathChallenge
Receive a path challenge block.- Parameters:
from- null if unknowndata- the challenge bytes, which must be copied out
gotPathResponse
Receive a path response block.- Parameters:
from- null if unknowndata- the response bytes, which must be copied out