> > > You need to pass a pointer to the actual (binary) value - not a > > > printable version of it. > > > > snmp_add_var(pdu, auth_OID, auth_OID_len, 'i', &value); > > > > Thanks but: > > > > x.c:1022: warning: passing arg 5 of `snmp_add_var' from > > incompatible pointer > type > OK - so cast it to the expected type: > > snmp_add_var(pdu, auth_OID, auth_OID_len, 'i', (u_char *)&value); > > > > > value is > > > > char value[20] > > > > so it already _was_ a pointer. > > > Yes - but a pointer to the wrong value. > "snmp_add_var" is expecting a pointer to the *binary* value, > not to a printable representation of it. > > For example, if value has the value 255, > then snmp_add_var would expect a single byte containing 0xff, > not three bytes containing the ascii characters '2', '5', '5'. > (Well, actually it'd expect the 4-octet value 0x000000ff, > but you get the idea). > > The Net-SNMP suite invariably handles MIB value parameters as > u_char*, but this doesn't mean a printable string. It's best > thought of as a generic pointer - i.e. similar to void* > > OK?
Well, no. I really appreciate your quick feedback and explanation but now I'm worse off than I was. Before, my set routine got called n times for port 1, now it doesn't get called at all! Now I've got: int SetTrapsEnabled(int links[]) { struct snmp_pdu *pdu; struct snmp_pdu *response; size_t port; int status; int retval; pdu = snmp_pdu_create(SNMP_MSG_SET); for (port = 0; port < NUM_IF; ++port) { link_OID[link_OID_len-1] = port+1; snmp_add_var(pdu, link_OID, link_OID_len, 'i', (u_char*)&(links[port])); } status = snmp_synch_response(ss, pdu, &response); ... And nothing happens! ------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 _______________________________________________ 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