SNMP Stack 5_1

uk.co.westhawk.snmp.stack
Interface ListeningContextFace

All Known Implementing Classes:
ListeningContext, ListeningContextPool

public interface ListeningContextFace

This interface contains the SNMP listening context methods.

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

Field Summary
static int DEFAULT_TRAP_PORT
          The default port number where we listen for traps (162).
static java.lang.String version_id
           
 
Method Summary
 void addRawPduListener(RawPduListener l)
          Adds the specified PDU listener to receive the undecoded PDUs.
 void addUnhandledRawPduListener(RawPduListener listener)
          Adds the specified PDU listener to receive the undecoded PDUs when it was not handled (i.e. not consumed) by any of the PDU listeners in addRawPduListener().
 void destroy()
          Removes the resouces held by this context.
 java.lang.String getBindAddress()
          Returns the local address the server will bind to When the address is null, the socket accepts connections on any/all local addresses.
 int getMaxRecvSize()
          Returns the maximum number of bytes this context will read from the socket.
 int getPort()
          Returns the port number.
 java.lang.String getTypeSocket()
          Returns the type of socket.
 void removeRawPduListener(RawPduListener l)
          Removes the specified PDU listener.
 void removeUnhandledRawPduListener(RawPduListener listener)
          Removes the specified unhandled PDU listener.
 void setMaxRecvSize(int no)
          Sets the maximum number of bytes this context will read from the socket.
 

Field Detail

version_id

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

DEFAULT_TRAP_PORT

public static final int DEFAULT_TRAP_PORT
The default port number where we listen for traps (162).

See Also:
Constant Field Values
Method Detail

getPort

public int getPort()
Returns the port number.

Returns:
The port no

getBindAddress

public java.lang.String getBindAddress()
Returns the local address the server will bind to When the address is null, the socket accepts connections on any/all local addresses.

Returns:
The bind address

getTypeSocket

public java.lang.String getTypeSocket()
Returns the type of socket.

Returns:
The type of socket
See Also:
SnmpContextBasisFace.STANDARD_SOCKET, SnmpContextBasisFace.TCP_SOCKET, SnmpContextBasisFace.NETSCAPE_SOCKET, SnmpContextBasisFace.KVM_SOCKET

getMaxRecvSize

public int getMaxRecvSize()
Returns the maximum number of bytes this context will read from the socket. By default this will be set to MSS (i.e. 1300).

Returns:
The number
See Also:
SnmpContextBasisFace.MSS, setMaxRecvSize(int), AbstractSnmpContext.setMaxRecvSize(int)

setMaxRecvSize

public void setMaxRecvSize(int no)
Sets the maximum number of bytes this context will read from the socket. By default this will be set to MSS (i.e. 1300).

Parameters:
no - The new size
See Also:
SnmpContextBasisFace.MSS, AbstractSnmpContext.getMaxRecvSize()

destroy

public void destroy()
Removes the resouces held by this context. This method will stop the thread listening for packets.


addRawPduListener

public void addRawPduListener(RawPduListener l)
                       throws java.io.IOException
Adds the specified PDU listener to receive the undecoded PDUs. When a PDU is received the PDU received event is fired to all listeners, until one of them consumes it.

All the SnmpContext objects use this method to listen for PDUs. When a SnmpContext object decodes the PDU succesfully, it will consume it.

Only when a listener is added will this context create a listening socket.

Parameters:
l - The listener object
Throws:
java.io.IOException - Thrown when creating a listening socket fails
See Also:
RawPduReceivedSupport.fireRawPduReceived(int, java.lang.String, int, byte[]), AbstractSnmpContext.addTrapListener(uk.co.westhawk.snmp.event.TrapListener), AbstractSnmpContext.addRequestPduListener(uk.co.westhawk.snmp.event.RequestPduListener), addUnhandledRawPduListener(RawPduListener)

removeRawPduListener

public void removeRawPduListener(RawPduListener l)
Removes the specified PDU listener. When there are no more listeners, calls destroy().

Parameters:
l - The listener object

addUnhandledRawPduListener

public void addUnhandledRawPduListener(RawPduListener listener)
                                throws java.io.IOException
Adds the specified PDU listener to receive the undecoded PDUs when it was not handled (i.e. not consumed) by any of the PDU listeners in addRawPduListener().

Only when a listener is added will this context create a listening socket.

Throws:
java.io.IOException - Thrown when creating a listening socket fails
See Also:
addRawPduListener(RawPduListener)

removeUnhandledRawPduListener

public void removeUnhandledRawPduListener(RawPduListener listener)
Removes the specified unhandled PDU listener. When there are no more listeners, calls destroy().


SNMP Stack 5_1