IP*Works! S/SNMP V6

ipworksssnmp
Class Mibbrowser

java.lang.Object
  |
  +--ipworksssnmp.Mibbrowser

public class Mibbrowser
extends java.lang.Object

The MIBBrowser bean is used to parse SNMP MIB Module definitions.

The MIBBrowser bean allows easy loading and querying of definitions in the SNMP Management Information Base (MIB) specifications.

The LoadMib method allows loading of MIB modules, which get stored in an internal tree structure for further queries.

If modules reference (import) other modules, recursive loading of modules is performed automatically and/or controlled by the ImportSymbols event.

The MIB tree is navigated through the SelectNode method, which enables pointing to a node in the tree specified by NodeOid and NodeLabel . Other node information is provided through the NodeModuleName , NodeFileName , NodeSyntax , NodeType , and NodeAccess properties.

The node selector parameter in SelectNode can be a label such as "internet", an OID such as "1.3.6.4", a combination of the two: "iso.3.dod.internet", or a label in a particular module such as "RFC1213-MIB!interfaces".

Node children and successors are provided by the ListChildren and ListSuccessors methods. The individual node information is provided via the MibNode event.

Module traps are listed via the ListTraps method. The individual trap information is provided through the TrapNode event.


Field Summary
static int accForNotify
           
static int accNoAccess
           
static int accReadCreate
           
static int accReadOnly
           
static int accReadWrite
           
static int accUnknown
           
static int accWriteOnly
           
static int mcrCapabilities
           
static int mcrCompliance
           
static int mcrModuleIdentity
           
static int mcrNotificationGroup
           
static int mcrNotificationType
           
static int mcrObjectGroup
           
static int mcrObjectIdentity
           
static int mcrObjectType
           
static int mcrTrapType
           
static int stxBitString
           
static int stxBoolean
           
static int stxChoice
           
static int stxCounter
           
static int stxCounter64
           
static int stxEnumerated
           
static int stxGauge
           
static int stxInteger
           
static int stxIpAddress
           
static int stxNetworkAddress
           
static int stxNSAP
           
static int stxNull
           
static int stxObjectId
           
static int stxOctetString
           
static int stxOpaque
           
static int stxSequence
           
static int stxSequenceOf
           
static int stxSet
           
static int stxTimeTicks
           
static int stxUInteger
           
static int stxUnknown
           
 
Constructor Summary
Mibbrowser()
           
 
Method Summary
 void addMibbrowserEventListener(MibbrowserEventListener l)
           
 java.lang.String config(java.lang.String configurationString)
          Sets or retrieves a beanconfiguration setting.
 int getNodeAccess()
          The access permissions for the selected node.
 java.lang.String getNodeDescription()
          Textual description of the selected node.
 java.lang.String getNodeFileName()
          The absolute path of the file where the selected node is declared.
 java.lang.String getNodeIndex()
          The index of the node in a table.
 java.lang.String getNodeLabel()
          The label of the selected node.
 java.lang.String getNodeModuleName()
          The name of the module where the selected node is declared.
 java.lang.String getNodeOid()
          The Object ID of the selected node.
 int getNodeSubId()
          The SubId of the currently selected node.
 int getNodeSyntax()
          The syntax of the selected node.
 java.lang.String getNodeSyntaxString()
          The node syntax of the selected node in text format.
 int getNodeType()
          The type of the selected node.
 java.lang.String getNodeTypeString()
          The node type of the selected node in text format.
 boolean isExactMatch()
          Controls the way the OID matching is done (complete or partial).
 void listChildren()
          Lists the immediate children of the selected node.
 void listSuccessors()
          Lists all successors of the selected node.
 void listTraps()
          Lists all the traps defined in the loaded modules.
 void loadMib(java.lang.String fileName)
          Parses the file FileName and adds the parsed nodes to the collection of existing nodes.
 void removeMibbrowserEventListener(MibbrowserEventListener l)
           
 void selectNode(java.lang.String selector)
          Used to select individual nodes in the loaded MIB module(s).
 void setExactMatch(boolean exactMatch)
          Controls the way the OID matching is done (complete or partial).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

accUnknown

public static final int accUnknown
See Also:
Constant Field Values

accNoAccess

public static final int accNoAccess
See Also:
Constant Field Values

accReadOnly

public static final int accReadOnly
See Also:
Constant Field Values

accReadCreate

public static final int accReadCreate
See Also:
Constant Field Values

accReadWrite

public static final int accReadWrite
See Also:
Constant Field Values

accWriteOnly

public static final int accWriteOnly
See Also:
Constant Field Values

accForNotify

public static final int accForNotify
See Also:
Constant Field Values

stxBoolean

public static final int stxBoolean
See Also:
Constant Field Values

stxInteger

public static final int stxInteger
See Also:
Constant Field Values

stxBitString

public static final int stxBitString
See Also:
Constant Field Values

stxOctetString

public static final int stxOctetString
See Also:
Constant Field Values

stxNull

public static final int stxNull
See Also:
Constant Field Values

stxObjectId

public static final int stxObjectId
See Also:
Constant Field Values

stxEnumerated

public static final int stxEnumerated
See Also:
Constant Field Values

stxSequenceOf

public static final int stxSequenceOf
See Also:
Constant Field Values

stxSequence

public static final int stxSequence
See Also:
Constant Field Values

stxSet

public static final int stxSet
See Also:
Constant Field Values

stxChoice

public static final int stxChoice
See Also:
Constant Field Values

stxNetworkAddress

public static final int stxNetworkAddress
See Also:
Constant Field Values

stxIpAddress

public static final int stxIpAddress
See Also:
Constant Field Values

stxCounter

public static final int stxCounter
See Also:
Constant Field Values

stxGauge

public static final int stxGauge
See Also:
Constant Field Values

stxTimeTicks

public static final int stxTimeTicks
See Also:
Constant Field Values

stxOpaque

public static final int stxOpaque
See Also:
Constant Field Values

stxNSAP

public static final int stxNSAP
See Also:
Constant Field Values

stxCounter64

public static final int stxCounter64
See Also:
Constant Field Values

stxUInteger

public static final int stxUInteger
See Also:
Constant Field Values

stxUnknown

public static final int stxUnknown
See Also:
Constant Field Values

mcrObjectType

public static final int mcrObjectType
See Also:
Constant Field Values

mcrObjectIdentity

public static final int mcrObjectIdentity
See Also:
Constant Field Values

mcrModuleIdentity

public static final int mcrModuleIdentity
See Also:
Constant Field Values

mcrNotificationType

public static final int mcrNotificationType
See Also:
Constant Field Values

mcrTrapType

public static final int mcrTrapType
See Also:
Constant Field Values

mcrObjectGroup

public static final int mcrObjectGroup
See Also:
Constant Field Values

mcrNotificationGroup

public static final int mcrNotificationGroup
See Also:
Constant Field Values

mcrCompliance

public static final int mcrCompliance
See Also:
Constant Field Values

mcrCapabilities

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

Mibbrowser

public Mibbrowser()
Method Detail

isExactMatch

public boolean isExactMatch()
Controls the way the OID matching is done (complete or partial).

If ExactMatch is set to True, the SelectNode method will try to find an exact match for the supplied selector. If not found, an exception will be thrown.

If ExactMatch is set to False, the SelectNode method will start from the root (iso) and will go as far as it can, finding the closest match for the requested node.

For instance, for SNMPv2-MIB, mib name 1.3.6.1.2.1.1.3.0 will return sysUpTime.0 while mib -exact name 1.3.6.1.2.1.1.3.0 will fail.


setExactMatch

public void setExactMatch(boolean exactMatch)
                   throws IPWorksSSNMPException
Controls the way the OID matching is done (complete or partial).

If ExactMatch is set to True, the SelectNode method will try to find an exact match for the supplied selector. If not found, an exception will be thrown.

If ExactMatch is set to False, the SelectNode method will start from the root (iso) and will go as far as it can, finding the closest match for the requested node.

For instance, for SNMPv2-MIB, mib name 1.3.6.1.2.1.1.3.0 will return sysUpTime.0 while mib -exact name 1.3.6.1.2.1.1.3.0 will fail.

IPWorksSSNMPException

getNodeAccess

public int getNodeAccess()
The access permissions for the selected node.

The following is the list of values for NodeAccess :

0
accUnknown
1
accNoAccess
2
accReadOnly
3
accReadCreate
4
accReadWrite
5
accWriteOnly
6
accForNotify


getNodeDescription

public java.lang.String getNodeDescription()
Textual description of the selected node.

Because loading descriptions can consume unwanted resources, the bean can control caching of descriptions in order to keep the memory footprint of the bean as small as possible.

To disable caching, set theCacheDescriptionsconfig setting to True. In this case, the bean will only save the offset of the description in the MIB file in memory, and will fetch the textual description directly from the file only when required. When using caching, make sure that the path of the loaded modules does not change or the property will be unable to fetch the correct text description.


getNodeFileName

public java.lang.String getNodeFileName()
The absolute path of the file where the selected node is declared.

It is possible for a node to be re-declared in other modules. In this case the property contains a comma spearated list of file names where the selected node is declared.


getNodeIndex

public java.lang.String getNodeIndex()
The index of the node in a table.

If the selected node has stxSequence syntax then the NodeIndex represents the column used to distinguish among different table rows.

Example:

 MibParser.LoadMib(""SNMPv2-MIB"")
 MibParser.SelectNode("1.3.6.1.2.1.2.2")
 Debug.Print MibParser1.NodeLabel // prints "ifTable"
 
 MibParser.SelectNode("1.3.6.1.2.1.2.2.1")
 Debug.Print MibParser1.NodeLabel  // prints "ifEntry"
 Debug.Print MibParser1.NodeIndex  // prints "ifIndex" 


getNodeLabel

public java.lang.String getNodeLabel()
The label of the selected node.

This label is unique within the MIB module where it is declared.


getNodeModuleName

public java.lang.String getNodeModuleName()
The name of the module where the selected node is declared.

It is possible for a node to be redeclared in other modules. In this case the NodeModuleName contains a comma spearated list of module names where the selected node is declared.


getNodeOid

public java.lang.String getNodeOid()
The Object ID of the selected node.

Contains the Object Id (OID) of the currently selected node. The OID uniquely identifies the selected node within the entire object hierarchy.


getNodeSubId

public int getNodeSubId()
The SubId of the currently selected node.

For instance, if you select the node "dod" in "rfc1155.smi", the NodeSubId value will be 6.


getNodeSyntax

public int getNodeSyntax()
The syntax of the selected node.

The syntax defines what type of data the selected node contains. Common data types include:

Boolean (1)\011\011
Boolean variable.
Integer (2)\011\011
A 32-bit signed integer.
OctetString (4)\011
An octet string variable that is binary or textual data.
Null (5)\011\011
NULL value.
ObjectId (6)\011
Object identifier.
IpAddress (64)\011
A 32-bit Internet address (aaa.bbb.ccc.ddd)
Counter (65)\011
A counter that increases until it reaches a maximum value of (2^32).
Gauge (66)\011\011
A non-negative int that can increase or decrease, but never exceed a maximum value.
TimeTicks (67)\011
A counter that measures time in hundredths of a second.
Opaque (68)\011\011
This type supports the capability to pass ASN.1 syntax.
Counter64 (70)\011
A counter that increases until it reaches a maximum value of (2^64).
UInteger (71)\011
A 32-bit unsigned integer.

Additional type definitions can be found in the SNMP RFC's.


getNodeSyntaxString

public java.lang.String getNodeSyntaxString()
The node syntax of the selected node in text format.

For instance, for the node "system" in "SNMPv2-MIB", NodeSyntax returns 6 ( stxObjectId ), while NodeSyntaxString returns "OBJECT IDENTIFIER".


getNodeType

public int getNodeType()
The type of the selected node.

The following are the possible values for NodeType :

0
mcrObjectType
1
mcrObjectIdentity
2
mcrModuleIdentity
3
mcrNotificationType
4
mcrTrapType
5
mcrObjectGroup
6
mcrNotificationGroup
7
mcrCompliance
8
mcrCapabilities
\011\011\011\011\011\011 \011


getNodeTypeString

public java.lang.String getNodeTypeString()
The node type of the selected node in text format.

For instance, for the node "system" in "SNMPv2-MIB", NodeType returns 2 ( mcrObjectIdentity ), while NodeTypeString returns "OBJECT-IDENTITY".


config

public java.lang.String config(java.lang.String configurationString)
                        throws IPWorksSSNMPException
Sets or retrieves a beanconfiguration setting.

Config is a generic method available in every bean. It is used to set and retrieveconfiguration settingsfor the bean.

Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the bean, access to these internal properties is provided through the Config method.

To set a configuration setting named PROPERTY , you must call Config("PROPERTY=VALUE") , where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).

To read (query) the value of a configuration setting, you must call Config("PROPERTY") . The value will be returned as a string.

IPWorksSSNMPException

listChildren

public void listChildren()
                  throws IPWorksSSNMPException
Lists the immediate children of the selected node.

The MibNode event fires once for every SubId of the selected node and provides all info related to that SubId.

For instance, the following code:

 MibParser.LoadMib("RFC1155-SMI")
 MibParser.SelectNode("internet")
 MibParser.ListChildren() 
will generate the following output through the MibNode event:
 directory    1.3.6.1.1
   mgmt         1.3.6.1.2
   experimental 1.3.6.1.3
   private      1.3.6.1.4 

IPWorksSSNMPException

listSuccessors

public void listSuccessors()
                    throws IPWorksSSNMPException
Lists all successors of the selected node.

The MibNode event fires once for each successor of the selected node and provides all information related to it.

IPWorksSSNMPException

listTraps

public void listTraps()
               throws IPWorksSSNMPException
Lists all the traps defined in the loaded modules.

The TrapNode event fires once for every trap and provides all info related to it.

For instance, the following code:

 MibParser.LoadMib("mib_ii.mib")
 MibParser.ListTraps() 
will generate the following output through the MibNode event:
 coldStart             0 snmp
   warmStart             1 snmp
   linkDown              2 snmp
   linkUp                3 snmp
   authenticationFailure 4 snmp 

IPWorksSSNMPException

loadMib

public void loadMib(java.lang.String fileName)
             throws IPWorksSSNMPException
Parses the file FileName and adds the parsed nodes to the collection of existing nodes.

This method can be used to load and parse a MIB file into the bean.

Some MIB modules contain references to other modules within their imports sections. When loading a MIB that contains external imports, the ImportSymbols event will fire for each external reference. These modules must be loaded if possible to generate a complete representation for the loaded MIB.

It is possible for the component to attempt to load all external references automatically. To do this, use Config and set " AutoLoadMibs=True ". Setting this configuration property causes the bean to attempt to find and load any external references included in the current MIB. The bean will only find external modules if they reside in the same directory as the current module. Alternatively, the bean can load additional modules by calling LoadMib while inside the ImportSymbols event.

If theAutoLoadMibsconfig setting is set to False, and no explicit action is taken to load necessary modules inside the ImportSymbols event, some symbols may remain unresolved. These symbols will not appear in the MibNode hierarchy until the module containing their definition is loaded. Order is unimportant when loading additional MIB modules. A complete list of unresolved symbols can be found by retrieving theUndefinedSymbolsconfig setting (comma separated list of symbols).

If the FileName parameter is not the name of a file, the bean will attempt to parse it as MIB data.

IPWorksSSNMPException

selectNode

public void selectNode(java.lang.String selector)
                throws IPWorksSSNMPException
Used to select individual nodes in the loaded MIB module(s).

SelectNode is used for selecting individual nodes and should be called before querying node information.

The Selector parameter can be a label such as "internet", an OID such as "1.3.6.4", a combination of the two: "iso.3.dod.internet", or a label in a particular module such as "RFC1213-MIB!interfaces".

Either '.' or ':' can be used to separate SubIds. If a SubId starts with "0x" or follows the ":" separator then its hexadecimal value is used. For instance, "0x1.0x3.0x6.0x1A" is the same as "1:3:6:1A".

All properties and methods of the bean will operate on the selected node. For example, calling ListSuccessors will only list the successors of the selected node.

IPWorksSSNMPException

addMibbrowserEventListener

public void addMibbrowserEventListener(MibbrowserEventListener l)
                                throws java.util.TooManyListenersException
java.util.TooManyListenersException

removeMibbrowserEventListener

public void removeMibbrowserEventListener(MibbrowserEventListener l)

IP*Works! S/SNMP V6

Copyright (c) 2005 /n software inc. - All rights reserved.