All Known Implementing Classes:
SAMClientEventListenerImpl, SAMEventHandler, SAMStreamSend.SendEventHandler, SAMStreamSink.SinkEventHandler, SAMStreamSink.SinkEventHandler2
Enclosing class:
SAMReader

public static interface SAMReader.SAMClientEventListener
Async event notification interface for SAM clients.
  • Field Details

    • SESSION_STATUS_OK

      static final String SESSION_STATUS_OK
      Session creation succeeded.
      See Also:
    • SESSION_STATUS_DUPLICATE_DEST

      static final String SESSION_STATUS_DUPLICATE_DEST
      Session creation failed because the destination is already in use.
      See Also:
    • SESSION_STATUS_I2P_ERROR

      static final String SESSION_STATUS_I2P_ERROR
      SESSION_STATUS_I2P_ERROR.
      See Also:
    • SESSION_STATUS_INVALID_KEY

      static final String SESSION_STATUS_INVALID_KEY
      Session creation failed because the supplied private key is invalid.
      See Also:
    • STREAM_STATUS_OK

      static final String STREAM_STATUS_OK
      Stream connect succeeded.
      See Also:
    • STREAM_STATUS_CANT_REACH_PEER

      static final String STREAM_STATUS_CANT_REACH_PEER
      Stream connect failed because the peer could not be reached.
      See Also:
    • STREAM_STATUS_I2P_ERROR

      static final String STREAM_STATUS_I2P_ERROR
      STREAM_STATUS_I2P_ERROR.
      See Also:
    • STREAM_STATUS_INVALID_KEY

      static final String STREAM_STATUS_INVALID_KEY
      Stream connect failed because the private key is invalid.
      See Also:
    • STREAM_STATUS_TIMEOUT

      static final String STREAM_STATUS_TIMEOUT
      Stream connect failed because the lease expired before it was established.
      See Also:
    • STREAM_CLOSED_OK

      static final String STREAM_CLOSED_OK
      Stream closed normally.
      See Also:
    • STREAM_CLOSED_CANT_REACH_PEER

      static final String STREAM_CLOSED_CANT_REACH_PEER
      Stream closed because the peer became unreachable.
      See Also:
    • STREAM_CLOSED_I2P_ERROR

      static final String STREAM_CLOSED_I2P_ERROR
      STREAM_CLOSED_I2P_ERROR.
      See Also:
    • STREAM_CLOSED_PEER_NOT_FOUND

      static final String STREAM_CLOSED_PEER_NOT_FOUND
      Stream closed because the destination was no longer known to the router.
      See Also:
    • STREAM_CLOSED_TIMEOUT

      static final String STREAM_CLOSED_TIMEOUT
      Stream closed because the lease expired.
      See Also:
    • NAMING_REPLY_OK

      static final String NAMING_REPLY_OK
      Naming lookup succeeded.
      See Also:
    • NAMING_REPLY_INVALID_KEY

      static final String NAMING_REPLY_INVALID_KEY
      Naming lookup failed because the private key is invalid.
      See Also:
    • NAMING_REPLY_KEY_NOT_FOUND

      static final String NAMING_REPLY_KEY_NOT_FOUND
      Naming lookup failed because no key matches the requested name.
      See Also:
  • Method Details

    • helloReplyReceived

      void helloReplyReceived(boolean ok, String version)
      Called when the HELLO reply arrives.
      Parameters:
      ok - whether the SAM bridge accepted our HELLO greeting
      version - the bridge version string it reported, null if none was sent
    • sessionStatusReceived

      void sessionStatusReceived(String result, String destination, String message)
      Called when a SESSION STATUS reply arrives.
      Parameters:
      result - the session status, one of the SESSION_STATUS_* constants
      destination - the base64 destination the status refers to
      message - the human-readable explanation supplied by the bridge
    • streamStatusReceived

      void streamStatusReceived(String result, String id, String message)
      Called when a STREAM STATUS reply arrives.
      Parameters:
      result - the stream status, one of the STREAM_STATUS_* constants
      id - the stream ID from the reply, null under SAM v3
      message - the human-readable explanation supplied by the bridge
    • streamConnectedReceived

      void streamConnectedReceived(String remoteDestination, String id)
      Called when a STREAM CONNECTED reply arrives.
      Parameters:
      remoteDestination - the base64 destination the stream is connected to
      id - the stream ID assigned by the SAM bridge
    • streamClosedReceived

      void streamClosedReceived(String result, String id, String message)
      Called when a STREAM CLOSED reply arrives.
      Parameters:
      result - the close status, one of the STREAM_CLOSED_* constants
      id - the stream ID of the stream that was closed
      message - the human-readable explanation supplied by the bridge
    • streamDataReceived

      void streamDataReceived(String id, byte[] data, int offset, int length)
      Called when data arrives on a stream.
      Parameters:
      id - the stream ID the data arrived on
      data - the buffer holding the payload
      offset - the index within data where the payload starts
      length - the number of payload bytes valid from offset
    • namingReplyReceived

      void namingReplyReceived(String name, String result, String value, String message)
      Called when a NAMING reply arrives.
      Parameters:
      name - the requested host name or service string
      result - the reply status, one of the NAMING_REPLY_* constants
      value - the resolved value, null when the lookup failed
      message - the human-readable explanation supplied by the bridge
    • destReplyReceived

      void destReplyReceived(String publicKey, String privateKey)
      Called when a DEST reply arrives.
      Parameters:
      publicKey - the base64 destination the bridge generated for us
      privateKey - the base64 private key matching that destination
    • datagramReceived

      void datagramReceived(String dest, byte[] data, int offset, int length, int fromPort, int toPort)
      Called when a datagram arrives.
      Parameters:
      dest - the base64 destination that sent the datagram
      data - the buffer holding the datagram body
      offset - the index within data where the body starts
      length - the number of body bytes valid from offset
      fromPort - the source port in host byte order
      toPort - the destination port in host byte order
    • rawReceived

      void rawReceived(byte[] data, int offset, int length, int fromPort, int toPort, int protocol)
      Called when a raw datagram arrives.
      Parameters:
      data - the buffer holding the raw datagram body
      offset - the index within data where the body starts
      length - the number of body bytes valid from offset
      fromPort - the source port in host byte order
      toPort - the destination port in host byte order
      protocol - the IP protocol number, or I2PSession.PROTO_DATAGRAM_RAW when unreported
    • pingReceived

      void pingReceived(String data)
      Called when a PING reply arrives.
      Parameters:
      data - the payload echoed back, limited to the first token of the line
    • pongReceived

      void pongReceived(String data)
      Called when a PONG reply arrives.
      Parameters:
      data - the payload echoed back, limited to the first token of the line
    • unknownMessageReceived

      void unknownMessageReceived(String major, String minor, Properties params)
      Called for a SAM message the reader does not parse.
      Parameters:
      major - the first token of the SAM message, naming the command family
      minor - the second token, naming the specific command within that family
      params - the remaining name=value pairs of the line, quotes stripped