[ Sorry for the delay in responding to this ]
>> In writing a client using net-snmplib, is there an easy way
>> of using indices.... [constructing] them from data.
> static const char varname[]="somemib::sometable.1.1";
> oid value[MAX_OID_LEN];
> size_t valuelen;
>
> valuelen=sizeof(value)/sizeof(oid);
> snmp_parse_oid(varname,value,&valuelen);
> value[valuelen-2]=index1;
> value[valuelen-1]=index2;
> snmp_add_null_var(pdu,value,valuelen);
>
> seems to work, but is this The Right Way(tm) ?
If the index values are available as a sequence of varbinds,
then you could use the internal 'build_oid' call.
Something like:
snmp_parse_oid( "SOMEMIB::sometable.1.1", value1, &value1len );
build_oid( &value2_ptr, &value2len, value1, value1len,
index_varbind_list );
But it's probably simpler to use your approach above :-)
Dave
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users