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

📄 ipv6interfacetable_interface.c

📁 开发snmp的开发包有两个开放的SNMP开发库
💻 C
📖 第 1 页 / 共 4 页
字号:
                                                                    ASN_TIMETICKS,                                                                    WATCHER_FIXED_SIZE));    }}                               /* _ipv6InterfaceTable_initialize_interface *//** * @internal * Shutdown the table ipv6InterfaceTable */void_ipv6InterfaceTable_shutdown_interface(ipv6InterfaceTable_registration *                                       reg_ptr){    /*     * shutdown the container     */    _ipv6InterfaceTable_container_shutdown(&ipv6InterfaceTable_if_ctx);}voidipv6InterfaceTable_valid_columns_set(netsnmp_column_info *vc){    ipv6InterfaceTable_if_ctx.tbl_info.valid_columns = vc;}                               /* ipv6InterfaceTable_valid_columns_set *//** * @internal * wrapper */static int_mfd_ipv6InterfaceTable_pre_request(netsnmp_mib_handler *handler,                                    netsnmp_handler_registration *reginfo,                                    netsnmp_agent_request_info                                    *agtreq_info,                                    netsnmp_request_info *requests){    int             rc;    DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_pre_request", "called\n"));    if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {        DEBUGMSGTL(("internal:ipv6InterfaceTable",                    "skipping additional pre_request\n"));        return SNMP_ERR_NOERROR;    }    rc = ipv6InterfaceTable_pre_request(ipv6InterfaceTable_if_ctx.                                        user_ctx);    if (MFD_SUCCESS != rc) {        /*         * nothing we can do about it but log it         */        DEBUGMSGTL(("ipv6InterfaceTable", "error %d from "                    "ipv6InterfaceTable_pre_request\n", rc));        netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));    }    return SNMP_ERR_NOERROR;}                               /* _mfd_ipv6InterfaceTable_pre_request *//** * @internal * wrapper */static int_mfd_ipv6InterfaceTable_post_request(netsnmp_mib_handler *handler,                                     netsnmp_handler_registration *reginfo,                                     netsnmp_agent_request_info                                     *agtreq_info,                                     netsnmp_request_info *requests){    int             rc, packet_rc;    DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_post_request", "called\n"));    /*     * wait for last call before calling user     */    if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) {        DEBUGMSGTL(("internal:ipv6InterfaceTable",                    "waiting for last post_request\n"));        return SNMP_ERR_NOERROR;    }    packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0);    if ((MFD_SUCCESS != packet_rc) && ipv6InterfaceTable_dirty_get()) {        /*         * we shouldn't get here. the undo steps should also clear         * the dirty flags.         */        snmp_log(LOG_WARNING,                 "ipv6InterfaceTable dirty flag set in post_request "                 "but status != SUCCESS.\n");    }    rc = ipv6InterfaceTable_post_request(ipv6InterfaceTable_if_ctx.                                         user_ctx, packet_rc);    if (MFD_SUCCESS != rc) {        /*         * nothing we can do about it but log it         */        DEBUGMSGTL(("ipv6InterfaceTable", "error %d from "                    "ipv6InterfaceTable_post_request\n", rc));    }    return SNMP_ERR_NOERROR;}                               /* _mfd_ipv6InterfaceTable_post_request *//** * @internal * wrapper */static int_mfd_ipv6InterfaceTable_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;    ipv6InterfaceTable_rowreq_ctx *rowreq_ctx =        netsnmp_container_table_row_extract(requests);    DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_object_lookup", "called\n"));    /*     * get our context from mfd     * ipv6InterfaceTable_interface_ctx *if_ctx =     *             (ipv6InterfaceTable_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        ipv6InterfaceTable_row_prep(rowreq_ctx);    return SNMP_VALIDATE_ERR(rc);}                               /* _mfd_ipv6InterfaceTable_object_lookup *//*********************************************************************** * * GET processing * ***********************************************************************//* * @internal * Retrieve the value for a particular column */NETSNMP_STATIC_INLINE int_ipv6InterfaceTable_get_column(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx,                               netsnmp_variable_list * var, int column){    int             rc = SNMPERR_SUCCESS;    DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_get_column", "called for %d\n", column));    netsnmp_assert(NULL != rowreq_ctx);    switch (column) {        /*         * ipv6InterfaceReasmMaxSize(2)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/R/d/h          */    case COLUMN_IPV6INTERFACEREASMMAXSIZE:        var->val_len = sizeof(u_long);        var->type = ASN_UNSIGNED;        rc = ipv6InterfaceReasmMaxSize_get(rowreq_ctx,                                           (u_long *) var->val.string);        break;        /*         * ipv6InterfaceIdentifier(3)/Ipv6AddressIfIdentifierTC/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H          */    case COLUMN_IPV6INTERFACEIDENTIFIER:        var->type = ASN_OCTET_STR;        rc = ipv6InterfaceIdentifier_get(rowreq_ctx,                                         (char **) &var->val.string,                                         &var->val_len);        break;        /*         * ipv6InterfaceEnableStatus(5)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h          */    case COLUMN_IPV6INTERFACEENABLESTATUS:        var->val_len = sizeof(u_long);        var->type = ASN_INTEGER;        rc = ipv6InterfaceEnableStatus_get(rowreq_ctx,                                           (u_long *) var->val.string);        break;        /*         * ipv6InterfaceReachableTime(6)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPV6INTERFACEREACHABLETIME:        var->val_len = sizeof(u_long);        var->type = ASN_UNSIGNED;        rc = ipv6InterfaceReachableTime_get(rowreq_ctx,                                            (u_long *) var->val.string);        break;        /*         * ipv6InterfaceRetransmitTime(7)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h          */    case COLUMN_IPV6INTERFACERETRANSMITTIME:        var->val_len = sizeof(u_long);        var->type = ASN_UNSIGNED;        rc = ipv6InterfaceRetransmitTime_get(rowreq_ctx,                                             (u_long *) var->val.string);        break;        /*         * ipv6InterfaceForwarding(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h          */    case COLUMN_IPV6INTERFACEFORWARDING:        var->val_len = sizeof(u_long);        var->type = ASN_INTEGER;        rc = ipv6InterfaceForwarding_get(rowreq_ctx,                                         (u_long *) var->val.string);        break;    default:        if (COLUMN_IPV6INTERFACEREASMMAXSIZE <= column && column <= COLUMN_IPV6INTERFACEFORWARDING) {            DEBUGMSGTL(("internal:${context}:_ipv6InterfaceTable_get_column",                "assume column %d is reserved\n", column));            rc = MFD_SKIP;        } else {            snmp_log(LOG_ERR,                     "unknown column %d in _ipv6InterfaceTable_get_column\n",                     column);        }        break;    }    return rc;}                               /* _ipv6InterfaceTable_get_column */int_mfd_ipv6InterfaceTable_get_values(netsnmp_mib_handler *handler,                                   netsnmp_handler_registration *reginfo,                                   netsnmp_agent_request_info *agtreq_info,                                   netsnmp_request_info *requests){    ipv6InterfaceTable_rowreq_ctx *rowreq_ctx =        netsnmp_container_table_row_extract(requests);    netsnmp_table_request_info *tri;    u_char         *old_string;    void            (*dataFreeHook) (void *);    int             rc;    DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_get_values", "called\n"));    netsnmp_assert(NULL != rowreq_ctx);    for (; requests; requests = requests->next) {        /*         * save old pointer, so we can free it if replaced         */        old_string = requests->requestvb->val.string;        dataFreeHook = requests->requestvb->dataFreeHook;        if (NULL == requests->requestvb->val.string) {            requests->requestvb->val.string = requests->requestvb->buf;            requests->requestvb->val_len =                sizeof(requests->requestvb->buf);        } else if (requests->requestvb->buf ==                   requests->requestvb->val.string) {            if (requests->requestvb->val_len !=                sizeof(requests->requestvb->buf))                requests->requestvb->val_len =                    sizeof(requests->requestvb->buf);        }        /*         * get column data         */        tri = netsnmp_extract_table_info(requests);        if (NULL == tri)            continue;        rc = _ipv6InterfaceTable_get_column(rowreq_ctx,                                            requests->requestvb,                                            tri->colnum);        if (rc) {            if (MFD_SKIP == rc) {                requests->requestvb->type = SNMP_NOSUCHINSTANCE;                rc = SNMP_ERR_NOERROR;            }        } else if (NULL == requests->requestvb->val.string) {            snmp_log(LOG_ERR, "NULL varbind data pointer!\n");            rc = SNMP_ERR_GENERR;        }        if (rc)            netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));        /*         * if the buffer wasn't used previously for the old data (i.e. it         * was allcoated memory)  and the get routine replaced the pointer,         * we need to free the previous pointer.         */        if (old_string && (old_string != requests->requestvb->buf) &&            (requests->requestvb->val.string != old_string)) {            if (dataFreeHook)                (*dataFreeHook) (old_string);            else                free(old_string);        }    }                           /* for results */    return SNMP_ERR_NOERROR;}                               /* _mfd_ipv6InterfaceTable_get_values *//*********************************************************************** * * SET processing * ***********************************************************************//*---------------------------------------------------------------------- * * SET: Syntax checks * *---------------------------------------------------------------------*//* * @internal * Check the syntax for a particular column */NETSNMP_STATIC_INLINE int_ipv6InterfaceTable_check_column(ipv6InterfaceTable_rowreq_ctx *                                 rowreq_ctx, netsnmp_variable_list * var,                                 int column){    int             rc = SNMPERR_SUCCESS;    DEBUGMSGTL(("internal:ipv6InterfaceTable:_ipv6InterfaceTable_check_column", "called for %d\n", column));    netsnmp_assert(NULL != rowreq_ctx);    switch (column) {        /*         * (INDEX) ipv6InterfaceIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H          */    case COLUMN_IPV6INTERFACEIFINDEX:        rc = SNMP_ERR_NOTWRITABLE;      /* can not change index of active row */        break;

⌨️ 快捷键说明

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