|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.sam.SAMHandler
net.i2p.sam.SAMv1Handler
public class SAMv1Handler
Class able to handle a SAM version 1 client connections.
Field Summary | |
---|---|
protected static long |
__id
|
protected long |
_id
|
protected SAMDatagramSession |
datagramSession
|
protected SAMRawSession |
rawSession
|
protected SAMStreamSession |
streamSession
|
protected int |
verMajorId
|
protected int |
verMinorId
|
Fields inherited from class net.i2p.sam.SAMHandler |
---|
bridge, i2cpProps, socket, thread, verMajor, verMinor |
Constructor Summary | |
---|---|
SAMv1Handler(SocketChannel s,
int verMajor,
int verMinor)
Create a new SAM version 1 handler. |
|
SAMv1Handler(SocketChannel s,
int verMajor,
int verMinor,
Properties i2cpProps)
Create a new SAM version 1 handler. |
Method Summary | |
---|---|
protected boolean |
execDatagramMessage(String opcode,
Properties props)
|
protected boolean |
execDestMessage(String opcode,
Properties props)
|
protected boolean |
execNamingMessage(String opcode,
Properties props)
|
protected boolean |
execRawMessage(String opcode,
Properties props)
|
protected boolean |
execSessionMessage(String opcode,
Properties props)
|
protected boolean |
execStreamClose(Properties props)
|
protected boolean |
execStreamConnect(Properties props)
|
protected boolean |
execStreamMessage(String opcode,
Properties props)
|
protected boolean |
execStreamSend(Properties props)
|
protected SAMDatagramSession |
getDatagramSession()
|
protected SAMRawSession |
getRawSession()
|
protected SAMStreamSession |
getStreamSession()
|
void |
handle()
Actually handle the SAM protocol. |
(package private) SAMStreamSession |
newSAMStreamSession(String destKeystream,
String direction,
Properties props)
|
void |
notifyStreamDisconnection(int id,
String result,
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,
String result,
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)
Send a byte array to a SAM client. |
void |
receiveRawBytes(byte[] data)
Send a byte array to a SAM client, without informations regarding the sender. |
void |
receiveStreamBytes(int id,
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,
String result,
String bufferState)
Sends the result of a stream send operation |
boolean |
verifVersion()
|
Methods inherited from class net.i2p.sam.SAMHandler |
---|
closeClientSocket, getClientSocket, getWriteLock, run, setBridge, shouldStop, startHandling, stopHandling, toString, writeBytes, writeBytes, writeString, writeString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int verMajorId
protected int verMinorId
protected SAMRawSession rawSession
protected SAMDatagramSession datagramSession
protected SAMStreamSession streamSession
protected long _id
protected static volatile long __id
Constructor Detail |
---|
public SAMv1Handler(SocketChannel s, int verMajor, int verMinor) throws SAMException, IOException
s
- Socket attached to a SAM clientverMajor
- SAM major version to manage (should be 1)verMinor
- SAM minor version to manage
SAMException
IOException
public SAMv1Handler(SocketChannel s, int verMajor, int verMinor, Properties i2cpProps) throws SAMException, 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)
SAMException
IOException
Method Detail |
---|
protected SAMRawSession getRawSession()
protected SAMDatagramSession getDatagramSession()
protected SAMStreamSession getStreamSession()
public boolean verifVersion()
public void handle()
SAMHandler
handle
in class SAMHandler
protected boolean execSessionMessage(String opcode, Properties props)
SAMStreamSession newSAMStreamSession(String destKeystream, String direction, Properties props) throws IOException, DataFormatException, SAMException
IOException
DataFormatException
SAMException
protected boolean execDestMessage(String opcode, Properties props)
protected boolean execNamingMessage(String opcode, Properties props)
protected boolean execDatagramMessage(String opcode, Properties props)
protected boolean execRawMessage(String opcode, Properties props)
protected boolean execStreamMessage(String opcode, Properties props)
protected boolean execStreamSend(Properties props)
protected boolean execStreamConnect(Properties props)
protected boolean execStreamClose(Properties props)
public void receiveRawBytes(byte[] data) throws IOException
SAMRawReceiver
receiveRawBytes
in interface SAMRawReceiver
data
- Byte array to be received
IOException
public void stopRawReceiving()
SAMRawReceiver
stopRawReceiving
in interface SAMRawReceiver
public void receiveDatagramBytes(Destination sender, byte[] data) throws IOException
SAMDatagramReceiver
receiveDatagramBytes
in interface SAMDatagramReceiver
sender
- Destinationdata
- Byte array to be received
IOException
public void stopDatagramReceiving()
SAMDatagramReceiver
stopDatagramReceiving
in interface SAMDatagramReceiver
public void streamSendAnswer(int id, String result, String bufferState) throws IOException
SAMStreamReceiver
streamSendAnswer
in interface SAMStreamReceiver
id
- Stream IDresult
- informationbufferState
- state of the buffer
IOException
public void notifyStreamSendBufferFree(int id) throws IOException
SAMStreamReceiver
notifyStreamSendBufferFree
in interface SAMStreamReceiver
id
- stream ID
IOException
public void notifyStreamIncomingConnection(int id, Destination d) throws IOException
SAMStreamReceiver
notifyStreamIncomingConnection
in interface SAMStreamReceiver
id
- New connection idd
- Destination
IOException
public void notifyStreamOutgoingConnection(int id, String result, String msg) throws IOException
SAMStreamReceiver
notifyStreamOutgoingConnection
in interface SAMStreamReceiver
id
- New connection idresult
- message resultmsg
- Message
IOException
public void receiveStreamBytes(int id, ByteBuffer data) throws IOException
SAMStreamReceiver
receiveStreamBytes
in interface SAMStreamReceiver
id
- Connection iddata
- Byte array to be received
IOException
public void notifyStreamDisconnection(int id, String result, String msg) throws IOException
SAMStreamReceiver
notifyStreamDisconnection
in interface SAMStreamReceiver
id
- Connection idresult
- Disconnection reason ("OK" or something else)msg
- Error message, if any
IOException
public void stopStreamReceiving()
SAMStreamReceiver
stopStreamReceiving
in interface SAMStreamReceiver
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |