Package net.i2p.sam
Class SAMv2Handler
- java.lang.Object
-
- net.i2p.sam.SAMHandler
-
- net.i2p.sam.SAMv1Handler
-
- net.i2p.sam.SAMv2Handler
-
- All Implemented Interfaces:
Runnable
,Handler
,SAMDatagramReceiver
,SAMRawReceiver
,SAMStreamReceiver
class SAMv2Handler extends SAMv1Handler implements SAMRawReceiver, SAMDatagramReceiver, SAMStreamReceiver
Class able to handle a SAM version 2 client connection.- Author:
- mkvore
-
-
Field Summary
-
Fields inherited from class net.i2p.sam.SAMv1Handler
_id, datagramSession, rawSession, SESSION_ERROR, streamSession
-
Fields inherited from class net.i2p.sam.SAMHandler
_log, bridge, i2cpProps, socket, stopHandler, stopLock, thread, verMajor, verMinor
-
-
Constructor Summary
Constructors Constructor Description SAMv2Handler(SocketChannel s, int verMajor, int verMinor, Properties i2cpProps, SAMBridge parent)
Create a new SAM version 2 handler.SAMv2Handler(SocketChannel s, int verMajor, int verMinor, SAMBridge parent)
Create a new SAM version 2 handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
execStreamMessage(String opcode, Properties props)
(package private) SAMStreamSession
newSAMStreamSession(String destKeystream, String direction, Properties props)
boolean
verifVersion()
-
Methods inherited from class net.i2p.sam.SAMv1Handler
createMessageString, execDatagramMessage, execDestMessage, execNamingMessage, execRawMessage, execSessionMessage, execStreamClose, execStreamConnect, execStreamSend, getDatagramSession, getRawSession, getStreamSession, handle, notifyStreamDisconnection, notifyStreamIncomingConnection, notifyStreamOutgoingConnection, notifyStreamSendBufferFree, receiveDatagramBytes, receiveRawBytes, receiveStreamBytes, stopDatagramReceiving, stopRawReceiving, stopStreamReceiving, streamSendAnswer, writeString
-
Methods inherited from class net.i2p.sam.SAMHandler
closeClientSocket, getClientSocket, getWriteLock, run, shouldStop, startHandling, stopHandling, toString, writeBytes, writeString, writeString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.i2p.sam.SAMDatagramReceiver
receiveDatagramBytes, stopDatagramReceiving
-
Methods inherited from interface net.i2p.sam.SAMRawReceiver
receiveRawBytes, stopRawReceiving
-
Methods inherited from interface net.i2p.sam.SAMStreamReceiver
notifyStreamDisconnection, notifyStreamIncomingConnection, notifyStreamOutgoingConnection, notifyStreamSendBufferFree, receiveStreamBytes, stopStreamReceiving, streamSendAnswer
-
-
-
-
Constructor Detail
-
SAMv2Handler
public SAMv2Handler(SocketChannel s, int verMajor, int verMinor, SAMBridge parent) throws SAMException, IOException
Create a new SAM version 2 handler. This constructor expects that the SAM HELLO message has been still answered (and stripped) from the socket input stream.- Parameters:
s
- Socket attached to a SAM clientverMajor
- SAM major version to manage (should be 2)verMinor
- SAM minor version to manage- Throws:
SAMException
IOException
-
SAMv2Handler
public SAMv2Handler(SocketChannel s, int verMajor, int verMinor, Properties i2cpProps, SAMBridge parent) throws SAMException, IOException
Create a new SAM version 2 handler. This constructor expects that the SAM HELLO message has been still answered (and stripped) from the socket input stream.- Parameters:
s
- Socket attached to a SAM clientverMajor
- SAM major version to manage (should be 2)verMinor
- SAM minor version to managei2cpProps
- properties to configure the I2CP connection (host, port, etc)- Throws:
SAMException
IOException
-
-
Method Detail
-
verifVersion
public boolean verifVersion()
- Overrides:
verifVersion
in classSAMv1Handler
-
newSAMStreamSession
SAMStreamSession newSAMStreamSession(String destKeystream, String direction, Properties props) throws IOException, DataFormatException, SAMException
-
execStreamMessage
protected boolean execStreamMessage(String opcode, Properties props)
- Overrides:
execStreamMessage
in classSAMv1Handler
-
-