java.io.Closeable
, java.lang.AutoCloseable
, I2PSessionListener
, I2PSessionMuxedListener
, SAMDatagramReceiver
, SAMMessageSess
, SAMRawReceiver
class MasterSession extends SAMv3StreamSession implements SAMDatagramReceiver, SAMRawReceiver, SAMMessageSess, I2PSessionMuxedListener
_isOwnSession, _log, canCreate, DEFAULT_FORCE_FLUSH, forceFlush, PROP_FORCE_FLUSH, recv, server, SOCKET_HANDLER_BUF_SIZE, socketMgr
コンストラクタ | 説明 |
---|---|
MasterSession(java.lang.String nick,
SAMv3DatagramServer dgServer,
SAMv3Handler handler,
java.util.Properties props) |
Build a Session according to information
registered with the given nickname.
|
修飾子とタイプ | メソッド | 説明 |
---|---|---|
void |
accept(SAMv3Handler handler,
boolean verbose) |
Accept a single incoming STREAM on the socket stolen from the handler.
|
java.lang.String |
add(java.lang.String nick,
java.lang.String style,
java.util.Properties props) |
Add a session
|
void |
close() |
Close the master session
Overridden to stop the acceptor.
|
void |
connect(SAMv3Handler handler,
java.lang.String dest,
java.util.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,
java.lang.String message,
java.lang.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.
|
java.lang.String |
remove(java.lang.String nick,
java.util.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(java.util.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, wait
getDestination, sendBytes, sendBytes
checkSocketHandlerId, closeConnection, connect, createSocketHandler, getDestination, getSocketReader, newSAMStreamSessionSocketReader, newStreamSender, removeSocketHandler, sendBytes, sendBytes, sendBytes, setReceiveLimit
getDB, getNick, getSocketServer, queueSocket
public MasterSession(java.lang.String nick, SAMv3DatagramServer dgServer, SAMv3Handler handler, java.util.Properties props) throws java.io.IOException, DataFormatException, SAMException
nick
- nickname of the sessionjava.io.IOException
DataFormatException
SAMException
public void start()
start
インタフェース内 SAMMessageSess
start
クラス内 SAMStreamSession
public java.lang.String add(java.lang.String nick, java.lang.String style, java.util.Properties props)
public java.lang.String remove(java.lang.String nick, java.util.Properties props)
public void receiveDatagramBytes(Destination sender, byte[] data, int proto, int fromPort, int toPort) throws java.io.IOException
SAMDatagramReceiver
receiveDatagramBytes
インタフェース内 SAMDatagramReceiver
sender
- Destinationdata
- Byte array to be receivedproto
- I2CP protocolfromPort
- I2CP from porttoPort
- I2CP to portjava.io.IOException
- alwayspublic void stopDatagramReceiving()
stopDatagramReceiving
インタフェース内 SAMDatagramReceiver
public void receiveRawBytes(byte[] data, int proto, int fromPort, int toPort) throws java.io.IOException
SAMRawReceiver
receiveRawBytes
インタフェース内 SAMRawReceiver
data
- Byte array to be receivedproto
- I2CP protocolfromPort
- I2CP from porttoPort
- I2CP to portjava.io.IOException
- alwayspublic void stopRawReceiving()
stopRawReceiving
インタフェース内 SAMRawReceiver
public void connect(SAMv3Handler handler, java.lang.String dest, java.util.Properties props) throws I2PException
SAMv3StreamSession
connect
クラス内 SAMv3StreamSession
handler
- 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
SAMv3StreamSession
accept
クラス内 SAMv3StreamSession
handler
- 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(java.util.Properties props, boolean sendPorts) throws SAMException
SAMv3StreamSession
startForwardingIncoming
クラス内 SAMv3StreamSession
SAMException
- alwayspublic void stopForwardingIncoming()
stopForwardingIncoming
クラス内 SAMv3StreamSession
public int getListenProtocol()
getListenProtocol
インタフェース内 SAMMessageSess
getListenProtocol
クラス内 SAMStreamSession
public int getListenPort()
getListenPort
インタフェース内 SAMMessageSess
getListenPort
クラス内 SAMStreamSession
public void close()
close
インタフェース内 java.lang.AutoCloseable
close
インタフェース内 java.io.Closeable
close
インタフェース内 SAMMessageSess
close
クラス内 SAMv3StreamSession
public void disconnected(I2PSession session)
I2PSessionMuxedListener
disconnected
インタフェース内 I2PSessionListener
disconnected
インタフェース内 I2PSessionMuxedListener
public void errorOccurred(I2PSession session, java.lang.String message, java.lang.Throwable error)
I2PSessionMuxedListener
errorOccurred
インタフェース内 I2PSessionListener
errorOccurred
インタフェース内 I2PSessionMuxedListener
error
- can be null? or not?public void messageAvailable(I2PSession session, int msgId, long size)
I2PSessionMuxedListener
messageAvailable
インタフェース内 I2PSessionListener
messageAvailable
インタフェース内 I2PSessionMuxedListener
session
- 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)
I2PSessionMuxedListener
messageAvailable
インタフェース内 I2PSessionMuxedListener
session
- 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)
I2PSessionMuxedListener
reportAbuse
インタフェース内 I2PSessionListener
reportAbuse
インタフェース内 I2PSessionMuxedListener
session
- session to report abuse toseverity
- how bad the abuse is