|
Apache Tomcat 6.0.53 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tomcat.util.net.NioChannel org.apache.tomcat.util.net.SecureNioChannel
public class SecureNioChannel
Implementation of a secure socket channel
Nested Class Summary | |
---|---|
static interface |
SecureNioChannel.ApplicationBufferHandler
Callback interface to be able to expand buffers when buffer overflow exceptions happen |
Field Summary | |
---|---|
protected boolean |
closed
|
protected boolean |
closing
|
protected boolean |
initHandshakeComplete
|
protected javax.net.ssl.SSLEngineResult.HandshakeStatus |
initHandshakeStatus
|
protected java.nio.ByteBuffer |
netInBuffer
|
protected java.nio.ByteBuffer |
netOutBuffer
|
protected NioSelectorPool |
pool
|
protected javax.net.ssl.SSLEngine |
sslEngine
|
Fields inherited from class org.apache.tomcat.util.net.NioChannel |
---|
bufHandler, emptyBuf, poller, sc |
Constructor Summary | |
---|---|
SecureNioChannel(java.nio.channels.SocketChannel channel,
javax.net.ssl.SSLEngine engine,
SecureNioChannel.ApplicationBufferHandler bufHandler,
NioSelectorPool pool)
|
Method Summary | |
---|---|
void |
close()
Sends a SSL close message, will not physically close the connection here. |
void |
close(boolean force)
Force a close, can throw an IOException |
boolean |
flush(boolean block,
java.nio.channels.Selector s,
long timeout,
MutableInteger lastWrite)
returns true if the network buffer has been flushed out and is empty |
protected boolean |
flush(java.nio.ByteBuffer buf)
Flushes the buffer to the network, non blocking |
boolean |
flushOutbound()
Return true if the buffer wrote data. |
int |
getBufferSize()
|
SecureNioChannel.ApplicationBufferHandler |
getBufHandler()
|
java.nio.ByteBuffer |
getEmptyBuf()
|
java.nio.channels.SocketChannel |
getIOChannel()
|
int |
getOutboundRemaining()
|
javax.net.ssl.SSLEngine |
getSslEngine()
|
int |
handshake(boolean read,
boolean write)
Performs SSL handshake, non blocking, but performs NEED_TASK on the same thread. |
protected javax.net.ssl.SSLEngineResult |
handshakeUnwrap(boolean doread)
Perform handshake unwrap |
protected javax.net.ssl.SSLEngineResult |
handshakeWrap(boolean doWrite)
Performs the WRAP function |
boolean |
isClosing()
|
boolean |
isInitHandshakeComplete()
|
int |
read(java.nio.ByteBuffer dst)
Reads a sequence of bytes from this channel into the given buffer. |
void |
reset()
|
void |
reset(javax.net.ssl.SSLEngine engine)
|
void |
setBufHandler(SecureNioChannel.ApplicationBufferHandler bufHandler)
|
protected javax.net.ssl.SSLEngineResult.HandshakeStatus |
tasks()
Executes all the tasks needed on the same thread. |
int |
write(java.nio.ByteBuffer src)
Writes a sequence of bytes to this channel from the given buffer. |
Methods inherited from class org.apache.tomcat.util.net.NioChannel |
---|
getAttachment, getPoller, isOpen, setIOChannel, setPoller, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.nio.ByteBuffer netInBuffer
protected java.nio.ByteBuffer netOutBuffer
protected javax.net.ssl.SSLEngine sslEngine
protected boolean initHandshakeComplete
protected javax.net.ssl.SSLEngineResult.HandshakeStatus initHandshakeStatus
protected boolean closed
protected boolean closing
protected NioSelectorPool pool
Constructor Detail |
---|
public SecureNioChannel(java.nio.channels.SocketChannel channel, javax.net.ssl.SSLEngine engine, SecureNioChannel.ApplicationBufferHandler bufHandler, NioSelectorPool pool) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public void reset(javax.net.ssl.SSLEngine engine) throws java.io.IOException
java.io.IOException
public void reset() throws java.io.IOException
reset
in class NioChannel
java.io.IOException
public int getBufferSize()
getBufferSize
in class NioChannel
public boolean flush(boolean block, java.nio.channels.Selector s, long timeout, MutableInteger lastWrite) throws java.io.IOException
flush
in class NioChannel
java.io.IOException
protected boolean flush(java.nio.ByteBuffer buf) throws java.io.IOException
buf
- ByteBuffer
java.io.IOException
public int handshake(boolean read, boolean write) throws java.io.IOException
handshake
in class NioChannel
read
- boolean - true if the underlying channel is readablewrite
- boolean - true if the underlying channel is writable
java.io.IOException
protected javax.net.ssl.SSLEngineResult.HandshakeStatus tasks()
protected javax.net.ssl.SSLEngineResult handshakeWrap(boolean doWrite) throws java.io.IOException
doWrite
- boolean
java.io.IOException
protected javax.net.ssl.SSLEngineResult handshakeUnwrap(boolean doread) throws java.io.IOException
doread
- boolean
java.io.IOException
public void close() throws java.io.IOException
close();
while (isOpen() && !myTimeoutFunction()) Thread.sleep(25);
if ( isOpen() ) close(true); //forces a close if you timed out
close
in interface java.io.Closeable
close
in interface java.nio.channels.Channel
close
in class NioChannel
java.io.IOException
- if an I/O error occurs
java.io.IOException
- if there is data on the outgoing network buffer and we are unable to flush itpublic void close(boolean force) throws java.io.IOException
close
in class NioChannel
force
- boolean
java.io.IOException
public int read(java.nio.ByteBuffer dst) throws java.io.IOException
read
in interface java.nio.channels.ReadableByteChannel
read
in class NioChannel
dst
- The buffer into which bytes are to be transferred
java.io.IOException
- If some other I/O error occurs
java.lang.IllegalArgumentException
- if the destination buffer is different than bufHandler.getReadBuffer()public int write(java.nio.ByteBuffer src) throws java.io.IOException
write
in interface java.nio.channels.WritableByteChannel
write
in class NioChannel
src
- The buffer from which bytes are to be retrieved
java.io.IOException
- If some other I/O error occurspublic int getOutboundRemaining()
getOutboundRemaining
in class NioChannel
public boolean flushOutbound() throws java.io.IOException
NioChannel
flushOutbound
in class NioChannel
java.io.IOException
public SecureNioChannel.ApplicationBufferHandler getBufHandler()
getBufHandler
in class NioChannel
public boolean isInitHandshakeComplete()
isInitHandshakeComplete
in class NioChannel
public boolean isClosing()
isClosing
in class NioChannel
public javax.net.ssl.SSLEngine getSslEngine()
public java.nio.ByteBuffer getEmptyBuf()
public void setBufHandler(SecureNioChannel.ApplicationBufferHandler bufHandler)
public java.nio.channels.SocketChannel getIOChannel()
getIOChannel
in class NioChannel
|
Apache Tomcat 6.0.53 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |