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

📄 ipsystemstatstable.c

📁 开发snmp的开发包有两个开放的SNMP开发库
💻 C
📖 第 1 页 / 共 5 页
字号:
/* * Note: this file originally auto-generated by mib2c using *       version : 1.48 $ of : mfd-top.m2c,v $  * * $Id: ipSystemStatsTable.c 14169 2006-01-25 16:28:12Z dts12 $ *//** \page MFD helper for ipSystemStatsTable * * \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 "ipSystemStatsTable.h"#include <net-snmp/agent/mib_modules.h>#include "ipSystemStatsTable_interface.h"oid             ipSystemStatsTable_oid[] = { IPSYSTEMSTATSTABLE_OID };int             ipSystemStatsTable_oid_size =OID_LENGTH(ipSystemStatsTable_oid);ipSystemStatsTable_registration ipSystemStatsTable_user_context;void            initialize_table_ipSystemStatsTable(void);void            shutdown_table_ipSystemStatsTable(void);/** * Initializes the ipSystemStatsTable module */voidinit_ipSystemStatsTable(void){    DEBUGMSGTL(("verbose:ipSystemStatsTable:init_ipSystemStatsTable",                "called\n"));    /*     * TODO:300:o: Perform ipSystemStatsTable one-time module initialization.     */    /*     * here we initialize all the tables we're planning on supporting     */    if (should_init("ipSystemStatsTable"))        initialize_table_ipSystemStatsTable();}                               /* init_ipSystemStatsTable *//** * Shut-down the ipSystemStatsTable module (agent is exiting) */voidshutdown_ipSystemStatsTable(void){    if (should_init("ipSystemStatsTable"))        shutdown_table_ipSystemStatsTable();}/** * Initialize the table ipSystemStatsTable  *    (Define its contents and how it's structured) */voidinitialize_table_ipSystemStatsTable(void){    ipSystemStatsTable_registration *user_context;    u_long          flags;    DEBUGMSGTL(("verbose:ipSystemStatsTable:initialize_table_ipSystemStatsTable", "called\n"));    /*     * TODO:301:o: Perform ipSystemStatsTable one-time table initialization.     */    /*     * TODO:302:o: |->Initialize ipSystemStatsTable 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("ipSystemStatsTable", NULL, NULL);    /*     * No support for any flags yet, but in the future you would     * set any flags here.     */    flags = 0;    /*     * call interface initialization code     */    _ipSystemStatsTable_initialize_interface(user_context, flags);}                               /* initialize_table_ipSystemStatsTable *//** * Shutdown the table ipSystemStatsTable  */voidshutdown_table_ipSystemStatsTable(void){    /*     * call interface shutdown code     */    _ipSystemStatsTable_shutdown_interface        (&ipSystemStatsTable_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) */intipSystemStatsTable_rowreq_ctx_init(ipSystemStatsTable_rowreq_ctx *                                   rowreq_ctx, void *user_init_ctx){    DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_rowreq_ctx_init", "called\n"));    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:210:o: |-> Perform extra ipSystemStatsTable rowreq initialization. (eg DEFVALS)     */    return MFD_SUCCESS;}                               /* ipSystemStatsTable_rowreq_ctx_init *//** * extra context cleanup * */voidipSystemStatsTable_rowreq_ctx_cleanup(ipSystemStatsTable_rowreq_ctx *                                      rowreq_ctx){    DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_rowreq_ctx_cleanup", "called\n"));    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:211:o: |-> Perform extra ipSystemStatsTable rowreq cleanup.     */}                               /* ipSystemStatsTable_rowreq_ctx_cleanup *//** * pre-request callback * * @param user_context * * @retval MFD_SUCCESS              : success. * @retval MFD_ERROR                : other error */intipSystemStatsTable_pre_request(ipSystemStatsTable_registration *                               user_context){    DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_pre_request", "called\n"));    /*     * TODO:510:o: Perform ipSystemStatsTable pre-request actions.     */    return MFD_SUCCESS;}                               /* ipSystemStatsTable_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) */intipSystemStatsTable_post_request(ipSystemStatsTable_registration *                                user_context, int rc){    DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_post_request", "called\n"));    /*     * TODO:511:o: Perform ipSystemStatsTable post-request actions.     */    return MFD_SUCCESS;}                               /* ipSystemStatsTable_post_request *//********************************************************************** ********************************************************************** *** *** Table ipSystemStatsTable *** ********************************************************************** **********************************************************************//* * IP-MIB::ipSystemStatsTable is subid 1 of ipTrafficStats. * Its status is Current. * OID: .1.3.6.1.2.1.4.31.1, length: 9 *//* * --------------------------------------------------------------------- * * TODO:200:r: Implement ipSystemStatsTable data context functions. *//* * ipSystemStatsTable_allocate_data * * Purpose: create new ipSystemStatsTable_data. */ipSystemStatsTable_data *ipSystemStatsTable_allocate_data(void){    /*     * TODO:201:r: |-> allocate memory for the ipSystemStatsTable data context.     */    ipSystemStatsTable_data *rtn =        SNMP_MALLOC_TYPEDEF(ipSystemStatsTable_data);    DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_allocate_data", "called\n"));    if (NULL == rtn) {        snmp_log(LOG_ERR, "unable to malloc memory for new "                 "ipSystemStatsTable_data.\n");    }    return rtn;}                               /* ipSystemStatsTable_allocate_data *//* * ipSystemStatsTable_release_data * * Purpose: release ipSystemStatsTable data. */voidipSystemStatsTable_release_data(ipSystemStatsTable_data * data){    DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_release_data", "called\n"));    /*     * TODO:202:r: |-> release memory for the ipSystemStatsTable data context.     */    free(data);}                               /* ipSystemStatsTable_release_data *//** * set mib index(es) * * @param tbl_idx mib index structure * @param ipSystemStatsIPVersion_val * * @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. */intipSystemStatsTable_indexes_set_tbl_idx(ipSystemStatsTable_mib_index *                                       tbl_idx,                                       u_long ipSystemStatsIPVersion_val){    DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_indexes_set_tbl_idx", "called\n"));    /*     * ipSystemStatsIPVersion(1)/InetVersion/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h      */    /** WARNING: this code might not work for netsnmp_systemstats_entry */    tbl_idx->ipSystemStatsIPVersion = ipSystemStatsIPVersion_val;    return MFD_SUCCESS;}                               /* ipSystemStatsTable_indexes_set_tbl_idx *//** * @internal * set row context indexes * * @param reqreq_ctx the row context that needs updated indexes * * @retval MFD_SUCCESS     : success. * @retval MFD_ERROR       : other error. * * @remark *  This function sets the mib indexs, then updates the oid indexs *  from the mib index. */intipSystemStatsTable_indexes_set(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,                               u_long ipSystemStatsIPVersion_val){    DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_indexes_set", "called\n"));    if (MFD_SUCCESS !=        ipSystemStatsTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx,                                               ipSystemStatsIPVersion_val))        return MFD_ERROR;    /*     * convert mib index to oid index     */    rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);    if (0 != ipSystemStatsTable_index_to_oid(&rowreq_ctx->oid_idx,                                             &rowreq_ctx->tbl_idx)) {        return MFD_ERROR;    }    return MFD_SUCCESS;}                               /* ipSystemStatsTable_indexes_set *//*--------------------------------------------------------------------- * IP-MIB::ipSystemStatsEntry.ipSystemStatsInReceives * ipSystemStatsInReceives is subid 3 of ipSystemStatsEntry. * Its status is Current, and its access level is ReadOnly. * OID: .1.3.6.1.2.1.4.31.1.1.3 * Description:The total number of input IP datagrams received, including            those received in error.            Discontinuities in the value of this counter can occur at            re-initialization of the management system, and at other            times as indicated by the value of            ipSystemStatsDiscontinuityTime. * * Attributes: *   accessible 1     isscalar 0     enums  0      hasdefval 0 *   readable   1     iscolumn 1     ranges 0      hashint   0 *   settable   0 * * * Its syntax is COUNTER (based on perltype COUNTER) * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) *//** * Extract the current value of the ipSystemStatsInReceives data. * * Set a value using the data context for the row. * * @param rowreq_ctx *        Pointer to the row request context. * @param ipSystemStatsInReceives_val_ptr *        Pointer to storage for a u_long variable * * @retval MFD_SUCCESS         : success

⌨️ 快捷键说明

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