- All Implemented Interfaces:
Closeable,AutoCloseable,ConnectionOrientedTransportMapping<UdpAddress>,TlsTransportMappingConfig<X509Certificate>,X509TlsTransportMappingConfig,TransportMapping<UdpAddress>
public class DTLSTM
extends DefaultUdpTransportMapping
implements X509TlsTransportMappingConfig, ConnectionOrientedTransportMapping<UdpAddress>
The
DTLSTM implements the Datagram Transport Layer Security Transport Mapping (TLS-TM) as defined by RFC
5953 with the new IO API and SSLEngine.
It uses a single thread for processing incoming and outgoing messages. The thread is started when the
listen method is called, or when an outgoing request is sent using the sendMessage method.
- Since:
- 3.0
- Version:
- 3.6.0
- Author:
- Frank Fock
-
Nested Class Summary
Nested classes/interfaces inherited from class org.snmp4j.transport.DefaultUdpTransportMapping
DefaultUdpTransportMapping.ListenThread -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final Stringstatic final intstatic final intstatic final intstatic final intFields inherited from class org.snmp4j.transport.DefaultUdpTransportMapping
listenerThread, socketFields inherited from class org.snmp4j.transport.UdpTransportMapping
udpAddressFields inherited from class org.snmp4j.transport.AbstractTransportMapping
asyncMsgProcessingSupported, listenWorkerTask, maxInboundMessageSize, suspendedAddresses, transportListener, transportStateListeners -
Constructor Summary
ConstructorsConstructorDescriptionDTLSTM()Creates a default UDP transport mapping with the server for incoming messages disabled.DTLSTM(DtlsAddress address) Creates a TLS transport mapping with the server, for incoming messages bind to the given DTLS address.DTLSTM(DtlsAddress address, boolean serverEnabled) Creates a TLS transport mapping with the server, for incoming messages bind to the given address.DTLSTM(TlsTmSecurityCallback<X509Certificate> securityCallback, DtlsAddress serverAddress) Creates a DTLS transport mapping that binds to the given address (interface) on the local host.DTLSTM(TlsTmSecurityCallback<X509Certificate> securityCallback, DtlsAddress serverAddress, CounterSupport counterSupport) Creates a TLS transport mapping that binds to the given address (interface) on the local host and runs as a server.DTLSTM(TlsTmSecurityCallback<X509Certificate> securityCallback, DtlsAddress serverAddress, CounterSupport counterSupport, boolean serverEnabled) Creates a TLS transport mapping that binds to the given address (interface) on the local host. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the socket and stops the listener thread and socket cleaner timer (ifDefaultUdpTransportMapping.getSocketTimeout()is greater than zero).booleanclose(UdpAddress remoteAddress) Closes a connection to the supplied remote address, if it is open.protected DatagramPacketcreateHandshakePacket(byte[] buf, SocketAddress socketAddr) protected SSLEngineConfiguratorReturns the configuredsetSslEngineConfigurator(SSLEngineConfigurator)or theDefaultSSLEngineConfigurationwhich will then become the configured SSL engine configurator.protected voidfireProcessMessage(DatagramPacket packet, ByteBuffer bis, TransportStateReference stateReference) longGets the connection timeout.intintGets the maximum number of milliseconds to wait for the DTLS handshake operation to succeed.Returns the address that represents the actual incoming address this transport mapping uses to listen for incoming packets.Gets the certificate alias used for client and server authentication.Returns theMessageLengthDecoderused by this transport mapping.Gets the (optional and possiblynull) revocation checker for the cert path validation of X509 certificates.Returns the property name that is used by this transport mapping to determine the protocol versions from system properties.String[]Return the (D)TLS protocol versions used by this transport mapping.Gets theTlsTmSecurityCallbackassociated with thisTransportMappinghook which is called by the transport mapping to lookup TLS security parameters from external configuration.Gets theCommonTimerthat controls socket cleanup operations.Gets the primaryAddressclass that is supported by this transport mapping.Returns a set ofDtlsAddressandUdpAddress.Gets the X509 certificate revocation list (CRL) URI, if defined.booleanReturnstrueif asynchronous (multi-threaded) message processing may be implemented.booleanChecks whether a server for incoming requests is enabled.voidlisten()Starts the listener thread that accepts incoming messages.protected List<DatagramPacket> onReceiveTimeout(SSLEngine engine, SocketAddress socketAddr) protected ByteBufferprepareInPacket(DatagramPacket packet, byte[] buf, TransportStateReference tmStateReference) Prepare a network packet for the application.protected List<DatagramPacket> prepareOutPackets(UdpAddress targetAddress, byte[] message, TransportStateReference tmStateReference, DatagramSocket socket, long timeoutMillis, int maxRetries) Prepare an application message for sending over the network to the specified target address.protected List<DatagramPacket> produceHandshakePackets(SSLEngine sslEngine, SocketAddress socketAddress) voidsetAsyncMsgProcessingSupported(boolean asyncMsgProcessingSupported) Specifies whether this transport mapping has to support asynchronous messages processing or not.voidsetConnectionTimeout(long connectionTimeout) Sets the connection timeout.voidsetDtlsHandshakeThreadPoolSize(int dtlsHandshakeThreadPoolSize) Sets the maximum number of threads reserved for DTLS inbound connection handshake processing.voidsetHandshakeTimeout(int handshakeTimeout) Sets the maximum number of milliseconds to wait for the DTLS handshake operation to succeed.voidsetKeyStore(String keyStore) voidsetKeyStorePassword(String keyStorePassword) voidsetLocalCertificateAlias(String localCertificateAlias) Sets the certificate alias used for client and server authentication by this TLSTM.voidsetMaxInboundMessageSize(int maxInboundMessageSize) Sets the maximum buffer size for incoming requests.voidsetMessageLengthDecoder(MessageLengthDecoder messageLengthDecoder) Sets theMessageLengthDecoderthat decodes the total message length from the header of a message.voidsetPKIXRevocationChecker(PKIXRevocationChecker pkixRevocationChecker) Sets the (optional and possiblynull) revocation checker for the cert path validation of X509 certificates.voidsetProtocolVersions(String[] dtlsProtocols) Sets the DTLS protocols/versions that DTLSTM should use during handshake.voidsetSecurityCallback(TlsTmSecurityCallback<X509Certificate> securityCallback) Sets theTlsTmSecurityCallbackassociated with thisTransportMappinghook.voidsetServerEnabled(boolean serverEnabled) Sets whether a server for incoming requests should be created when the transport is set into listen state.voidsetSslEngineConfigurator(SSLEngineConfigurator sslEngineConfigurator) voidsetTrustManagerFactory(TLSTMTrustManagerFactory trustManagerFactory) Set the TLSTM trust manager factory.voidsetTrustStore(String trustStore) voidsetTrustStorePassword(String trustStorePassword) voidSets the X509 certificate revocation list (CRL) URI, to enable CRL checking.Methods inherited from class org.snmp4j.transport.DefaultUdpTransportMapping
ensureSocket, getReceiveBufferSize, getSocketTimeout, renewSocketAfterException, sendMessage, setReceiveBufferSize, setSocketTimeoutMethods inherited from class org.snmp4j.transport.UdpTransportMapping
getAddressMethods inherited from class org.snmp4j.transport.AbstractTransportMapping
addTransportListener, addTransportStateListener, fireConnectionStateChanged, fireProcessMessage, getListenWorkerTask, getMaxInboundMessageSize, getPriority, getSuspendedAddresses, getThreadName, handleDroppedMessageToSend, isListening, removeAllTransportListeners, removeTransportListener, removeTransportStateListener, resumeAddress, setPriority, setThreadName, suspendAddressMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.snmp4j.transport.ConnectionOrientedTransportMapping
addTransportStateListener, removeTransportStateListener, resumeAddress, suspendAddressMethods inherited from interface org.snmp4j.TransportMapping
addTransportListener, getMaxInboundMessageSize, getMaxOutboundMessageSize, isAddressSupported, isAddressSupported, isListening, removeTransportListener, sendMessage
-
Field Details
-
MAX_HANDSHAKE_LOOPS
public static final int MAX_HANDSHAKE_LOOPS- See Also:
-
DEFAULT_SOCKET_TIMEOUT
public static final int DEFAULT_SOCKET_TIMEOUT- See Also:
-
DEFAULT_HANDSHAKE_TIMEOUT
public static final int DEFAULT_HANDSHAKE_TIMEOUT- See Also:
-
DEFAULT_CONNECTION_TIMEOUT
public static final int DEFAULT_CONNECTION_TIMEOUT- See Also:
-
DEFAULT_DTLSTM_PROTOCOLS
- See Also:
-
MAX_TLS_PAYLOAD_SIZE
public static final int MAX_TLS_PAYLOAD_SIZE- See Also:
-
-
Constructor Details
-
DTLSTM
Creates a default UDP transport mapping with the server for incoming messages disabled.- Throws:
UnknownHostException- if the local host cannot be determined.IOException
-
DTLSTM
Creates a TLS transport mapping with the server, for incoming messages bind to the given DTLS address. ThesecurityCallbackneeds to be specified beforelisten()is called.- Parameters:
address- server address to bind.- Throws:
IOException- on failure of binding a local port.- Since:
- 3.3.2
-
DTLSTM
Creates a TLS transport mapping with the server, for incoming messages bind to the given address. ThesecurityCallbackneeds to be specified beforelisten()is called.- Parameters:
address- server address to bind.serverEnabled- defines the role of the underlyingSSLEngine. Setting this tofalseenables theSSLEngine.setUseClientMode(boolean).- Throws:
IOException- on failure of binding a local port.- Since:
- 3.2.0
-
DTLSTM
public DTLSTM(TlsTmSecurityCallback<X509Certificate> securityCallback, DtlsAddress serverAddress) throws IOException Creates a DTLS transport mapping that binds to the given address (interface) on the local host.- Parameters:
securityCallback- a security name callback to resolve X509 certificates to tmSecurityNames.serverAddress- the UdpAddress instance that describes the server address to listen on incoming connection requests.- Throws:
IOException- if the given address cannot be bound.
-
DTLSTM
public DTLSTM(TlsTmSecurityCallback<X509Certificate> securityCallback, DtlsAddress serverAddress, CounterSupport counterSupport) throws IOException Creates a TLS transport mapping that binds to the given address (interface) on the local host and runs as a server.- Parameters:
securityCallback- a security name callback to resolve X509 certificates to tmSecurityNames.serverAddress- the UdpAddress instance that describes the server address to listen on incoming connection requests.counterSupport- The CounterSupport instance to be used to count events created by this TLSTM instance. To get a default instance, useCounterSupport.getInstance().- Throws:
IOException- if the given address cannot be bound.
-
DTLSTM
public DTLSTM(TlsTmSecurityCallback<X509Certificate> securityCallback, DtlsAddress serverAddress, CounterSupport counterSupport, boolean serverEnabled) throws IOException Creates a TLS transport mapping that binds to the given address (interface) on the local host.- Parameters:
securityCallback- a security name callback to resolve X509 certificates to tmSecurityNames.serverAddress- the UdpAddress instance that describes the server address to listen on incoming connection requests.counterSupport- The CounterSupport instance to be used to count events created by this TLSTM instance. To get a default instance, useCounterSupport.getInstance().serverEnabled- defines the role of the underlyingSSLEngine. Setting this tofalseenables theSSLEngine.setUseClientMode(boolean).- Throws:
IOException- if the given address cannot be bound.- Since:
- 3.2.0
-
-
Method Details
-
listen
Starts the listener thread that accepts incoming messages. The thread is started in daemon mode and thus it will not block application terminated. Nevertheless, theclose()method should be called to stop the listen thread gracefully and free associated ressources.- Specified by:
listenin interfaceTransportMapping<UdpAddress>- Overrides:
listenin classDefaultUdpTransportMapping- Throws:
IOException- if the listen port could not be bound to the server thread.
-
close
Closes the socket and stops the listener thread and socket cleaner timer (ifDefaultUdpTransportMapping.getSocketTimeout()is greater than zero).- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceTransportMapping<UdpAddress>- Overrides:
closein classDefaultUdpTransportMapping- Throws:
IOException- if the socket cannot be closed.
-
getSupportedTransportType
- Specified by:
getSupportedTransportTypein interfaceTransportMapping<UdpAddress>- Returns:
TransportType.receiverifisServerEnabled()istrueandTransportType.senderotherwise.- Since:
- 3.2.0
-
getDtlsHandshakeThreadPoolSize
public int getDtlsHandshakeThreadPoolSize() -
setDtlsHandshakeThreadPoolSize
public void setDtlsHandshakeThreadPoolSize(int dtlsHandshakeThreadPoolSize) Sets the maximum number of threads reserved for DTLS inbound connection handshake processing.- Parameters:
dtlsHandshakeThreadPoolSize- the thread pool size that gets effective whenlisten()is called. Default isDEFAULT_DTLS_HANDSHAKE_THREADPOOL_SIZE.
-
getLocalCertificateAlias
Description copied from interface:TlsTransportMappingConfigGets the certificate alias used for client and server authentication. See alsoTlsTransportMappingConfig.setLocalCertificateAlias(java.lang.String)- Specified by:
getLocalCertificateAliasin interfaceTlsTransportMappingConfig<X509Certificate>- Returns:
- the certificate alias selecting the local certificate.
-
getProtocolVersions
Description copied from interface:TlsTransportMappingConfigReturn the (D)TLS protocol versions used by this transport mapping.- Specified by:
getProtocolVersionsin interfaceTlsTransportMappingConfig<X509Certificate>- Returns:
- an array of SunJSSE TLS/DTLS provider (depending on the transport mapping type).
-
getProtocolVersionPropertyName
Returns the property name that is used by this transport mapping to determine the protocol versions from system properties.- Specified by:
getProtocolVersionPropertyNamein interfaceTlsTransportMappingConfig<X509Certificate>- Returns:
- a property name like
SnmpConfigurator.P_TLS_VERSIONorSnmpConfigurator.P_DTLS_VERSION.
-
setProtocolVersions
Sets the DTLS protocols/versions that DTLSTM should use during handshake. The default is defined byDEFAULT_DTLSTM_PROTOCOLS.- Specified by:
setProtocolVersionsin interfaceTlsTransportMappingConfig<X509Certificate>- Parameters:
dtlsProtocols- an array of TLS protocol (version) names supported by the SunJSSE provider. The order in the array defines which protocol is tried during handshake first.- Since:
- 3.0
-
getKeyStore
- Specified by:
getKeyStorein interfaceTlsTransportMappingConfig<X509Certificate>
-
setKeyStore
- Specified by:
setKeyStorein interfaceTlsTransportMappingConfig<X509Certificate>
-
getKeyStorePassword
- Specified by:
getKeyStorePasswordin interfaceTlsTransportMappingConfig<X509Certificate>
-
setKeyStorePassword
- Specified by:
setKeyStorePasswordin interfaceTlsTransportMappingConfig<X509Certificate>
-
getTrustStore
- Specified by:
getTrustStorein interfaceTlsTransportMappingConfig<X509Certificate>
-
setTrustStore
- Specified by:
setTrustStorein interfaceTlsTransportMappingConfig<X509Certificate>
-
getTrustStorePassword
- Specified by:
getTrustStorePasswordin interfaceTlsTransportMappingConfig<X509Certificate>
-
setTrustStorePassword
- Specified by:
setTrustStorePasswordin interfaceTlsTransportMappingConfig<X509Certificate>
-
setLocalCertificateAlias
Sets the certificate alias used for client and server authentication by this TLSTM. Setting this property to a value other thannullfilters out any certificates which are not in the chain of the given alias.- Specified by:
setLocalCertificateAliasin interfaceTlsTransportMappingConfig<X509Certificate>- Parameters:
localCertificateAlias- a certificate alias which filters a single certification chain from thejavax.net.ssl.keyStorekey store to be used to authenticate this TLS transport mapping. Ifnullno filtering appears, which could lead to more than a single chain available for authentication by the peer, which would violate the TLSTM standard requirements.
-
getCounterSupport
-
getSupportedAddressClass
Description copied from interface:TransportMappingGets the primaryAddressclass that is supported by this transport mapping.- Specified by:
getSupportedAddressClassin interfaceTransportMapping<UdpAddress>- Overrides:
getSupportedAddressClassin classUdpTransportMapping- Returns:
- a subclass of
Address.
-
getSupportedAddressClasses
Returns a set ofDtlsAddressandUdpAddress.- Specified by:
getSupportedAddressClassesin interfaceTransportMapping<UdpAddress>- Returns:
- a set of address classes with at least one element (see
getSupportedAddressClass().
-
getSecurityCallback
Description copied from interface:TlsTransportMappingConfigGets theTlsTmSecurityCallbackassociated with thisTransportMappinghook which is called by the transport mapping to lookup TLS security parameters from external configuration.- Specified by:
getSecurityCallbackin interfaceTlsTransportMappingConfig<X509Certificate>- Returns:
- a
TlsTmSecurityCallbackinstance.
-
setSecurityCallback
Description copied from interface:TlsTransportMappingConfigSets theTlsTmSecurityCallbackassociated with thisTransportMappinghook. This hook will be called to lookup the security name based on the TLS peer certificate, for example. SeeTlsTmSecurityCallbackfor details.- Specified by:
setSecurityCallbackin interfaceTlsTransportMappingConfig<X509Certificate>- Parameters:
securityCallback- aTlsTmSecurityCallbackinstance. Setting this hook tonullwill disable incoming request processing because these request will be rejected due to an authorization error (no mathing SNMPv3 view).
-
getTrustManagerFactory
-
setTrustManagerFactory
Set the TLSTM trust manager factory. Using a trust manager factory other than the default allows to add support for Java 1.7 X509ExtendedTrustManager.- Parameters:
trustManagerFactory- a X.509 trust manager factory implementing the interfaceTLSTMTrustManagerFactory.- Since:
- 3.0.0
-
getListenAddress
Description copied from interface:TransportMappingReturns the address that represents the actual incoming address this transport mapping uses to listen for incoming packets.- Specified by:
getListenAddressin interfaceTransportMapping<UdpAddress>- Overrides:
getListenAddressin classDefaultUdpTransportMapping- Returns:
- the address for incoming packets or
nullthis transport mapping is not configured to listen for incoming packets.
-
close
Closes a connection to the supplied remote address, if it is open. This method is particularly useful when not using a timeout for remote connections.- Specified by:
closein interfaceConnectionOrientedTransportMapping<UdpAddress>- Parameters:
remoteAddress- the address of the peer socket.- Returns:
trueif the connection has been closed andfalseif there was nothing to close.- Throws:
IOException- if the remote address cannot be closed due to an IO exception.
-
getConnectionTimeout
public long getConnectionTimeout()Gets the connection timeout. This timeout specifies the time a connection may be idle before it is closed.- Specified by:
getConnectionTimeoutin interfaceConnectionOrientedTransportMapping<UdpAddress>- Returns:
- long the idle timeout in milliseconds.
-
getMessageLengthDecoder
Returns theMessageLengthDecoderused by this transport mapping.- Specified by:
getMessageLengthDecoderin interfaceConnectionOrientedTransportMapping<UdpAddress>- Returns:
- a MessageLengthDecoder instance.
-
setMessageLengthDecoder
Sets theMessageLengthDecoderthat decodes the total message length from the header of a message.- Specified by:
setMessageLengthDecoderin interfaceConnectionOrientedTransportMapping<UdpAddress>- Parameters:
messageLengthDecoder- a MessageLengthDecoder instance.
-
setConnectionTimeout
public void setConnectionTimeout(long connectionTimeout) Sets the connection timeout. This timeout specifies the time a connection may be idle before it is closed.- Specified by:
setConnectionTimeoutin interfaceConnectionOrientedTransportMapping<UdpAddress>- Parameters:
connectionTimeout- the idle timeout in milliseconds. A zero or negative value will disable any timeout and connections opened by this transport mapping will stay opened until they are explicitly closed.
-
getSocketCleaner
Gets theCommonTimerthat controls socket cleanup operations.- Specified by:
getSocketCleanerin interfaceConnectionOrientedTransportMapping<UdpAddress>- Overrides:
getSocketCleanerin classAbstractTransportMapping<UdpAddress>- Returns:
- a socket cleaner timer.
- Since:
- 3.0
-
isServerEnabled
public boolean isServerEnabled()Checks whether a server for incoming requests is enabled.- Specified by:
isServerEnabledin interfaceConnectionOrientedTransportMapping<UdpAddress>- Returns:
- boolean
-
setServerEnabled
public void setServerEnabled(boolean serverEnabled) Sets whether a server for incoming requests should be created when the transport is set into listen state. Setting this value has no effect until thelisten()method is called (if the transport is already listening,close()has to be called before).- Specified by:
setServerEnabledin interfaceConnectionOrientedTransportMapping<UdpAddress>- Parameters:
serverEnabled- iftrueif the transport will listens for incoming requests afterlisten()has been called.
-
setMaxInboundMessageSize
public void setMaxInboundMessageSize(int maxInboundMessageSize) Sets the maximum buffer size for incoming requests. When SNMP packets are received that are longer than this maximum size, the messages will be silently dropped and the connection will be closed.- Overrides:
setMaxInboundMessageSizein classDefaultUdpTransportMapping- Parameters:
maxInboundMessageSize- the length of the inbound buffer in bytes.
-
getHandshakeTimeout
public int getHandshakeTimeout()Gets the maximum number of milliseconds to wait for the DTLS handshake operation to succeed.- Returns:
- the handshake timeout millis.
-
setHandshakeTimeout
public void setHandshakeTimeout(int handshakeTimeout) Sets the maximum number of milliseconds to wait for the DTLS handshake operation to succeed.- Parameters:
handshakeTimeout- the new handshake timeout millis.
-
getX509CertificateRevocationListURI
Description copied from interface:X509TlsTransportMappingConfigGets the X509 certificate revocation list (CRL) URI, if defined.- Specified by:
getX509CertificateRevocationListURIin interfaceX509TlsTransportMappingConfig- Returns:
nullif there is no CRL available/necessary or a URI string that points to a CRL file.
-
setX09CertificateRevocationListURI
Description copied from interface:X509TlsTransportMappingConfigSets the X509 certificate revocation list (CRL) URI, to enable CRL checking.- Specified by:
setX09CertificateRevocationListURIin interfaceX509TlsTransportMappingConfig- Parameters:
crlURI-nullif there is no CRL available/necessary or a URI string that points to a CRL file.
-
prepareOutPackets
protected List<DatagramPacket> prepareOutPackets(UdpAddress targetAddress, byte[] message, TransportStateReference tmStateReference, DatagramSocket socket, long timeoutMillis, int maxRetries) throws IOException Description copied from class:DefaultUdpTransportMappingPrepare an application message for sending over the network to the specified target address.- Overrides:
prepareOutPacketsin classDefaultUdpTransportMapping- Parameters:
targetAddress- the UDP address the message will be sent to.message- the application message to send.tmStateReference- the transport state reference associated with this message.socket- the socket that will send the message over the network. @return an ByteBuffer that contains the network representation of the message (i.e. encrypted).timeoutMillis- maximum number of milli seconds the connection creation might take (if connection based). Use 0 for responses or transport mappings that do not require connection establishment.maxRetries- maximum retries during connection creation. Use 0 for responses.- Returns:
- a list of prepared
DatagramPacketinstances. By default this is a singleton list. - Throws:
IOException- if the preparation of the network message fails (e.g. because the encryption handshake fails).
-
onReceiveTimeout
protected List<DatagramPacket> onReceiveTimeout(SSLEngine engine, SocketAddress socketAddr) throws IOException - Throws:
IOException
-
getPKIXRevocationChecker
Description copied from interface:X509TlsTransportMappingConfigGets the (optional and possiblynull) revocation checker for the cert path validation of X509 certificates.- Specified by:
getPKIXRevocationCheckerin interfaceX509TlsTransportMappingConfig- Returns:
nullto disable cert path validation with CLR checking or a properly configured cert path checker instance.
-
setPKIXRevocationChecker
Description copied from interface:X509TlsTransportMappingConfigSets the (optional and possiblynull) revocation checker for the cert path validation of X509 certificates.- Specified by:
setPKIXRevocationCheckerin interfaceX509TlsTransportMappingConfig- Parameters:
pkixRevocationChecker-nullto disable cert path validation with CLR checking or a properly configured cert path checker instance.
-
isAsyncMsgProcessingSupported
public boolean isAsyncMsgProcessingSupported()Description copied from class:AbstractTransportMappingReturnstrueif asynchronous (multi-threaded) message processing may be implemented. The default istrue.- Overrides:
isAsyncMsgProcessingSupportedin classAbstractTransportMapping<UdpAddress>- Returns:
- if
falseis returned theMessageDispatcher.processMessage(org.snmp4j.TransportMapping, org.snmp4j.smi.Address, java.nio.ByteBuffer, org.snmp4j.TransportStateReference)method must not return before the message has been entirely processed.
-
setAsyncMsgProcessingSupported
public void setAsyncMsgProcessingSupported(boolean asyncMsgProcessingSupported) Description copied from class:AbstractTransportMappingSpecifies whether this transport mapping has to support asynchronous messages processing or not.- Overrides:
setAsyncMsgProcessingSupportedin classAbstractTransportMapping<UdpAddress>- Parameters:
asyncMsgProcessingSupported- iffalsetheMessageDispatcher.processMessage(org.snmp4j.TransportMapping, org.snmp4j.smi.Address, java.nio.ByteBuffer, org.snmp4j.TransportStateReference)method must not return before the message has been entirely processed, because the incoming message buffer is not copied before the message is being processed. Iftruethe message buffer is copied for each call, so that the message processing can be implemented asynchronously.
-
fireProcessMessage
protected void fireProcessMessage(DatagramPacket packet, ByteBuffer bis, TransportStateReference stateReference) - Overrides:
fireProcessMessagein classDefaultUdpTransportMapping
-
prepareInPacket
protected ByteBuffer prepareInPacket(DatagramPacket packet, byte[] buf, TransportStateReference tmStateReference) throws IOException Description copied from class:DefaultUdpTransportMappingPrepare a network packet for the application.- Overrides:
prepareInPacketin classDefaultUdpTransportMapping- Parameters:
packet- the incoming network datagram packet.buf- the buffer of the packet.tmStateReference- the transport state reference.- Returns:
- a byte buffer with the application data of the packet.
- Throws:
IOException- if there occurs an IO exception during preparation.
-
produceHandshakePackets
protected List<DatagramPacket> produceHandshakePackets(SSLEngine sslEngine, SocketAddress socketAddress) throws IOException - Throws:
IOException
-
createHandshakePacket
-
getSslEngineConfigurator
-
setSslEngineConfigurator
-
ensureSslEngineConfigurator
Returns the configuredsetSslEngineConfigurator(SSLEngineConfigurator)or theDefaultSSLEngineConfigurationwhich will then become the configured SSL engine configurator. This method is not synchronized against concurrent execution ofsetSslEngineConfigurator(SSLEngineConfigurator).- Returns:
- a non-null
SSLEngineConfigurator. - Since:
- 3.0.5
-