Package org.snmp4j.transport
Class UdpTransportMapping
- All Implemented Interfaces:
TransportMapping<UdpAddress>
- Direct Known Subclasses:
DefaultUdpTransportMapping
The
UdpTransportMapping
is the abstract base class for
UDP transport mappings.- Version:
- 1.0
- Author:
- Frank Fock
-
Field Summary
Fields inherited from class org.snmp4j.transport.AbstractTransportMapping
asyncMsgProcessingSupported, maxInboundMessageSize, maxOutboundMessageSize, transportListener
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
close()
Closes the transport an releases all bound resources synchronously.Returns the transport address that is configured for this transport mapping for sending and receiving messages.Returns the address that represents the actual incoming address this transport mapping uses to listen for incoming packets.Gets theAddress
class that is supported by this transport mapping.abstract void
listen()
Listen for incoming messages.abstract void
sendMessage
(UdpAddress address, byte[] message, TransportStateReference tmStateReference) Sends a message to the supplied address using this transport.Methods inherited from class org.snmp4j.transport.AbstractTransportMapping
addTransportListener, fireProcessMessage, getMaxInboundMessageSize, getMaxOutboundMessageSize, isAsyncMsgProcessingSupported, removeAllTransportListeners, removeTransportListener, setAsyncMsgProcessingSupported
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.snmp4j.TransportMapping
isListening
-
Field Details
-
udpAddress
-
-
Constructor Details
-
UdpTransportMapping
-
-
Method Details
-
getSupportedAddressClass
Description copied from interface:TransportMapping
Gets theAddress
class that is supported by this transport mapping.- Specified by:
getSupportedAddressClass
in interfaceTransportMapping<UdpAddress>
- Specified by:
getSupportedAddressClass
in classAbstractTransportMapping<UdpAddress>
- Returns:
- a subclass of
Address
.
-
getAddress
Returns the transport address that is configured for this transport mapping for sending and receiving messages.- Returns:
- the
Address
used by this transport mapping. The returned instance must not be modified!
-
getListenAddress
Description copied from interface:TransportMapping
Returns the address that represents the actual incoming address this transport mapping uses to listen for incoming packets.- Returns:
- the address for incoming packets or
null
this transport mapping is not configured to listen for incoming packets.
-
listen
Description copied from interface:TransportMapping
Listen for incoming messages. For connection oriented transports, this method needs to be called beforeTransportMapping.sendMessage(A, byte[], org.snmp4j.TransportStateReference)
is called for the first time.- Specified by:
listen
in interfaceTransportMapping<UdpAddress>
- Specified by:
listen
in classAbstractTransportMapping<UdpAddress>
- Throws:
IOException
- if an IO operation exception occurs while starting the listener.
-
close
Description copied from interface:TransportMapping
Closes the transport an releases all bound resources synchronously.- Specified by:
close
in interfaceTransportMapping<UdpAddress>
- Specified by:
close
in classAbstractTransportMapping<UdpAddress>
- Throws:
IOException
- if any IO operation for the close fails.
-
sendMessage
public abstract void sendMessage(UdpAddress address, byte[] message, TransportStateReference tmStateReference) throws IOException Description copied from interface:TransportMapping
Sends a message to the supplied address using this transport.- Specified by:
sendMessage
in interfaceTransportMapping<UdpAddress>
- Specified by:
sendMessage
in classAbstractTransportMapping<UdpAddress>
- Parameters:
address
- anAddress
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.- Throws:
IOException
- if any underlying IO operation fails.
-