java.lang.Object
net.i2p.sam.client.SAMClientEventListenerImpl
net.i2p.sam.client.SAMEventHandler
net.i2p.sam.client.SAMStreamSink.SinkEventHandler
net.i2p.sam.client.SAMStreamSink.SinkEventHandler2
- All Implemented Interfaces:
SAMReader.SAMClientEventListener
- Enclosing class:
SAMStreamSink
Handler for the second master session stream.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final InputStreamStream the second session's messages arrive on.Fields inherited from class SAMStreamSink.SinkEventHandler
_outModifier and TypeFieldDescriptionprotected final OutputStreamStream to the SAM bridge, used to answer keepalives.Fields inherited from interface SAMReader.SAMClientEventListener
NAMING_REPLY_INVALID_KEY, NAMING_REPLY_KEY_NOT_FOUND, NAMING_REPLY_OK, SESSION_STATUS_DUPLICATE_DEST, SESSION_STATUS_I2P_ERROR, SESSION_STATUS_INVALID_KEY, SESSION_STATUS_OK, STREAM_CLOSED_CANT_REACH_PEER, STREAM_CLOSED_I2P_ERROR, STREAM_CLOSED_OK, STREAM_CLOSED_PEER_NOT_FOUND, STREAM_CLOSED_TIMEOUT, STREAM_STATUS_CANT_REACH_PEER, STREAM_STATUS_I2P_ERROR, STREAM_STATUS_INVALID_KEY, STREAM_STATUS_OK, STREAM_STATUS_TIMEOUTModifier and TypeFieldDescriptionstatic final StringNaming lookup failed because the private key is invalid.static final StringNaming lookup failed because no key matches the requested name.static final StringNaming lookup succeeded.static final StringSession creation failed because the destination is already in use.static final StringSESSION_STATUS_I2P_ERROR.static final StringSession creation failed because the supplied private key is invalid.static final StringSession creation succeeded.static final StringStream closed because the peer became unreachable.static final StringSTREAM_CLOSED_I2P_ERROR.static final StringStream closed normally.static final StringStream closed because the destination was no longer known to the router.static final StringStream closed because the lease expired.static final StringStream connect failed because the peer could not be reached.static final StringSTREAM_STATUS_I2P_ERROR.static final StringStream connect failed because the private key is invalid.static final StringStream connect succeeded.static final StringStream connect failed because the lease expired before it was established.Constructor Summary
ConstructorsConstructorDescriptionSinkEventHandler2(I2PAppContext ctx, InputStream in, OutputStream out) SinkEventHandler2.Method Summary
All MethodsModifier and TypeMethodDescriptionvoidstreamStatusReceived(String result, String id, String message) Opens the sink once the bridge confirms the stream connection.Methods inherited from class SAMStreamSink.SinkEventHandler
datagramReceived, pingReceived, rawReceived, streamClosedReceived, streamConnectedReceived, streamDataReceivedModifier and TypeMethodDescriptionvoiddatagramReceived(String dest, byte[] data, int offset, int length, int fromPort, int toPort) Appends the received datagram to the first open sink.voidpingReceived(String data) Answers a bridge keepalive with a matching PONG.voidrawReceived(byte[] data, int offset, int length, int fromPort, int toPort, int protocol) Appends the received raw datagram to the first open sink.voidstreamClosedReceived(String result, String id, String message) Closes the sink file and records the connection lifetime.voidstreamConnectedReceived(String dest, String id) Opens a sink file for a newly connected stream.voidstreamDataReceived(String id, byte[] data, int offset, int length) Appends the received stream data to the sink file.Methods inherited from class SAMEventHandler
helloReplyReceived, namingReplyReceived, sessionStatusReceived, unknownMessageReceived, waitForHelloReply, waitForNamingReply, waitForSessionAddReply, waitForSessionCreateReply, waitForStreamStatusReplyModifier and TypeMethodDescriptionvoidhelloReplyReceived(boolean ok, String version) Records the HELLO outcome and version, then wakes any waiter.voidnamingReplyReceived(String name, String result, String value, String msg) Files a naming reply under its name, value on success and result otherwise.voidsessionStatusReceived(String result, String destination, String msg) May be called twice, first for CREATE and second for ADD.voidunknownMessageReceived(String major, String minor, Properties params) Logs a message this handler has no handling for.Wait for the connection to be established, returning the server version if everything went ok.waitForNamingReply(String name) Return the destination found matching the name, or null if the key was not able to be retrieved.booleanWait for the session to be added, returning true if everything went ok.booleanWait for the session to be created, returning true if everything went ok.booleanWait for the stream to be created, returning true if everything went ok.Methods inherited from class SAMClientEventListenerImpl
destReplyReceived, pongReceivedModifier and TypeMethodDescriptionvoiddestReplyReceived(String publicKey, String privateKey) Called when a DEST reply arrives.voidpongReceived(String data) Called when a PONG reply arrives.
Field Details
_in
Stream the second session's messages arrive on.
Constructor Details
SinkEventHandler2
SinkEventHandler2.- Parameters:
ctx- the application context for the event handlerin- the forwarded connection's input stream, read for the destination line and the streamed dataout- the bridge output stream, used to answer keepalives
Method Details
streamStatusReceived
Opens the sink once the bridge confirms the stream connection.- Specified by:
streamStatusReceivedin interfaceSAMReader.SAMClientEventListener- Overrides:
streamStatusReceivedin classSAMEventHandler- Parameters:
result- the stream status, one of the STREAM_STATUS_* constantsid- the stream ID from the reply, null under SAM v3message- the human-readable explanation supplied by the bridge