📄 mtetriggerthresholdtable.c
字号:
/* * This file was generated by mib2c and is intended for use as * a mib module for the ucd-snmp snmpd agent. *//* * This should always be included first before anything else */#include <net-snmp/net-snmp-config.h>#if HAVE_STDLIB_H#include <stdlib.h>#endif#if HAVE_STRING_H#include <string.h>#else#include <strings.h>#endif/* * minimal include directives */#include <net-snmp/net-snmp-includes.h>#include <net-snmp/agent/net-snmp-agent-includes.h>#include "header_complex.h"#include "mteTriggerThresholdTable.h"#include "mteTriggerTable.h"/* * mteTriggerThresholdTable_variables_oid: * this is the top level oid that we want to register under. This * is essentially a prefix, with the suffix appearing in the * variable below. */oid mteTriggerThresholdTable_variables_oid[] = { 1, 3, 6, 1, 2, 1, 88, 1, 2, 6 };/* * variable2 mteTriggerThresholdTable_variables: * this variable defines function callbacks and type return information * for the mteTriggerThresholdTable mib section */struct variable2 mteTriggerThresholdTable_variables[] = { /* * magic number , variable type , ro/rw , callback fn , L, oidsuffix */#define MTETRIGGERTHRESHOLDSTARTUP 3 {MTETRIGGERTHRESHOLDSTARTUP, ASN_INTEGER, RWRITE, var_mteTriggerThresholdTable, 2, {1, 1}},#define MTETRIGGERTHRESHOLDRISING 4 {MTETRIGGERTHRESHOLDRISING, ASN_INTEGER, RWRITE, var_mteTriggerThresholdTable, 2, {1, 2}},#define MTETRIGGERTHRESHOLDFALLING 5 {MTETRIGGERTHRESHOLDFALLING, ASN_INTEGER, RWRITE, var_mteTriggerThresholdTable, 2, {1, 3}},#define MTETRIGGERTHRESHOLDDELTARISING 6 {MTETRIGGERTHRESHOLDDELTARISING, ASN_INTEGER, RWRITE, var_mteTriggerThresholdTable, 2, {1, 4}},#define MTETRIGGERTHRESHOLDDELTAFALLING 7 {MTETRIGGERTHRESHOLDDELTAFALLING, ASN_INTEGER, RWRITE, var_mteTriggerThresholdTable, 2, {1, 5}},#define MTETRIGGERTHRESHOLDOBJECTSOWNER 8 {MTETRIGGERTHRESHOLDOBJECTSOWNER, ASN_OCTET_STR, RWRITE, var_mteTriggerThresholdTable, 2, {1, 6}},#define MTETRIGGERTHRESHOLDOBJECTS 9 {MTETRIGGERTHRESHOLDOBJECTS, ASN_OCTET_STR, RWRITE, var_mteTriggerThresholdTable, 2, {1, 7}},#define MTETRIGGERTHRESHOLDRISINGEVENTOWNER 10 {MTETRIGGERTHRESHOLDRISINGEVENTOWNER, ASN_OCTET_STR, RWRITE, var_mteTriggerThresholdTable, 2, {1, 8}},#define MTETRIGGERTHRESHOLDRISINGEVENT 11 {MTETRIGGERTHRESHOLDRISINGEVENT, ASN_OCTET_STR, RWRITE, var_mteTriggerThresholdTable, 2, {1, 9}},#define MTETRIGGERTHRESHOLDFALLINGEVENTOWNER 12 {MTETRIGGERTHRESHOLDFALLINGEVENTOWNER, ASN_OCTET_STR, RWRITE, var_mteTriggerThresholdTable, 2, {1, 10}},#define MTETRIGGERTHRESHOLDFALLINGEVENT 13 {MTETRIGGERTHRESHOLDFALLINGEVENT, ASN_OCTET_STR, RWRITE, var_mteTriggerThresholdTable, 2, {1, 11}},#define MTETRIGGERTHRESHOLDDELTARISINGEVENTOWNER 14 {MTETRIGGERTHRESHOLDDELTARISINGEVENTOWNER, ASN_OCTET_STR, RWRITE, var_mteTriggerThresholdTable, 2, {1, 12}},#define MTETRIGGERTHRESHOLDDELTARISINGEVENT 15 {MTETRIGGERTHRESHOLDDELTARISINGEVENT, ASN_OCTET_STR, RWRITE, var_mteTriggerThresholdTable, 2, {1, 13}},#define MTETRIGGERTHRESHOLDDELTAFALLINGEVENTOWNER 16 {MTETRIGGERTHRESHOLDDELTAFALLINGEVENTOWNER, ASN_OCTET_STR, RWRITE, var_mteTriggerThresholdTable, 2, {1, 14}},#define MTETRIGGERTHRESHOLDDELTAFALLINGEVENT 17 {MTETRIGGERTHRESHOLDDELTAFALLINGEVENT, ASN_OCTET_STR, RWRITE, var_mteTriggerThresholdTable, 2, {1, 15}},};/* * (L = length of the oidsuffix) *//* * global storage of our data, saved in and configured by header_complex() */extern struct header_complex_index *mteTriggerTableStorage;/* * init_mteTriggerThresholdTable(): * Initialization routine. This is called when the agent starts up. * At a minimum, registration of your variables should take place here. */voidinit_mteTriggerThresholdTable(void){ DEBUGMSGTL(("mteTriggerThresholdTable", "initializing... ")); /* * register ourselves with the agent to handle our mib tree */ REGISTER_MIB("mteTriggerThresholdTable", mteTriggerThresholdTable_variables, variable2, mteTriggerThresholdTable_variables_oid); DEBUGMSGTL(("mteTriggerThresholdTable", "done.\n"));}/* * var_mteTriggerThresholdTable(): * Handle this table separately from the scalar value case. * The workings of this are basically the same as for var_mteTriggerThresholdTable above. */unsigned char *var_mteTriggerThresholdTable(struct variable *vp, oid * name, size_t * length, int exact, size_t * var_len, WriteMethod ** write_method){ struct mteTriggerTable_data *StorageTmp = NULL; DEBUGMSGTL(("mteTriggerThresholdTable", "var_mteTriggerThresholdTable: Entering... \n")); /* * this assumes you have registered all your data properly */ if ((StorageTmp = header_complex(mteTriggerTableStorage, vp, name, length, exact, var_len, write_method)) == NULL) return NULL; if (!(StorageTmp->mteTriggerTest[0] & MTETRIGGERTEST_THRESHOLD)) return NULL; /* * this is where we do the value assignments for the mib results. */ switch (vp->magic) { case MTETRIGGERTHRESHOLDSTARTUP: *write_method = write_mteTriggerThresholdStartup; *var_len = sizeof(StorageTmp->mteTriggerThresholdStartup); return (u_char *) & StorageTmp->mteTriggerThresholdStartup; case MTETRIGGERTHRESHOLDRISING: *write_method = write_mteTriggerThresholdRising; *var_len = sizeof(StorageTmp->mteTriggerThresholdRising); return (u_char *) & StorageTmp->mteTriggerThresholdRising; case MTETRIGGERTHRESHOLDFALLING: *write_method = write_mteTriggerThresholdFalling; *var_len = sizeof(StorageTmp->mteTriggerThresholdFalling); return (u_char *) & StorageTmp->mteTriggerThresholdFalling; case MTETRIGGERTHRESHOLDDELTARISING: *write_method = write_mteTriggerThresholdDeltaRising; *var_len = sizeof(StorageTmp->mteTriggerThresholdDeltaRising); return (u_char *) & StorageTmp->mteTriggerThresholdDeltaRising; case MTETRIGGERTHRESHOLDDELTAFALLING: *write_method = write_mteTriggerThresholdDeltaFalling; *var_len = sizeof(StorageTmp->mteTriggerThresholdDeltaFalling); return (u_char *) & StorageTmp->mteTriggerThresholdDeltaFalling; case MTETRIGGERTHRESHOLDOBJECTSOWNER: *write_method = write_mteTriggerThresholdObjectsOwner; *var_len = StorageTmp->mteTriggerThresholdObjectsOwnerLen; return (u_char *) StorageTmp->mteTriggerThresholdObjectsOwner; case MTETRIGGERTHRESHOLDOBJECTS: *write_method = write_mteTriggerThresholdObjects; *var_len = StorageTmp->mteTriggerThresholdObjectsLen; return (u_char *) StorageTmp->mteTriggerThresholdObjects; case MTETRIGGERTHRESHOLDRISINGEVENTOWNER: *write_method = write_mteTriggerThresholdRisingEventOwner; *var_len = StorageTmp->mteTriggerThresholdRisingEventOwnerLen; return (u_char *) StorageTmp->mteTriggerThresholdRisingEventOwner; case MTETRIGGERTHRESHOLDRISINGEVENT: *write_method = write_mteTriggerThresholdRisingEvent; *var_len = StorageTmp->mteTriggerThresholdRisingEventLen; return (u_char *) StorageTmp->mteTriggerThresholdRisingEvent; case MTETRIGGERTHRESHOLDFALLINGEVENTOWNER: *write_method = write_mteTriggerThresholdFallingEventOwner; *var_len = StorageTmp->mteTriggerThresholdFallingEventOwnerLen; return (u_char *) StorageTmp->mteTriggerThresholdFallingEventOwner; case MTETRIGGERTHRESHOLDFALLINGEVENT: *write_method = write_mteTriggerThresholdFallingEvent; *var_len = StorageTmp->mteTriggerThresholdFallingEventLen; return (u_char *) StorageTmp->mteTriggerThresholdFallingEvent; case MTETRIGGERTHRESHOLDDELTARISINGEVENTOWNER: *write_method = write_mteTriggerThresholdDeltaRisingEventOwner; *var_len = StorageTmp->mteTriggerThresholdDeltaRisingEventOwnerLen; return (u_char *) StorageTmp-> mteTriggerThresholdDeltaRisingEventOwner; case MTETRIGGERTHRESHOLDDELTARISINGEVENT: *write_method = write_mteTriggerThresholdDeltaRisingEvent; *var_len = StorageTmp->mteTriggerThresholdDeltaRisingEventLen; return (u_char *) StorageTmp->mteTriggerThresholdDeltaRisingEvent; case MTETRIGGERTHRESHOLDDELTAFALLINGEVENTOWNER: *write_method = write_mteTriggerThresholdDeltaFallingEventOwner; *var_len = StorageTmp->mteTriggerThresholdDeltaFallingEventOwnerLen; return (u_char *) StorageTmp-> mteTriggerThresholdDeltaFallingEventOwner; case MTETRIGGERTHRESHOLDDELTAFALLINGEVENT: *write_method = write_mteTriggerThresholdDeltaFallingEvent; *var_len = StorageTmp->mteTriggerThresholdDeltaFallingEventLen; return (u_char *) StorageTmp->mteTriggerThresholdDeltaFallingEvent; default: ERROR_MSG(""); } return NULL;}intwrite_mteTriggerThresholdStartup(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){ static int tmpvar; struct mteTriggerTable_data *StorageTmp = NULL; size_t newlen = name_len - (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 - 1); DEBUGMSGTL(("mteTriggerThresholdTable", "write_mteTriggerThresholdStartup entering action=%d... \n", action)); if ((StorageTmp = header_complex(mteTriggerTableStorage, NULL, &name[sizeof (mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 - 1], &newlen, 1, NULL, NULL)) == NULL) return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */ switch (action) { case RESERVE1: if (var_val_type != ASN_INTEGER) { fprintf(stderr, "write to mteTriggerThresholdStartup not ASN_INTEGER\n"); return SNMP_ERR_WRONGTYPE; } if (StorageTmp->storageType != ST_NONVOLATILE) return SNMP_ERR_NOTWRITABLE; break; case RESERVE2: /* * memory reseveration, final preparation... */ break; case FREE: /* * Release any resources that have been allocated */ break; case ACTION: /* * The variable has been stored in long_ret for * you to use, and you have just been asked to do something with * it. Note that anything done here must be reversable in the UNDO case */ tmpvar = StorageTmp->mteTriggerThresholdStartup; StorageTmp->mteTriggerThresholdStartup = *((long *) var_val); break; case UNDO: /* * Back out any changes made in the ACTION case */ StorageTmp->mteTriggerThresholdStartup = tmpvar; break; case COMMIT: /* * Things are working well, so it's now safe to make the change * permanently. Make sure that anything done here can't fail! */ break; } return SNMP_ERR_NOERROR;}intwrite_mteTriggerThresholdRising(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){ static int tmpvar; struct mteTriggerTable_data *StorageTmp = NULL; size_t newlen = name_len - (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 - 1); DEBUGMSGTL(("mteTriggerThresholdTable", "write_mteTriggerThresholdRising entering action=%d... \n", action)); if ((StorageTmp = header_complex(mteTriggerTableStorage, NULL, &name[sizeof (mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 - 1], &newlen, 1, NULL, NULL)) == NULL) return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */ switch (action) { case RESERVE1: if (var_val_type != ASN_INTEGER) { fprintf(stderr, "write to mteTriggerThresholdRising not ASN_INTEGER\n"); return SNMP_ERR_WRONGTYPE; } if (StorageTmp->storageType != ST_NONVOLATILE) return SNMP_ERR_NOTWRITABLE; break; case RESERVE2: /* * memory reseveration, final preparation... */ break; case FREE: /* * Release any resources that have been allocated */ break; case ACTION: /* * The variable has been stored in long_ret for * you to use, and you have just been asked to do something with
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -