Hi:
I have a problem about snmpset,when I set only one variable,all the values of variables are changed .
I want to change the value of only one variable,what can I do to solve the problem? Looking forward for your help!
Here is parts of my program,"example_int"is a global variable:
case DOWNSNDPACK:
long_ret = example_int;
*write_method = write_exampleint;
return (u_char *) & long_ret;
case DOWNRCVPACK:
long_ret = example_int;
*write_method = write_exampleint;
return (u_char *) & long_ret;
case DOWNFLOW:
long_ret = example_int;
*write_method = write_exampleint;
return (u_char *) & long_ret;
case CPURATE:
strcpy(string, example_str);
*var_len = strlen(string);
*write_method = write_examplestr;
return (u_char *) string;
int write_exampleint(int action,
u_char * var_val,
u_char var_val_type,
size_t var_val_len,
u_char * statP, oid * name, size_t name_len)
{
#define MAX_EXAMPLE_INT 100
static long intval;
static long old_intval;
switch (action) {
case RESERVE1:
if (var_val_type != ASN_INTEGER) {
DEBUGMSGTL(("example", "%x not integer type", var_val_type));
return SNMP_ERR_WRONGTYPE;
}
if (var_val_len > sizeof(long)) {
DEBUGMSGTL(("example", "wrong length %x", var_val_len));
return SNMP_ERR_WRONGLENGTH;
}
intval = *((long *) var_val);
if (intval > MAX_EXAMPLE_INT) {
DEBUGMSGTL(("example", "wrong value %x", intval));
return SNMP_ERR_WRONGVALUE;
}
break;
case RESERVE2:
break;
case FREE:
break;
case ACTION:
old_intval = example_int;
example_int = intval;
break;
case UNDO:
example_int = old_intval;
break;
case COMMIT:
break;
}
return SNMP_ERR_NOERROR;
}
------------------------------------------------------------------------------ Forrester Wave Report - Recovery time is now measured in hours and minutes not days. Key insights are discussed in the 2010 Forrester Wave Report as part of an in-depth evaluation of disaster recovery service providers. Forrester found the best-in-class provider in terms of services and vision. Read this report now! http://p.sf.net/sfu/ibm-webcastpromo
_______________________________________________ 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
