On 08/04/2008, Kris van Rens <[EMAIL PROTECTED]> wrote:
> I'm trying this now, but for some reason, I get stuck at the first
> object. Here's what I do:
> read_objid("IF-MIB::ifPhysAddress", if_oid, &if_oid_len);
>
> // Walk the list of IF-MIB::ifPhysAddress.x
> for (i = 0; i < 10; i++) {
> req = snmp_pdu_create(SNMP_MSG_GETNEXT);
> snmp_add_null_var(req, if_oid, if_oid_len);
> ret = snmp_synch_response(sess_h, req, &resp);
> if (ret != STAT_SUCCESS || resp->errstat != SNMP_ERR_NOERROR)
> goto out_snmp_synch_response;
>
>
> // DEBUG
> print_variable(resp->variables->name,
> resp->variables->name_length,
> resp->variables);
You need to update the 'if_oid' buffer with the OID from this response.
At the moment, you're asking for the same OID every time.
> Here's the output:
> ---
> # ./snmptest
>
> IF-MIB::ifPhysAddress.1 = STRING:
> IF-MIB::ifPhysAddress.1 = STRING:
which is why you get the same answer every time.
The key with GetNext is to use the results from one request
as the input to the next.
Dave
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Register now and save $200. Hurry, offer ends at 11:59 p.m.,
Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders