abstract class SAMMessageSession extends Object
Modifier and Type | Class and Description |
---|---|
(package private) class |
SAMMessageSession.SAMMessageSessionHandler
SAM message-based session handler, running in its own thread
|
Modifier | Constructor and 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.
|
Modifier and Type | Method and 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.
|
protected abstract void |
messageReceived(byte[] msg)
Handle a new received message
|
abstract boolean |
sendBytes(String dest,
byte[] data)
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 abstract void |
shutDown()
Do whatever is needed to shutdown the SAM session
|
protected final Log _log
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 sessionIOException
DataFormatException
I2PSessionException
protected 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 sessionIOException
DataFormatException
I2PSessionException
public Destination getDestination()
public abstract boolean sendBytes(String dest, byte[] data) throws DataFormatException
dest
- Destinationdata
- Bytes to be sentDataFormatException
protected boolean sendBytesThroughMessageSession(String dest, byte[] data, int proto, int fromPort, int toPort) throws DataFormatException
dest
- Destinationdata
- Bytes to be sentproto
- I2CP protocolfromPort
- I2CP from porttoPort
- I2CP to portDataFormatException
- on unknown / bad destpublic void close()
protected abstract void messageReceived(byte[] msg)
msg
- Message payloadprotected abstract void shutDown()
protected I2PSession getI2PSession()