org.snmp4j.transport
Class UdpTransportMapping

java.lang.Object
  extended by org.snmp4j.transport.AbstractTransportMapping
      extended by org.snmp4j.transport.UdpTransportMapping
All Implemented Interfaces:
TransportMapping
Direct Known Subclasses:
DefaultUdpTransportMapping

public abstract class UdpTransportMapping
extends AbstractTransportMapping

The UdpTransportMapping is the abstract base class for UDP transport mappings.

Version:
1.0
Author:
Frank Fock

Field Summary
protected  UdpAddress udpAddress
           
 
Fields inherited from class org.snmp4j.transport.AbstractTransportMapping
asyncMsgProcessingSupported, maxInboundMessageSize, transportListener
 
Constructor Summary
UdpTransportMapping(UdpAddress udpAddress)
           
 
Method Summary
abstract  void close()
          Closes the transport an releases all bound resources synchronously.
 UdpAddress getAddress()
          Returns the transport address that is used by this transport mapping for sending and receiving messages.
 Address getListenAddress()
          Returns the address that represents the incoming address this transport mapping uses to listen for incoming packets.
 java.lang.Class getSupportedAddressClass()
          Gets the Address class that is this transport mapping supports.
abstract  void listen()
          Listen for incoming messages.
abstract  void sendMessage(Address address, byte[] message)
          Sends a message to the supplied address using this transport.
 
Methods inherited from class org.snmp4j.transport.AbstractTransportMapping
addMessageDispatcher, addTransportListener, fireProcessMessage, getMaxInboundMessageSize, isAsyncMsgProcessingSupported, removeMessageDispatcher, 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 Detail

udpAddress

protected UdpAddress udpAddress
Constructor Detail

UdpTransportMapping

public UdpTransportMapping(UdpAddress udpAddress)
Method Detail

getSupportedAddressClass

public java.lang.Class getSupportedAddressClass()
Description copied from interface: TransportMapping
Gets the Address class that is this transport mapping supports.

Specified by:
getSupportedAddressClass in interface TransportMapping
Specified by:
getSupportedAddressClass in class AbstractTransportMapping
Returns:
a subclass of Address.

getAddress

public UdpAddress getAddress()
Returns the transport address that is used by this transport mapping for sending and receiving messages.

Returns:
the Address used by this transport mapping. The returned instance must not be modified!

getListenAddress

public Address getListenAddress()
Description copied from interface: TransportMapping
Returns the address that represents the 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

public abstract void listen()
                     throws java.io.IOException
Description copied from interface: TransportMapping
Listen for incoming messages. For connection oriented transports, this method needs to be called before TransportMapping.sendMessage(org.snmp4j.smi.Address, byte[]) is called for the first time.

Specified by:
listen in interface TransportMapping
Specified by:
listen in class AbstractTransportMapping
Throws:
java.io.IOException

close

public abstract void close()
                    throws java.io.IOException
Description copied from interface: TransportMapping
Closes the transport an releases all bound resources synchronously.

Specified by:
close in interface TransportMapping
Specified by:
close in class AbstractTransportMapping
Throws:
java.io.IOException

sendMessage

public abstract void sendMessage(Address address,
                                 byte[] message)
                          throws java.io.IOException
Description copied from interface: TransportMapping
Sends a message to the supplied address using this transport.

Specified by:
sendMessage in interface TransportMapping
Specified by:
sendMessage in class AbstractTransportMapping
Parameters:
address - an Address instance denoting the target address.
message - the whole message as an array of bytes.
Throws:
java.io.IOException

Copyright 2005-2010 Frank Fock (SNMP4J.org)

Copyright © 2011 SNMP4J.org. All Rights Reserved.