Closeable, AutoCloseable, I2PSessionListener, I2PSessionMuxedListener, SAMDatagramReceiver, SAMMessageSess, SAMRawReceiver, Sessionclass MasterSession extends SAMv3StreamSession implements SAMDatagramReceiver, SAMRawReceiver, SAMMessageSess, I2PSessionMuxedListener
SAMStreamSession.DisconnectListener, SAMStreamSession.SAMStreamSessionServer, SAMStreamSession.SAMStreamSessionSocketReader, SAMStreamSession.SAMv1StreamSessionSocketReader, SAMStreamSession.StreamSender_isOwnSession, _log, canCreate, DEFAULT_FORCE_FLUSH, forceFlush, PROP_FORCE_FLUSH, recv, server, SOCKET_HANDLER_BUF_SIZE, socketMgr| Constructor | Description |
|---|---|
MasterSession(String nick,
SAMv3DatagramServer dgServer,
SAMv3Handler handler,
Properties props) |
Build a Session according to information
registered with the given nickname.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
accept(SAMv3Handler handler,
boolean verbose) |
Accept a single incoming STREAM on the socket stolen from the handler.
|
String |
add(String nick,
String style,
Properties props) |
Add a session
|
void |
close() |
Close the master session
Overridden to stop the acceptor.
|
void |
connect(SAMv3Handler handler,
String dest,
Properties props) |
Connect the SAM STREAM session to the specified Destination
for a single connection, using the socket stolen from the handler.
|
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.
|
int |
getListenPort() |
|
int |
getListenProtocol() |
|
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().
|
void |
receiveDatagramBytes(Destination sender,
byte[] data,
int proto,
int fromPort,
int toPort) |
Send a byte array to a SAM client.
|
void |
receiveRawBytes(byte[] data,
int proto,
int fromPort,
int toPort) |
Send a byte array to a SAM client, without informations
regarding the sender.
|
String |
remove(String nick,
Properties props) |
Remove a session
|
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.
|
void |
start() |
Overridden to start the acceptor.
|
void |
startForwardingIncoming(Properties props,
boolean sendPorts) |
Forward sockets from I2P to the host/port provided.
|
void |
stopDatagramReceiving() |
Does nothing.
|
void |
stopForwardingIncoming() |
does nothing
|
void |
stopRawReceiving() |
Does nothing.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetDestination, sendBytes, sendBytescheckSocketHandlerId, closeConnection, connect, createSocketHandler, getDestination, getSocketReader, newSAMStreamSessionSocketReader, newStreamSender, removeSocketHandler, sendBytes, sendBytes, sendBytes, setReceiveLimitgetDB, getNick, getSocketServer, queueSocketpublic MasterSession(String nick, SAMv3DatagramServer dgServer, SAMv3Handler handler, Properties props) throws IOException, DataFormatException, SAMException
nick - nickname of the sessionIOExceptionDataFormatExceptionSAMExceptionpublic void start()
start in interface SAMMessageSessstart in class SAMStreamSessionpublic String add(String nick, String style, Properties props)
public String remove(String nick, Properties props)
public void receiveDatagramBytes(Destination sender, byte[] data, int proto, int fromPort, int toPort) throws IOException
SAMDatagramReceiverreceiveDatagramBytes in interface SAMDatagramReceiversender - Destinationdata - Byte array to be receivedproto - I2CP protocolfromPort - I2CP from porttoPort - I2CP to portIOException - alwayspublic void stopDatagramReceiving()
stopDatagramReceiving in interface SAMDatagramReceiverpublic void receiveRawBytes(byte[] data,
int proto,
int fromPort,
int toPort)
throws IOException
SAMRawReceiverreceiveRawBytes in interface SAMRawReceiverdata - Byte array to be receivedproto - I2CP protocolfromPort - I2CP from porttoPort - I2CP to portIOException - alwayspublic void stopRawReceiving()
stopRawReceiving in interface SAMRawReceiverpublic void connect(SAMv3Handler handler, String dest, Properties props) throws I2PException
SAMv3StreamSessionconnect in class SAMv3StreamSessionhandler - The handler that communicates with the requesting clientdest - Base64-encoded Destination to connect toprops - Options to be used for connectionI2PException - alwayspublic void accept(SAMv3Handler handler, boolean verbose) throws SAMException
SAMv3StreamSessionaccept in class SAMv3StreamSessionhandler - The handler that communicates with the requesting clientverbose - If true, SAM will send the Base64-encoded peer Destination of an
incoming socket as the first line of data sent to its client
on the handler socketSAMException - alwayspublic void startForwardingIncoming(Properties props, boolean sendPorts) throws SAMException
SAMv3StreamSessionstartForwardingIncoming in class SAMv3StreamSessionSAMException - alwayspublic void stopForwardingIncoming()
stopForwardingIncoming in class SAMv3StreamSessionpublic int getListenProtocol()
getListenProtocol in interface SAMMessageSessgetListenProtocol in class SAMStreamSessionpublic int getListenPort()
getListenPort in interface SAMMessageSessgetListenPort in class SAMStreamSessionpublic void close()
close in interface AutoCloseableclose in interface Closeableclose in interface SAMMessageSessclose in class SAMv3StreamSessionpublic void disconnected(I2PSession session)
I2PSessionMuxedListenerdisconnected in interface I2PSessionListenerdisconnected in interface I2PSessionMuxedListenerpublic void errorOccurred(I2PSession session, String message, Throwable error)
I2PSessionMuxedListenererrorOccurred in interface I2PSessionListenererrorOccurred in interface I2PSessionMuxedListenererror - 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 void reportAbuse(I2PSession session, int severity)
I2PSessionMuxedListenerreportAbuse in interface I2PSessionListenerreportAbuse in interface I2PSessionMuxedListenersession - session to report abuse toseverity - how bad the abuse is