示例#1
0
文件: procreq.c 项目: mingpen/OpenNT
void fixupql(SnmpMgmtQueryList *ql, UINT *errorStatus, UINT *errorIndex)
    {
    UINT v;   // index into view list 
    UINT q;   // index into queue list
    UINT vb;  // index into varbind list 

    // process queries
    for (q=0; (q < ql->len) && !(*errorStatus); q++)
        {
        SNMPDBG((SNMP_LOG_TRACE, "SNMP: PDU: validating query 0x%08lx.\n", ql->query[q].addr));

        // process variable bindings gathered
        for (vb=0; (vb < ql->query[q].vbl.len) && !(*errorStatus); vb++)
            {
            // calculate view index
            v = ql->query[q].xlat[vb].view;
            // check oid returned from subagent
            if (0 < SnmpUtilOidNCmp(
                        &ql->query[q].vbl.list[vb].name,
                        &extAgents[vl[v]].supportedView,
                        extAgents[vl[v]].supportedView.idLength
                        ))
                {
                // retry getnext using next view 
                nextvb(&ql->query[q], vb, v, errorStatus, errorIndex); 
                }
            }
        }

    } // end fixupql()
示例#2
0
文件: walk.cpp 项目: asir6/Colt
// return vb of next oid in agent tree, return 1 else return 0, reason set
int MibIter::next(Vb& vb, char *& reason)
{
  int rc;

  if (valid_ == 0) // not valid object
     return -1;

  // 1. poll for value
  if (first_ == 0) {
    rc = snmp_->get( pdu_, *target_);
    first_++;
  }
  else {
   rc = snmp_->get_next( pdu_, *target_);
  }

  if (rc != SNMP_CLASS_SUCCESS) {
       reason = const_cast <char*> (snmp_->error_string());
       return 0;
  }

  // 2. check for problems
  if (pdu_.get_error_status()) {
     reason = const_cast <char*> (pdu_.agent_error_reason());
     return 0;
  }

  // 3. return vb to caller
  pdu_.get_vb(vb, 0);
  Oid nextoid;
  vb.get_oid(nextoid); // and setup next oid to get
  Vb nextvb(nextoid);
  pdu_.delete_all_vbs();
  pdu_ += nextvb; // can't do set_vb as there are no entries to replace

  return 1; // ok
}