public interface TransportMapping<A extends Address>
TransportMapping
defines the common interface for SNMP
transport mappings. A transport mapping can only support a single
transport protocol.Modifier and Type | Method and 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.
|
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.
|
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 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.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 IOException
IOException
- if any IO operation for the close fails.void listen() throws IOException
sendMessage(A, byte[], org.snmp4j.TransportStateReference)
is called for the
first time.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 © 2023 SNMP4J.org. All rights reserved.