SNMP Stack 5_1

uk.co.westhawk.snmp.event
Class RawPduReceivedSupport

java.lang.Object
  |
  +--uk.co.westhawk.snmp.event.RawPduReceivedSupport

public class RawPduReceivedSupport
extends java.lang.Object

This is a utility class that can be used by classes that support raw pdu listener functionality. You can use an instance of this class as a member field of your class and delegate various work to it.

Since:
4_14
Version:
$Revision: 1.5 $ $Date: 2006/02/09 14:30:18 $
Author:
Birgit Arkesteijn

Field Summary
static java.lang.String version_id
           
 
Constructor Summary
RawPduReceivedSupport(java.lang.Object src)
          The constructor.
 
Method Summary
 void addRawPduListener(RawPduListener listener)
          Adds the specified pdu listener to receive pdus.
 void empty()
          Removes all the listeners.
 boolean fireRawPduReceived(int version, java.lang.String hostAddress, int hostPort, byte[] message)
          Fires an undecoded pdu event.
 int getListenerCount()
          Returns the number of listeners.
 void removeRawPduListener(RawPduListener listener)
          Removes the specified pdu listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

version_id

public static final java.lang.String version_id
See Also:
Constant Field Values
Constructor Detail

RawPduReceivedSupport

public RawPduReceivedSupport(java.lang.Object src)
The constructor.

Parameters:
src - The source (ListeningContext) of the pdu events when they are fired.
Method Detail

empty

public void empty()
Removes all the listeners.


getListenerCount

public int getListenerCount()
Returns the number of listeners.

Returns:
The number of listeners.

addRawPduListener

public void addRawPduListener(RawPduListener listener)
Adds the specified pdu listener to receive pdus.


removeRawPduListener

public void removeRawPduListener(RawPduListener listener)
Removes the specified pdu listener.


fireRawPduReceived

public boolean fireRawPduReceived(int version,
                                  java.lang.String hostAddress,
                                  int hostPort,
                                  byte[] message)
Fires an undecoded pdu event. The event is fired to all listeners, unless one of them consumes it. The idea is that for undecoded pdus it is very unlikely that more than one party (usually SnmpContext objects) is interested.

Parameters:
version - The SNMP version of the pdu
hostAddress - The IP address of the host where the pdu came from
hostPort - The remote port number of the host where the pdu came from
message - The pdu in bytes
Returns:
Whether or not the event has been consumed.

SNMP Stack 5_1