Dear all
i'm using mib2c.scalar.conf to work on a scalar in
RFC3812,called mplsTunnelNotificationMaxRate.
though,i have no problem when trying to get,but really
comfused working with set.
i always get the message
Error in packet
Reason:notWritable(That object does not support
modification)
Here is my code:
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "mplsTunnelNotificationMaxRate.h"
static unsigned mplsTunnelNotificationMaxRate;
/** Initializes the mplsTunnelNotificationMaxRate
module */
void
init_mplsTunnelNotificationMaxRate (void)
{
static oid mplsTunnelNotificationMaxRate_oid[] =
{ 1, 3, 6, 1, 2, 1, 10, 166, 3, 1, 5 };
netsnmp_register_scalar
(netsnmp_create_handler_registration
("mplsTunnelNotificationMaxRate",
handle_mplsTunnelNotificationMaxRate,
mplsTunnelNotificationMaxRate_oid,
OID_LENGTH (mplsTunnelNotificationMaxRate_oid),
HANDLER_CAN_RWRITE));
mplsTunnelNotificationMaxRate = 8;
}
int
handle_mplsTunnelNotificationMaxRate
(netsnmp_mib_handler * handler,
netsnmp_handler_registration * reginfo,
netsnmp_agent_request_info * reqinfo,
netsnmp_request_info * requests)
{
unsigned *temp;
switch (reqinfo->mode)
{
case MODE_GET:
snmp_set_var_typed_value (requests->requestvb,
ASN_UNSIGNED, (u_char *)
& mplsTunnelNotificationMaxRate,
sizeof (mplsTunnelNotificationMaxRate));
break;
case MODE_SET_RESERVE1:
if ( requests->requestvb->type != ASN_UNSIGNED)
{
netsnmp_set_request_error (reqinfo, requests,
SNMP_ERR_WRONGTYPE);
return;
}
if (requests->requestvb->val_len > sizeof
(unsigned))
{
netsnmp_set_request_error (reqinfo, requests,
SNMP_ERR_WRONGVALUE);
return;
}
break;
case MODE_SET_RESERVE2:
temp = (unsigned *) malloc (sizeof (unsigned));
if (NULL == temp)
{
netsnmp_set_request_error (reqinfo, requests,
SNMP_ERR_RESOURCEUNAVAILABLE);
return;
}
break;
case MODE_SET_FREE:
free (temp);
break;
case MODE_SET_ACTION:
* temp = mplsTunnelNotificationMaxRate;
mplsTunnelNotificationMaxRate = (unsigned) *
(requests->requestvb->val.integer);
break;
case MODE_SET_COMMIT:
free (temp);
break;
case MODE_SET_UNDO:
mplsTunnelNotificationMaxRate = *temp;
free(temp);
break;
default:
snmp_log (LOG_ERR,
"unknown mode (%d) in
handle_mplsTunnelNotificationMaxRate\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
please help me !
thx
_________________________________________________________
Do You Yahoo!?
150万曲MP3疯狂搜,带您闯入音乐殿堂
http://music.yisou.com/
美女明星应有尽有,搜遍美图、艳图和酷图
http://image.yisou.com
1G就是1000兆,雅虎电邮自助扩容!
http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/event/mail_1g/
-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
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