SNMP Stack 4_12

uk.co.westhawk.snmp.stack
Interface SnmpContextBasisFace

All Known Subinterfaces:
SnmpContextFace, SnmpContextv2cFace, SnmpContextv3Face
All Known Implementing Classes:
AbstractSnmpContext

public interface SnmpContextBasisFace

This interface contains the SNMP context interface that is needed by every Pdu to send a SNMP v1, v2c and v3 request. The context also provides functionality to receive traps.

Version:
$Revision: 3.3 $ $Date: 2002/10/10 15:13:57 $
Author:
Tim Panton
See Also:
SnmpContext, SnmpContextv2c, SnmpContextv3

Field Summary
static int DEFAULT_PORT
          The default port number where SNMP requests are send to.
static java.lang.String KVM_SOCKET
          The KVM Socket type.
static int MAXPDU
          The Maximum number of outstanding PDUs a context can handle at a given moment in time.
static int MSS
          The Maximum size of a message in octets.
static java.lang.String NETSCAPE_SOCKET
          The Netscape Socket type.
static java.lang.String STANDARD_SOCKET
          The Standard Socket type.
static java.lang.String version_id
           
 
Method Summary
 boolean addPdu(Pdu pdu)
          Adds a pdu to the context.
 void addTrapListener(TrapListener l)
          Adds the specified trap listener to receive traps from the host that matches this context.
 void destroy()
          Removes the resouces held by this context.
 byte[] encodePacket(byte msg_type, int rId, int errstat, int errind, java.util.Enumeration ve)
          Encodes a pdu.
 java.lang.String getHost()
          Returns the host
 int getPort()
          Returns the port number
 java.lang.String getTypeSocket()
          Returns the type socket
 int getVersion()
          Return the SNMP version of the context.
 Pdu processIncomingTrap(byte[] message)
          Processes an incoming trap.
 boolean removePdu(int requestId)
          Removes a pdu from the context.
 void removeTrapListener(TrapListener l)
          Removes the specified trap listener.
 void sendPacket(byte[] packet)
          Sends an encoded pdu.
 

Field Detail

version_id

public static final java.lang.String version_id

DEFAULT_PORT

public static final int DEFAULT_PORT
The default port number where SNMP requests are send to.

STANDARD_SOCKET

public static final java.lang.String STANDARD_SOCKET
The Standard Socket type.

NETSCAPE_SOCKET

public static final java.lang.String NETSCAPE_SOCKET
The Netscape Socket type.

KVM_SOCKET

public static final java.lang.String KVM_SOCKET
The KVM Socket type.

MAXPDU

public static final int MAXPDU
The Maximum number of outstanding PDUs a context can handle at a given moment in time.

MSS

public static final int MSS
The Maximum size of a message in octets.
Method Detail

getVersion

public int getVersion()
Return the SNMP version of the context.
Returns:
The version

getHost

public java.lang.String getHost()
Returns the host
Returns:
The host

getPort

public int getPort()
Returns the port number
Returns:
The port no

getTypeSocket

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

addPdu

public boolean addPdu(Pdu pdu)
               throws java.io.IOException,
                      PduException
Adds a pdu to the context. This is for internal use only and should NOT be called by the developper. This is called by the the Pdu itself and is added to the interface to cover the different kind of Contexts.

removePdu

public boolean removePdu(int requestId)
Removes a pdu from the context. This is for internal use only and should NOT be called by the developper. This is called by the the Pdu itself and is added to the interface to cover the different kind of Contexts.

encodePacket

public byte[] encodePacket(byte msg_type,
                           int rId,
                           int errstat,
                           int errind,
                           java.util.Enumeration ve)
                    throws java.io.IOException,
                           EncodingException
Encodes a pdu. This is for internal use only and should NOT be called by the developper. This is called by the the Pdu itself and is added to the interface to cover the different kind of Contexts.
Returns:
The encoded packet

sendPacket

public void sendPacket(byte[] packet)
Sends an encoded pdu. This is for internal use only and should NOT be called by the developper. This is called by the the Pdu itself and is added to the interface to cover the different kind of Contexts.
Parameters:
packet - The encoded packet

destroy

public void destroy()
Removes the resouces held by this context. Should be called by the user/developper when the context is no longer needed.

addTrapListener

public void addTrapListener(TrapListener l)
                     throws java.io.IOException
Adds the specified trap listener to receive traps from the host that matches this context.

removeTrapListener

public void removeTrapListener(TrapListener l)
                        throws java.io.IOException
Removes the specified trap listener.

processIncomingTrap

public Pdu processIncomingTrap(byte[] message)
                        throws DecodingException,
                               java.io.IOException
Processes an incoming trap. The context will try to process the incoming trap, using the SNMP version and other security parameters. If any of these do not correspond, a DecodingException will be thrown.

SNMP Stack 4_12