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

📄 ipcidrroutetable.c

📁 snmp的源代码,已经在我的ubuntu下编译通过
💻 C
📖 第 1 页 / 共 5 页
字号:
/* * Note: this file originally auto-generated by mib2c using *       version : 1.32 $ of : mfd-top.m2c,v $  * * $Id: ipCidrRouteTable.c,v 1.7 2004/10/16 00:15:47 rstory Exp $ *//** \mainpage MFD helper for ipCidrRouteTable * * \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 "ipCidrRouteTable.h"#include <net-snmp/agent/mib_modules.h>#include "ipCidrRouteTable_interface.h"oid             ipCidrRouteTable_oid[] = { IPCIDRROUTETABLE_OID };int             ipCidrRouteTable_oid_size =OID_LENGTH(ipCidrRouteTable_oid);void            initialize_table_ipCidrRouteTable(void);/** * Initializes the ipCidrRouteTable module */voidinit_ipCidrRouteTable(void){    DEBUGMSGTL(("verbose:ipCidrRouteTable:init_ipCidrRouteTable",                "called\n"));    /*     * TODO:300:o: Perform ipCidrRouteTable one-time module initialization.     */    /*     * here we initialize all the tables we're planning on supporting     */    if (should_init("ipCidrRouteTable"))        initialize_table_ipCidrRouteTable();}                               /* init_ipCidrRouteTable *//** * Initialize the table ipCidrRouteTable  *    (Define its contents and how it's structured) */voidinitialize_table_ipCidrRouteTable(void){    ipCidrRouteTable_registration_ptr user_context;    u_long          flags;    DEBUGMSGTL(("verbose:ipCidrRouteTable:initialize_table_ipCidrRouteTable", "called\n"));    /*     * TODO:301:o: Perform ipCidrRouteTable one-time table initialization.     */    /*     * TODO:302:o: |->Initialize ipCidrRouteTable 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("ipCidrRouteTable", NULL, NULL);    /*     * No support for any flags yet, but in the future you would     * set any flags here.     */    flags = 0;    /*     * call interface initialization code     */    _ipCidrRouteTable_initialize_interface(user_context, flags);}                               /* initialize_table_ipCidrRouteTable *//** * pre-request callback * * * @retval MFD_SUCCESS              : success. * @retval MFD_ERROR                : other error */intipCidrRouteTable_pre_request(ipCidrRouteTable_registration_ptr                             user_context){    DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_pre_request",                "called\n"));    /*     * TODO:510:o: Perform ipCidrRouteTable pre-request actions.     */    return MFD_SUCCESS;}                               /* ipCidrRouteTable_pre_request *//** * post-request callback * * * @retval MFD_SUCCESS : success. * @retval MFD_ERROR   : other error (ignored) */intipCidrRouteTable_post_request(ipCidrRouteTable_registration_ptr                              user_context){    DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_post_request",                "called\n"));    /*     * TODO:511:o: Perform ipCidrRouteTable pos-request actions.     */    return MFD_SUCCESS;}                               /* ipCidrRouteTable_post_request *//********************************************************************** ********************************************************************** *** *** Table ipCidrRouteTable *** ********************************************************************** **********************************************************************//* * ipCidrRouteTable is subid 4 of ipForward. * Its status is Deprecated. * OID: .1.3.6.1.2.1.4.24.4, length: 9 *//* * --------------------------------------------------------------------- * * TODO:200:r: Implement ipCidrRouteTable data context functions. *//* * ipCidrRouteTable_allocate_data * * Purpose: create new ipCidrRouteTable_data. */ipCidrRouteTable_data *ipCidrRouteTable_allocate_data(void){    /*     * TODO:201:r: |-> allocate memory for the ipCidrRouteTable data context.     */    ipCidrRouteTable_data *rtn = netsnmp_access_route_entry_create();    DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_allocate_data",                "called\n"));    if (NULL == rtn) {        snmp_log(LOG_ERR, "unable to malloc memory for new "                 "ipCidrRouteTable_data.\n");    }    return rtn;}                               /* ipCidrRouteTable_allocate_data *//* * ipCidrRouteTable_release_data * * Purpose: release ipCidrRouteTable data. */voidipCidrRouteTable_release_data(ipCidrRouteTable_data * data){    DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_release_data",                "called\n"));    /*     * TODO:202:r: |-> release memory for the ipCidrRouteTable data context.     */    netsnmp_access_route_entry_free(data);}                               /* ipCidrRouteTable_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. */intipCidrRouteTable_indexes_set_tbl_idx(ipCidrRouteTable_mib_index * tbl_idx,                                     u_long ipCidrRouteDest_val,                                     u_long ipCidrRouteMask_val,                                     long ipCidrRouteTos_val,                                     u_long ipCidrRouteNextHop_val){    DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_indexes_set_tbl_idx", "called\n"));    /*     * ipCidrRouteDest(1)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h      */    tbl_idx->ipCidrRouteDest = ipCidrRouteDest_val;    /*     * ipCidrRouteMask(2)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h      */    tbl_idx->ipCidrRouteMask = ipCidrRouteMask_val;    /*     * ipCidrRouteTos(3)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h      */    tbl_idx->ipCidrRouteTos = ipCidrRouteTos_val;    /*     * ipCidrRouteNextHop(4)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h      */    tbl_idx->ipCidrRouteNextHop = ipCidrRouteNextHop_val;    return MFD_SUCCESS;}                               /* ipCidrRouteTable_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. */intipCidrRouteTable_indexes_set(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,                             u_long ipCidrRouteDest_val,                             u_long ipCidrRouteMask_val,                             long ipCidrRouteTos_val,                             u_long ipCidrRouteNextHop_val){    DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_indexes_set",                "called\n"));    if (MFD_SUCCESS !=        ipCidrRouteTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx,                                             ipCidrRouteDest_val,                                             ipCidrRouteMask_val,                                             ipCidrRouteTos_val,                                             ipCidrRouteNextHop_val))        return MFD_ERROR;    /*     * convert mib index to oid index     */    rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);    if (0 != ipCidrRouteTable_index_to_oid(&rowreq_ctx->oid_idx,                                           &rowreq_ctx->tbl_idx)) {        return MFD_ERROR;    }    return MFD_SUCCESS;}                               /* ipCidrRouteTable_indexes_set *//*--------------------------------------------------------------------- * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteIfIndex * ipCidrRouteIfIndex is subid 5 of ipCidrRouteEntry. * Its status is Deprecated, and its access level is Create. * OID: .1.3.6.1.2.1.4.24.4.1.5 * Description:The ifIndex value which identifies  the local interface                 through which the next hop of this route should be                  reached. * * Attributes: *   accessible 1     isscalar 0     enums  0      hasdefval 1 *   readable   1     iscolumn 1     ranges 0      hashint   0 *   settable   1 *   defval: 0 * * * Its syntax is INTEGER32 (based on perltype INTEGER32) * The net-snmp type is ASN_INTEGER. The C type decl is long (long) *//** * Extract the current value of the ipCidrRouteIfIndex data. * * Set a value using the data context for the row. * * @param rowreq_ctx *        Pointer to the row request context. * @param ipCidrRouteIfIndex_val_ptr *        Pointer to storage for a long variable * * @retval MFD_SUCCESS         : success * @retval MFD_SKIP            : skip this node (no value for now) * @retval MFD_ERROR           : Any other error */intipCidrRouteIfIndex_get(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,                       long *ipCidrRouteIfIndex_val_ptr){   /** we should have a non-NULL pointer */    netsnmp_assert(NULL != ipCidrRouteIfIndex_val_ptr);    DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteIfIndex_get",                "called\n"));    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:231:o: |-> Extract the current value of the ipCidrRouteIfIndex data.     * set (* ipCidrRouteIfIndex_val_ptr ) from rowreq_ctx->data     */    (*ipCidrRouteIfIndex_val_ptr) = rowreq_ctx->data->if_index;    return MFD_SUCCESS;}                               /* ipCidrRouteIfIndex_get *//*--------------------------------------------------------------------- * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteType * ipCidrRouteType is subid 6 of ipCidrRouteEntry. * Its status is Deprecated, and its access level is Create. * OID: .1.3.6.1.2.1.4.24.4.1.6 * Description:The type of route.  Note that local(3) refers to a                  route for which the next hop is the final destination;                   remote(4) refers to a route for which the next hop is                  not the final destination.                 Routes which do not result in traffic forwarding or                 rejection should not be displayed even if the                  implementation keeps them stored internally.                 reject (2) refers to a route which, if matched,                  discards the message as unreachable. This is used in                  some protocols as a means of correctly aggregating                  routes. * * Attributes: *   accessible 1     isscalar 0     enums  1      hasdefval 0 *   readable   1     iscolumn 1     ranges 0      hashint   0 *   settable   1 * * Enum range: 3/8. Values:  other(1), reject(2), local(3), remote(4) * * Its syntax is INTEGER (based on perltype INTEGER) * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) *//** * Extract the current value of the ipCidrRouteType data. *

⌨️ 快捷键说明

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