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

📄 ipsystemstatstable.c

📁 snmp的源代码,已经在我的ubuntu下编译通过
💻 C
📖 第 1 页 / 共 5 页
字号:
/* * Note: this file originally auto-generated by mib2c using *       version : 1.32 $ of : mfd-top.m2c,v $  * * $Id: ipSystemStatsTable.c,v 1.3 2004/10/16 00:31:18 rstory Exp $ *//** \mainpage 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);void            initialize_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 *//** * Initialize the table ipSystemStatsTable  *    (Define its contents and how it's structured) */voidinitialize_table_ipSystemStatsTable(void){    ipSystemStatsTable_registration_ptr 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 *//** * pre-request callback * * * @retval MFD_SUCCESS              : success. * @retval MFD_ERROR                : other error */intipSystemStatsTable_pre_request(ipSystemStatsTable_registration_ptr                               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 * * * @retval MFD_SUCCESS : success. * @retval MFD_ERROR   : other error (ignored) */intipSystemStatsTable_post_request(ipSystemStatsTable_registration_ptr                                user_context){    DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_post_request", "called\n"));    /*     * TODO:511:o: Perform ipSystemStatsTable pos-request actions.     */    return MFD_SUCCESS;}                               /* ipSystemStatsTable_post_request *//********************************************************************** ********************************************************************** *** *** Table ipSystemStatsTable *** ********************************************************************** **********************************************************************//* * 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 * * @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 * @retval MFD_SKIP            : skip this node (no value for now) * @retval MFD_ERROR           : Any other error */intipSystemStatsInReceives_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,                            u_long * ipSystemStatsInReceives_val_ptr){   /** we should have a non-NULL pointer */    netsnmp_assert(NULL != ipSystemStatsInReceives_val_ptr);    DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsInReceives_get",                "called\n"));    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:231:o: |-> Extract the current value of the ipSystemStatsInReceives data.     * set (* ipSystemStatsInReceives_val_ptr ) from rowreq_ctx->data     */    (*ipSystemStatsInReceives_val_ptr) =        rowreq_ctx->data->stats.HCInReceives.low;    return MFD_SUCCESS;}                               /* ipSystemStatsInReceives_get *//*--------------------------------------------------------------------- * IP-MIB::ipSystemStatsEntry.ipSystemStatsHCInReceives * ipSystemStatsHCInReceives is subid 4 of ipSystemStatsEntry. * Its status is Current, and its access level is ReadOnly. * OID: .1.3.6.1.2.1.4.31.1.1.4 * Description:The total number of input IP datagrams received, including            those received in error.  This object counts the same            datagrams as ipSystemStatsInReceives but allows for larger            values.            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 COUNTER64 (based on perltype COUNTER64) * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64) *//** * Extract the current value of the ipSystemStatsHCInReceives data. * * Set a value using the data context for the row. * * @param rowreq_ctx *        Pointer to the row request context. * @param ipSystemStatsHCInReceives_val_ptr *        Pointer to storage for a U64 variable * * @retval MFD_SUCCESS         : success * @retval MFD_SKIP            : skip this node (no value for now) * @retval MFD_ERROR           : Any other error */intipSystemStatsHCInReceives_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,

⌨️ 快捷键说明

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