|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.client.streaming.I2PSocketManagerImpl
class I2PSocketManagerImpl
Centralize the coordination and multiplexing of the local client's streaming. There should be one I2PSocketManager for each I2PSession, and if an application is sending and receiving data through the streaming library using an I2PSocketManager, it should not attempt to call I2PSession's setSessionListener or receive any messages with its .receiveMessage
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface net.i2p.client.streaming.I2PSocketManager |
---|
I2PSocketManager.DisconnectListener |
Field Summary | |
---|---|
static short |
ACK
|
static short |
CHAFF
|
static short |
CLOSE_IN
|
static short |
CLOSE_OUT
|
static short |
DATA_IN
|
static short |
DATA_OUT
|
static short |
SYN
|
Constructor Summary | |
---|---|
I2PSocketManagerImpl()
|
|
I2PSocketManagerImpl(java.lang.String name)
|
Method Summary | |
---|---|
void |
addDisconnectListener(I2PSocketManager.DisconnectListener lsnr)
|
I2PSocketOptions |
buildOptions()
|
I2PSocketOptions |
buildOptions(java.util.Properties opts)
|
I2PSocket |
connect(Destination peer)
Create a new connected socket (block until the socket is created) |
I2PSocket |
connect(Destination peer,
I2PSocketOptions options)
Create a new connected socket (block until the socket is created) |
void |
destroySocketManager()
Destroy the socket manager, freeing all the associated resources. |
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 |
long |
getAcceptTimeout()
|
I2PSocketOptions |
getDefaultOptions()
|
java.lang.String |
getName()
|
static java.lang.String |
getReadableForm(java.lang.String id)
|
I2PServerSocket |
getServerSocket()
|
I2PSession |
getSession()
|
void |
init(I2PAppContext context,
I2PSession session,
java.util.Properties opts,
java.lang.String name)
|
java.util.Set |
listSockets()
Retrieve a set of currently connected I2PSockets, either initiated locally or remotely. |
static byte[] |
makePacket(byte type,
java.lang.String id,
byte[] payload)
Create a new packet of the given type for the specified connection containing the given payload |
void |
messageAvailable(I2PSession session,
int msgId,
long size)
Instruct the client that the given session has received a message with size # of bytes. |
boolean |
ping(Destination peer,
long timeoutMs)
Ping the specified peer, returning true if they replied to the ping within the timeout specified, false otherwise. |
void |
removeDisconnectListener(I2PSocketManager.DisconnectListener lsnr)
|
void |
removeSocket(I2PSocketImpl sock)
|
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 |
setAcceptTimeout(long ms)
How long should we wait for the client to .accept() a socket before sending back a NACK/Close? |
void |
setDefaultOptions(I2PSocketOptions options)
|
void |
setName(java.lang.String name)
|
void |
setSession(I2PSession session)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final short ACK
public static final short CLOSE_OUT
public static final short DATA_OUT
public static final short SYN
public static final short CLOSE_IN
public static final short DATA_IN
public static final short CHAFF
Constructor Detail |
---|
public I2PSocketManagerImpl()
public I2PSocketManagerImpl(java.lang.String name)
Method Detail |
---|
public void init(I2PAppContext context, I2PSession session, java.util.Properties opts, java.lang.String name)
init
in interface I2PSocketManager
public I2PSession getSession()
getSession
in interface I2PSocketManager
public void setSession(I2PSession session)
public void setAcceptTimeout(long ms)
setAcceptTimeout
in interface I2PSocketManager
ms
- milliseconds to wait, maximumpublic long getAcceptTimeout()
getAcceptTimeout
in interface I2PSocketManager
public void disconnected(I2PSession session)
I2PSessionListener
disconnected
in interface I2PSessionListener
public void errorOccurred(I2PSession session, java.lang.String message, java.lang.Throwable error)
I2PSessionListener
errorOccurred
in interface I2PSessionListener
public void messageAvailable(I2PSession session, int msgId, long size)
I2PSessionListener
messageAvailable
in interface I2PSessionListener
session
- session to notifymsgId
- message number availablesize
- size of the messagepublic void reportAbuse(I2PSession session, int severity)
I2PSessionListener
reportAbuse
in interface I2PSessionListener
session
- session to report abuse toseverity
- how bad the abuse ispublic void setDefaultOptions(I2PSocketOptions options)
setDefaultOptions
in interface I2PSocketManager
public I2PSocketOptions getDefaultOptions()
getDefaultOptions
in interface I2PSocketManager
public I2PSocketOptions buildOptions()
buildOptions
in interface I2PSocketManager
public I2PSocketOptions buildOptions(java.util.Properties opts)
buildOptions
in interface I2PSocketManager
public I2PServerSocket getServerSocket()
getServerSocket
in interface I2PSocketManager
public I2PSocket connect(Destination peer, I2PSocketOptions options) throws I2PException, java.net.ConnectException, java.net.NoRouteToHostException, java.io.InterruptedIOException
connect
in interface I2PSocketManager
peer
- Destination to connect tooptions
- I2P socket options to be used for connecting
java.net.ConnectException
- if the peer refuses the connection
java.net.NoRouteToHostException
- if the peer is not found or not reachable
java.io.InterruptedIOException
- if the connection timeouts
I2PException
- if there is some other I2P-related problempublic I2PSocket connect(Destination peer) throws I2PException, java.net.ConnectException, java.net.NoRouteToHostException, java.io.InterruptedIOException
connect
in interface I2PSocketManager
peer
- Destination to connect to
java.net.ConnectException
- if the peer refuses the connection
java.net.NoRouteToHostException
- if the peer is not found or not reachable
java.io.InterruptedIOException
- if the connection timeouts
I2PException
- if there is some other I2P-related problempublic void destroySocketManager()
destroySocketManager
in interface I2PSocketManager
public java.util.Set listSockets()
listSockets
in interface I2PSocketManager
public boolean ping(Destination peer, long timeoutMs)
ping
in interface I2PSocketManager
public void removeSocket(I2PSocketImpl sock)
public java.lang.String getName()
getName
in interface I2PSocketManager
public void setName(java.lang.String name)
setName
in interface I2PSocketManager
public void addDisconnectListener(I2PSocketManager.DisconnectListener lsnr)
addDisconnectListener
in interface I2PSocketManager
public void removeDisconnectListener(I2PSocketManager.DisconnectListener lsnr)
removeDisconnectListener
in interface I2PSocketManager
public static java.lang.String getReadableForm(java.lang.String id)
public static byte[] makePacket(byte type, java.lang.String id, byte[] payload)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |