com.adventnet.snmp.mibs.agent
Class AgentMibUtil

java.lang.Object
  |
  +--com.adventnet.snmp.mibs.agent.AgentMibUtil

public class AgentMibUtil
extends java.lang.Object

This class has utilities are used by interpretted agents which use the MIB file (AGENTCLAUSE).


Constructor Summary
AgentMibUtil()
           
 
Method Summary
(package private)  void checkNodeError(MibNode node, SnmpVarBind varbind, int version)
          Checks if the agent has received an instance in case of GET ,SET request messages
(package private) static boolean checkValidVersion(int version)
          checks if the version got is v1 or v2c
static java.lang.String decodeInstance(int[] instance_oid, LeafSyntax syntax)
          This method is used by AgentClause to decode index for table implemetations.
static java.util.Vector decodeInstance(int[] instance_oid, java.util.Vector indexMibNodes)
          This method is used by AgentMibModule's makeInstances to decode index for table implemetations.
static int[] encodeInstanceString(java.util.Vector indexVector, java.util.Vector indexMibNodes)
          Encodes an instance string based on the indexVector (Vector of basic Snmp Type Values) helpful when you have a multiple column INDEX which needs to be encoded.
static MibNode getNextSubTreeLeafNode(MibNode node)
          returns the next Leaf Node in the same subtree .
static MibNode getSubTreeLeafNode(MibNode node)
          returns the next Leaf Node in the same subtree .
(package private)  boolean isLastInstance(AgentMibNode node, int[] OID)
          Utility method to check if the OID received is last instance Used by SnmpAgent in case of DEFVAL s and FILE-COMMAND API users will not require this method.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgentMibUtil

public AgentMibUtil()
Method Detail

encodeInstanceString

public static int[] encodeInstanceString(java.util.Vector indexVector,
                                         java.util.Vector indexMibNodes)
                                  throws java.lang.NumberFormatException
Encodes an instance string based on the indexVector (Vector of basic Snmp Type Values) helpful when you have a multiple column INDEX which needs to be encoded.

Parameters:
indexVector - index of SnmpVars
indexMibNodes - Vector of indexMibNodes defined for this node

Returns:
integer array which represents the instance OID
See Also:
()

decodeInstance

public static java.lang.String decodeInstance(int[] instance_oid,
                                              LeafSyntax syntax)
This method is used by AgentClause to decode index for table implemetations.

Parameters:
instance_oid - ,object identiier of instance.
syntax - object having node information of type LeafSyntax.
Returns:
oid of String Type

See Also:
()

decodeInstance

public static java.util.Vector decodeInstance(int[] instance_oid,
                                              java.util.Vector indexMibNodes)
                                       throws java.lang.Exception
This method is used by AgentMibModule's makeInstances to decode index for table implemetations.

This method is not very rigid as far as decoding is concerned Though a Table Node may have more than one column Index and say we get an Instance OID which has less number of columns we return whatever decoded columns we have primarily. This is done to cater for get Next Requests.

Parameters:
instance_oid - object id of the perticular instance.
indexMibNodes - Vector contains list of indeces.
Returns:
Vector of Strings


getNextSubTreeLeafNode

public static MibNode getNextSubTreeLeafNode(MibNode node)
returns the next Leaf Node in the same subtree .
Parameters:
node - whose next leaf node in subtree is to be found
Returns:
null if next LeafNode is null or is not in the same subtree

getSubTreeLeafNode

public static MibNode getSubTreeLeafNode(MibNode node)
returns the next Leaf Node in the same subtree .
Parameters:
node - in whose subtree the leaf node is to be found
Returns:
null if LeafNode is null or is not in the same subtree

isLastInstance

boolean isLastInstance(AgentMibNode node,
                       int[] OID)
Utility method to check if the OID received is last instance Used by SnmpAgent in case of DEFVAL s and FILE-COMMAND API users will not require this method.

checkNodeError

void checkNodeError(MibNode node,
                    SnmpVarBind varbind,
                    int version)
              throws MibException,
                     AgentSnmpException
Checks if the agent has received an instance in case of GET ,SET request messages
Parameters:
the - node for which the request has been received
varbind - received
version - received in the incoming request

checkValidVersion

static boolean checkValidVersion(int version)
                          throws MibException
checks if the version got is v1 or v2c