java.lang.Object
net.i2p.sam.client.SAMClientEventListenerImpl
- All Implemented Interfaces:
SAMReader.SAMClientEventListener
- Direct Known Subclasses:
SAMEventHandler
Basic noop client event listener.
Field Summary
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
ConstructorsConstructorDescriptionA listener that discards every event; the methods below are no-ops and there is no field to set, so a bare instance is the whole implementation.Method Summary
All MethodsModifier and TypeMethodDescriptionvoiddatagramReceived(String dest, byte[] data, int offset, int length, int fromPort, int toPort) Called when a datagram arrives.voiddestReplyReceived(String publicKey, String privateKey) Called when a DEST reply arrives.voidhelloReplyReceived(boolean ok, String version) Called when the HELLO reply arrives.voidnamingReplyReceived(String name, String result, String value, String message) Called when a NAMING reply arrives.voidpingReceived(String data) Called when a PING reply arrives.voidpongReceived(String data) Called when a PONG reply arrives.voidrawReceived(byte[] data, int offset, int length, int fromPort, int toPort, int protocol) Called when a raw datagram arrives.voidsessionStatusReceived(String result, String destination, String message) Called when a SESSION STATUS reply arrives.voidstreamClosedReceived(String result, String id, String message) Called when a STREAM CLOSED reply arrives.voidstreamConnectedReceived(String remoteDestination, String id) Called when a STREAM CONNECTED reply arrives.voidstreamDataReceived(String id, byte[] data, int offset, int length) Called when data arrives on a stream.voidstreamStatusReceived(String result, String id, String message) Called when a STREAM STATUS reply arrives.voidunknownMessageReceived(String major, String minor, Properties params) Called for a SAM message the reader does not parse.
Constructor Details
SAMClientEventListenerImpl
public SAMClientEventListenerImpl()A listener that discards every event; the methods below are no-ops and there is no field to set, so a bare instance is the whole implementation.
Method Details
destReplyReceived
Description copied from interface:SAMReader.SAMClientEventListenerCalled when a DEST reply arrives.- Specified by:
destReplyReceivedin interfaceSAMReader.SAMClientEventListener- Parameters:
publicKey- the base64 destination the bridge generated for usprivateKey- the base64 private key matching that destination
helloReplyReceived
Description copied from interface:SAMReader.SAMClientEventListenerCalled when the HELLO reply arrives.- Specified by:
helloReplyReceivedin interfaceSAMReader.SAMClientEventListener- Parameters:
ok- whether the SAM bridge accepted our HELLO greetingversion- the bridge version string it reported, null if none was sent
namingReplyReceived
Description copied from interface:SAMReader.SAMClientEventListenerCalled when a NAMING reply arrives.- Specified by:
namingReplyReceivedin interfaceSAMReader.SAMClientEventListener- Parameters:
name- the requested host name or service stringresult- the reply status, one of the NAMING_REPLY_* constantsvalue- the resolved value, null when the lookup failedmessage- the human-readable explanation supplied by the bridge
sessionStatusReceived
Description copied from interface:SAMReader.SAMClientEventListenerCalled when a SESSION STATUS reply arrives.- Specified by:
sessionStatusReceivedin interfaceSAMReader.SAMClientEventListener- Parameters:
result- the session status, one of the SESSION_STATUS_* constantsdestination- the base64 destination the status refers tomessage- the human-readable explanation supplied by the bridge
streamClosedReceived
Description copied from interface:SAMReader.SAMClientEventListenerCalled when a STREAM CLOSED reply arrives.- Specified by:
streamClosedReceivedin interfaceSAMReader.SAMClientEventListener- Parameters:
result- the close status, one of the STREAM_CLOSED_* constantsid- the stream ID of the stream that was closedmessage- the human-readable explanation supplied by the bridge
streamConnectedReceived
Description copied from interface:SAMReader.SAMClientEventListenerCalled when a STREAM CONNECTED reply arrives.- Specified by:
streamConnectedReceivedin interfaceSAMReader.SAMClientEventListener- Parameters:
remoteDestination- the base64 destination the stream is connected toid- the stream ID assigned by the SAM bridge
streamDataReceived
Description copied from interface:SAMReader.SAMClientEventListenerCalled when data arrives on a stream.- Specified by:
streamDataReceivedin interfaceSAMReader.SAMClientEventListener- Parameters:
id- the stream ID the data arrived ondata- the buffer holding the payloadoffset- the index within data where the payload startslength- the number of payload bytes valid from offset
streamStatusReceived
Description copied from interface:SAMReader.SAMClientEventListenerCalled when a STREAM STATUS reply arrives.- Specified by:
streamStatusReceivedin interfaceSAMReader.SAMClientEventListener- 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
datagramReceived
public void datagramReceived(String dest, byte[] data, int offset, int length, int fromPort, int toPort) Description copied from interface:SAMReader.SAMClientEventListenerCalled when a datagram arrives.- Specified by:
datagramReceivedin interfaceSAMReader.SAMClientEventListener- Parameters:
dest- the base64 destination that sent the datagramdata- the buffer holding the datagram bodyoffset- the index within data where the body startslength- the number of body bytes valid from offsetfromPort- the source port in host byte ordertoPort- the destination port in host byte order
rawReceived
public void rawReceived(byte[] data, int offset, int length, int fromPort, int toPort, int protocol) Description copied from interface:SAMReader.SAMClientEventListenerCalled when a raw datagram arrives.- Specified by:
rawReceivedin interfaceSAMReader.SAMClientEventListener- Parameters:
data- the buffer holding the raw datagram bodyoffset- the index within data where the body startslength- the number of body bytes valid from offsetfromPort- the source port in host byte ordertoPort- the destination port in host byte orderprotocol- the IP protocol number, or I2PSession.PROTO_DATAGRAM_RAW when unreported
pingReceived
Description copied from interface:SAMReader.SAMClientEventListenerCalled when a PING reply arrives.- Specified by:
pingReceivedin interfaceSAMReader.SAMClientEventListener- Parameters:
data- the payload echoed back, limited to the first token of the line
pongReceived
Description copied from interface:SAMReader.SAMClientEventListenerCalled when a PONG reply arrives.- Specified by:
pongReceivedin interfaceSAMReader.SAMClientEventListener- Parameters:
data- the payload echoed back, limited to the first token of the line
unknownMessageReceived
Description copied from interface:SAMReader.SAMClientEventListenerCalled for a SAM message the reader does not parse.- Specified by:
unknownMessageReceivedin interfaceSAMReader.SAMClientEventListener- Parameters:
major- the first token of the SAM message, naming the command familyminor- the second token, naming the specific command within that familyparams- the remaining name=value pairs of the line, quotes stripped