Package org.apache.mina.filter.ssl
Class SslHandler
java.lang.Object
org.apache.mina.filter.ssl.SslHandler
- Direct Known Subclasses:
SSLHandlerG0,SSLHandlerG1
Default interface for SSL exposed to the
SslFilter-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final org.slf4j.LoggerStatic loggerprotected final Deque<WriteRequest> Requests which have been sent to the socket and waiting acknowledgmentprotected static final intMaximum size of encoder buffer in packetsprotected IoBufferProgressive decoder bufferprotected final Deque<WriteRequest> Write Requests which are enqueued prior to the completion of the handshakingprotected final SSLEngineSSL Engineprotected final ExecutorTask executorprotected static final intMinimum size of encoder buffer in packetsprotected final IoSessionSocket sessionprotected static final IoBufferZero length buffer used to prime the ssl engine -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidack(IoFilter.NextFilter next, WriteRequest request) Acknowledge that aWriteRequesthas been successfully written to theIoSessionprotected IoBufferallocate_app_buffer(int estimate) Allocates the default decoder buffer for the given source sizeprotected IoBufferallocate_encode_buffer(int estimate) Allocates the default encoder buffer for the given source sizeabstract voidclose(IoFilter.NextFilter next, boolean linger) Closes the encryption session and writes any required messagesabstract booleanabstract booleanisOpen()abstract voidopen(IoFilter.NextFilter next) Opens the encryption session, this may include sending the initial handshake messageabstract voidreceive(IoFilter.NextFilter next, IoBuffer message) Decodes encrypted messages and passes the results to thenextfilter.protected IoBufferresume_decode_buffer(IoBuffer source) Combines the received data with any previously received dataprotected voidsuspend_decode_buffer(IoBuffer source) Stores data for later use if any is remainingtoString()abstract voidwrite(IoFilter.NextFilter next, WriteRequest request) Encrypts and writes the specifiedWriteRequestto theIoSessionor enqueues it to be processed later.
-
Field Details
-
MIN_ENCODER_BUFFER_PACKETS
protected static final int MIN_ENCODER_BUFFER_PACKETSMinimum size of encoder buffer in packets- See Also:
-
MAX_ENCODER_BUFFER_PACKETS
protected static final int MAX_ENCODER_BUFFER_PACKETSMaximum size of encoder buffer in packets- See Also:
-
ZERO
Zero length buffer used to prime the ssl engine -
LOGGER
protected static final org.slf4j.Logger LOGGERStatic logger -
mEncodeQueue
Write Requests which are enqueued prior to the completion of the handshaking -
mAckQueue
Requests which have been sent to the socket and waiting acknowledgment -
mEngine
SSL Engine -
mExecutor
Task executor -
mSession
Socket session -
mDecodeBuffer
Progressive decoder buffer
-
-
Constructor Details
-
SslHandler
Instantiates a new handler- Parameters:
p- enginee- executors- session
-
-
Method Details
-
isOpen
public abstract boolean isOpen()- Returns:
trueif the encryption session is open
-
isConnected
public abstract boolean isConnected()- Returns:
trueif the encryption session is connected and secure
-
open
Opens the encryption session, this may include sending the initial handshake message- Parameters:
next- The next filter- Throws:
SSLException- The thrown exception
-
receive
Decodes encrypted messages and passes the results to thenextfilter.- Parameters:
next- The next filtermessage- the received message- Throws:
SSLException- The thrown exception
-
ack
Acknowledge that aWriteRequesthas been successfully written to theIoSessionThis functionality is used to enforce flow control by allowing only a specific number of pending write operations at any moment of time. When one
WriteRequestis acknowledged, another can be encoded and written.- Parameters:
next- The next filterrequest- The request to ack- Throws:
SSLException- The thrown exception
-
write
public abstract void write(IoFilter.NextFilter next, WriteRequest request) throws SSLException, WriteRejectedException Encrypts and writes the specifiedWriteRequestto theIoSessionor enqueues it to be processed later.The encryption session may be currently handshaking preventing application messages from being written.
- Parameters:
next- The next filterrequest- The request to write- Throws:
SSLException- The thrown exceptionWriteRejectedException- when the session is closing
-
close
Closes the encryption session and writes any required messages- Parameters:
next- The next filterlinger- if true, write any queued messages before closing- Throws:
SSLException- The thrown exception
-
toString
-
resume_decode_buffer
Combines the received data with any previously received data- Parameters:
source- received data- Returns:
- buffer to decode
-
suspend_decode_buffer
Stores data for later use if any is remaining- Parameters:
source- the buffer previously returned byresume_decode_buffer(IoBuffer)
-
allocate_encode_buffer
Allocates the default encoder buffer for the given source size- Parameters:
estimate- The estimated remaining size- Returns:
- buffer The allocated buffer
-
allocate_app_buffer
Allocates the default decoder buffer for the given source size- Parameters:
estimate- The estimated remaining size- Returns:
- buffer The allocated buffer
-