snmp
Class SNMPTrapSenderInterface

java.lang.Object
  extended bysnmp.SNMPTrapSenderInterface

public class SNMPTrapSenderInterface
extends java.lang.Object

The class SNMPTrapSenderInterface implements an interface for sending SNMPv1 and SNMPv2 trap messages to a remote SNMP manager. The approach is that from version 1 of SNMP, using no encryption of data. Communication occurs via UDP, using port 162, the standard SNMP trap port, as the destination port.


Field Summary
static int SNMP_TRAP_PORT
           
 
Constructor Summary
SNMPTrapSenderInterface()
          Construct a new trap sender object to send traps to remote SNMP hosts.
SNMPTrapSenderInterface(int localPort)
          Construct a new trap sender object to send traps to remote SNMP hosts, binding to the specified local port.
 
Method Summary
 void sendTrap(java.net.InetAddress hostAddress, java.lang.String community, SNMPv1TrapPDU pdu)
          Send the supplied trap pdu to the specified host, using the supplied community name and using 0 for the version field in the SNMP message (corresponding to SNMP version 1).
 void sendTrap(java.net.InetAddress hostAddress, java.lang.String community, SNMPv2TrapPDU pdu)
          Send the supplied trap pdu to the specified host, using the supplied community name and using 1 for the version field in the SNMP message.
 void sendTrap(int version, java.net.InetAddress hostAddress, java.lang.String community, SNMPv1TrapPDU pdu)
          Send the supplied SNMPv1 trap pdu to the specified host, using the supplied version number and community name.
 void sendTrap(int version, java.net.InetAddress hostAddress, java.lang.String community, SNMPv2TrapPDU pdu)
          Send the supplied SNMPv2 trap pdu to the specified host, using the supplied version number and community name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SNMP_TRAP_PORT

public static final int SNMP_TRAP_PORT
See Also:
Constant Field Values
Constructor Detail

SNMPTrapSenderInterface

public SNMPTrapSenderInterface()
                        throws java.net.SocketException
Construct a new trap sender object to send traps to remote SNMP hosts.


SNMPTrapSenderInterface

public SNMPTrapSenderInterface(int localPort)
                        throws java.net.SocketException
Construct a new trap sender object to send traps to remote SNMP hosts, binding to the specified local port.

Method Detail

sendTrap

public void sendTrap(int version,
                     java.net.InetAddress hostAddress,
                     java.lang.String community,
                     SNMPv1TrapPDU pdu)
              throws java.io.IOException
Send the supplied SNMPv1 trap pdu to the specified host, using the supplied version number and community name. Use version = 0 for SNMP version 1, or version = 1 for enhanced capabilities provided through RFC 1157.

Throws:
java.io.IOException

sendTrap

public void sendTrap(java.net.InetAddress hostAddress,
                     java.lang.String community,
                     SNMPv1TrapPDU pdu)
              throws java.io.IOException
Send the supplied trap pdu to the specified host, using the supplied community name and using 0 for the version field in the SNMP message (corresponding to SNMP version 1).

Throws:
java.io.IOException

sendTrap

public void sendTrap(int version,
                     java.net.InetAddress hostAddress,
                     java.lang.String community,
                     SNMPv2TrapPDU pdu)
              throws java.io.IOException
Send the supplied SNMPv2 trap pdu to the specified host, using the supplied version number and community name.

Throws:
java.io.IOException

sendTrap

public void sendTrap(java.net.InetAddress hostAddress,
                     java.lang.String community,
                     SNMPv2TrapPDU pdu)
              throws java.io.IOException
Send the supplied trap pdu to the specified host, using the supplied community name and using 1 for the version field in the SNMP message.

Throws:
java.io.IOException