本文整理汇总了C++中REGISTER_MIB函数的典型用法代码示例。如果您正苦于以下问题:C++ REGISTER_MIB函数的具体用法?C++ REGISTER_MIB怎么用?C++ REGISTER_MIB使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了REGISTER_MIB函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: int_hpux
void int_hpux(void)
{
/* define the structure we're going to ask the agent to register our
information at */
struct variable2 hp_variables[] = {
{HPCONF, ASN_INTEGER, RWRITE, var_hp, 1, {HPCONF}},
{HPRECONFIG, ASN_INTEGER, RWRITE, var_hp, 1, {HPRECONFIG}},
{HPFLAG, ASN_INTEGER, RWRITE, var_hp, 1, {HPFLAG}},
{HPLOGMASK, ASN_INTEGER, RWRITE, var_hp, 1, {ERRORFLAG}},
{HPSTATUS, ASN_INTEGER, RWRITE, var_hp, 1, {ERRORMSG}}
};
struct variable2 hptrap_variables[] = {
{HPTRAP, ASN_IPADDRESS, RWRITE, var_hp, 1, {HPTRAP }},
};
/* Define the OID pointer to the top of the mib tree that we're
registering underneath */
oid hp_variables_oid[] = { 1,3,6,1,4,1,11,2,13,1,2,1 };
oid hptrap_variables_oid[] = { 1,3,6,1,4,1,11,2,13,2 };
/* register ourselves with the agent to handle our mib tree */
REGISTER_MIB("mibII/hpux:hp", hp_variables, variable2, hp_variables_oid);
REGISTER_MIB("mibII/hpux:hptrap", hptrap_variables, variable2, \
hptrap_variables_oid);
}
示例2: init_logmatch
void
init_logmatch(void)
{
struct variable2 logmatch_info[] = {
{LOGMATCH_INFO, ASN_INTEGER, NETSNMP_OLDAPI_RONLY,
var_logmatch_table, 0}
};
struct variable2 logmatch_table[] = {
{LOGMATCH_INDEX, ASN_INTEGER, NETSNMP_OLDAPI_RONLY,
var_logmatch_table, 1, {1}},
{LOGMATCH_NAME, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY,
var_logmatch_table, 1, {2}},
{LOGMATCH_FILENAME, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY,
var_logmatch_table, 1, {3}},
{LOGMATCH_REGEX, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY,
var_logmatch_table, 1, {4}},
{LOGMATCH_GLOBALCTR, ASN_COUNTER, NETSNMP_OLDAPI_RONLY,
var_logmatch_table, 1, {5}},
{LOGMATCH_GLOBALCNT, ASN_INTEGER, NETSNMP_OLDAPI_RONLY,
var_logmatch_table, 1, {6}},
{LOGMATCH_CURRENTCTR, ASN_COUNTER, NETSNMP_OLDAPI_RONLY,
var_logmatch_table, 1, {7}},
{LOGMATCH_CURRENTCNT, ASN_INTEGER, NETSNMP_OLDAPI_RONLY,
var_logmatch_table, 1, {8}},
{LOGMATCH_COUNTER, ASN_COUNTER, NETSNMP_OLDAPI_RONLY,
var_logmatch_table, 1, {9}},
{LOGMATCH_COUNT, ASN_INTEGER, NETSNMP_OLDAPI_RONLY,
var_logmatch_table, 1, {10}},
{LOGMATCH_FREQ, ASN_INTEGER, NETSNMP_OLDAPI_RONLY,
var_logmatch_table, 1, {11}},
{LOGMATCH_ERROR, ASN_INTEGER, NETSNMP_OLDAPI_RONLY,
var_logmatch_table, 1, {100}},
{LOGMATCH_MSG, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY,
var_logmatch_table, 1, {101}}
};
/*
* Define the OID pointer to the top of the mib tree that we're
* registering underneath
*/
oid logmatch_info_oid[] = { NETSNMP_UCDAVIS_MIB, 16, 1 };
oid logmatch_variables_oid[] = { NETSNMP_UCDAVIS_MIB, 16, 2, 1 };
/*
* register ourselves with the agent to handle our mib tree
*/
REGISTER_MIB("ucd-snmp/logmatch", logmatch_info, variable2,
logmatch_info_oid);
REGISTER_MIB("ucd-snmp/logmatch", logmatch_table, variable2,
logmatch_variables_oid);
snmpd_register_config_handler("logmatch", logmatch_parse_config,
logmatch_free_config,
"logmatch name path cycletime regex");
}
示例3: init_ip
void
init_ip(void)
{
netsnmp_handler_registration *reginfo;
/*
* register ourselves with the agent as a group of scalars...
*/
DEBUGMSGTL(("mibII/ip", "Initialising IP group\n"));
reginfo = netsnmp_create_handler_registration("ip", ip_handler,
ip_oid, OID_LENGTH(ip_oid), HANDLER_CAN_RONLY);
netsnmp_register_scalar_group(reginfo, IPFORWARDING, IPROUTEDISCARDS);
/*
* .... with a local cache
* (except for HP-UX 11, which extracts objects individually)
*/
#ifndef hpux11
netsnmp_inject_handler( reginfo,
netsnmp_get_cache_handler(IP_STATS_CACHE_TIMEOUT,
ip_load, ip_free,
ip_oid, OID_LENGTH(ip_oid)));
#endif
/*
* register (using the old-style API) to handle the IP tables
*/
REGISTER_MIB("mibII/ipaddr", ipaddr_variables,
variable1, ipaddr_variables_oid);
REGISTER_MIB("mibII/iproute", iproute_variables,
variable1, iproute_variables_oid);
REGISTER_MIB("mibII/ipmedia", ipmedia_variables,
variable1, ipmedia_variables_oid);
if (++ip_module_count == 2)
REGISTER_SYSOR_ENTRY(ip_module_oid,
"The MIB module for managing IP and ICMP implementations");
/*
* for speed optimization, we call this now to do the lookup
*/
#ifdef IPSTAT_SYMBOL
auto_nlist(IPSTAT_SYMBOL, 0, 0);
#endif
#ifdef IP_FORWARDING_SYMBOL
auto_nlist(IP_FORWARDING_SYMBOL, 0, 0);
#endif
#ifdef TCP_TTL_SYMBOL
auto_nlist(TCP_TTL_SYMBOL, 0, 0);
#endif
#ifdef MIB_IPCOUNTER_SYMBOL
auto_nlist(MIB_IPCOUNTER_SYMBOL, 0, 0);
#endif
#ifdef solaris2
init_kernel_sunos5();
#endif
}
示例4: nk_awk
/*
static int nk_awk(char *src, int pos, char *dst)
{
char *ptmp = src;
int j;
while((*ptmp != '\0') && ((*ptmp == ' ') || (*ptmp == '\t'))) ptmp++;
for(j = 0; j < pos; j++)
{
sscanf(ptmp, "%s", dst);
ptmp += strlen(dst);
while((*ptmp != '\0') && ((*ptmp == ' ') || (*ptmp == '\t'))) ptmp++;
if(*ptmp == '\0')
{
*dst = '\0';
return -1;
}
}
return 0;
}
int nk_parse_tmp_file(char *filename, int pos, char *dst)
{
char tmp[256];
int ret = 0;
FILE *fp = fopen(filename, "r");
if(fp)
{
memset(tmp, '\0', sizeof(tmp));
fgets(tmp, sizeof(tmp), fp);
if(nk_awk(tmp, pos, dst) < 0)
{
ret = -1;
}
fclose(fp);
}
else
{
ret = -2;
}
return ret;
}
*/
void init_cisco_MIB(void)
{
#ifdef CONFIG_MODEL_RV0XX
REGISTER_MIB("common", common_variables, variable2, common_variables_oid);
REGISTER_MIB("basicMgt", basicMgt_variables, variable4, basicMgt_variables_oid);
REGISTER_MIB("advanceMgt", advanceMgt_variables, variable4, advanceMgt_variables_oid);
REGISTER_MIB("wanMgt", wanMgt_variables, variable4, wanMgt_variables_oid);
REGISTER_MIB("entity", entity_variables, variable2, entity_variables_oid);
#endif
}
示例5: init_extensible
void init_extensible(void)
{
struct variable2 extensible_extensible_variables[] = {
{MIBINDEX, ASN_INTEGER, RONLY, var_extensible_shell, 1, {MIBINDEX}},
{ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_shell, 1, {ERRORNAME}},
{SHELLCOMMAND, ASN_OCTET_STR, RONLY, var_extensible_shell, 1, {SHELLCOMMAND}},
{ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_shell, 1, {ERRORFLAG}},
{ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_shell, 1, {ERRORMSG}},
{ERRORFIX, ASN_INTEGER, RWRITE, var_extensible_shell, 1, {ERRORFIX}},
{ERRORFIXCMD, ASN_OCTET_STR, RONLY, var_extensible_shell, 1, {ERRORFIXCMD}}
};
/* Define the OID pointer to the top of the mib tree that we're
registering underneath */
oid extensible_variables_oid[] = { EXTENSIBLEMIB,SHELLMIBNUM,1 };
/* register ourselves with the agent to handle our mib tree */
REGISTER_MIB("mibII/extensible", extensible_extensible_variables, variable2, \
extensible_variables_oid);
snmpd_register_config_handler("exec", extensible_parse_config,
extensible_free_config,
"[miboid] name program arguments");
snmpd_register_config_handler("sh", extensible_parse_config,
extensible_free_config,
"[miboid] name program-or-script arguments");
snmpd_register_config_handler("execfix", execfix_parse_config, NULL,
"exec-or-sh-name program [arguments...]");
}
示例6: init_versioninfo
void init_versioninfo(void)
{
/* define the structure we're going to ask the agent to register our
information at */
struct variable2 extensible_version_variables[] = {
{MIBINDEX, ASN_INTEGER, RONLY, var_extensible_version, 1, {MIBINDEX}},
{VERTAG, ASN_OCTET_STR, RONLY, var_extensible_version, 1, {VERTAG}},
{VERDATE, ASN_OCTET_STR, RONLY, var_extensible_version, 1, {VERDATE}},
{VERCDATE, ASN_OCTET_STR, RONLY, var_extensible_version, 1, {VERCDATE}},
{VERIDENT, ASN_OCTET_STR, RONLY, var_extensible_version, 1, {VERIDENT}},
{VERCONFIG, ASN_OCTET_STR, RONLY, var_extensible_version, 1, {VERCONFIG}},
{VERCLEARCACHE, ASN_INTEGER, RWRITE, var_extensible_version, 1, {VERCLEARCACHE}},
{VERUPDATECONFIG, ASN_INTEGER, RWRITE, var_extensible_version, 1, {VERUPDATECONFIG}},
{VERRESTARTAGENT, ASN_INTEGER, RWRITE, var_extensible_version, 1, {VERRESTARTAGENT}},
{VERDEBUGGING, ASN_INTEGER, RWRITE, var_extensible_version, 1, {VERDEBUGGING}}
};
/* Define the OID pointer to the top of the mib tree that we're
registering underneath */
oid version_variables_oid[] = { EXTENSIBLEMIB,VERSIONMIBNUM };
/* register ourselves with the agent to handle our mib tree */
REGISTER_MIB("ucd-snmp/versioninfo", extensible_version_variables, \
variable2, version_variables_oid);
}
示例7: init_cpqHost
/** Initializes the cpqHost module */
void
init_cpqHost(void)
{
DEBUGMSGTL(("cpqHost", "Initializing\n"));
myDistro = getDistroInfo();
cpqHostMibStatusArray[CPQMIB].major = CPQMIBREVMAJOR;
cpqHostMibStatusArray[CPQMIB].minor = CPQMIBREVMINOR;
netsnmp_register_scalar_group(
netsnmp_create_handler_registration("cpqHostMib",
cpqHostMib_handler,
cpqHostMib_oid,
OID_LENGTH(cpqHostMib_oid),
HANDLER_CAN_RONLY),
CPQHOSTMIBREVMAJOR, CPQHOSTMIBCONDITION);
netsnmp_register_scalar_group(
netsnmp_create_handler_registration("cpqHostInfo",
cpqHostInfo_handler,
cpqHostInfo_oid,
OID_LENGTH(cpqHostInfo_oid),
HANDLER_CAN_RONLY),
CPQHOSTNAME, CPQHOSTSYSDESCR);
init_cpqHoFileSysTable();
init_cpqHoSwVerTable();
init_cpqHostOsMem();
init_cpqHoSWRunningTable();
/*
* register ourselves with the agent to handle our mib tree
*/
REGISTER_MIB("cpqHostOs", cpqHostOs_variables, variable7,
cpqHostOs_variables_oid);
/*
* place any other initialization junk you need here
*/
cpqHostMibStatusArray[CPQMIB].stat = MIB_STATUS_AVAILABLE;
cpqHostMibStatusArray[CPQMIB].cond = MIB_CONDITION_OK;
DEBUGMSGTL(("cpqHost", "Checkinging periodic test trap interval = %d\n", testtrap_interval));
if (testtrap_interval >= 0) {
if ((GenericDataStr = getenv(GenericDataEnv)) != (char *) 0)
GenericData = GenericDataStr;
DEBUGMSGTL(("cpqHost", "Registering periodic test trap alarm\n"));
SendcpqHostGenericTrap();
if (testtrap_interval > 0) {
if (snmp_alarm_register(testtrap_interval,
SA_REPEAT,
(SNMPAlarmCallback *) &SendcpqHostGenericTrap,
NULL) == 0 )
DEBUGMSGTL(("cpqHost", "Alarm register failed\n"));
}
}
}
示例8: init_ip
void
init_ip(void)
{
/*
* register ourselves with the agent to handle our mib tree
*/
REGISTER_MIB("mibII/ip", ip_variables, variable3, ip_variables_oid);
if (++ip_module_count == 2)
REGISTER_SYSOR_ENTRY(ip_module_oid,
"The MIB module for managing IP and ICMP implementations");
/*
* for speed optimization, we call this now to do the lookup
*/
#ifdef IPSTAT_SYMBOL
auto_nlist(IPSTAT_SYMBOL, 0, 0);
#endif
#ifdef IP_FORWARDING_SYMBOL
auto_nlist(IP_FORWARDING_SYMBOL, 0, 0);
#endif
#ifdef TCP_TTL_SYMBOL
auto_nlist(TCP_TTL_SYMBOL, 0, 0);
#endif
#ifdef MIB_IPCOUNTER_SYMBOL
auto_nlist(MIB_IPCOUNTER_SYMBOL, 0, 0);
#endif
#ifdef solaris2
init_kernel_sunos5();
#endif
}
示例9: init_dlmod
void
init_dlmod(void)
{
char *p;
int len;
REGISTER_MIB("dlmod", dlmod_variables, variable4, dlmod_variables_oid);
/*
* TODO: REGISTER_SYSOR_ENTRY
*/
DEBUGMSGTL(("dlmod", "register mib\n"));
snmpd_register_config_handler("dlmod", dlmod_parse_config,
dlmod_free_config,
"module-name module-path");
p = getenv("SNMPDLMODPATH");
strncpy(dlmod_path, SNMPDLMODPATH, sizeof(dlmod_path));
dlmod_path[ sizeof(dlmod_path)-1 ] = 0;
if (p) {
if (p[0] == ':') {
len = strlen(dlmod_path);
if (dlmod_path[len - 1] != ':') {
strncat(dlmod_path, ":", sizeof(dlmod_path) - len -1);
len++;
}
strncat(dlmod_path, p + 1, sizeof(dlmod_path) - len);
} else
strncpy(dlmod_path, p, sizeof(dlmod_path));
}
dlmod_path[ sizeof(dlmod_path)-1 ] = 0;
DEBUGMSGTL(("dlmod", "dlmod_path: %s\n", dlmod_path));
}
示例10: ospf6_snmp_init
/* Register OSPFv3-MIB. */
void
ospf6_snmp_init ()
{
smux_init (ospf6d_oid, sizeof (ospf6d_oid) / sizeof (oid));
REGISTER_MIB ("OSPFv3MIB", ospfv3_variables, variable, ospfv3_oid);
smux_start ();
}
示例11: init_hr_device
void init_hr_device (void)
{
int i;
/*
* Initially assume no devices
* Insert pointers to initialisation/get_next routines
* for particular device types as they are implemented
* (set up in the appropriate 'init_*()' routine )
*/
for (i = 0; i < HRDEV_TYPE_MAX; ++i)
{
init_device[i] = NULL;
next_device[i] = NULL;
save_device[i] = NULL;
dev_idx_inc[i] = 0; /* Assume random indices */
device_descr[i] = NULL;
device_prodid[i] = NULL;
device_status[i] = NULL;
device_errors[i] = NULL;
}
REGISTER_MIB ("host/hr_device", hrdevice_variables, variable4, hrdevice_variables_oid);
}
示例12: init_hrh_storage
void
init_hrh_storage(void)
{
char *appname;
netsnmp_register_scalar(
netsnmp_create_handler_registration("host/hrMemorySize", handle_memsize,
hrMemorySize_oid, OID_LENGTH(hrMemorySize_oid),
HANDLER_CAN_RONLY));
REGISTER_MIB("host/hr_storage", hrstore_variables, variable2,
hrStorageTable_oid);
appname = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_LIB_APPTYPE);
netsnmp_ds_register_config(ASN_BOOLEAN, appname, "skipNFSInHostResources",
NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES);
netsnmp_ds_register_config(ASN_BOOLEAN, appname, "realStorageUnits",
NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_REALSTORAGEUNITS);
snmpd_register_config_handler("storageUseNFS", parse_storage_config, NULL,
"1 | 2\t\t(1 = enable, 2 = disable)");
}
示例13: init_errormib
void init_errormib (void)
{
/*
* define the structure we're going to ask the agent to register our
* information at
*/
struct variable2 extensible_error_variables[] = {
{MIBINDEX, ASN_INTEGER, NETSNMP_OLDAPI_RONLY,
var_extensible_errors, 1, {MIBINDEX}},
{ERRORNAME, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY,
var_extensible_errors, 1, {ERRORNAME}},
{ERRORFLAG, ASN_INTEGER, NETSNMP_OLDAPI_RONLY,
var_extensible_errors, 1, {ERRORFLAG}},
{ERRORMSG, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY,
var_extensible_errors, 1, {ERRORMSG}}
};
/*
* Define the OID pointer to the top of the mib tree that we're
* registering underneath
*/
oid extensible_error_variables_oid[] = { NETSNMP_UCDAVIS_MIB, NETSNMP_ERRORMIBNUM };
/*
* register ourselves with the agent to handle our mib tree
*/
REGISTER_MIB ("ucd-snmp/errormib", extensible_error_variables, variable2, extensible_error_variables_oid);
}
示例14: init_traceRouteResultsTable
void
init_traceRouteResultsTable(void)
{
DEBUGMSGTL(("traceRouteResultsTable", "initializing... "));
/*
* register ourselves with the agent to handle our mib tree
*/
REGISTER_MIB("traceRouteResultsTable",
traceRouteResultsTable_variables, variable2,
traceRouteResultsTable_variables_oid);
/*
* register our config handler(s) to deal with registrations
*/
snmpd_register_config_handler("traceRouteResultsTable",
parse_traceRouteResultsTable, NULL,
NULL);
/*
* we need to be called back later to store our data
*/
snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
store_traceRouteResultsTable, NULL);
DEBUGMSGTL(("traceRouteResultsTable", "done.\n"));
}
示例15: init_snmpNotifyFilterTable
/*
* init_snmpNotifyFilterTable():
* Initialization routine. This is called when the agent starts up.
* At a minimum, registration of your variables should take place here.
*/
void
init_snmpNotifyFilterTable(void)
{
DEBUGMSGTL(("snmpNotifyFilterTable", "initializing... "));
/*
* register ourselves with the agent to handle our mib tree
*/
REGISTER_MIB("snmpNotifyFilterTable", snmpNotifyFilterTable_variables,
variable2, snmpNotifyFilterTable_variables_oid);
/*
* register our config handler(s) to deal with registrations
*/
snmpd_register_config_handler("snmpNotifyFilterTable",
parse_snmpNotifyFilterTable, NULL, NULL);
/*
* we need to be called back later to store our data
*/
snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
store_snmpNotifyFilterTable, NULL);
/*
* place any other initialization junk you need here
*/
DEBUGMSGTL(("snmpNotifyFilterTable", "done.\n"));
}