求助
请问大家红色部分应怎么填写?
我需要set的类型是ipAddress,是不是直接在requests->requestvb->val.XXX中 提取 信息??
求高手指点。
int
handle_ipAddr(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* We are never called for a GETNEXT if it's registered as a
* "instance", as it's "magically" handled for us.
*/
/*
* a instance handler also only hands us one request at a time, so
* we don't need to loop over a list of requests; we'll only get one.
*/
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_IPADDRESS,
(u_char *)
/* XXX: a pointer to the scalar's data */
,
/*
* XXX: the length of the data in bytes
*/ );
break;
/*
* SET REQUEST
*
* multiple states in the transaction. See:
* http://www.net-snmp.org/tutorial ... ule/set-actions.jpg
*/
case MODE_SET_RESERVE1:
if ( /* XXX: check incoming data in requests->requestvb->val.XXX for failures, like an incorrect type or an illegal value or ... */ ) {
netsnmp_set_request_error(reqinfo, requests,
/* XXX: set error code depending on problem (like SNMP_ERR_WRONGTYPE or SNMP_ERR_WRONGVALUE or ... */
);
}
break;
case MODE_SET_RESERVE2:
/*
* XXX malloc "undo" storage buffer
*/
if ( /* XXX if malloc, or whatever, failed: */ ) {
netsnmp_set_request_error(reqinfo, requests,
SNMP_ERR_RESOURCEUNAVAILABLE);
}
break;
case MODE_SET_FREE:
/*
* XXX: free resources allocated in RESERVE1 and/or
* RESERVE2. Something failed somewhere, and the states
* below won't be called.
*/
break;
case MODE_SET_ACTION:
/*
* XXX: perform the value change here
*/
if ( /* XXX: error? */ ) {
netsnmp_set_request_error(reqinfo, requests, /* some error */
);
}
break;
case MODE_SET_COMMIT:
/*
* XXX: delete temporary storage
*/
if ( /* XXX: error? */ ) {
/*
* try _really_really_ hard to never get to this point
*/
netsnmp_set_request_error(reqinfo, requests,
SNMP_ERR_COMMITFAILED);
}
break;
case MODE_SET_UNDO:
/*
* XXX: UNDO and return to previous value for the object
*/
if ( /* XXX: error? */ ) {
/*
* try _really_really_ hard to never get to this point
*/
netsnmp_set_request_error(reqinfo, requests,
SNMP_ERR_UNDOFAILED);
}
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR, "unknown mode (%d) in handle_ipAddr\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
我需要set的类型是ipAddress,是不是直接在requests->requestvb->val.XXX中 提取 信息??
求高手指点。
int
handle_ipAddr(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* We are never called for a GETNEXT if it's registered as a
* "instance", as it's "magically" handled for us.
*/
/*
* a instance handler also only hands us one request at a time, so
* we don't need to loop over a list of requests; we'll only get one.
*/
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_IPADDRESS,
(u_char *)
/* XXX: a pointer to the scalar's data */
,
/*
* XXX: the length of the data in bytes
*/ );
break;
/*
* SET REQUEST
*
* multiple states in the transaction. See:
* http://www.net-snmp.org/tutorial ... ule/set-actions.jpg
*/
case MODE_SET_RESERVE1:
if ( /* XXX: check incoming data in requests->requestvb->val.XXX for failures, like an incorrect type or an illegal value or ... */ ) {
netsnmp_set_request_error(reqinfo, requests,
/* XXX: set error code depending on problem (like SNMP_ERR_WRONGTYPE or SNMP_ERR_WRONGVALUE or ... */
);
}
break;
case MODE_SET_RESERVE2:
/*
* XXX malloc "undo" storage buffer
*/
if ( /* XXX if malloc, or whatever, failed: */ ) {
netsnmp_set_request_error(reqinfo, requests,
SNMP_ERR_RESOURCEUNAVAILABLE);
}
break;
case MODE_SET_FREE:
/*
* XXX: free resources allocated in RESERVE1 and/or
* RESERVE2. Something failed somewhere, and the states
* below won't be called.
*/
break;
case MODE_SET_ACTION:
/*
* XXX: perform the value change here
*/
if ( /* XXX: error? */ ) {
netsnmp_set_request_error(reqinfo, requests, /* some error */
);
}
break;
case MODE_SET_COMMIT:
/*
* XXX: delete temporary storage
*/
if ( /* XXX: error? */ ) {
/*
* try _really_really_ hard to never get to this point
*/
netsnmp_set_request_error(reqinfo, requests,
SNMP_ERR_COMMITFAILED);
}
break;
case MODE_SET_UNDO:
/*
* XXX: UNDO and return to previous value for the object
*/
if ( /* XXX: error? */ ) {
/*
* try _really_really_ hard to never get to this point
*/
netsnmp_set_request_error(reqinfo, requests,
SNMP_ERR_UNDOFAILED);
}
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR, "unknown mode (%d) in handle_ipAddr\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
...全文
相关推荐
大学生心理求助态度与心理求助行为的关系研究.docx
【大学生心理求助态度与心理求助行为的关系研究】这篇研究报告探讨了大学生在面对心理困扰时,其心理求助态度与实际求助行为之间的联系。
网络游戏-基于lora网络的求助杆及求助系统.zip
**求助系统设计**:详述求助系统的架构,包括硬件(如求助杆)、软件(信号处理和传输)、用户界面和后台管理系统等组成部分。5.
校园应急管理数字求助对讲系统.doc
二、对讲求助点的分布1.2.1 校园对讲求助:对讲求助点应覆盖校园的主要区域,如教学楼、图书馆、宿舍区、操场、食堂等人员密集场所。这些地点设置的求助按钮应易于识别和操作,确保在紧急情况下能被迅速触发。
基于ZigBee技术的门铃及老人求助系统
《基于ZigBee技术的智能门铃及老人求助系统》随着科技的进步,智能家居产品逐渐进入人们的生活,其中,基于ZigBee技术的门铃及老人求助系统以其人性化的功能设计,解决了传统门铃及老人求助的局限性。
通信与网络中的地铁站内无线乘客求助系统设计方案
"通信与网络中的地铁站内无线乘客求助系统设计方案"地铁站内无线乘客求助系统是现代城市交通中不可或缺的一部分,它旨在提供快速、可靠的乘客求助服务,同时简化安装和维护过程。针对这一需求,设计了一种基于


其它技术问题
