|
||||||||||
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
net.i2p.client.I2PSessionMuxedImpl
class I2PSessionMuxedImpl
I2PSession with protocol and ports Streaming lib has been modified to send I2PSession.PROTO_STREAMING but still receives all. It sends with fromPort and toPort = 0, and receives on all ports. No datagram apps have been modified yet. Therefore the compatibility situation is as follows: Compatibility: old streaming -> new streaming: sends proto anything, rcvs proto anything new streaming -> old streaming: sends PROTO_STREAMING, ignores rcvd proto old datagram -> new datagram: sends proto anything, rcvs proto anything new datagram -> old datagram: sends PROTO_DATAGRAM, ignores rcvd proto In all the above cases, streaming and datagram receive traffic for the other protocol, same as before. old datagram -> new muxed: doesn't work because the old sends proto 0 but the udp side of the mux registers with PROTO_DATAGRAM, so the datagrams go to the streaming side, same as before. old streaming -> new muxed: works Typical Usage: Streaming + datagrams: I2PSocketManager sockMgr = getSocketManager(); I2PSession session = sockMgr.getSession(); session.addMuxedSessionListener(myI2PSessionMuxedListener, I2PSession.PROTO_DATAGRAM, I2PSession.PORT_ANY); * or * session.addSessionListener(myI2PSessionListener, I2PSession.PROTO_DATAGRAM, I2PSession.PORT_ANY); session.sendMessage(dest, payload, I2PSession.PROTO_DATAGRAM, fromPort, toPort); Datagrams only, with multiple ports: I2PClient client = I2PClientFactory.createClient(); ... I2PSession session = client.createSession(...); session.addMuxedSessionListener(myI2PSessionMuxedListener, I2PSession.PROTO_DATAGRAM, I2PSession.PORT_ANY); * or * session.addSessionListener(myI2PSessionListener, I2PSession.PROTO_DATAGRAM, I2PSession.PORT_ANY); session.sendMessage(dest, payload, I2PSession.PROTO_DATAGRAM, fromPort, toPort); Multiple streaming ports: Needs some streaming lib hacking
Nested Class Summary | |
---|---|
protected class |
I2PSessionMuxedImpl.MuxedAvailabilityNotifier
|
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, _bwLimits, _bwReceivedLock, _closed, _closing, _context, _handlerMap, _hostname, _log, _opening, _out, _pendingLookups, _portNum, _producer, _queue, _reader, _sessionListener, _socket, _writer, LISTEN_PORT, PROP_ENABLE_SSL |
Fields inherited from interface net.i2p.client.I2PSession |
---|
PORT_ANY, PORT_UNSPECIFIED, PROTO_ANY, PROTO_DATAGRAM, PROTO_STREAMING, PROTO_UNSPECIFIED |
Constructor Summary | |
---|---|
I2PSessionMuxedImpl(I2PAppContext ctx,
InputStream destKeyStream,
Properties options)
|
Method Summary | |
---|---|
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 |
addNewMessage(MessagePayloadMessage msg)
Receive a payload message and let the app know its available |
void |
addSessionListener(I2PSessionListener lsnr,
int proto,
int port)
Listen on specified protocol and port. |
void |
removeListener(int proto,
int port)
removes the specified listener (only) |
boolean |
sendMessage(Destination dest,
byte[] payload)
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,
SessionKey keyUsed,
Set 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 tagsSent,
long expires)
End-to-End Crypto is disabled, tags and keys are ignored. |
boolean |
sendMessage(Destination dest,
byte[] payload,
int offset,
int size,
SessionKey keyUsed,
Set tagsSent,
long expires,
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 tagsSent,
long expires,
int proto,
int fromPort,
int toPort,
int flags)
See I2PSessionMuxedImpl for proto/port details. |
void |
setSessionListener(I2PSessionListener lsnr)
listen on all protocols and ports |
Methods inherited from class net.i2p.client.I2PSessionImpl2 |
---|
destroySession, getTimeout, receiveMessage, receiveStatus, reconnect, sendBestEffort, sendBestEffort, sendMessage, sendMessage, sendMessage, sendNoEffort, shouldCompress |
Methods inherited from class net.i2p.client.I2PSessionImpl |
---|
bandwidthLimits, bwReceived, connect, dateUpdated, destLookupFailed, destReceived, destroySession, disconnect, disconnected, getDecryptionKey, getLeaseSet, getMyDestination, getOpening, getOptions, getPrefix, getPrivateKey, getProducer, getSessionId, isClosed, lastActivity, loadConfig, lookupDest, lookupDest, messageReceived, propogateError, readError, reportAbuse, sendMessage, setLeaseSet, setOpening, setReduced, setSessionId, shouldReconnect, toString, updateActivity, updateOptions |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.i2p.client.I2PSession |
---|
bandwidthLimits, connect, destroySession, getDecryptionKey, getMyDestination, getPrivateKey, isClosed, lookupDest, lookupDest, receiveMessage, reportAbuse, sendMessage, sendMessage, sendMessage, updateOptions |
Constructor Detail |
---|
public I2PSessionMuxedImpl(I2PAppContext ctx, InputStream destKeyStream, Properties options) throws I2PSessionException
I2PSessionException
Method Detail |
---|
public void setSessionListener(I2PSessionListener lsnr)
setSessionListener
in interface I2PSession
setSessionListener
in class I2PSessionImpl
lsnr
- listener to retrieve eventspublic void addSessionListener(I2PSessionListener lsnr, int proto, int port)
addSessionListener
in interface I2PSession
addSessionListener
in class I2PSessionImpl2
proto
- 1-254 or PROTO_ANY for all; recommended:
I2PSession.PROTO_STREAMING
I2PSession.PROTO_DATAGRAM
255 disallowedport
- 1-65535 or PORT_ANY for allpublic void addMuxedSessionListener(I2PSessionMuxedListener l, int proto, int port)
addMuxedSessionListener
in interface I2PSession
addMuxedSessionListener
in class I2PSessionImpl2
proto
- 1-254 or 0 for all; 255 disallowedport
- 1-65535 or 0 for allpublic void removeListener(int proto, int port)
removeListener
in interface I2PSession
removeListener
in class I2PSessionImpl2
public boolean sendMessage(Destination dest, byte[] payload) throws I2PSessionException
I2PSession
sendMessage
in interface I2PSession
sendMessage
in class I2PSessionImpl2
dest
- location to send the messagepayload
- body of the message to be sent (unencrypted)
I2PSessionException
public boolean sendMessage(Destination dest, byte[] payload, int proto, int fromport, int toport) throws I2PSessionException
I2PSession
sendMessage
in interface I2PSession
sendMessage
in class I2PSessionImpl2
I2PSessionException
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set tagsSent, long expires) throws I2PSessionException
I2PSession
sendMessage
in interface I2PSession
sendMessage
in class I2PSessionImpl2
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, Set tagsSent, int proto, int fromport, int toport) throws I2PSessionException
I2PSession
sendMessage
in interface I2PSession
sendMessage
in class I2PSessionImpl2
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, Set tagsSent, long expires, int proto, int fromPort, int toPort) throws I2PSessionException
I2PSession
sendMessage
in interface I2PSession
sendMessage
in class I2PSessionImpl2
keyUsed
- unused - no end-to-end cryptotagsSent
- unused - no end-to-end cryptoproto
- 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 unset
I2PSessionException
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set tagsSent, long expires, int proto, int fromPort, int toPort, int flags) throws I2PSessionException
I2PSession
sendMessage
in interface I2PSession
sendMessage
in class I2PSessionImpl2
keyUsed
- unused - no end-to-end cryptotagsSent
- unused - no end-to-end cryptoproto
- 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
- to be passed to the router
I2PSessionException
public void addNewMessage(MessagePayloadMessage msg)
addNewMessage
in class I2PSessionImpl
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |