Closeable, AutoCloseable, SAMMessageSessSAMDatagramSession, SAMRawSessionabstract class SAMMessageSession extends Object implements SAMMessageSess
| Modifier and Type | Field | Description |
|---|---|---|
protected boolean |
_isOwnSession |
|
protected Log |
_log |
| Modifier | Constructor | Description |
|---|---|---|
protected |
SAMMessageSession(InputStream destStream,
Properties props) |
Initialize a new SAM message-based session.
|
protected |
SAMMessageSession(String dest,
Properties props) |
Initialize a new SAM message-based session.
|
protected |
SAMMessageSession(I2PSession sess,
int listenProtocol,
int listenPort) |
Initialize a new SAM message-based session using an existing I2PSession.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
Close a SAM message-based session.
|
Destination |
getDestination() |
Get the SAM message-based session Destination.
|
protected I2PSession |
getI2PSession() |
Get the I2PSession object used by the SAM message-based session.
|
int |
getListenPort() |
|
int |
getListenProtocol() |
|
protected abstract void |
messageReceived(byte[] msg,
int proto,
int fromPort,
int toPort) |
Handle a new received message
|
abstract boolean |
sendBytes(String dest,
byte[] data,
int proto,
int fromPort,
int toPort) |
Send bytes through a SAM message-based session.
|
protected boolean |
sendBytesThroughMessageSession(String dest,
byte[] data,
int proto,
int fromPort,
int toPort) |
Actually send bytes through the SAM message-based session I2PSession
(er...).
|
protected boolean |
sendBytesThroughMessageSession(String dest,
byte[] data,
int proto,
int fromPort,
int toPort,
boolean sendLeaseSet,
int sendTags,
int tagThreshold,
int expiration) |
Actually send bytes through the SAM message-based session I2PSession,
using per-message extended options.
|
protected abstract void |
shutDown() |
Do whatever is needed to shutdown the SAM session
|
void |
start() |
Start a SAM message-based session.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsendBytesprotected final Log _log
protected final boolean _isOwnSession
protected SAMMessageSession(String dest, Properties props) throws IOException, DataFormatException, I2PSessionException
dest - Base64-encoded destination and private keys (same format as PrivateKeyFile)props - Properties to setup the I2P sessionIOExceptionDataFormatExceptionI2PSessionExceptionprotected SAMMessageSession(InputStream destStream, Properties props) throws IOException, DataFormatException, I2PSessionException
destStream - Input stream containing the destination and private keys (same format as PrivateKeyFile)props - Properties to setup the I2P sessionIOExceptionDataFormatExceptionI2PSessionExceptionprotected SAMMessageSession(I2PSession sess, int listenProtocol, int listenPort) throws IOException, DataFormatException, I2PSessionException
IOExceptionDataFormatExceptionI2PSessionExceptionpublic void start()
SAMMessageSessstart in interface SAMMessageSesspublic Destination getDestination()
getDestination in interface SAMMessageSesspublic int getListenProtocol()
getListenProtocol in interface SAMMessageSesspublic int getListenPort()
getListenPort in interface SAMMessageSesspublic abstract boolean sendBytes(String dest, byte[] data, int proto, int fromPort, int toPort) throws DataFormatException, I2PSessionException
sendBytes in interface SAMMessageSessdest - Destinationdata - Bytes to be sentDataFormatException - on unknown / bad destI2PSessionException - on serious error, probably session closedprotected boolean sendBytesThroughMessageSession(String dest, byte[] data, int proto, int fromPort, int toPort) throws DataFormatException, I2PSessionException
dest - Destinationdata - Bytes to be sentproto - I2CP protocolfromPort - I2CP from porttoPort - I2CP to portDataFormatException - on unknown / bad destI2PSessionException - on serious error, probably session closedprotected boolean sendBytesThroughMessageSession(String dest, byte[] data, int proto, int fromPort, int toPort, boolean sendLeaseSet, int sendTags, int tagThreshold, int expiration) throws DataFormatException, I2PSessionException
dest - Destinationdata - Bytes to be sentproto - I2CP protocolfromPort - I2CP from porttoPort - I2CP to portsendLeaseSet - true is the usual setting and the I2CP defaultsendTags - 0 to leave as defaulttagThreshold - 0 to leave as defaultexpiration - SECONDS from now, NOT absolute time, 0 to leave as defaultDataFormatException - on unknown / bad destI2PSessionException - on serious error, probably session closedpublic void close()
close in interface AutoCloseableclose in interface Closeableclose in interface SAMMessageSessprotected abstract void messageReceived(byte[] msg,
int proto,
int fromPort,
int toPort)
msg - Message payloadprotected abstract void shutDown()
protected I2PSession getI2PSession()