java.lang.AutoCloseable
, java.io.Closeable
ConnectionOrientedTransportMapping<A>
AbstractTransportMapping
, DefaultTcpTransportMapping
, DefaultUdpTransportMapping
, DTLSTM
, TcpTransportMapping
, TLSTM
, UdpTransportMapping
public interface TransportMapping<A extends Address>
extends java.io.Closeable
TransportMapping
defines the common interface for SNMP
transport mappings. A transport mapping can only support a single
transport protocol.Modifier and Type | Method | Description |
---|---|---|
void |
addTransportListener(TransportListener transportListener) |
Adds a transport listener to the transport.
|
void |
close() |
Closes the transport an releases all bound resources synchronously.
|
A |
getListenAddress() |
Returns the address that represents the actual incoming address this transport
mapping uses to listen for incoming packets.
|
int |
getMaxInboundMessageSize() |
Gets the maximum length of an incoming message that can be successfully
processed by this transport mapping implementation.
|
java.lang.Class<? extends Address> |
getSupportedAddressClass() |
Gets the
Address class that is supported by this transport mapping. |
boolean |
isListening() |
Returns
true if the transport mapping is listening for
incoming messages. |
void |
listen() |
Listen for incoming messages.
|
void |
removeTransportListener(TransportListener transportListener) |
Removes a transport listener.
|
void |
sendMessage(A address,
byte[] message,
TransportStateReference tmStateReference) |
Sends a message to the supplied address using this transport.
|
java.lang.Class<? extends Address> getSupportedAddressClass()
Address
class that is supported by this transport mapping.Address
.A getListenAddress()
null
this transport
mapping is not configured to listen for incoming packets.void sendMessage(A address, byte[] message, TransportStateReference tmStateReference) throws java.io.IOException
address
- an Address
instance denoting the target address.message
- the whole message as an array of bytes.tmStateReference
- the (optional) transport model state reference as defined by
RFC 5590 section 6.1.java.io.IOException
- if any underlying IO operation fails.void addTransportListener(TransportListener transportListener)
transportListener
- a TransportListener
instance.void removeTransportListener(TransportListener transportListener)
TransportListener
.transportListener
- a TransportListener
instance.void close() throws java.io.IOException
close
in interface java.lang.AutoCloseable
close
in interface java.io.Closeable
java.io.IOException
- if any IO operation for the close fails.void listen() throws java.io.IOException
sendMessage(A, byte[], org.snmp4j.TransportStateReference)
is called for the
first time.java.io.IOException
- if an IO operation exception occurs while starting the listener.boolean isListening()
true
if 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.true
if this transport mapping is listening for messages.int getMaxInboundMessageSize()
Copyright © 2018 SNMP4J.org. All rights reserved.