public abstract class SslHandler extends Object
SslFilter
Modifier and Type | Field and Description |
---|---|
protected static Logger |
LOGGER
Static logger
|
protected Deque<WriteRequest> |
mAckQueue
Requests which have been sent to the socket and waiting acknowledgment
|
protected static int |
MAX_ENCODER_BUFFER_PACKETS
Maximum size of encoder buffer in packets
|
protected IoBuffer |
mDecodeBuffer
Progressive decoder buffer
|
protected Deque<WriteRequest> |
mEncodeQueue
Write Requests which are enqueued prior to the completion of the handshaking
|
protected SSLEngine |
mEngine
SSL Engine
|
protected Executor |
mExecutor
Task executor
|
protected static int |
MIN_ENCODER_BUFFER_PACKETS
Minimum size of encoder buffer in packets
|
protected IoSession |
mSession
Socket session
|
protected static IoBuffer |
ZERO
Zero length buffer used to prime the ssl engine
|
Constructor and Description |
---|
SslHandler(SSLEngine p,
Executor e,
IoSession s)
Instantiates a new handler
|
Modifier and Type | Method and Description |
---|---|
abstract void |
ack(IoFilter.NextFilter next,
WriteRequest request)
Acknowledge that a
WriteRequest has been successfully written to the
IoSession
This functionality is used to enforce flow control by allowing only a
specific number of pending write operations at any moment of time. |
protected IoBuffer |
allocate_app_buffer(int estimate)
Allocates the default decoder buffer for the given source size
|
protected IoBuffer |
allocate_encode_buffer(int estimate)
Allocates the default encoder buffer for the given source size
|
abstract void |
close(IoFilter.NextFilter next,
boolean linger)
Closes the encryption session and writes any required messages
|
abstract boolean |
isConnected() |
abstract boolean |
isOpen() |
abstract void |
open(IoFilter.NextFilter next)
Opens the encryption session, this may include sending the initial handshake
message
|
abstract void |
receive(IoFilter.NextFilter next,
IoBuffer message)
Decodes encrypted messages and passes the results to the
next filter. |
protected IoBuffer |
resume_decode_buffer(IoBuffer source)
Combines the received data with any previously received data
|
protected void |
suspend_decode_buffer(IoBuffer source)
Stores data for later use if any is remaining
|
String |
toString() |
abstract void |
write(IoFilter.NextFilter next,
WriteRequest request)
Encrypts and writes the specified
WriteRequest to the
IoSession or enqueues it to be processed later. |
protected static final int MIN_ENCODER_BUFFER_PACKETS
protected static final int MAX_ENCODER_BUFFER_PACKETS
protected static final IoBuffer ZERO
protected static final Logger LOGGER
protected final Deque<WriteRequest> mEncodeQueue
protected final Deque<WriteRequest> mAckQueue
protected final SSLEngine mEngine
protected final Executor mExecutor
protected final IoSession mSession
protected IoBuffer mDecodeBuffer
public abstract boolean isOpen()
true
if the encryption session is openpublic abstract boolean isConnected()
true
if the encryption session is connected and securepublic abstract void open(IoFilter.NextFilter next) throws SSLException
next
- The next filterSSLException
- The thrown exceptionpublic abstract void receive(IoFilter.NextFilter next, IoBuffer message) throws SSLException
next
filter.next
- The next filtermessage
- the received messageSSLException
- The thrown exceptionpublic abstract void ack(IoFilter.NextFilter next, WriteRequest request) throws SSLException
WriteRequest
has been successfully written to the
IoSession
This functionality is used to enforce flow control by allowing only a
specific number of pending write operations at any moment of time. When one
WriteRequest
is acknowledged, another can be encoded and written.
next
- The next filterrequest
- The request to ackSSLException
- The thrown exceptionpublic abstract void write(IoFilter.NextFilter next, WriteRequest request) throws SSLException, WriteRejectedException
WriteRequest
to the
IoSession
or enqueues it to be processed later.
The encryption session may be currently handshaking preventing application messages from being written.
next
- The next filterrequest
- The request to writeSSLException
- The thrown exceptionWriteRejectedException
- when the session is closingpublic abstract void close(IoFilter.NextFilter next, boolean linger) throws SSLException
next
- The next filterlinger
- if true, write any queued messages before closingSSLException
- The thrown exceptionprotected IoBuffer resume_decode_buffer(IoBuffer source)
source
- received dataprotected void suspend_decode_buffer(IoBuffer source)
source
- the buffer previously returned by
resume_decode_buffer(IoBuffer)
protected IoBuffer allocate_encode_buffer(int estimate)
estimate
- The estimated remaining sizeprotected IoBuffer allocate_app_buffer(int estimate)
estimate
- The estimated remaining sizeCopyright © 2004–2022 Apache MINA Project. All rights reserved.