class I2PSessionImpl2 extends I2PSessionImpl
I2PSessionImpl.AvailabilityNotifier, I2PSessionImpl.State
Modifier and Type | Field and Description |
---|---|
protected boolean |
_noEffort
Don't expect any MSMs from the router for outbound traffic @since 0.8.1
|
protected Map<Long,MessageState> |
_sendingStates
set of MessageState objects, representing all of the messages in the process of being sent
|
protected AtomicLong |
_sendMessageNonce |
_availabilityNotifier, _availableMessages, _bwLimits, _bwReceivedLock, _context, _handlerMap, _hostname, _leaseSet, _leaseSetWait, _log, _pendingLookups, _portNum, _producer, _queue, _reader, _sessionListener, _socket, _state, _stateLock, _writer, CACHE_MAX_SIZE, LISTEN_PORT, PROP_DOMAIN_SOCKET, PROP_ENABLE_SSL, PROP_PW, PROP_USER
PORT_ANY, PORT_UNSPECIFIED, PROTO_ANY, PROTO_DATAGRAM, PROTO_DATAGRAM_RAW, PROTO_STREAMING, PROTO_UNSPECIFIED
Modifier | Constructor and Description |
---|---|
protected |
I2PSessionImpl2(I2PAppContext ctx,
InputStream destKeyStream,
Properties options)
for extension by I2PSessionMuxedImpl
Create a new session, reading the Destination, PrivateKey, and SigningPrivateKey
from the destKeyStream, and using the specified options to connect to the router
|
protected |
I2PSessionImpl2(I2PAppContext context,
Properties options,
I2PClientMessageHandlerMap handlerMap)
for extension by SimpleSession (no dest)
|
protected |
I2PSessionImpl2(I2PSessionImpl primary,
InputStream destKeyStream,
Properties options) |
Modifier and Type | Method and Description |
---|---|
void |
addMuxedSessionListener(I2PSessionMuxedListener l,
int proto,
int port)
Listen on specified protocol and port, and receive notification
of proto, fromPort, and toPort for every message.
|
void |
addSessionListener(I2PSessionListener lsnr,
int proto,
int port)
Listen on specified protocol and port.
|
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)
Only call this with nonzero status, i.e.
|
protected boolean |
reconnect()
Called whenever we want to reconnect (used only in the superclass).
|
void |
removeListener(int proto,
int port)
removes the specified listener (only)
|
protected boolean |
sendBestEffort(Destination dest,
byte[] payload,
long expires,
int flags)
TODO - Don't need to save MessageState since actuallyWait is false...
|
protected boolean |
sendBestEffort(Destination dest,
byte[] payload,
SessionKey keyUsed,
Set<SessionTag> tagsSent,
long expires) |
boolean |
sendMessage(Destination dest,
byte[] payload)
unused, see MuxedImpl override
|
boolean |
sendMessage(Destination dest,
byte[] payload,
int offset,
int size)
Send a new message to the given destination, containing the specified
payload, returning true if the router feels confident that the message
was delivered.
|
boolean |
sendMessage(Destination dest,
byte[] payload,
int proto,
int fromport,
int toport)
See I2PSessionMuxedImpl for proto/port details.
|
boolean |
sendMessage(Destination dest,
byte[] payload,
int offset,
int size,
int proto,
int fromport,
int toport,
SendMessageOptions options)
See I2PSessionMuxedImpl for proto/port details.
|
long |
sendMessage(Destination dest,
byte[] payload,
int offset,
int size,
int proto,
int fromport,
int toport,
SendMessageOptions options,
SendMessageStatusListener listener)
Send a message and request an asynchronous notification of delivery status.
|
boolean |
sendMessage(Destination dest,
byte[] payload,
int offset,
int size,
SessionKey keyUsed,
Set<SessionTag> tagsSent)
End-to-End Crypto is disabled, tags and keys are ignored.
|
boolean |
sendMessage(Destination dest,
byte[] payload,
int offset,
int size,
SessionKey keyUsed,
Set<SessionTag> tagsSent,
int proto,
int fromport,
int toport)
See I2PSessionMuxedImpl for proto/port details.
|
boolean |
sendMessage(Destination dest,
byte[] payload,
int offset,
int size,
SessionKey keyUsed,
Set<SessionTag> tagsSent,
long expires)
Unused? see MuxedImpl override
|
boolean |
sendMessage(Destination dest,
byte[] payload,
int offset,
int size,
SessionKey keyUsed,
Set<SessionTag> tagsSent,
long expire,
int proto,
int fromport,
int toport)
See I2PSessionMuxedImpl for proto/port details.
|
boolean |
sendMessage(Destination dest,
byte[] payload,
int offset,
int size,
SessionKey keyUsed,
Set<SessionTag> tagsSent,
long expire,
int proto,
int fromport,
int toport,
int flags)
See I2PSessionMuxedImpl for proto/port details.
|
boolean |
sendMessage(Destination dest,
byte[] payload,
SessionKey keyUsed,
Set<SessionTag> tagsSent)
End-to-End Crypto is disabled, tags and keys are ignored!
Like sendMessage above, except the key used and the tags sent are exposed to the
application.
|
protected boolean |
sendNoEffort(Destination dest,
byte[] payload,
long expires,
int flags)
Same as sendBestEffort(), except we do not expect any MessageStatusMessage responses -
not for accepted, or success, or failure.
|
protected boolean |
shouldCompress(int size) |
protected void |
startVerifyUsage()
Fire up a periodic task to check for unclaimed messages
|
addNewMessage, addSubsession, bandwidthLimits, bwReceived, changeState, clearCache, connect, dateUpdated, destLookupFailed, destLookupFailed, destReceived, destReceived, destroySession, disconnect, disconnected, getContext, getDecryptionKey, getFastReceive, getHandlerMap, getLeaseSet, getMyDestination, getOptions, getPrefix, getPrivateKey, getProducer, getSessionId, getSubsessions, isClosed, lastActivity, lookupDest, lookupDest, lookupDest, lookupDest, messageReceived, propogateError, readError, removeSubsession, reportAbuse, sendMessage_unchecked, sendMessage, setLeaseSet, setReduced, setSessionId, setSessionListener, shouldReconnect, toString, updateActivity, updateOptions, verifyOpen, waitForDate
protected final Map<Long,MessageState> _sendingStates
protected final AtomicLong _sendMessageNonce
protected boolean _noEffort
protected I2PSessionImpl2(I2PAppContext context, Properties options, I2PClientMessageHandlerMap handlerMap)
protected I2PSessionImpl2(I2PAppContext ctx, InputStream destKeyStream, Properties options) throws I2PSessionException
destKeyStream
- stream containing the private key data,
format is specified in PrivateKeyFile
options
- set of options to configure the router with, if null will use System propertiesI2PSessionException
- if there is a problem loading the private keysprotected I2PSessionImpl2(I2PSessionImpl primary, InputStream destKeyStream, Properties options) throws I2PSessionException
I2PSessionException
protected void startVerifyUsage()
startVerifyUsage
in class I2PSessionImpl
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
proto
- 1-254 or PROTO_ANY (0) for all; recommended:
I2PSession.PROTO_STREAMING
I2PSession.PROTO_DATAGRAM
255 disallowedport
- 1-65535 or PORT_ANY (0) for allUnsupportedOperationException
- always, use MuxedImplpublic void addMuxedSessionListener(I2PSessionMuxedListener l, int proto, int port)
I2PSession
proto
- 1-254 or PROTO_ANY (0) for all; 255 disallowedport
- 1-65535 or PORT_ANY (0) for allUnsupportedOperationException
- always, use MuxedImplpublic void removeListener(int proto, int port)
I2PSession
UnsupportedOperationException
- always, use MuxedImplpublic boolean sendMessage(Destination dest, byte[] payload, int proto, int fromport, int toport) throws I2PSessionException
I2PSession
UnsupportedOperationException
- always, use MuxedImplI2PSessionException
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set<SessionTag> tagsSent, int proto, int fromport, int toport) throws I2PSessionException
I2PSession
keyUsed
- UNUSED, IGNORED.tagsSent
- UNUSED, IGNORED.proto
- 1-254 or 0 for unset; recommended:
I2PSession.PROTO_UNSPECIFIED
I2PSession.PROTO_STREAMING
I2PSession.PROTO_DATAGRAM
255 disallowedfromport
- 1-65535 or 0 for unsettoport
- 1-65535 or 0 for unsetUnsupportedOperationException
- always, use MuxedImplI2PSessionException
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set<SessionTag> tagsSent, long expire, int proto, int fromport, int toport) throws I2PSessionException
I2PSession
keyUsed
- UNUSED, IGNORED.tagsSent
- UNUSED, IGNORED.expire
- absolute expiration timestamp, NOT interval from nowproto
- 1-254 or 0 for unset; recommended:
I2PSession.PROTO_UNSPECIFIED
I2PSession.PROTO_STREAMING
I2PSession.PROTO_DATAGRAM
255 disallowedfromport
- 1-65535 or 0 for unsettoport
- 1-65535 or 0 for unsetUnsupportedOperationException
- always, use MuxedImplI2PSessionException
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set<SessionTag> tagsSent, long expire, int proto, int fromport, int toport, int flags) throws I2PSessionException
I2PSession
keyUsed
- UNUSED, IGNORED.tagsSent
- UNUSED, IGNORED.expire
- absolute expiration timestamp, NOT interval from nowproto
- 1-254 or 0 for unset; recommended:
I2PSession.PROTO_UNSPECIFIED
I2PSession.PROTO_STREAMING
I2PSession.PROTO_DATAGRAM
255 disallowedfromport
- 1-65535 or 0 for unsettoport
- 1-65535 or 0 for unsetUnsupportedOperationException
- always, use MuxedImplI2PSessionException
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, int proto, int fromport, int toport, SendMessageOptions options) throws I2PSessionException
I2PSession
proto
- 1-254 or 0 for unset; recommended:
I2PSession.PROTO_UNSPECIFIED
I2PSession.PROTO_STREAMING
I2PSession.PROTO_DATAGRAM
255 disallowedfromport
- 1-65535 or 0 for unsettoport
- 1-65535 or 0 for unsetoptions
- to be passed to the routerUnsupportedOperationException
- always, use MuxedImplI2PSessionException
public long sendMessage(Destination dest, byte[] payload, int offset, int size, int proto, int fromport, int toport, SendMessageOptions options, SendMessageStatusListener listener) throws I2PSessionException
I2PSession
proto
- 1-254 or 0 for unset; recommended:
I2PSession.PROTO_UNSPECIFIED
I2PSession.PROTO_STREAMING
I2PSession.PROTO_DATAGRAM
255 disallowedfromport
- 1-65535 or 0 for unsettoport
- 1-65535 or 0 for unsetoptions
- to be passed to the routerUnsupportedOperationException
- always, use MuxedImplI2PSessionException
- on all errorspublic boolean sendMessage(Destination dest, byte[] payload) throws I2PSessionException
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
I2PSession
dest
- location to send the messagepayload
- body of the message to be sent (unencrypted)I2PSessionException
public boolean sendMessage(Destination dest, byte[] payload, SessionKey keyUsed, Set<SessionTag> tagsSent) throws I2PSessionException
I2PSession
If some application layer message delivery confirmation is used, rather than i2p's (slow) built in confirmation via guaranteed delivery mode, the application can update the SessionKeyManager, ala:
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).
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, Set<SessionTag> tagsSent) throws I2PSessionException
I2PSession
keyUsed
- unused - no end-to-end cryptotagsSent
- unused - no end-to-end cryptoI2PSessionException
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set<SessionTag> tagsSent, long expires) throws I2PSessionException
keyUsed
- unused - no end-to-end cryptotagsSent
- unused - no end-to-end cryptoexpires
- absolute expiration timestamp, NOT interval from nowI2PSessionException
public byte[] receiveMessage(int msgId) throws I2PSessionException
receiveMessage
in interface I2PSession
receiveMessage
in class I2PSessionImpl
msgId
- message to fetchI2PSessionException
protected boolean sendBestEffort(Destination dest, byte[] payload, SessionKey keyUsed, Set<SessionTag> tagsSent, long expires) throws I2PSessionException
keyUsed
- unused - no end-to-end cryptotagsSent
- unused - no end-to-end cryptoI2PSessionException
protected boolean sendBestEffort(Destination dest, byte[] payload, long expires, int flags) throws I2PSessionException
flags
- to be passed to the routerI2PSessionException
protected boolean sendNoEffort(Destination dest, byte[] payload, long expires, int flags) throws I2PSessionException
I2PSessionException
public void receiveStatus(int msgId, long nonce, int status)
receiveStatus
in class I2PSessionImpl
status
- != 0protected boolean reconnect()
reconnect
in class I2PSessionImpl