java.io.Closeable
, java.lang.AutoCloseable
, SAMMessageSess
SAMDatagramSession
, SAMRawSession
abstract class SAMMessageSession extends java.lang.Object implements SAMMessageSess
修飾子とタイプ | フィールド | 説明 |
---|---|---|
protected boolean |
_isOwnSession |
|
protected Log |
_log |
修飾子 | コンストラクタ | 説明 |
---|---|---|
protected |
SAMMessageSession(java.io.InputStream destStream,
java.util.Properties props) |
Initialize a new SAM message-based session.
|
protected |
SAMMessageSession(java.lang.String dest,
java.util.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.
|
修飾子とタイプ | メソッド | 説明 |
---|---|---|
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(java.lang.String dest,
byte[] data,
int proto,
int fromPort,
int toPort) |
Send bytes through a SAM message-based session.
|
protected boolean |
sendBytesThroughMessageSession(java.lang.String dest,
byte[] data,
int proto,
int fromPort,
int toPort) |
Actually send bytes through the SAM message-based session I2PSession
(er...).
|
protected boolean |
sendBytesThroughMessageSession(java.lang.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, wait
sendBytes
protected final Log _log
protected final boolean _isOwnSession
protected SAMMessageSession(java.lang.String dest, java.util.Properties props) throws java.io.IOException, DataFormatException, I2PSessionException
dest
- Base64-encoded destination and private keys (same format as PrivateKeyFile)props
- Properties to setup the I2P sessionjava.io.IOException
DataFormatException
I2PSessionException
protected SAMMessageSession(java.io.InputStream destStream, java.util.Properties props) throws java.io.IOException, DataFormatException, I2PSessionException
destStream
- Input stream containing the destination and private keys (same format as PrivateKeyFile)props
- Properties to setup the I2P sessionjava.io.IOException
DataFormatException
I2PSessionException
protected SAMMessageSession(I2PSession sess, int listenProtocol, int listenPort) throws java.io.IOException, DataFormatException, I2PSessionException
java.io.IOException
DataFormatException
I2PSessionException
public void start()
SAMMessageSess
start
インタフェース内 SAMMessageSess
public Destination getDestination()
getDestination
インタフェース内 SAMMessageSess
public int getListenProtocol()
getListenProtocol
インタフェース内 SAMMessageSess
public int getListenPort()
getListenPort
インタフェース内 SAMMessageSess
public abstract boolean sendBytes(java.lang.String dest, byte[] data, int proto, int fromPort, int toPort) throws DataFormatException, I2PSessionException
sendBytes
インタフェース内 SAMMessageSess
dest
- Destinationdata
- Bytes to be sentDataFormatException
- on unknown / bad destI2PSessionException
- on serious error, probably session closedprotected boolean sendBytesThroughMessageSession(java.lang.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(java.lang.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
インタフェース内 java.lang.AutoCloseable
close
インタフェース内 java.io.Closeable
close
インタフェース内 SAMMessageSess
protected abstract void messageReceived(byte[] msg, int proto, int fromPort, int toPort)
msg
- Message payloadprotected abstract void shutDown()
protected I2PSession getI2PSession()