long[] oid, int pos, int depth,
SnmpRequestTree handlers, AcmChecker checker)
throws SnmpStatusException {
int length = oid.length;
SnmpMibNode node = null;
if (handlers == null)
// This should be considered as a genErr, but we do not want to
// abort the whole request, so we're going to throw
// a noSuchObject...
//
throw noSuchObjectException;
final Object data = handlers.getUserData();
final int pduVersion = handlers.getRequestPduVersion();
// The generic case where the end of the OID has been reached is
// handled in the superclass
// XXX Revisit: this works but it is somewhat convoluted. Just setting
// arc to -1 would work too.
if (pos >= length)
return super.findNextHandlingNode(varbind,oid,pos,depth,
handlers, checker);
// Ok, we've got the arc.
long arc = oid[pos];
long[] result = null;
// We have a recursive logic. Should we have a loop instead?
try {
if (isTable(arc)) {
// If the arc identifies a table, then we need to forward
// the search to the table.
// Gets the table identified by `arc'
SnmpMibTable table = getTable(arc);
// Forward to the table
checker.add(depth, arc);
try {
result = table.findNextHandlingNode(varbind,oid,pos+1,
depth+1,handlers,
checker);
}catch(SnmpStatusException ex) {
throw noSuchObjectException;
} finally {
checker.remove(depth);
}
// Build up the leaf OID
result[depth] = arc;
return result;
} else if (isReadable(arc)) {
// If the arc identifies a readable variable, then two cases:
if (pos == (length - 1)) {
// The end of the OID is reached, so we return the leaf
// corresponding to the variable identified by `arc'
// Build up the OID
// result = new SnmpOid(0);
// result.insert((int)arc);
result = new long[depth+2];
result[depth+1] = 0L;
result[depth] = arc;
checker.add(depth, result, depth, 2);
try {
checker.checkCurrentOid();
} catch(SnmpStatusException e) {
throw noSuchObjectException;
} finally {
checker.remove(depth,2);
}
// Registers this node
handlers.add(this,depth,varbind);
return result;
}
// The end of the OID is not yet reached, so we must return
// the next leaf following the variable identified by `arc'.
// We cannot return the variable because whatever follows in
// the OID will be greater or equals to 0, and 0 identifies
// the variable itself - so we have indeed to return the
// next object.
// So we do nothing, because this case is handled at the
// end of the if ... else if ... else ... block.
} else if (isNestedArc(arc)) {
// Now if the arc leads to a subgroup, we delegate the
// search to the child, just as done in SnmpMibNode.
//
// get the child ( = nested arc node).
//
final SnmpMibNode child = getChild(arc);
if (child != null) {
checker.add(depth, arc);
try {
result = child.findNextHandlingNode(varbind,oid,pos+1,
depth+1,handlers,
checker);
result[depth] = arc;
return result;
} finally {