public class I2PSessionDemultiplexer extends Object implements I2PSessionMuxedListener
| Constructor and Description |
|---|
I2PSessionDemultiplexer(I2PAppContext ctx)Create a new demultiplexer. |
| Modifier and Type | Method and Description |
|---|---|
void | addListener(I2PSessionListener l,
int proto,
int port)For those that don't need to hear about the protocol and ports
in messageAvailable()
(Streaming lib) |
void | addMuxedListener(I2PSessionMuxedListener l,
int proto,
int port)For those that do care
UDP perhaps |
void | disconnected(I2PSession session)Notify the client that the session has been terminated. |
void | errorOccurred(I2PSession session,
String message,
Throwable error)Notify the client that some error occurred. |
void | messageAvailable(I2PSession session,
int msgId,
long size)Will be called only if you register via
setSessionListener() or addSessionListener(). |
void | messageAvailable(I2PSession session,
int msgId,
long size,
int proto,
int fromport,
int toport)Instruct the client that the given session has received a message
Will be called only if you register via addMuxedSessionListener(). |
static String | protocolNumberToString(int proto)Convert a protocol number to a human-readable string. |
void | removeListener(int proto,
int port)Remove a listener for the given protocol and port. |
void | reportAbuse(I2PSession session,
int severity)Instruct the client that the session specified seems to be under attack
and that the client may wish to move its destination to another router. |
public I2PSessionDemultiplexer(I2PAppContext ctx)
ctx - contextpublic void addListener(I2PSessionListener l, int proto, int port)
l - the listenerproto - the protocol numberport - the port numberpublic void addMuxedListener(I2PSessionMuxedListener l, int proto, int port)
l - the listenerproto - the protocol numberport - the port numberpublic void disconnected(I2PSession session)
I2PSessionMuxedListenerdisconnected in interface I2PSessionListenerdisconnected in interface I2PSessionMuxedListenersession - the sessionpublic void errorOccurred(I2PSession session, String message, Throwable error)
I2PSessionMuxedListenererrorOccurred in interface I2PSessionListenererrorOccurred in interface I2PSessionMuxedListenersession - the sessionmessage - the error messageerror - can be null? or not?public void messageAvailable(I2PSession session, int msgId, long size)
I2PSessionMuxedListenermessageAvailable in interface I2PSessionListenermessageAvailable in interface I2PSessionMuxedListenersession - session to notifymsgId - message number availablesize - size of the message - why it's a long and not an int is a mysterypublic void messageAvailable(I2PSession session, int msgId, long size, int proto, int fromport, int toport)
I2PSessionMuxedListenermessageAvailable in interface I2PSessionMuxedListenersession - session to notifymsgId - message number availablesize - size of the message - why it's a long and not an int is a mysteryproto - 1-254 or 0 for unspecifiedfromport - 1-65535 or 0 for unspecifiedtoport - 1-65535 or 0 for unspecifiedpublic static String protocolNumberToString(int proto)
proto - protocol numberpublic void removeListener(int proto,
int port)proto - the protocol numberport - the port numberpublic void reportAbuse(I2PSession session, int severity)
I2PSessionMuxedListenerreportAbuse in interface I2PSessionListenerreportAbuse in interface I2PSessionMuxedListenersession - session to report abuse toseverity - how bad the abuse is