com.adventnet.snmp.mibs.agent
Class SnmpMibTrapService

java.lang.Object
  extended by com.adventnet.snmp.snmp2.agent.Cache
      extended by com.adventnet.snmp.snmp2.agent.BaseSnmpStore
          extended by com.adventnet.snmp.snmp2.agent.BaseSnmpTrapService
              extended by com.adventnet.snmp.snmp2.agent.SnmpTrapService
                  extended by com.adventnet.snmp.mibs.agent.SnmpMibTrapService
All Implemented Interfaces:
TrapRequestListener, AgentEventListener, java.io.Serializable

public class SnmpMibTrapService
extends SnmpTrapService

Used to send SNMP V1 & SNMP V2c Traps. Provides MIB support for traps by looking up for node Labels argument. It will convert into corresponding SnmpVarBind and SnmpOID by using the MibOperations instance.

See Also:
AgentMibOperations, MibOperations , TrapRequestEvent, Serialized Form

Field Summary
(package private)  java.lang.String mibModules
           
 
Fields inherited from class com.adventnet.snmp.snmp2.agent.BaseSnmpTrapService
isInformRequest
 
Fields inherited from class com.adventnet.snmp.snmp2.agent.BaseSnmpStore
debugLevel, protocol, session
 
Constructor Summary
SnmpMibTrapService()
          No Arg constructor creates a MibOperations reference if the Cache doesnt have one
SnmpMibTrapService(com.adventnet.snmp.mibs.AgentMibOperations mibOperations)
          constructor with param MibOperations
 
Method Summary
 MibModule addMib(java.lang.String mibFile)
          adds the Mib to the list of modules already loaded
 void addTrapRequest(TrapRequestEvent te)
          This is the listener method for TrapRequestEvents Source beans would call this method when they need to issue Traps
 java.lang.String getMibModules()
          Get the MIBs loaded in this applet/application
(package private)  SnmpVarBind getVarBind(OidandValue oidValue)
          adds the varbind with specified oid, type and value to the pdu
 int getVersion()
          get the Snmp Version
static void main(java.lang.String[] args)
          It can also used as a stand-alone application
 void sendTrap(java.lang.String managerNode, int managerPort, SnmpOID enterpriseOID, java.lang.String community, int trapIndex, long timeticks, java.util.Vector varbindings)
          Used by SnmpAgent to send SNMPV1 & SNMPV2 traps
 void sendTrap(java.lang.String managerNode, int managerPort, java.lang.String enterprise, java.lang.String community, int trapIndex, long timeticks, OidandValue[] varbindings)
          Using the AgentMibOperations instance this method resolves the enterprise & OidandValue into corresponding SnmpOID and SnmpVarBind variables.
 void setMibModules(java.lang.String mibFiles)
          parse the MibFiles in this application and setupAgent clauses
 void setMibOperations(com.adventnet.snmp.mibs.AgentMibOperations mibOps)
          Setter for MibOperations which loads the MIB etc Note that the MibOperations are shared
 void setVersion(int snmpVersion)
          sets the Snmp version
(package private)  void updateMibs(java.lang.String mibModules)
           
 
Methods inherited from class com.adventnet.snmp.snmp2.agent.SnmpTrapService
addSnmpV2TrapHeader, disableAuthTraps, doRegistration, getContextName, getFailedInformVect, getSecurityLevel, getSecurityModel, getTrapFlag, getTrapObject, getTrapPathName, getTrapTableName, getUserName, getV3TrapTableName, isPersistence, isReliableTraps, nativeInitTrapService, printDecodedPDU, sendTrap, sendTrap, sendTrap, sendTrapToManagersInTable, setContextName, setFToVPersistence, setHandler, setPersistence, setRefreshTrapTable, setReliableTraps, setSecurityLevel, setSecurityModel, setTrapFlag, setTrapForwardingTable, setTrapObject, setTrapPathName, setTrapTableName, setUserName, setV3TrapTableName, setWriter
 
Methods inherited from class com.adventnet.snmp.snmp2.agent.BaseSnmpTrapService
addRegistrationListener, addSnmpV1TrapHeader, closeTrapSession, createProtocolOptions, getAgentAddr, getCommunity, getEnterpriseOID, getInformFlag, getLocalAddress, getManagerHost, getManagerPort, getTrapForwardingTable, getTrapIndex, getTrapSession, getVarbind, initSeperateTrapSession, isTrapSessionAlive, isTrapSourceDefault, isUsesSeperateSession, oidEqualsSnmp, oidEqualsSnmp, removeRegistrationListener, sendTrap, sendTrap, sendTrap, sendTrapDefault, sendTrapToManagers, setAgentAddr, setCommunity, setDebug, setDefaultTrap, setEnterpriseOID, setForwardingEntryOID, setHandler, setInformFlag, setLocalAddress, setManagerHost, setManagerPort, setProtocol, setTrapIndex, setTrapSession, setTrapSessionPort, setTrapSourceDefault, setUsesSeperateSession, setVarbind, validateTrap
 
Methods inherited from class com.adventnet.snmp.snmp2.agent.BaseSnmpStore
closeAll, finalize, getSnmpAPI, getSnmpSession, getSnmpSession, initSession, initSnmpStore, isAlive, isDebug, killSnmpAgent
 
Methods inherited from class com.adventnet.snmp.snmp2.agent.Cache
getFromCache, getMibOperations, putInCache, setMibOperations
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mibModules

java.lang.String mibModules
Constructor Detail

SnmpMibTrapService

public SnmpMibTrapService(com.adventnet.snmp.mibs.AgentMibOperations mibOperations)
constructor with param MibOperations


SnmpMibTrapService

public SnmpMibTrapService()
No Arg constructor creates a MibOperations reference if the Cache doesnt have one

Method Detail

setMibOperations

public void setMibOperations(com.adventnet.snmp.mibs.AgentMibOperations mibOps)
Setter for MibOperations which loads the MIB etc Note that the MibOperations are shared


main

public static void main(java.lang.String[] args)
It can also used as a stand-alone application

usage: SnmpTrap [-d] [-M managerNode] [-m MIB_file] [-m2 Second_MIB_file] [-p port] [-t timeticks]


sendTrap

public void sendTrap(java.lang.String managerNode,
                     int managerPort,
                     SnmpOID enterpriseOID,
                     java.lang.String community,
                     int trapIndex,
                     long timeticks,
                     java.util.Vector varbindings)
Used by SnmpAgent to send SNMPV1 & SNMPV2 traps

Parameters:
enterpriseOID - enterprise-oid (in OID format )
varbindings - Vector of type Snmp.SnmpVarBind
See Also:
SnmpVarBind

sendTrap

public void sendTrap(java.lang.String managerNode,
                     int managerPort,
                     java.lang.String enterprise,
                     java.lang.String community,
                     int trapIndex,
                     long timeticks,
                     OidandValue[] varbindings)
Using the AgentMibOperations instance this method resolves the enterprise & OidandValue into corresponding SnmpOID and SnmpVarBind variables.

Parameters:
enterprise - enterprise-oid(in string)
varbindings - Vector in OidandValue
See Also:
OidandValue

setVersion

public void setVersion(int snmpVersion)
sets the Snmp version

Overrides:
setVersion in class BaseSnmpTrapService
Parameters:
SnmpAPI - version constant

getVersion

public int getVersion()
get the Snmp Version

Overrides:
getVersion in class BaseSnmpTrapService
Returns:
Snmp version value
See Also:
version constans like SnmpAPI.SNMP_VERSION_1 etc..

getVarBind

SnmpVarBind getVarBind(OidandValue oidValue)
adds the varbind with specified oid, type and value to the pdu


addTrapRequest

public void addTrapRequest(TrapRequestEvent te)
This is the listener method for TrapRequestEvents Source beans would call this method when they need to issue Traps

Specified by:
addTrapRequest in interface TrapRequestListener
Overrides:
addTrapRequest in class SnmpTrapService
Parameters:
te - the trap event
See Also:
TrapRequestEvent

setMibModules

public void setMibModules(java.lang.String mibFiles)
parse the MibFiles in this application and setupAgent clauses

Parameters:
a - white-space separated list of mib files

getMibModules

public java.lang.String getMibModules()
Get the MIBs loaded in this applet/application

Returns:
a white-space separated list of mib files.

updateMibs

void updateMibs(java.lang.String mibModules)

addMib

public MibModule addMib(java.lang.String mibFile)
adds the Mib to the list of modules already loaded

Returns:
null on errors