class 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 and 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 and Description |
|---|---|
void | accept(SAMv3Handler handler,
boolean verbose)Accept a single incoming I2P stream and pipe data through the handler's
socket. |
String | add(String nick,
String style,
Properties props)Add a session |
void | close()Close the primary/master session and all subsessions. |
void | connectAsync(SAMv3Handler handler,
String dest,
Properties props)Initiate an async STREAM CONNECT. |
void | disconnected(I2PSession session)Called when the I2P session is disconnected. |
void | errorOccurred(I2PSession session,
String message,
Throwable error)Called when an I2P error occurs. |
int | getListenPort()Get the port for this session's listener. |
int | getListenProtocol()Get the I2CP protocol for this session's listener. |
void | messageAvailable(I2PSession session,
int msgId,
long size)Called when a message is available (unmuxed). |
void | messageAvailable(I2PSession session,
int msgId,
long size,
int proto,
int fromPort,
int toPort)Called when a muxed message is available. |
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)Called when abuse is reported on the session. |
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. |
getDB, getNick, getSocketServer, queueSocketcheckSocketHandlerId, closeConnection, connect, createSocketHandler, getDestination, getSocketReader, isDestroyed, lookupDest, newSAMStreamSessionSocketReader, newStreamSender, removeSocketHandler, sendBytes, sendBytes, sendBytes, setReceiveLimitclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetDestination, lookupDest, sendBytes, sendBytespublic MasterSession(String nick, SAMv3DatagramServer dgServer, SAMv3Handler handler, Properties props) throws IOException, DataFormatException, SAMException
nick - nickname of the sessionIOExceptionDataFormatExceptionSAMExceptionpublic void accept(SAMv3Handler handler, boolean verbose) throws SAMException
SAMv3StreamSessionaccept in class SAMv3StreamSessionhandler - handler whose socket becomes the I2P data pipeverbose - if true, send peer Destination as first lineSAMException - alwayspublic String add(String nick, String style, Properties props)
public void close()
close in interface Closeableclose in interface AutoCloseableclose in interface SAMMessageSessclose in class SAMv3StreamSessionpublic void connectAsync(SAMv3Handler handler, String dest, Properties props) throws DataFormatException
SAMv3StreamSessionconnectAsync in class SAMv3StreamSessionhandler - handler whose socket becomes the I2P data pipedest - Base64-encoded Destinationprops - connection optionsDataFormatException - alwayspublic void disconnected(I2PSession session)
disconnected in interface I2PSessionListenerdisconnected in interface I2PSessionMuxedListenersession - the disconnected sessionpublic void errorOccurred(I2PSession session, String message, Throwable error)
errorOccurred in interface I2PSessionListenererrorOccurred in interface I2PSessionMuxedListenersession - the sessionmessage - error descriptionerror - the exception, if anypublic int getListenPort()
SAMStreamSessiongetListenPort in interface SAMMessageSessgetListenPort in class SAMStreamSessionpublic int getListenProtocol()
SAMStreamSessiongetListenProtocol in interface SAMMessageSessgetListenProtocol in class SAMStreamSessionpublic void messageAvailable(I2PSession session, int msgId, long size)
messageAvailable in interface I2PSessionListenermessageAvailable in interface I2PSessionMuxedListenersession - the sessionmsgId - the message IDsize - the message sizepublic void messageAvailable(I2PSession session, int msgId, long size, int proto, int fromPort, int toPort)
messageAvailable in interface I2PSessionMuxedListenersession - the sessionmsgId - the message IDsize - the message sizeproto - the protocol numberfromPort - the source porttoPort - the destination portpublic 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 receiveRawBytes(byte[] data,
int proto,
int fromPort,
int toPort)
throws IOExceptionSAMRawReceiverreceiveRawBytes in interface SAMRawReceiverdata - Byte array to be receivedproto - I2CP protocolfromPort - I2CP from porttoPort - I2CP to portIOException - alwayspublic String remove(String nick, Properties props)
props - session configuration properties, may be nullpublic void reportAbuse(I2PSession session, int severity)
reportAbuse in interface I2PSessionListenerreportAbuse in interface I2PSessionMuxedListenersession - the sessionseverity - the abuse severity levelpublic void start()
start in interface SAMMessageSessstart in class SAMStreamSessionpublic void startForwardingIncoming(Properties props, boolean sendPorts) throws SAMException
SAMv3StreamSessionstartForwardingIncoming in class SAMv3StreamSessionSAMException - alwayspublic void stopDatagramReceiving()
stopDatagramReceiving in interface SAMDatagramReceiverpublic void stopForwardingIncoming()
stopForwardingIncoming in class SAMv3StreamSessionpublic void stopRawReceiving()
stopRawReceiving in interface SAMRawReceiver