> > 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?

Dave



-------------------------------------------------------
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

Reply via email to