class I2PSessionImpl2 extends I2PSessionImpl
I2PSessionImpl.AvailabilityNotifier, I2PSessionImpl.StateI2PSession.TunnelPair| Modifier and Type | Field and Description |
|---|---|
protected boolean | _noEffortDon't expect any MSMs from the router for outbound traffic @since 0.8.1 |
protected Map<Long,MessageState> | _sendingStatesset of MessageState objects, representing all of the messages in the process of being sent |
protected AtomicLong | _sendMessageNonce_sendMessageNonce. |
_availabilityNotifier, _availableMessages, _bwLimits, _bwReceivedLock, _context, _handlerMap, _hostname, _leaseSet, _leaseSetWait, _log, _pendingLookups, _portNum, _producer, _queue, _reader, _sessionListener, _socket, _state, _stateLock, _transientSigningPublicKey, _tunnelStatusListeners, _writer, CACHE_MAX_SIZE, DUMMY_SESSION, LISTEN_PORT, PROP_DOMAIN_SOCKETPORT_ANY, PORT_UNSPECIFIED, PROTO_ANY, PROTO_DATAGRAM, PROTO_DATAGRAM_RAW, PROTO_DATAGRAM2, PROTO_DATAGRAM3, 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)I2PSessionImpl2. |
| Modifier and Type | Method and Description |
|---|---|
void | addMuxedSessionListener(I2PSessionMuxedListener l,
int proto,
int port)Not supported. |
void | addSessionListener(I2PSessionListener lsnr,
int proto,
int port)Not supported. |
void | addTunnelStatusListener(TunnelStatusListener lsnr)Add a listener for tunnel status changes. |
void | destroySession(boolean sendDisconnect)destroySession. |
I2PSession.TunnelPair | getCurrentTunnelPair()getCurrentTunnelPair. |
protected long | getTimeout()Return the timeout value. |
protected void | notifyPoolShuttingDown(String poolName,
boolean isInbound)Notify listeners of pool shutdown. |
protected void | notifyTunnelFailed(String poolName,
boolean isInbound)Notify listeners of a tunnel failure. |
protected void | notifyTunnelRemoved(TunnelRemovalEvent event)Notify listeners of a tunnel removal. |
void | rebuildTunnels()rebuildTunnels. |
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)Not supported. |
void | removeTunnelStatusListener(TunnelStatusListener lsnr)removeTunnelStatusListener. |
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)Send a message with best effort delivery. |
boolean | sendMessage(Destination dest,
byte[] payload)unused, see MuxedImpl override |
boolean | sendMessage(Destination dest,
byte[] payload,
int offset,
int size)sendMessage. |
boolean | sendMessage(Destination dest,
byte[] payload,
int proto,
int fromport,
int toport)Not supported. |
boolean | sendMessage(Destination dest,
byte[] payload,
int offset,
int size,
int proto,
int fromport,
int toport,
SendMessageOptions options)Not supported. |
long | sendMessage(Destination dest,
byte[] payload,
int offset,
int size,
int proto,
int fromport,
int toport,
SendMessageOptions options,
SendMessageStatusListener listener)Not supported. |
boolean | sendMessage(Destination dest,
byte[] payload,
int offset,
int size,
SessionKey keyUsed,
Set<SessionTag> tagsSent)Send a message with session key and tags. |
boolean | sendMessage(Destination dest,
byte[] payload,
int offset,
int size,
SessionKey keyUsed,
Set<SessionTag> tagsSent,
int proto,
int fromport,
int toport)Not supported. |
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)Not supported. |
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)Not supported. |
boolean | sendMessage(Destination dest,
byte[] payload,
SessionKey keyUsed,
Set<SessionTag> tagsSent)Send a message with session key and tags. |
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. |
void | setCurrentTunnelPair(I2PSession.TunnelPair pair)setCurrentTunnelPair. |
protected boolean | shouldCompress(int size)Return whether compression should be used. |
protected void | startVerifyUsage()Fire up a periodic task to check for unclaimed messages |
boolean | switchToNewTunnel()switchToNewTunnel. |
addNewMessage, addSubsession, bandwidthLimits, bwReceived, changeState, clearCache, connect, dateUpdated, destLookupFailed, destLookupFailed, destReceived, destReceived, destroySession, disconnect, disconnected, getContext, getFastReceive, getHandlerMap, getLastLS2SignTime, getLeaseSet, getMyDestination, getName, getOfflineExpiration, getOfflineSignature, getOptions, getPrefix, getPrivateKey, getProducer, getRouterVersion, getSessionId, getSubsessions, getTransientSigningPublicKey, isClosed, isOffline, lastActivity, lookupDest, lookupDest, lookupDest, lookupDest, lookupDest, lookupDest, lookupDest2, messageReceived, propagateError, readError, removeSubsession, reportAbuse, sendBlindingInfo, sendMessage_unchecked, sendMessage, setLastLS2SignTime, setLeaseSet, setReduced, setSessionId, setSessionListener, shouldReconnect, supportsLS2, toString, updateActivity, updateOptions, verifyOpen, waitForDateclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetDecryptionKeyprotected boolean _noEffort
protected final Map<Long,MessageState> _sendingStates
protected final AtomicLong _sendMessageNonce
protected I2PSessionImpl2(I2PAppContext ctx, InputStream destKeyStream, Properties options) throws I2PSessionException
destKeyStream - stream containing the private key data, format is specified in PrivateKeyFileoptions - set of options to configure the router with, if null will use System propertiesI2PSessionException - if there is a problem loading the private keysprotected I2PSessionImpl2(I2PAppContext context, Properties options, I2PClientMessageHandlerMap handlerMap)
protected I2PSessionImpl2(I2PSessionImpl primary, InputStream destKeyStream, Properties options) throws I2PSessionException
I2PSessionExceptionpublic void addMuxedSessionListener(I2PSessionMuxedListener l, int proto, int port)
l - the listener to addproto - 1-254 or PROTO_ANY (0) for all; 255 disallowedport - 1-65535 or PORT_ANY (0) for allUnsupportedOperationException - alwayspublic void addSessionListener(I2PSessionListener lsnr, int proto, int port)
lsnr - the listener to addproto - 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 - alwayspublic void addTunnelStatusListener(TunnelStatusListener lsnr)
lsnr - the listener to addpublic void destroySession(boolean sendDisconnect)
destroySession in class I2PSessionImplsendDisconnect - if true, send disconnect message to routerpublic I2PSession.TunnelPair getCurrentTunnelPair()
protected long getTimeout()
protected void notifyPoolShuttingDown(String poolName, boolean isInbound)
protected void notifyTunnelFailed(String poolName, boolean isInbound)
protected void notifyTunnelRemoved(TunnelRemovalEvent event)
public void rebuildTunnels()
public byte[] receiveMessage(int msgId)
throws I2PSessionExceptionreceiveMessage in interface I2PSessionreceiveMessage in class I2PSessionImplmsgId - message to fetchI2PSessionException - on errorpublic void receiveStatus(int msgId,
long nonce,
int status)receiveStatus in class I2PSessionImplstatus - != 0msgId - the message IDnonce - the nonceprotected boolean reconnect()
reconnect in class I2PSessionImplpublic void removeListener(int proto,
int port)proto - protocol numberport - port numberUnsupportedOperationException - alwayspublic void removeTunnelStatusListener(TunnelStatusListener lsnr)
lsnr - the listener to removeprotected boolean sendBestEffort(Destination dest, byte[] payload, long expires, int flags) throws I2PSessionException
dest - the destinationpayload - the payloadexpires - expiration timeflags - to be passed to the routerI2PSessionExceptionprotected boolean sendBestEffort(Destination dest, byte[] payload, SessionKey keyUsed, Set<SessionTag> tagsSent, long expires) throws I2PSessionException
dest - the destinationpayload - the payloadkeyUsed - unused - no end-to-end cryptotagsSent - unused - no end-to-end cryptoexpires - expiration timeI2PSessionExceptionpublic boolean sendMessage(Destination dest, byte[] payload) throws I2PSessionException
dest - location to send the messagepayload - body of the message to be sent (unencrypted)I2PSessionException - on errorpublic boolean sendMessage(Destination dest, byte[] payload, int offset, int size) throws I2PSessionException
dest - location to send the messagepayload - body of the message to be sent (unencrypted)offset - offset into the payloadsize - number of bytes to sendI2PSessionException - on errorpublic boolean sendMessage(Destination dest, byte[] payload, int proto, int fromport, int toport) throws I2PSessionException
dest - location to send the messagepayload - body of the message to be sent (unencrypted)proto - protocol numberfromport - source porttoport - destination portUnsupportedOperationException - alwaysI2PSessionException - on errorpublic boolean sendMessage(Destination dest, byte[] payload, int offset, int size, int proto, int fromport, int toport, SendMessageOptions options) throws I2PSessionException
dest - location to send the messagepayload - body of the message to be sent (unencrypted)offset - offset into the payloadsize - number of bytes to sendproto - 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 - alwaysI2PSessionException - on errorpublic long sendMessage(Destination dest, byte[] payload, int offset, int size, int proto, int fromport, int toport, SendMessageOptions options, SendMessageStatusListener listener) throws I2PSessionException
dest - location to send the messagepayload - body of the message to be sent (unencrypted)offset - offset into the payloadsize - number of bytes to sendproto - 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 routerlistener - for delivery status notificationUnsupportedOperationException - alwaysI2PSessionException - on all errorspublic boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set<SessionTag> tagsSent) throws I2PSessionException
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)offset - offset into the payloadsize - number of bytes to sendI2PSessionException - on errorpublic boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set<SessionTag> tagsSent, int proto, int fromport, int toport) throws I2PSessionException
dest - location to send the messagepayload - body of the message to be sent (unencrypted)offset - offset into the payloadsize - number of bytes to sendkeyUsed - 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 - alwaysI2PSessionException - on errorpublic 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 cryptodest - location to send the messagepayload - body of the message to be sent (unencrypted)offset - offset into the payloadsize - number of bytes to sendexpires - absolute expiration timestamp, NOT interval from nowI2PSessionException - on errorpublic 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
dest - location to send the messagepayload - body of the message to be sent (unencrypted)offset - offset into the payloadsize - number of bytes to sendkeyUsed - 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 - alwaysI2PSessionException - on errorpublic 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
dest - location to send the messagepayload - body of the message to be sent (unencrypted)offset - offset into the payloadsize - number of bytes to sendkeyUsed - 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 unsetflags - message flagsUnsupportedOperationException - alwaysI2PSessionException - on errorpublic boolean sendMessage(Destination dest, byte[] payload, SessionKey keyUsed, Set<SessionTag> tagsSent) throws I2PSessionException
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 - on errorprotected boolean sendNoEffort(Destination dest, byte[] payload, long expires, int flags) throws I2PSessionException
I2PSessionExceptionpublic void setCurrentTunnelPair(I2PSession.TunnelPair pair)
pair - the tunnel pair in useprotected boolean shouldCompress(int size)
protected void startVerifyUsage()
startVerifyUsage in class I2PSessionImplpublic boolean switchToNewTunnel()