⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 null.c

📁 snmp的源代码,已经在我的ubuntu下编译通过
💻 C
字号:
#include <net-snmp/net-snmp-config.h>#if HAVE_STRING_H#include <string.h>#else#include <strings.h>#endif#include <net-snmp/net-snmp-includes.h>#include <net-snmp/agent/net-snmp-agent-includes.h>#include <net-snmp/agent/null.h>#if HAVE_DMALLOC_H#include <dmalloc.h>#endifintnetsnmp_register_null(oid * loc, size_t loc_len){    return netsnmp_register_null_context(loc, loc_len, NULL);}intnetsnmp_register_null_context(oid * loc, size_t loc_len,                              const char *contextName){    netsnmp_handler_registration *reginfo;    reginfo = SNMP_MALLOC_TYPEDEF(netsnmp_handler_registration);    reginfo->handlerName = strdup("");    reginfo->rootoid = loc;    reginfo->rootoid_len = loc_len;    reginfo->handler =        netsnmp_create_handler("null", netsnmp_null_handler);    if (contextName)        reginfo->contextName = strdup(contextName);    reginfo->modes = HANDLER_CAN_DEFAULT;    return netsnmp_register_handler(reginfo);}intnetsnmp_null_handler(netsnmp_mib_handler *handler,                     netsnmp_handler_registration *reginfo,                     netsnmp_agent_request_info *reqinfo,                     netsnmp_request_info *requests){    DEBUGMSGTL(("helper:null", "Got request\n"));    DEBUGMSGTL(("helper:null", "  oid:"));    DEBUGMSGOID(("helper:null", requests->requestvb->name,                 requests->requestvb->name_length));    DEBUGMSG(("helper:null", "\n"));    switch (reqinfo->mode) {    case MODE_GETNEXT:    case MODE_GETBULK:        return SNMP_ERR_NOERROR;    case MODE_GET:        netsnmp_set_all_requests_error(reqinfo, requests,                                       SNMP_NOSUCHOBJECT);        return SNMP_ERR_NOERROR;    default:        netsnmp_set_all_requests_error(reqinfo, requests,                                       SNMP_ERR_NOSUCHNAME);        return SNMP_ERR_NOERROR;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -