Top Description Inners Fields Constructors Methods
org.apache.tomcat.util.net

public Class SecureNio2Channel

extends Nio2Channel
Class Inheritance
Imports
java.io.EOFException, .IOException, java.nio.ByteBuffer, java.nio.channels.AsynchronousSocketChannel, .CompletionHandler, .WritePendingException, java.util.Collections, .HashMap, .List, .Map, java.util.concurrent.ExecutionException, .Future, .TimeUnit, .TimeoutException, javax.net.ssl.SSLEngine, .SSLEngineResult, .SSLEngineResult.HandshakeStatus, .SSLEngineResult.Status, .SSLException, .SSLSession, org.apache.juli.logging.Log, .LogFactory, org.apache.tomcat.util.buf.ByteBufferUtils, org.apache.tomcat.util.net.TLSClientHelloExtractor.ExtractorResult, org.apache.tomcat.util.net.openssl.ciphers.Cipher, org.apache.tomcat.util.res.StringManager

Implementation of a secure socket channel for NIO2.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private class
private class
private class
private class
private static enum

Field Summary

Modifier and TypeField and Description
private final Map<String, List<String>>
protected boolean
protected boolean
private static final int
protected final Nio2Endpoint
private volatile boolean
private final CompletionHandler<Integer, SocketWrapperBase<Nio2Channel>>
private volatile SSLEngineResult.HandshakeStatus
private final CompletionHandler<Integer, SocketWrapperBase<Nio2Channel>>
private static final Log
protected ByteBuffer
protected ByteBuffer
private static final StringManager
protected volatile boolean
protected SSLEngine
private volatile boolean
Inherited from org.apache.tomcat.util.net.Nio2Channel:
bufHandlerCLOSED_NIO2_CHANNELemptyBufscsocketWrapper

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides org.apache.tomcat.util.net.Nio2Channel.close.

Implements java.nio.channels.AsynchronousChannel.close.

Sends an SSL close message, will not physically close the connection here.

public void
close(boolean
Should the underlying socket be forcibly closed?
force
)

Overrides org.apache.tomcat.util.net.Nio2Channel.close.

Close the connection.

private void
public Future<Boolean>

Returns:

true if the network buffer has been flushed out and is empty else false (as a future)
flush
()

Overrides org.apache.tomcat.util.net.Nio2Channel.flush.

Flush the channel.

public void
free()

Overrides org.apache.tomcat.util.net.Nio2Channel.free.

Free the channel memory

public ByteBuffer
public SSLEngine
public SSLSupport
public int

Returns:

0 if hand shake is complete, negative if the socket needs to close and positive if the handshake is incomplete
handshake
()

Overrides org.apache.tomcat.util.net.Nio2Channel.handshake.

Performs SSL handshake, non blocking, but performs NEED_TASK on the same thread.

protected int
handshakeInternal(boolean async)

protected SSLEngineResult

Returns:

the result
handshakeUnwrap
()

Perform handshake unwrap

protected SSLEngineResult

Returns:

the result
handshakeWrap
()

Performs the WRAP function

public boolean
public boolean
private int
public Future<Integer>

Returns:

The number of bytes read, possibly zero, or -1 if the channel has reached end-of-stream
read
(ByteBuffer
The buffer into which bytes are to be transferred
dst
)

Overrides org.apache.tomcat.util.net.Nio2Channel.read.

Implements java.nio.channels.AsynchronousByteChannel.read.

Reads a sequence of bytes from this channel into the given buffer.

public <A> void
read(final ByteBuffer dst, final long timeout, final TimeUnit unit, final A attachment, final CompletionHandler<Integer, ? super A> handler)

Overrides org.apache.tomcat.util.net.Nio2Channel.read.

public <A> void
read(final ByteBuffer[] dsts, final int offset, final int length, final long timeout, final TimeUnit unit, final A attachment, final CompletionHandler<Long, ? super A> handler)

Overrides org.apache.tomcat.util.net.Nio2Channel.read.

public void
rehandshake()

Force a blocking handshake to take place for this key.

public void
reset(AsynchronousSocketChannel
The new async channel to associate with this NIO2 channel
channel
,
SocketWrapperBase<Nio2Channel>
The new socket to associate with this NIO2 channel
socket
)

Overrides org.apache.tomcat.util.net.Nio2Channel.reset.

Reset the channel.

protected SSLEngineResult.HandshakeStatus

Returns:

the status
tasks
()

Executes all the tasks needed on the same thread.

public Future<Integer>

Returns:

The number of bytes written, possibly zero
write
(ByteBuffer
The buffer from which bytes are to be retrieved
src
)

Overrides org.apache.tomcat.util.net.Nio2Channel.write.

Implements java.nio.channels.AsynchronousByteChannel.write.

Writes a sequence of bytes to this channel from the given buffer.

public <A> void
write(final ByteBuffer src, final long timeout, final TimeUnit unit, final A attachment, final CompletionHandler<Integer, ? super A> handler)

Overrides org.apache.tomcat.util.net.Nio2Channel.write.

public <A> void
write(final ByteBuffer[] srcs, final int offset, final int length, final long timeout, final TimeUnit unit, final A attachment, final CompletionHandler<Long, ? super A> handler)

Overrides org.apache.tomcat.util.net.Nio2Channel.write.

Inherited from org.apache.tomcat.util.net.Nio2Channel:
getAppReadBufHandlergetBufHandlergetIOChannelgetSocketWrapperisOpenreadsetAppReadBufHandlertoStringwrite