class SAMv3Handler extends SAMv1Handler
Modifier and Type | Field and Description |
---|---|
static SessionsDB |
sSessionsHash |
_id, datagramSession, rawSession, SESSION_ERROR, streamSession
_log, bridge, i2cpProps, socket, stopHandler, stopLock, thread, verMajor, verMinor
Constructor and Description |
---|
SAMv3Handler(SocketChannel s,
int verMajor,
int verMinor,
Properties i2cpProps,
SAMBridge parent)
Create a new SAM version 3 handler.
|
SAMv3Handler(SocketChannel s,
int verMajor,
int verMinor,
SAMBridge parent)
Create a new SAM version 3 handler.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
execSessionMessage(String opcode,
Properties props) |
protected boolean |
execStreamConnect(Properties props) |
protected boolean |
execStreamMessage(String opcode,
Properties props) |
(package private) SAMBridge |
getBridge()
For SAMv3StreamSession
|
String |
getClientIP() |
(package private) Session |
getSession()
For SAMv3DatagramServer
|
void |
handle()
Actually handle the SAM protocol.
|
void |
notifyStreamIncomingConnection(Destination d,
int fromPort,
int toPort) |
static void |
notifyStreamIncomingConnection(SocketChannel client,
Destination d) |
static void |
notifyStreamIncomingConnection(SocketChannel client,
Destination d,
int fromPort,
int toPort) |
void |
notifyStreamResult(boolean verbose,
String result,
String message) |
(package private) void |
setSession(SAMv3DatagramSession sess)
For subsessions created by MasterSession
|
(package private) void |
setSession(SAMv3RawSession sess)
For subsessions created by MasterSession
|
(package private) void |
setSession(SAMv3StreamSession sess)
For subsessions created by MasterSession
|
void |
stealSocket()
For SAMv3StreamSession connect and accept
|
void |
stopHandling()
Stop the SAM handler, close the socket,
unregister with the bridge.
|
boolean |
verifVersion() |
createMessageString, execDatagramMessage, execDestMessage, execNamingMessage, execRawMessage, execStreamClose, execStreamSend, getDatagramSession, getRawSession, getStreamSession, notifyStreamDisconnection, notifyStreamIncomingConnection, notifyStreamOutgoingConnection, notifyStreamSendBufferFree, receiveDatagramBytes, receiveRawBytes, receiveStreamBytes, stopDatagramReceiving, stopRawReceiving, stopStreamReceiving, streamSendAnswer, writeString
closeClientSocket, getClientSocket, getWriteLock, run, shouldStop, startHandling, toString, writeBytes, writeString, writeString
public static final SessionsDB sSessionsHash
public SAMv3Handler(SocketChannel s, int verMajor, int verMinor, SAMBridge parent) throws SAMException, IOException
s
- Socket attached to a SAM clientverMajor
- SAM major version to manage (should be 3)verMinor
- SAM minor version to manageSAMException
IOException
public SAMv3Handler(SocketChannel s, int verMajor, int verMinor, Properties i2cpProps, SAMBridge parent) throws SAMException, IOException
s
- Socket attached to a SAM clientverMajor
- SAM major version to manage (should be 3)verMinor
- SAM minor version to managei2cpProps
- properties to configure the I2CP connection (host, port, etc)SAMException
IOException
public boolean verifVersion()
verifVersion
in class SAMv1Handler
public String getClientIP()
public void stealSocket()
SAMBridge getBridge()
Session getSession()
void setSession(SAMv3RawSession sess)
void setSession(SAMv3DatagramSession sess)
void setSession(SAMv3StreamSession sess)
public void handle()
SAMHandler
handle
in class SAMv1Handler
public void stopHandling()
stopHandling
in interface Handler
stopHandling
in class SAMHandler
protected boolean execSessionMessage(String opcode, Properties props)
execSessionMessage
in class SAMv1Handler
protected boolean execStreamMessage(String opcode, Properties props)
execStreamMessage
in class SAMv1Handler
protected boolean execStreamConnect(Properties props)
execStreamConnect
in class SAMv1Handler
public void notifyStreamResult(boolean verbose, String result, String message) throws IOException
verbose
- if false, does nothingresult
- non-nullmessage
- may be nullIOException
public void notifyStreamIncomingConnection(Destination d, int fromPort, int toPort) throws IOException
IOException
public static void notifyStreamIncomingConnection(SocketChannel client, Destination d) throws IOException
IOException
public static void notifyStreamIncomingConnection(SocketChannel client, Destination d, int fromPort, int toPort) throws IOException
IOException