📄 snmpnotifyfiltertable.c
字号:
/* * Note: this file originally auto-generated by mib2c using * version : 1.48 $ of : mfd-top.m2c,v $ * * $Id: snmpNotifyFilterTable.c 14169 2006-01-25 16:28:12Z dts12 $ *//** \page MFD helper for snmpNotifyFilterTable * * \section intro Introduction * Introductory text. * *//* * standard Net-SNMP includes */#include <net-snmp/net-snmp-config.h>#include <net-snmp/net-snmp-includes.h>#include <net-snmp/agent/net-snmp-agent-includes.h>/* * include our parent header */#include "snmpNotifyFilterTable.h"#include <net-snmp/agent/mib_modules.h>#include "snmpNotifyFilterTable_interface.h"oid snmpNotifyFilterTable_oid[] = { SNMPNOTIFYFILTERTABLE_OID };int snmpNotifyFilterTable_oid_size =OID_LENGTH(snmpNotifyFilterTable_oid);snmpNotifyFilterTable_registration snmpNotifyFilterTable_user_context;void initialize_table_snmpNotifyFilterTable(void);void shutdown_table_snmpNotifyFilterTable(void);/** * Initializes the snmpNotifyFilterTable module */voidinit_snmpNotifyFilterTable(void){ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:init_snmpNotifyFilterTable", "called\n")); /* * TODO:300:o: Perform snmpNotifyFilterTable one-time module initialization. */ /* * here we initialize all the tables we're planning on supporting */ if (should_init("snmpNotifyFilterTable")) initialize_table_snmpNotifyFilterTable();} /* init_snmpNotifyFilterTable *//** * Shut-down the snmpNotifyFilterTable module (agent is exiting) */voidshutdown_snmpNotifyFilterTable(void){ if (should_init("snmpNotifyFilterTable")) shutdown_table_snmpNotifyFilterTable();}/** * Initialize the table snmpNotifyFilterTable * (Define its contents and how it's structured) */voidinitialize_table_snmpNotifyFilterTable(void){ snmpNotifyFilterTable_registration *user_context; u_long flags; DEBUGMSGTL(("verbose:snmpNotifyFilterTable:initialize_table_snmpNotifyFilterTable", "called\n")); /* * TODO:301:o: Perform snmpNotifyFilterTable one-time table initialization. */ /* * TODO:302:o: |->Initialize snmpNotifyFilterTable user context * if you'd like to pass in a pointer to some data for this * table, allocate or set it up here. */ /* * a netsnmp_data_list is a simple way to store void pointers. A simple * string token is used to add, find or remove pointers. */ user_context = netsnmp_create_data_list("snmpNotifyFilterTable", NULL, NULL); /* * No support for any flags yet, but in the future you would * set any flags here. */ flags = 0; /* * call interface initialization code */ _snmpNotifyFilterTable_initialize_interface(user_context, flags);} /* initialize_table_snmpNotifyFilterTable *//** * Shutdown the table snmpNotifyFilterTable */voidshutdown_table_snmpNotifyFilterTable(void){ /* * call interface shutdown code */ _snmpNotifyFilterTable_shutdown_interface (&snmpNotifyFilterTable_user_context);}/** * extra context initialization (eg default values) * * @param rowreq_ctx : row request context * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate) * * @retval MFD_SUCCESS : no errors * @retval MFD_ERROR : error (context allocate will fail) */intsnmpNotifyFilterTable_rowreq_ctx_init(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx, void *user_init_ctx){ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_rowreq_ctx_init", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * TODO:210:o: |-> Perform extra snmpNotifyFilterTable rowreq initialization. (eg DEFVALS) */ /* * strings and oids are hard to handle automagically. * so all we've got for you is a hint: * * memcpy(rowreq_ctx->data.snmpNotifyFilterMask, 0, * len(0) * sizeof(snmpNotifyFilterMask[0]); */ rowreq_ctx->data.snmpNotifyFilterType = SNMPNOTIFYFILTERTYPE_INCLUDED; rowreq_ctx->data.snmpNotifyFilterStorageType = STORAGETYPE_NONVOLATILE; return MFD_SUCCESS;} /* snmpNotifyFilterTable_rowreq_ctx_init *//** * extra context cleanup * @param rowreq_ctx */voidsnmpNotifyFilterTable_rowreq_ctx_cleanup(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx){ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_rowreq_ctx_cleanup", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * TODO:211:o: |-> Perform extra snmpNotifyFilterTable rowreq cleanup. */} /* snmpNotifyFilterTable_rowreq_ctx_cleanup *//************************************************************ * the *_should_save routine is called to determine if a row * should be stored persistently. * * Note that this is not a 'dirty' check (i.e. if a row has changed), * but a check for volatile rows that should not be saved between * restarts. * @param rowreq_ctx * @retval 1 if the row should be stored * @retval 0 if the row should not be stored */int snmpNotifyFilterTable_container_should_save (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx) { if (SNMP_STORAGE_VOLATILE == rowreq_ctx->data.snmpNotifyFilterStorageType) return 0; return 1; /* save the row */}/** * pre-request callback * * @param user_context * @retval MFD_SUCCESS : success. * @retval MFD_ERROR : other error */intsnmpNotifyFilterTable_pre_request(snmpNotifyFilterTable_registration * user_context){ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_pre_request", "called\n")); /* * TODO:510:o: Perform snmpNotifyFilterTable pre-request actions. */ return MFD_SUCCESS;} /* snmpNotifyFilterTable_pre_request *//** * post-request callback * * Note: * New rows have been inserted into the container, and * deleted rows have been removed from the container and * released. * @param user_context * @param rc : MFD_SUCCESS if all requests succeeded * * @retval MFD_SUCCESS : success. * @retval MFD_ERROR : other error (ignored) */intsnmpNotifyFilterTable_post_request(snmpNotifyFilterTable_registration * user_context, int rc){ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_post_request", "called\n")); /* * TODO:511:o: Perform snmpNotifyFilterTable post-request actions. */ /* * check to set if any rows were changed. */ if (snmpNotifyFilterTable_dirty_get()) { /* * check if request was successful. If so, this would be * a good place to save data to its persistent store. */ if (MFD_SUCCESS == rc) { /* * save changed rows, if you haven't already */ snmp_store(netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_APPTYPE)); } snmpNotifyFilterTable_dirty_set(0); /* clear table dirty flag */ } return MFD_SUCCESS;} /* snmpNotifyFilterTable_post_request *//********************************************************************** ********************************************************************** *** *** Table snmpNotifyFilterTable *** ********************************************************************** **********************************************************************//* * SNMP-NOTIFICATION-MIB::snmpNotifyFilterTable is subid 3 of snmpNotifyObjects. * Its status is Current. * OID: .1.3.6.1.6.3.13.1.3, length: 9 *//* * --------------------------------------------------------------------- * * TODO:200:r: Implement snmpNotifyFilterTable data context functions. *//** * set mib index(es) * * @param tbl_idx mib index structure * @param snmpNotifyFilterProfileName_val_ptr * @param snmpNotifyFilterProfileName_val_ptr_len * @param snmpNotifyFilterSubtree_val_ptr * @param snmpNotifyFilterSubtree_val_ptr_len * * @retval MFD_SUCCESS : success. * @retval MFD_ERROR : other error. * * @remark * This convenience function is useful for setting all the MIB index * components with a single function call. It is assume that the C values * have already been mapped from their native/rawformat to the MIB format. */intsnmpNotifyFilterTable_indexes_set_tbl_idx(snmpNotifyFilterTable_mib_index * tbl_idx, char *snmpNotifyFilterProfileName_val_ptr, size_t snmpNotifyFilterProfileName_val_ptr_len, oid * snmpNotifyFilterSubtree_val_ptr, size_t snmpNotifyFilterSubtree_val_ptr_len){ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_indexes_set_tbl_idx", "called\n")); /* * snmpNotifyFilterProfileName(1)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H */ tbl_idx->snmpNotifyFilterProfileName_len = sizeof(tbl_idx->snmpNotifyFilterProfileName) / sizeof(tbl_idx->snmpNotifyFilterProfileName[0]); /* max length */ /* * make sure there is enough space for snmpNotifyFilterProfileName data */ if ((NULL == tbl_idx->snmpNotifyFilterProfileName) || (tbl_idx->snmpNotifyFilterProfileName_len < (snmpNotifyFilterProfileName_val_ptr_len))) { snmp_log(LOG_ERR, "not enough space for value\n"); return MFD_ERROR; } tbl_idx->snmpNotifyFilterProfileName_len = snmpNotifyFilterProfileName_val_ptr_len; memcpy(tbl_idx->snmpNotifyFilterProfileName, snmpNotifyFilterProfileName_val_ptr, snmpNotifyFilterProfileName_val_ptr_len * sizeof(snmpNotifyFilterProfileName_val_ptr[0])); /* * snmpNotifyFilterSubtree(1)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h */ tbl_idx->snmpNotifyFilterSubtree_len = sizeof(tbl_idx->snmpNotifyFilterSubtree) / sizeof(tbl_idx->snmpNotifyFilterSubtree[0]); /* max length */ /* * make sure there is enough space for snmpNotifyFilterSubtree data */ if ((NULL == tbl_idx->snmpNotifyFilterSubtree) || (tbl_idx->snmpNotifyFilterSubtree_len < (snmpNotifyFilterSubtree_val_ptr_len))) { snmp_log(LOG_ERR, "not enough space for value\n"); return MFD_ERROR; } tbl_idx->snmpNotifyFilterSubtree_len = snmpNotifyFilterSubtree_val_ptr_len; memcpy(tbl_idx->snmpNotifyFilterSubtree, snmpNotifyFilterSubtree_val_ptr, snmpNotifyFilterSubtree_val_ptr_len * sizeof(snmpNotifyFilterSubtree_val_ptr[0])); return MFD_SUCCESS;} /* snmpNotifyFilterTable_indexes_set_tbl_idx */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -