|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.client.I2PSessionImpl
net.i2p.client.I2PSessionImpl2
class I2PSessionImpl2
Thread safe implementation of an I2P session running over TCP.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class net.i2p.client.I2PSessionImpl |
---|
I2PSessionImpl.AvailabilityNotifier, I2PSessionImpl.VerifyUsage |
Field Summary |
---|
Fields inherited from class net.i2p.client.I2PSessionImpl |
---|
_availabilityNotifier, _availableMessages, _closed, _closing, _context, _handlerMap, _hostname, _log, _opening, _out, _portNum, _producer, _reader, _sessionListener, _socket, _writer, LISTEN_PORT |
Fields inherited from interface net.i2p.client.I2PSession |
---|
PORT_ANY, PORT_UNSPECIFIED, PROTO_ANY, PROTO_DATAGRAM, PROTO_STREAMING, PROTO_UNSPECIFIED |
Constructor Summary | |
---|---|
I2PSessionImpl2()
for extension |
|
I2PSessionImpl2(I2PAppContext ctx,
java.io.InputStream destKeyStream,
java.util.Properties options)
Create a new session, reading the Destination, PrivateKey, and SigningPrivateKey from the destKeyStream, and using the specified options to connect to the router |
Method Summary | |
---|---|
void |
addMuxedSessionListener(I2PSessionMuxedListener l,
int proto,
int port)
See I2PSessionMuxedImpl for details |
void |
addSessionListener(I2PSessionListener lsnr,
int proto,
int port)
See I2PSessionMuxedImpl for details |
void |
destroySession(boolean sendDisconnect)
Tear down the session, and do NOT reconnect. |
protected long |
getTimeout()
|
byte[] |
receiveMessage(int msgId)
pull the unencrypted AND DECOMPRESSED data |
void |
receiveStatus(int msgId,
long nonce,
int status)
|
protected boolean |
reconnect()
Called whenever we want to reconnect (used only in the superclass). |
void |
removeListener(int proto,
int port)
See I2PSessionMuxedImpl for details |
protected boolean |
sendBestEffort(Destination dest,
byte[] payload,
SessionKey keyUsed,
java.util.Set tagsSent,
long expires)
|
boolean |
sendMessage(Destination dest,
byte[] payload)
Send the data to the destination. |
boolean |
sendMessage(Destination dest,
byte[] payload,
int offset,
int size)
|
boolean |
sendMessage(Destination dest,
byte[] payload,
int proto,
int fromport,
int toport)
See I2PSessionMuxedImpl for details |
boolean |
sendMessage(Destination dest,
byte[] payload,
int offset,
int size,
SessionKey keyUsed,
java.util.Set tagsSent)
|
boolean |
sendMessage(Destination dest,
byte[] payload,
int offset,
int size,
SessionKey keyUsed,
java.util.Set tagsSent,
int proto,
int fromport,
int toport)
See I2PSessionMuxedImpl for details |
boolean |
sendMessage(Destination dest,
byte[] payload,
int offset,
int size,
SessionKey keyUsed,
java.util.Set tagsSent,
long expires)
|
boolean |
sendMessage(Destination dest,
byte[] payload,
int offset,
int size,
SessionKey keyUsed,
java.util.Set tagsSent,
long expire,
int proto,
int fromport,
int toport)
See I2PSessionMuxedImpl for details |
boolean |
sendMessage(Destination dest,
byte[] payload,
SessionKey keyUsed,
java.util.Set tagsSent)
Like sendMessage above, except the key used and the tags sent are exposed to the application. |
protected boolean |
shouldCompress(int size)
|
Methods inherited from class net.i2p.client.I2PSessionImpl |
---|
addNewMessage, bandwidthLimits, connect, dateUpdated, destroySession, disconnect, disconnected, getDecryptionKey, getLeaseSet, getMyDestination, getOpening, getOptions, getPrefix, getPrivateKey, getProducer, getSessionId, isClosed, lastActivity, loadConfig, lookupDest, messageReceived, propogateError, readError, reportAbuse, sendMessage, setLeaseSet, setOpening, setReduced, setSessionId, setSessionListener, shouldReconnect, toString, updateActivity |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public I2PSessionImpl2()
public I2PSessionImpl2(I2PAppContext ctx, java.io.InputStream destKeyStream, java.util.Properties options) throws I2PSessionException
I2PSessionException
- if there is a problem loading the private keys orMethod Detail |
---|
protected long getTimeout()
public void destroySession(boolean sendDisconnect)
I2PSessionImpl
destroySession
in class I2PSessionImpl
protected boolean shouldCompress(int size)
public void addSessionListener(I2PSessionListener lsnr, int proto, int port)
I2PSession
public void addMuxedSessionListener(I2PSessionMuxedListener l, int proto, int port)
I2PSession
public void removeListener(int proto, int port)
I2PSession
public boolean sendMessage(Destination dest, byte[] payload, int proto, int fromport, int toport) throws I2PSessionException
I2PSession
I2PSessionException
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, java.util.Set tagsSent, int proto, int fromport, int toport) throws I2PSessionException
I2PSession
I2PSessionException
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, java.util.Set tagsSent, long expire, int proto, int fromport, int toport) throws I2PSessionException
I2PSession
I2PSessionException
public boolean sendMessage(Destination dest, byte[] payload) throws I2PSessionException
I2PSessionImpl
sendMessage
in interface I2PSession
sendMessage
in class I2PSessionImpl
dest
- location to send the messagepayload
- body of the message to be sent (unencrypted)
I2PSessionException
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size) throws I2PSessionException
I2PSessionException
public boolean sendMessage(Destination dest, byte[] payload, SessionKey keyUsed, java.util.Set tagsSent) throws I2PSessionException
I2PSession
SessionKeyManager.getInstance().tagsDelivered(dest.getPublicKey(), keyUsed, tagsSent);If an application is using guaranteed delivery mode, this is not useful, but for applications using best effort delivery mode, if they can know with certainty that a message was delivered and can update the SessionKeyManager appropriately, a significant performance boost will occur (subsequent message encryption and decryption will be done via AES and a SessionTag, rather than ElGamal+AES, which is 1000x slower).
sendMessage
in interface I2PSession
sendMessage
in class I2PSessionImpl
keyUsed
- unused - no end-to-end cryptotagsSent
- unused - no end-to-end cryptodest
- location to send the messagepayload
- body of the message to be sent (unencrypted)
I2PSessionException
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, java.util.Set tagsSent) throws I2PSessionException
keyUsed
- unused - no end-to-end cryptotagsSent
- unused - no end-to-end crypto
I2PSessionException
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, java.util.Set tagsSent, long expires) throws I2PSessionException
keyUsed
- unused - no end-to-end cryptotagsSent
- unused - no end-to-end crypto
I2PSessionException
public byte[] receiveMessage(int msgId) throws I2PSessionException
receiveMessage
in interface I2PSession
receiveMessage
in class I2PSessionImpl
msgId
- message to fetch
I2PSessionException
protected boolean sendBestEffort(Destination dest, byte[] payload, SessionKey keyUsed, java.util.Set tagsSent, long expires) throws I2PSessionException
keyUsed
- unused - no end-to-end cryptotagsSent
- unused - no end-to-end crypto
I2PSessionException
public void receiveStatus(int msgId, long nonce, int status)
receiveStatus
in class I2PSessionImpl
protected boolean reconnect()
reconnect
in class I2PSessionImpl
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |