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

📄 ipsystemstatstable_interface.c

📁 开发snmp的开发包有两个开放的SNMP开发库
💻 C
📖 第 1 页 / 共 3 页
字号:
    rowreq_ctx->ipSystemStatsTable_data_list = NULL;    /*     * if we allocated data, call init routine     */    if (!(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) {        if (SNMPERR_SUCCESS !=            ipSystemStatsTable_rowreq_ctx_init(rowreq_ctx,                                               user_init_ctx)) {            ipSystemStatsTable_release_rowreq_ctx(rowreq_ctx);            rowreq_ctx = NULL;        }    }    return rowreq_ctx;}                               /* ipSystemStatsTable_allocate_rowreq_ctx *//* * @internal * release resources for a ipSystemStatsTable_rowreq_ctx */voidipSystemStatsTable_release_rowreq_ctx(ipSystemStatsTable_rowreq_ctx *                                      rowreq_ctx){    DEBUGMSGTL(("internal:ipSystemStatsTable:ipSystemStatsTable_release_rowreq_ctx", "called\n"));    netsnmp_assert(NULL != rowreq_ctx);    ipSystemStatsTable_rowreq_ctx_cleanup(rowreq_ctx);    /*     * for non-transient data, don't free data we got from the user     */    if ((rowreq_ctx->data) &&        !(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER))        ipSystemStatsTable_release_data(rowreq_ctx->data);    /*     * free index oid pointer     */    if (rowreq_ctx->oid_idx.oids != rowreq_ctx->oid_tmp)        free(rowreq_ctx->oid_idx.oids);    SNMP_FREE(rowreq_ctx);}                               /* ipSystemStatsTable_release_rowreq_ctx *//** * @internal * wrapper */static int_mfd_ipSystemStatsTable_pre_request(netsnmp_mib_handler *handler,                                    netsnmp_handler_registration *reginfo,                                    netsnmp_agent_request_info                                    *agtreq_info,                                    netsnmp_request_info *requests){    int             rc;    DEBUGMSGTL(("internal:ipSystemStatsTable:_mfd_ipSystemStatsTable_pre_request", "called\n"));    if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {        DEBUGMSGTL(("internal:ipSystemStatsTable",                    "skipping additional pre_request\n"));        return SNMP_ERR_NOERROR;    }    rc = ipSystemStatsTable_pre_request(ipSystemStatsTable_if_ctx.                                        user_ctx);    if (MFD_SUCCESS != rc) {        /*         * nothing we can do about it but log it         */        DEBUGMSGTL(("ipSystemStatsTable", "error %d from "                    "ipSystemStatsTable_pre_request\n", rc));        netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));    }    return SNMP_ERR_NOERROR;}                               /* _mfd_ipSystemStatsTable_pre_request *//** * @internal * wrapper */static int_mfd_ipSystemStatsTable_post_request(netsnmp_mib_handler *handler,                                     netsnmp_handler_registration *reginfo,                                     netsnmp_agent_request_info                                     *agtreq_info,                                     netsnmp_request_info *requests){    ipSystemStatsTable_rowreq_ctx *rowreq_ctx =        netsnmp_container_table_row_extract(requests);    int             rc, packet_rc;    DEBUGMSGTL(("internal:ipSystemStatsTable:_mfd_ipSystemStatsTable_post_request", "called\n"));    /*     * release row context, if deleted     */    if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED))        ipSystemStatsTable_release_rowreq_ctx(rowreq_ctx);    /*     * wait for last call before calling user     */    if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) {        DEBUGMSGTL(("internal:ipSystemStatsTable",                    "waiting for last post_request\n"));        return SNMP_ERR_NOERROR;    }    packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0);    rc = ipSystemStatsTable_post_request(ipSystemStatsTable_if_ctx.                                         user_ctx, packet_rc);    if (MFD_SUCCESS != rc) {        /*         * nothing we can do about it but log it         */        DEBUGMSGTL(("ipSystemStatsTable", "error %d from "                    "ipSystemStatsTable_post_request\n", rc));    }    return SNMP_ERR_NOERROR;}                               /* _mfd_ipSystemStatsTable_post_request *//** * @internal * wrapper */static int_mfd_ipSystemStatsTable_object_lookup(netsnmp_mib_handler *handler, netsnmp_handler_registration                                      *reginfo, netsnmp_agent_request_info                                      *agtreq_info,                                      netsnmp_request_info *requests){    int             rc = SNMP_ERR_NOERROR;    ipSystemStatsTable_rowreq_ctx *rowreq_ctx =        netsnmp_container_table_row_extract(requests);    DEBUGMSGTL(("internal:ipSystemStatsTable:_mfd_ipSystemStatsTable_object_lookup", "called\n"));    /*     * get our context from mfd     * ipSystemStatsTable_interface_ctx *if_ctx =     *             (ipSystemStatsTable_interface_ctx *)reginfo->my_reg_void;     */    if (NULL == rowreq_ctx) {        rc = SNMP_ERR_NOCREATION;    }    if (MFD_SUCCESS != rc)        netsnmp_request_set_error_all(requests, rc);    else        ipSystemStatsTable_row_prep(rowreq_ctx);    return SNMP_VALIDATE_ERR(rc);}                               /* _mfd_ipSystemStatsTable_object_lookup *//*********************************************************************** * * GET processing * ***********************************************************************//* * @internal * Retrieve the value for a particular column */NETSNMP_STATIC_INLINE int_ipSystemStatsTable_get_column(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,                               netsnmp_variable_list * var, int column){    int             rc = SNMPERR_SUCCESS;    DEBUGMSGTL(("internal:ipSystemStatsTable:_mfd_ipSystemStatsTable_get_column", "called for %d\n", column));    netsnmp_assert(NULL != rowreq_ctx);    switch (column) {        /*         * ipSystemStatsInReceives(3)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSINRECEIVES:        var->val_len = sizeof(u_long);        var->type = ASN_COUNTER;        rc = ipSystemStatsInReceives_get(rowreq_ctx,                                         (u_long *) var->val.string);        break;        /*         * ipSystemStatsHCInReceives(4)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSHCINRECEIVES:        var->val_len = sizeof(U64);        var->type = ASN_COUNTER64;        rc = ipSystemStatsHCInReceives_get(rowreq_ctx,                                           (U64 *) var->val.string);        break;        /*         * ipSystemStatsInOctets(5)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSINOCTETS:        var->val_len = sizeof(u_long);        var->type = ASN_COUNTER;        rc = ipSystemStatsInOctets_get(rowreq_ctx,                                       (u_long *) var->val.string);        break;        /*         * ipSystemStatsHCInOctets(6)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSHCINOCTETS:        var->val_len = sizeof(U64);        var->type = ASN_COUNTER64;        rc = ipSystemStatsHCInOctets_get(rowreq_ctx,                                         (U64 *) var->val.string);        break;        /*         * ipSystemStatsInHdrErrors(7)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSINHDRERRORS:        var->val_len = sizeof(u_long);        var->type = ASN_COUNTER;        rc = ipSystemStatsInHdrErrors_get(rowreq_ctx,                                          (u_long *) var->val.string);        break;        /*         * ipSystemStatsInNoRoutes(8)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSINNOROUTES:        var->val_len = sizeof(u_long);        var->type = ASN_COUNTER;        rc = ipSystemStatsInNoRoutes_get(rowreq_ctx,                                         (u_long *) var->val.string);        break;        /*         * ipSystemStatsInAddrErrors(9)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSINADDRERRORS:        var->val_len = sizeof(u_long);        var->type = ASN_COUNTER;        rc = ipSystemStatsInAddrErrors_get(rowreq_ctx,                                           (u_long *) var->val.string);        break;        /*         * ipSystemStatsInUnknownProtos(10)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSINUNKNOWNPROTOS:        var->val_len = sizeof(u_long);        var->type = ASN_COUNTER;        rc = ipSystemStatsInUnknownProtos_get(rowreq_ctx,                                              (u_long *) var->val.string);        break;        /*         * ipSystemStatsInTruncatedPkts(11)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSINTRUNCATEDPKTS:        var->val_len = sizeof(u_long);        var->type = ASN_COUNTER;        rc = ipSystemStatsInTruncatedPkts_get(rowreq_ctx,                                              (u_long *) var->val.string);        break;        /*         * ipSystemStatsInForwDatagrams(12)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSINFORWDATAGRAMS:        var->val_len = sizeof(u_long);        var->type = ASN_COUNTER;        rc = ipSystemStatsInForwDatagrams_get(rowreq_ctx,                                              (u_long *) var->val.string);        break;        /*         * ipSystemStatsHCInForwDatagrams(13)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSHCINFORWDATAGRAMS:        var->val_len = sizeof(U64);        var->type = ASN_COUNTER64;        rc = ipSystemStatsHCInForwDatagrams_get(rowreq_ctx,                                                (U64 *) var->val.string);        break;        /*         * ipSystemStatsReasmReqds(14)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSREASMREQDS:        var->val_len = sizeof(u_long);        var->type = ASN_COUNTER;        rc = ipSystemStatsReasmReqds_get(rowreq_ctx,                                         (u_long *) var->val.string);        break;        /*         * ipSystemStatsReasmOKs(15)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSREASMOKS:        var->val_len = sizeof(u_long);        var->type = ASN_COUNTER;        rc = ipSystemStatsReasmOKs_get(rowreq_ctx,                                       (u_long *) var->val.string);        break;        /*         * ipSystemStatsReasmFails(16)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSREASMFAILS:        var->val_len = sizeof(u_long);        var->type = ASN_COUNTER;        rc = ipSystemStatsReasmFails_get(rowreq_ctx,                                         (u_long *) var->val.string);        break;        /*         * ipSystemStatsInDiscards(17)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSINDISCARDS:        var->val_len = sizeof(u_long);        var->type = ASN_COUNTER;        rc = ipSystemStatsInDiscards_get(rowreq_ctx,                                         (u_long *) var->val.string);        break;        /*         * ipSystemStatsInDelivers(18)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSINDELIVERS:        var->val_len = sizeof(u_long);        var->type = ASN_COUNTER;        rc = ipSystemStatsInDelivers_get(rowreq_ctx,                                         (u_long *) var->val.string);        break;        /*         * ipSystemStatsHCInDelivers(19)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSHCINDELIVERS:        var->val_len = sizeof(U64);        var->type = ASN_COUNTER64;        rc = ipSystemStatsHCInDelivers_get(rowreq_ctx,                                           (U64 *) var->val.string);        break;        /*         * ipSystemStatsOutRequests(20)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSOUTREQUESTS:        var->val_len = sizeof(u_long);        var->type = ASN_COUNTER;        rc = ipSystemStatsOutRequests_get(rowreq_ctx,                                          (u_long *) var->val.string);        break;        /*         * ipSystemStatsHCOutRequests(21)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSHCOUTREQUESTS:        var->val_len = sizeof(U64);        var->type = ASN_COUNTER64;        rc = ipSystemStatsHCOutRequests_get(rowreq_ctx,                                            (U64 *) var->val.string);        break;        /*         * ipSystemStatsOutNoRoutes(22)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSOUTNOROUTES:        var->val_len = sizeof(u_long);        var->type = ASN_COUNTER;        rc = ipSystemStatsOutNoRoutes_get(rowreq_ctx,                                          (u_long *) var->val.string);        break;        /*         * ipSystemStatsOutForwDatagrams(23)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSOUTFORWDATAGRAMS:        var->val_len = sizeof(u_long);        var->type = ASN_COUNTER;        rc = ipSystemStatsOutForwDatagrams_get(rowreq_ctx,                                               (u_long *) var->val.string);        break;        /*         * ipSystemStatsHCOutForwDatagrams(24)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSHCOUTFORWDATAGRAMS:        var->val_len = sizeof(U64);        var->type = ASN_COUNTER64;        rc = ipSystemStatsHCOutForwDatagrams_get(rowreq_ctx,                                                 (U64 *) var->val.string);        break;        /*         * ipSystemStatsOutDiscards(25)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSOUTDISCARDS:        var->val_len = sizeof(u_long);        var->type = ASN_COUNTER;        rc = ipSystemStatsOutDiscards_get(rowreq_ctx,                                          (u_long *) var->val.string);        break;        /*         * ipSystemStatsOutFragReqds(26)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSOUTFRAGREQDS:        var->val_len = sizeof(u_long);        var->type = ASN_COUNTER;        rc = ipSystemStatsOutFragReqds_get(rowreq_ctx,                                           (u_long *) var->val.string);        break;        /*         * ipSystemStatsOutFragOKs(27)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSOUTFRAGOKS:        var->val_len = sizeof(u_long);        var->type = ASN_COUNTER;        rc = ipSystemStatsOutFragOKs_get(rowreq_ctx,                                         (u_long *) var->val.string);        break;        /*         * ipSystemStatsOutFragFails(28)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSOUTFRAGFAILS:        var->val_len = sizeof(u_long);        var->type = ASN_COUNTER;        rc = ipSystemStatsOutFragFails_get(rowreq_ctx,                                           (u_long *) var->val.string);        break;        /*         * ipSystemStatsOutFragCreates(29)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPSYSTEMSTATSOUTFRAGCREATES:        var->val_len = sizeof(u_long);        var->type = ASN_COUNTER;        rc = ipSystemStatsOutFragCreates_get(rowreq_ctx,                                             (u_long *) var->val.string);        break;        /*

⌨️ 快捷键说明

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