Handler, SAMDatagramReceiver, SAMRawReceiver, SAMStreamReceiverSAMv2Handler, SAMv3Handlerclass SAMv1Handler extends SAMHandler implements SAMRawReceiver, SAMDatagramReceiver, SAMStreamReceiver
| 修飾子とタイプ | フィールド | 説明 |
|---|---|---|
protected long |
_id |
|
protected SAMMessageSess |
datagramSession |
|
protected SAMMessageSess |
rawSession |
|
protected static java.lang.String |
SESSION_ERROR |
|
protected SAMStreamSession |
streamSession |
_log, bridge, i2cpProps, socket, stopHandler, stopLock, thread, verMajor, verMinor| コンストラクタ | 説明 |
|---|---|
SAMv1Handler(java.nio.channels.SocketChannel s,
int verMajor,
int verMinor,
java.util.Properties i2cpProps,
SAMBridge parent) |
Create a new SAM version 1 handler.
|
SAMv1Handler(java.nio.channels.SocketChannel s,
int verMajor,
int verMinor,
SAMBridge parent) |
Create a new SAM version 1 handler.
|
| 修飾子とタイプ | メソッド | 説明 |
|---|---|---|
protected static java.lang.String |
createMessageString(java.lang.String msg) |
Create a string to be appended to a status.
|
protected boolean |
execDatagramMessage(java.lang.String opcode,
java.util.Properties props) |
|
protected boolean |
execDestMessage(java.lang.String opcode,
java.util.Properties props) |
|
protected boolean |
execNamingMessage(java.lang.String opcode,
java.util.Properties props) |
|
protected boolean |
execRawMessage(java.lang.String opcode,
java.util.Properties props) |
|
protected boolean |
execSessionMessage(java.lang.String opcode,
java.util.Properties props) |
|
protected boolean |
execStreamClose(java.util.Properties props) |
|
protected boolean |
execStreamConnect(java.util.Properties props) |
|
protected boolean |
execStreamMessage(java.lang.String opcode,
java.util.Properties props) |
|
protected boolean |
execStreamSend(java.util.Properties props) |
|
protected SAMMessageSess |
getDatagramSession() |
|
protected SAMMessageSess |
getRawSession() |
|
protected SAMStreamSession |
getStreamSession() |
|
void |
handle() |
Actually handle the SAM protocol.
|
void |
notifyStreamDisconnection(int id,
java.lang.String result,
java.lang.String msg) |
Notify that a connection has been closed
FIXME: this interface should be cleaner
|
void |
notifyStreamIncomingConnection(int id,
Destination d) |
Notify about a new incoming connection
|
void |
notifyStreamOutgoingConnection(int id,
java.lang.String result,
java.lang.String msg) |
Notify about a new outgoing connection
|
void |
notifyStreamSendBufferFree(int id) |
Notifies that the outwards buffer is free for writing
|
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.
|
void |
receiveStreamBytes(int id,
java.nio.ByteBuffer data) |
Transmit a byte array from I2P to a SAM client.
|
void |
stopDatagramReceiving() |
Stop receiving data.
|
void |
stopRawReceiving() |
Stop receiving data.
|
void |
stopStreamReceiving() |
Stop receiving data.
|
void |
streamSendAnswer(int id,
java.lang.String result,
java.lang.String bufferState) |
Sends the result of a stream send operation
|
boolean |
verifVersion() |
|
protected boolean |
writeString(java.lang.String s,
java.lang.String msg) |
Write a string and message, escaping the message.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcloseClientSocket, getClientSocket, getWriteLock, run, shouldStop, startHandling, stopHandling, toString, writeBytes, writeString, writeStringprotected SAMMessageSess rawSession
protected SAMMessageSess datagramSession
protected SAMStreamSession streamSession
protected final long _id
protected static final java.lang.String SESSION_ERROR
public SAMv1Handler(java.nio.channels.SocketChannel s,
int verMajor,
int verMinor,
SAMBridge parent)
throws SAMException,
java.io.IOException
s - Socket attached to a SAM clientverMajor - SAM major version to manage (should be 1)verMinor - SAM minor version to manageSAMExceptionjava.io.IOExceptionpublic SAMv1Handler(java.nio.channels.SocketChannel s,
int verMajor,
int verMinor,
java.util.Properties i2cpProps,
SAMBridge parent)
throws SAMException,
java.io.IOException
s - Socket attached to a SAM clientverMajor - SAM major version to manage (should be 1)verMinor - SAM minor version to managei2cpProps - properties to configure the I2CP connection (host, port, etc)SAMExceptionjava.io.IOExceptionprotected final SAMMessageSess getRawSession()
protected final SAMMessageSess getDatagramSession()
protected final SAMStreamSession getStreamSession()
public boolean verifVersion()
public void handle()
SAMHandlerhandle クラス内 SAMHandlerprotected boolean execSessionMessage(java.lang.String opcode,
java.util.Properties props)
protected boolean execDestMessage(java.lang.String opcode,
java.util.Properties props)
protected boolean execNamingMessage(java.lang.String opcode,
java.util.Properties props)
protected boolean execDatagramMessage(java.lang.String opcode,
java.util.Properties props)
protected boolean execRawMessage(java.lang.String opcode,
java.util.Properties props)
protected boolean execStreamMessage(java.lang.String opcode,
java.util.Properties props)
protected boolean execStreamSend(java.util.Properties props)
protected boolean execStreamConnect(java.util.Properties props)
protected boolean execStreamClose(java.util.Properties props)
public void receiveRawBytes(byte[] data,
int proto,
int fromPort,
int toPort)
throws java.io.IOException
SAMRawReceiverreceiveRawBytes インタフェース内 SAMRawReceiverdata - Byte array to be receivedproto - I2CP protocolfromPort - I2CP from porttoPort - I2CP to portjava.io.IOExceptionpublic void stopRawReceiving()
SAMRawReceiverstopRawReceiving インタフェース内 SAMRawReceiverpublic void receiveDatagramBytes(Destination sender, byte[] data, int proto, int fromPort, int toPort) throws java.io.IOException
SAMDatagramReceiverreceiveDatagramBytes インタフェース内 SAMDatagramReceiversender - Destinationdata - Byte array to be receivedproto - I2CP protocolfromPort - I2CP from porttoPort - I2CP to portjava.io.IOExceptionpublic void stopDatagramReceiving()
SAMDatagramReceiverstopDatagramReceiving インタフェース内 SAMDatagramReceiverpublic void streamSendAnswer(int id,
java.lang.String result,
java.lang.String bufferState)
throws java.io.IOException
SAMStreamReceiverstreamSendAnswer インタフェース内 SAMStreamReceiverid - Stream IDresult - informationbufferState - state of the bufferjava.io.IOExceptionpublic void notifyStreamSendBufferFree(int id)
throws java.io.IOException
SAMStreamReceivernotifyStreamSendBufferFree インタフェース内 SAMStreamReceiverid - stream IDjava.io.IOExceptionpublic void notifyStreamIncomingConnection(int id,
Destination d)
throws java.io.IOException
SAMStreamReceivernotifyStreamIncomingConnection インタフェース内 SAMStreamReceiverid - New connection idd - Destinationjava.io.IOExceptionpublic void notifyStreamOutgoingConnection(int id,
java.lang.String result,
java.lang.String msg)
throws java.io.IOException
SAMStreamReceivernotifyStreamOutgoingConnection インタフェース内 SAMStreamReceivermsg - may be nullid - New connection idresult - message resultjava.io.IOExceptionprotected static java.lang.String createMessageString(java.lang.String msg)
msg - may be nullprotected boolean writeString(java.lang.String s,
java.lang.String msg)
s - The string, non-nullpublic void receiveStreamBytes(int id,
java.nio.ByteBuffer data)
throws java.io.IOException
SAMStreamReceiverreceiveStreamBytes インタフェース内 SAMStreamReceiverid - Connection iddata - Byte array to be receivedjava.io.IOExceptionpublic void notifyStreamDisconnection(int id,
java.lang.String result,
java.lang.String msg)
throws java.io.IOException
SAMStreamReceivernotifyStreamDisconnection インタフェース内 SAMStreamReceivermsg - may be nullid - Connection idresult - Disconnection reason ("OK" or something else)java.io.IOExceptionpublic void stopStreamReceiving()
SAMStreamReceiverstopStreamReceiving インタフェース内 SAMStreamReceiver