- java.lang.Object
-
- org.snmp4j.transport.AbstractTransportMapping<TcpAddress>
-
- org.snmp4j.transport.TcpTransportMapping<org.snmp4j.transport.TLSTM.SocketEntry>
-
- org.snmp4j.transport.TLSTM
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,ConnectionOrientedTransportMapping<TcpAddress>,TlsTransportMappingConfig<java.security.cert.X509Certificate>,X509TlsTransportMappingConfig,TransportMapping<TcpAddress>
public class TLSTM extends TcpTransportMapping<org.snmp4j.transport.TLSTM.SocketEntry> implements X509TlsTransportMappingConfig
TheTLSTMimplements the Transport Layer Security Transport Mapping (TLS-TM) as defined by RFC 5953 with the new IO API andSSLEngine.It uses a single thread for processing incoming and outgoing messages. The thread is started when the
listenmethod is called, or when an outgoing request is sent using thesendMessagemethod.- Since:
- 2.0
- Version:
- 3.2.0
- Author:
- Frank Fock
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_TLSTM_PROTOCOLSstatic intMAX_TLS_PAYLOAD_SIZEstatic intTLS_MAX_FRAGMENT_SIZE-
Fields inherited from class org.snmp4j.transport.AbstractTransportMapping
asyncMsgProcessingSupported, maxInboundMessageSize, transportListener
-
Fields inherited from class org.snmp4j.transport.TcpTransportMapping
sockets, tcpAddress
-
-
Constructor Summary
Constructors Constructor Description TLSTM()Creates a default TCP transport mapping with the server for incoming messages disabled.TLSTM(TlsAddress address)Creates a TLS transport mapping with the server for incoming messages bind to the given address.TLSTM(TlsAddress address, boolean serverEnabled)Creates a TLS transport mapping with the server for incoming messages bind to the given address.TLSTM(TlsTmSecurityCallback<java.security.cert.X509Certificate> securityCallback, TlsAddress serverAddress)Creates a TLS transport mapping that binds to the given address (interface) on the local host.TLSTM(TlsTmSecurityCallback<java.security.cert.X509Certificate> securityCallback, TlsAddress serverAddress, CounterSupport counterSupport)Creates a TLS transport mapping that binds to the given address (interface) on the local host.TLSTM(TlsTmSecurityCallback<java.security.cert.X509Certificate> securityCallback, TlsAddress serverAddress, CounterSupport counterSupport, boolean serverEnabled)Creates a TLS transport mapping that binds to the given address (interface) on the local host.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()Closes all open sockets and stops the internal server thread that processes messages.protected TlsAddresscreateIncomingAddress(java.net.Socket s)protected SSLEngineConfiguratorensureSslEngineConfigurator()Returns the configuredsetSslEngineConfigurator(SSLEngineConfigurator)or theDefaultSSLEngineConfigurationwhich will then become the configured SSL engine configurator.longgetConnectionTimeout()Gets the connection timeout.CounterSupportgetCounterSupport()java.lang.StringgetKeyStore()java.lang.StringgetKeyStorePassword()TcpAddressgetListenAddress()Returns the address that represents the actual incoming address this transport mapping uses to listen for incoming packets.java.lang.StringgetLocalCertificateAlias()Gets the certificate alias used for client and server authentication.intgetMaxInboundMessageSize()Gets the inbound buffer size for incoming requests.MessageLengthDecodergetMessageLengthDecoder()Returns theMessageLengthDecoderused by this transport mapping.java.lang.StringgetProtocolVersionPropertyName()Returns the property name that is used by this transport mapping to determine the protocol versions from system properties.java.lang.String[]getProtocolVersions()Return the (D)TLS protocol versions used by this transport mapping.TlsTmSecurityCallback<java.security.cert.X509Certificate>getSecurityCallback()Gets theTlsTmSecurityCallbackassociated with thisTransportMappinghook which is called by the transport mapping to lookup TLS security parameters from external configuration.CommonTimergetSocketCleaner()Gets theCommonTimerthat controls socket cleanup operations.SSLEngineConfiguratorgetSslEngineConfigurator()java.lang.Class<? extends Address>getSupportedAddressClass()Gets the primaryAddressclass that is supported by this transport mapping.TransportTypegetSupportedTransportType()java.lang.StringgetThreadName()Returns the name of the listen thread.intgetTlsMaxFragmentSize()Gets the maximum fragment size of supported for this transport mapping when acting as TLS server.java.lang.String[]getTlsProtocols()Deprecated.UsegetProtocolVersions()instead.TLSTMTrustManagerFactorygetTrustManagerFactory()java.lang.StringgetTrustStore()java.lang.StringgetTrustStorePassword()booleanisListening()Returnstrueif the transport mapping is listening for incoming messages.booleanisServerEnabled()Checks whether a server for incoming requests is enabled.voidlisten()Listen for incoming and outgoing requests.voidsendMessage(TcpAddress address, byte[] message, TransportStateReference tmStateReference, long timeoutMillis, int maxRetries)Sends a SNMP message to the supplied address.voidsetConnectionTimeout(long connectionTimeout)Sets the connection timeout.voidsetKeyStore(java.lang.String keyStore)voidsetKeyStorePassword(java.lang.String keyStorePassword)voidsetLocalCertificateAlias(java.lang.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.voidsetProtocolVersions(java.lang.String[] protocolVersions)Sets the TLS protocols/versions that TLSTM should use during handshake.voidsetSecurityCallback(TlsTmSecurityCallback<java.security.cert.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)Sets the configurator for theSSLEngineinternally used to run the TLS communication.voidsetThreadName(java.lang.String name)Sets the name of the listen thread for this UDP transport mapping.voidsetTlsMaxFragmentSize(int tlsMaxFragmentSize)Sets the maximum TLS fragment size that this transport mapping should support as server.voidsetTlsProtocols(java.lang.String[] tlsProtocols)Deprecated.UsesetProtocolVersions(String[])instead.voidsetTrustManagerFactory(TLSTMTrustManagerFactory trustManagerFactory)Set the TLSTM trust manager factory.voidsetTrustStore(java.lang.String trustStore)voidsetTrustStorePassword(java.lang.String trustStorePassword)-
Methods inherited from class org.snmp4j.transport.AbstractTransportMapping
addTransportListener, fireProcessMessage, isAsyncMsgProcessingSupported, removeTransportListener, setAsyncMsgProcessingSupported
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from class org.snmp4j.transport.TcpTransportMapping
addTransportStateListener, close, closeSockets, fireConnectionStateChanged, getAddress, getServer, removeTransportStateListener, setSocketOptions, timeoutSocket
-
Methods inherited from interface org.snmp4j.TransportMapping
addTransportListener, getSupportedAddressClasses, isAddressSupported, isAddressSupported, removeTransportListener
-
-
-
-
Field Detail
-
TLS_MAX_FRAGMENT_SIZE
public static final int TLS_MAX_FRAGMENT_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_TLSTM_PROTOCOLS
public static final java.lang.String DEFAULT_TLSTM_PROTOCOLS
- See Also:
- Constant Field Values
-
MAX_TLS_PAYLOAD_SIZE
public static final int MAX_TLS_PAYLOAD_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TLSTM
public TLSTM() throws java.net.UnknownHostExceptionCreates a default TCP transport mapping with the server for incoming messages disabled.- Throws:
java.net.UnknownHostException- if the local host cannot be determined.
-
TLSTM
public TLSTM(TlsAddress address) throws java.io.IOException
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- the address to bind for incoming requests.- Throws:
java.io.IOException- on failure of binding a local port.
-
TLSTM
public TLSTM(TlsAddress address, boolean serverEnabled) throws java.io.IOException
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- the address to bind for incoming requests.serverEnabled- defines the role of the underlyingSSLEngine. Setting this tofalseenables theSSLEngine.setUseClientMode(boolean).- Throws:
java.io.IOException- on failure of binding a local port.- Since:
- 3.2.0
-
TLSTM
public TLSTM(TlsTmSecurityCallback<java.security.cert.X509Certificate> securityCallback, TlsAddress serverAddress) throws java.io.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 TcpAddress instance that describes the server address to listen on incoming connection requests.- Throws:
java.io.IOException- if the given address cannot be bound.
-
TLSTM
public TLSTM(TlsTmSecurityCallback<java.security.cert.X509Certificate> securityCallback, TlsAddress serverAddress, CounterSupport counterSupport) throws java.io.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 TcpAddress 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:
java.io.IOException- if the given address cannot be bound.
-
TLSTM
public TLSTM(TlsTmSecurityCallback<java.security.cert.X509Certificate> securityCallback, TlsAddress serverAddress, CounterSupport counterSupport, boolean serverEnabled) throws java.io.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 TcpAddress 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:
java.io.IOException- if the given address cannot be bound.- Since:
- 3.2.0
-
-
Method Detail
-
getLocalCertificateAlias
public java.lang.String 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<java.security.cert.X509Certificate>- Returns:
- the certificate alias selecting the local certificate.
-
getSupportedTransportType
public TransportType getSupportedTransportType()
- Specified by:
getSupportedTransportTypein interfaceTransportMapping<TcpAddress>- Returns:
TransportType.anyifisServerEnabled()istrueandTransportType.senderotherwise.- Since:
- 3.2.0
-
getTlsMaxFragmentSize
public int getTlsMaxFragmentSize()
Gets the maximum fragment size of supported for this transport mapping when acting as TLS server.- Returns:
- the maximum TLS fragment size as defined by RFC 6066 section 4.
-
setTlsMaxFragmentSize
public void setTlsMaxFragmentSize(int tlsMaxFragmentSize)
Sets the maximum TLS fragment size that this transport mapping should support as server. There is no need to change that from the defaultTLS_MAX_FRAGMENT_SIZEunless, a new Java version allows to set the maximum fragment size to a lower value.- Parameters:
tlsMaxFragmentSize- a value as defined by RFC 6066 section 4.- Since:
- 3.0.5
-
getTlsProtocols
@Deprecated public java.lang.String[] getTlsProtocols()
Deprecated.UsegetProtocolVersions()instead.Gets the TLS protocols supported by this transport mapping.- Returns:
- an array of TLS protocol (version) names supported by the SunJSSE provider.
-
setTlsProtocols
@Deprecated public void setTlsProtocols(java.lang.String[] tlsProtocols)
Deprecated.UsesetProtocolVersions(String[])instead.Sets the TLS protocols/versions that TLSTM should use during handshake. The default is defined byDEFAULT_TLSTM_PROTOCOLS.- Parameters:
tlsProtocols- 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:
- 2.0.3
-
setProtocolVersions
public void setProtocolVersions(java.lang.String[] protocolVersions)
Sets the TLS protocols/versions that TLSTM should use during handshake. The default is defined byDEFAULT_TLSTM_PROTOCOLS.- Specified by:
setProtocolVersionsin interfaceTlsTransportMappingConfig<java.security.cert.X509Certificate>- Parameters:
protocolVersions- 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
-
getProtocolVersions
public java.lang.String[] getProtocolVersions()
Description copied from interface:TlsTransportMappingConfigReturn the (D)TLS protocol versions used by this transport mapping.- Specified by:
getProtocolVersionsin interfaceTlsTransportMappingConfig<java.security.cert.X509Certificate>- Returns:
- an array of SunJSSE TLS/DTLS provider (depending on the transport mapping type).
-
getProtocolVersionPropertyName
public java.lang.String getProtocolVersionPropertyName()
Returns the property name that is used by this transport mapping to determine the protocol versions from system properties.- Specified by:
getProtocolVersionPropertyNamein interfaceTlsTransportMappingConfig<java.security.cert.X509Certificate>- Returns:
- a property name like
SnmpConfigurator.P_TLS_VERSIONorSnmpConfigurator.P_DTLS_VERSION. - Since:
- 3.0
-
getKeyStore
public java.lang.String getKeyStore()
- Specified by:
getKeyStorein interfaceTlsTransportMappingConfig<java.security.cert.X509Certificate>
-
setKeyStore
public void setKeyStore(java.lang.String keyStore)
- Specified by:
setKeyStorein interfaceTlsTransportMappingConfig<java.security.cert.X509Certificate>
-
getKeyStorePassword
public java.lang.String getKeyStorePassword()
- Specified by:
getKeyStorePasswordin interfaceTlsTransportMappingConfig<java.security.cert.X509Certificate>
-
setKeyStorePassword
public void setKeyStorePassword(java.lang.String keyStorePassword)
- Specified by:
setKeyStorePasswordin interfaceTlsTransportMappingConfig<java.security.cert.X509Certificate>
-
getTrustStore
public java.lang.String getTrustStore()
- Specified by:
getTrustStorein interfaceTlsTransportMappingConfig<java.security.cert.X509Certificate>
-
setTrustStore
public void setTrustStore(java.lang.String trustStore)
- Specified by:
setTrustStorein interfaceTlsTransportMappingConfig<java.security.cert.X509Certificate>
-
getTrustStorePassword
public java.lang.String getTrustStorePassword()
- Specified by:
getTrustStorePasswordin interfaceTlsTransportMappingConfig<java.security.cert.X509Certificate>
-
setTrustStorePassword
public void setTrustStorePassword(java.lang.String trustStorePassword)
- Specified by:
setTrustStorePasswordin interfaceTlsTransportMappingConfig<java.security.cert.X509Certificate>
-
setLocalCertificateAlias
public void setLocalCertificateAlias(java.lang.String localCertificateAlias)
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<java.security.cert.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
public CounterSupport getCounterSupport()
-
getSupportedAddressClass
public java.lang.Class<? extends Address> getSupportedAddressClass()
Description copied from interface:TransportMappingGets the primaryAddressclass that is supported by this transport mapping.- Specified by:
getSupportedAddressClassin interfaceTransportMapping<TcpAddress>- Overrides:
getSupportedAddressClassin classTcpTransportMapping<org.snmp4j.transport.TLSTM.SocketEntry>- Returns:
- a subclass of
Address.
-
getSecurityCallback
public TlsTmSecurityCallback<java.security.cert.X509Certificate> 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<java.security.cert.X509Certificate>- Returns:
- a
TlsTmSecurityCallbackinstance.
-
setSecurityCallback
public void setSecurityCallback(TlsTmSecurityCallback<java.security.cert.X509Certificate> securityCallback)
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<java.security.cert.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).
-
getSslEngineConfigurator
public SSLEngineConfigurator getSslEngineConfigurator()
-
setSslEngineConfigurator
public void setSslEngineConfigurator(SSLEngineConfigurator sslEngineConfigurator)
Sets the configurator for theSSLEngineinternally used to run the TLS communication. This method should be called before any new connection is established that should use this configurator/configuration.- Parameters:
sslEngineConfigurator- aSSLEngineConfiguratorinstance likeDefaultSSLEngineConfiguration.- Since:
- 3.0.5
-
getTrustManagerFactory
public TLSTMTrustManagerFactory getTrustManagerFactory()
-
setTrustManagerFactory
public void setTrustManagerFactory(TLSTMTrustManagerFactory trustManagerFactory)
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:
- 2.0.3
-
listen
public void listen() throws java.io.IOExceptionListen for incoming and outgoing requests. If theserverEnabledmember isfalsethe server for incoming requests is not started. This starts the internal server thread that processes messages.- Specified by:
listenin interfaceTransportMapping<TcpAddress>- Specified by:
listenin classTcpTransportMapping<org.snmp4j.transport.TLSTM.SocketEntry>- Throws:
java.net.SocketException- when the transport is already listening for incoming/outgoing messages.java.io.IOException- if the listen port could not be bound to the server thread.
-
setThreadName
public void setThreadName(java.lang.String name)
Sets the name of the listen thread for this UDP transport mapping. This method has no effect, if called beforelisten()has been called for this transport mapping.- Parameters:
name- the new thread name.- Since:
- 1.6
-
getThreadName
public java.lang.String getThreadName()
Returns the name of the listen thread.- Returns:
- the thread name if in listening mode, otherwise
null. - Since:
- 1.6
-
close
public void close()
Closes all open sockets and stops the internal server thread that processes messages.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceTransportMapping<TcpAddress>- Specified by:
closein classTcpTransportMapping<org.snmp4j.transport.TLSTM.SocketEntry>
-
sendMessage
public void sendMessage(TcpAddress address, byte[] message, TransportStateReference tmStateReference, long timeoutMillis, int maxRetries) throws java.io.IOException
Sends a SNMP message to the supplied address.- Specified by:
sendMessagein interfaceTransportMapping<TcpAddress>- Specified by:
sendMessagein classTcpTransportMapping<org.snmp4j.transport.TLSTM.SocketEntry>- Parameters:
address- anTcpAddress. AClassCastExceptionis thrown ifaddressis not aTcpAddressinstance.message- byte[] the message to sent.tmStateReference- the (optional) transport model state reference as defined by RFC 5590 section 6.1.timeoutMillis- maximum number of milli seconds the connection creation might take (if connection based).maxRetries- maximum retries during connection creation.- Throws:
java.io.IOException- if an IO exception occurs while trying to send the message.
-
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<TcpAddress>- Overrides:
getConnectionTimeoutin classTcpTransportMapping<org.snmp4j.transport.TLSTM.SocketEntry>- Returns:
- long the idle timeout in milliseconds.
-
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<TcpAddress>- Overrides:
setConnectionTimeoutin classTcpTransportMapping<org.snmp4j.transport.TLSTM.SocketEntry>- 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
public CommonTimer getSocketCleaner()
Gets theCommonTimerthat controls socket cleanup operations.- Specified by:
getSocketCleanerin interfaceConnectionOrientedTransportMapping<TcpAddress>- Returns:
- a socket cleaner timer.
- Since:
- 3.0
-
isServerEnabled
public boolean isServerEnabled()
Checks whether a server for incoming requests is enabled.- Returns:
- boolean
-
getMessageLengthDecoder
public MessageLengthDecoder getMessageLengthDecoder()
Description copied from class:TcpTransportMappingReturns theMessageLengthDecoderused by this transport mapping.- Specified by:
getMessageLengthDecoderin interfaceConnectionOrientedTransportMapping<TcpAddress>- Specified by:
getMessageLengthDecoderin classTcpTransportMapping<org.snmp4j.transport.TLSTM.SocketEntry>- Returns:
- a MessageLengthDecoder instance.
-
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).- Parameters:
serverEnabled- iftrueif the transport will listens for incoming requests afterlisten()has been called.
-
setMessageLengthDecoder
public void setMessageLengthDecoder(MessageLengthDecoder messageLengthDecoder)
Description copied from class:TcpTransportMappingSets theMessageLengthDecoderthat decodes the total message length from the header of a message.- Specified by:
setMessageLengthDecoderin interfaceConnectionOrientedTransportMapping<TcpAddress>- Specified by:
setMessageLengthDecoderin classTcpTransportMapping<org.snmp4j.transport.TLSTM.SocketEntry>- Parameters:
messageLengthDecoder- a MessageLengthDecoder instance.
-
getMaxInboundMessageSize
public int getMaxInboundMessageSize()
Gets the inbound 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.- Specified by:
getMaxInboundMessageSizein interfaceTransportMapping<TcpAddress>- Overrides:
getMaxInboundMessageSizein classAbstractTransportMapping<TcpAddress>- Returns:
- the maximum inbound buffer size in bytes.
-
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.- Parameters:
maxInboundMessageSize- the length of the inbound buffer in bytes.
-
isListening
public boolean isListening()
Description copied from interface:TransportMappingReturnstrueif the transport mapping is listening for incoming messages. For connection oriented transport mappings this is a prerequisite to be able to send SNMP messages. For connectionless transport mappings it is a prerequisite to be able to receive responses.- Specified by:
isListeningin interfaceTransportMapping<TcpAddress>- Returns:
trueif this transport mapping is listening for messages.
-
createIncomingAddress
protected TlsAddress createIncomingAddress(java.net.Socket s)
-
getListenAddress
public TcpAddress 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<TcpAddress>- Overrides:
getListenAddressin classTcpTransportMapping<org.snmp4j.transport.TLSTM.SocketEntry>- Returns:
- the address for incoming packets or
nullthis transport mapping is not configured to listen for incoming packets.
-
ensureSslEngineConfigurator
protected SSLEngineConfigurator 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
-
-