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 Methods
    Modifier and Type
    Method
    Description
    void
    gotACK(long ackThru, int acks, byte[] ranges)
    Receive an acknowledgment block.
    void
    gotAddress(byte[] ip, int port)
    Receive an address block.
    void
    gotDateTime(long time)
    Receive a date/time synchronization block.
    void
    gotFragment(byte[] data, int off, int len, long messageID, int frag, boolean isLast)
    Receive a fragment of a fragmented message.
    void
    Receive an I2NP message block.
    void
    gotOptions(byte[] options, boolean isHandshake)
    Receive a session options block.
    void
    gotPathChallenge(RemoteHostId from, byte[] data)
    Receive a path challenge block.
    void
    gotPathResponse(RemoteHostId from, byte[] data)
    Receive a path response block.
    void
    gotPeerTest(int msg, int status, Hash h, byte[] data)
    Receive a peer test block.
    void
    gotRelayIntro(Hash aliceHash, byte[] data)
    Receive a relay introduction.
    void
    gotRelayRequest(byte[] data)
    Receive a relay request.
    void
    gotRelayResponse(int status, byte[] data)
    Receive a relay response.
    void
    gotRelayTag(long tag)
    Receive a relay tag.
    void
    Receive a relay tag request.
    void
    gotRI(RouterInfo ri, boolean isHandshake, boolean flood)
    Receive a complete RouterInfo block.
    void
    gotRIFragment(byte[] data, boolean isHandshake, boolean flood, boolean isGzipped, int frag, int totalFrags)
    Receive a fragment of a RouterInfo block.
    void
    gotTermination(int reason, long lastReceived)
    Receive a session termination block.
    void
    gotToken(long token, long expires)
    Receive a new session token.
  • Method Details

    • gotDateTime

      void gotDateTime(long time) throws DataFormatException
      Receive a date/time synchronization block.
      Parameters:
      time - time in milliseconds since epoch
      Throws:
      DataFormatException - if the block is malformed
    • gotI2NP

      void gotI2NP(I2NPMessage msg) throws I2NPMessageException
      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 data
      off - offset in data
      len - length of data to copy
      messageID - unique message identifier
      frag - 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 acknowledged
      acks - number of additional acknowledgments beyond ackThru
      ranges - null if none
    • gotOptions

      void gotOptions(byte[] options, boolean isHandshake) throws DataFormatException
      Receive a session options block.
      Parameters:
      options - the option data
      isHandshake - true only for message 3 part 2
      Throws:
      DataFormatException - if the options are malformed
    • gotRI

      void gotRI(RouterInfo ri, boolean isHandshake, boolean flood) throws DataFormatException
      Receive a complete RouterInfo block.
      Parameters:
      ri - will already be validated
      isHandshake - true only for message 3 part 2
      flood - 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 fragmented
      isHandshake - true only for message 3 part 2
      flood - true if this is a floodfill router
      isGzipped - true if the data is gzipped
      frag - fragment number (0-based)
      totalFrags - total number of fragments
    • gotAddress

      void gotAddress(byte[] ip, int port)
      Receive an address block.
      Parameters:
      ip - IP address bytes
      port - 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 = reject
      data - excludes flag, includes signature
    • gotRelayIntro

      void gotRelayIntro(Hash aliceHash, byte[] data)
      Receive a relay introduction.
      Parameters:
      aliceHash - hash of the introducer
      data - excludes flag, includes signature
    • gotPeerTest

      void gotPeerTest(int msg, int status, Hash h, byte[] data)
      Receive a peer test block.
      Parameters:
      msg - 1-7
      status - 0 = accept, 1-255 = reject
      h - Alice or Charlie hash for msg 2 and 4, null for msg 1, 3, 5-7
      data - 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 test
      expires - token expiration time in milliseconds
    • gotTermination

      void gotTermination(int reason, long lastReceived)
      Receive a session termination block.
      Parameters:
      reason - termination reason code
      lastReceived - in theory could wrap around to negative, but very unlikely
    • gotPathChallenge

      void gotPathChallenge(RemoteHostId from, byte[] data)
      Receive a path challenge block.
      Parameters:
      from - null if unknown
      data - the challenge bytes, which must be copied out
    • gotPathResponse

      void gotPathResponse(RemoteHostId from, byte[] data)
      Receive a path response block.
      Parameters:
      from - null if unknown
      data - the response bytes, which must be copied out