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

📄 iftable.c

📁 开发snmp的开发包有两个开放的SNMP开发库
💻 C
📖 第 1 页 / 共 5 页
字号:
     * TODO:231:o: |-> Extract the current value of the ifPhysAddress data.     * copy (* ifPhysAddress_val_ptr_ptr ) data and (* ifPhysAddress_val_ptr_len_ptr ) from rowreq_ctx->data     */    /*     * make sure there is enough space for ifPhysAddress data     */    if ((NULL == (*ifPhysAddress_val_ptr_ptr)) ||        ((*ifPhysAddress_val_ptr_len_ptr) <         (rowreq_ctx->data.ifPhysAddress_len *          sizeof(rowreq_ctx->data.ifPhysAddress[0])))) {        /*         * allocate space for ifPhysAddress data         */        (*ifPhysAddress_val_ptr_ptr) =            malloc(rowreq_ctx->data.ifPhysAddress_len *                   sizeof(rowreq_ctx->data.ifPhysAddress[0]));        if (NULL == (*ifPhysAddress_val_ptr_ptr)) {            snmp_log(LOG_ERR, "could not allocate memory\n");            return MFD_ERROR;        }    }    (*ifPhysAddress_val_ptr_len_ptr) =        rowreq_ctx->data.ifPhysAddress_len *        sizeof(rowreq_ctx->data.ifPhysAddress[0]);    memcpy((*ifPhysAddress_val_ptr_ptr), rowreq_ctx->data.ifPhysAddress,           (*ifPhysAddress_val_ptr_len_ptr));    return MFD_SUCCESS;}                               /* ifPhysAddress_get *//*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifAdminStatus * ifAdminStatus is subid 7 of ifEntry. * Its status is Current, and its access level is ReadWrite. * OID: .1.3.6.1.2.1.2.2.1.7 * Description:The desired state of the interface.  The testing(3) state            indicates that no operational packets can be passed.  When a            managed system initializes, all interfaces start with            ifAdminStatus in the down(2) state.  As a result of either            explicit management action or per configuration information            retained by the managed system, ifAdminStatus is then            changed to either the up(1) or testing(3) states (or remains            in the down(2) state). * * Attributes: *   accessible 1     isscalar 0     enums  1      hasdefval 0 *   readable   1     iscolumn 1     ranges 0      hashint   0 *   settable   1 * * Enum range: 2/8. Values:  up(1), down(2), testing(3) * * 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 ifAdminStatus data. * * Set a value using the data context for the row. * * @param rowreq_ctx *        Pointer to the row request context. * @param ifAdminStatus_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 */intifAdminStatus_get(ifTable_rowreq_ctx * rowreq_ctx,                  u_long * ifAdminStatus_val_ptr){   /** we should have a non-NULL pointer */    netsnmp_assert(NULL != ifAdminStatus_val_ptr);    DEBUGMSGTL(("verbose:ifTable:ifAdminStatus_get", "called\n"));    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:231:o: |-> Extract the current value of the ifAdminStatus data.     * copy (* ifAdminStatus_val_ptr ) from rowreq_ctx->data     */    (*ifAdminStatus_val_ptr) = rowreq_ctx->data.ifAdminStatus;    return MFD_SUCCESS;}                               /* ifAdminStatus_get *//*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifOperStatus * ifOperStatus is subid 8 of ifEntry. * Its status is Current, and its access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.8 * Description:The current operational state of the interface.  The            testing(3) state indicates that no operational packets can            be passed.  If ifAdminStatus is down(2) then ifOperStatus            should be down(2).  If ifAdminStatus is changed to up(1)            then ifOperStatus should change to up(1) if the interface is            ready to transmit and receive network traffic; it should            change to dormant(5) if the interface is waiting for            external actions (such as a serial line waiting for an            incoming connection); it should remain in the down(2) state            if and only if there is a fault that prevents it from going            to the up(1) state; it should remain in the notPresent(6)            state if the interface has missing (typically, hardware)            components. * * Attributes: *   accessible 1     isscalar 0     enums  1      hasdefval 0 *   readable   1     iscolumn 1     ranges 0      hashint   0 *   settable   0 * * Enum range: 5/8. Values:  up(1), down(2), testing(3), unknown(4), dormant(5), notPresent(6), lowerLayerDown(7) * * 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 ifOperStatus data. * * Set a value using the data context for the row. * * @param rowreq_ctx *        Pointer to the row request context. * @param ifOperStatus_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 */intifOperStatus_get(ifTable_rowreq_ctx * rowreq_ctx,                 u_long * ifOperStatus_val_ptr){   /** we should have a non-NULL pointer */    netsnmp_assert(NULL != ifOperStatus_val_ptr);    DEBUGMSGTL(("verbose:ifTable:ifOperStatus_get", "called\n"));    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:231:o: |-> Extract the current value of the ifOperStatus data.     * copy (* ifOperStatus_val_ptr ) from rowreq_ctx->data     */    (*ifOperStatus_val_ptr) = rowreq_ctx->data.ifOperStatus;    return MFD_SUCCESS;}                               /* ifOperStatus_get *//*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifLastChange * ifLastChange is subid 9 of ifEntry. * Its status is Current, and its access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.9 * Description:The value of sysUpTime at the time the interface entered            its current operational state.  If the current state was            entered prior to the last re-initialization of the local            network management subsystem, then this object contains a            zero value. * * Attributes: *   accessible 1     isscalar 0     enums  0      hasdefval 0 *   readable   1     iscolumn 1     ranges 0      hashint   0 *   settable   0 * * * Its syntax is TICKS (based on perltype TICKS) * The net-snmp type is ASN_TIMETICKS. The C type decl is u_long (u_long) *//** * Extract the current value of the ifLastChange data. * * Set a value using the data context for the row. * * @param rowreq_ctx *        Pointer to the row request context. * @param ifLastChange_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 */intifLastChange_get(ifTable_rowreq_ctx * rowreq_ctx,                 u_long * ifLastChange_val_ptr){   /** we should have a non-NULL pointer */    netsnmp_assert(NULL != ifLastChange_val_ptr);    DEBUGMSGTL(("verbose:ifTable:ifLastChange_get", "called\n"));    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:231:o: |-> Extract the current value of the ifLastChange data.     * copy (* ifLastChange_val_ptr ) from rowreq_ctx->data     */    (*ifLastChange_val_ptr) = rowreq_ctx->data.ifLastChange;    return MFD_SUCCESS;}                               /* ifLastChange_get *//*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifInOctets * ifInOctets is subid 10 of ifEntry. * Its status is Current, and its access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.10 * Description:The total number of octets received on the interface,            including framing characters.            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            ifCounterDiscontinuityTime. * * 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 ifInOctets data. * * Set a value using the data context for the row. * * @param rowreq_ctx *        Pointer to the row request context. * @param ifInOctets_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 */intifInOctets_get(ifTable_rowreq_ctx * rowreq_ctx,               u_long * ifInOctets_val_ptr){   /** we should have a non-NULL pointer */    netsnmp_assert(NULL != ifInOctets_val_ptr);    DEBUGMSGTL(("verbose:ifTable:ifInOctets_get", "called\n"));    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:231:o: |-> Extract the current value of the ifInOctets data.     * copy (* ifInOctets_val_ptr ) from rowreq_ctx->data     */    (*ifInOctets_val_ptr) = rowreq_ctx->data.ifInOctets;    return MFD_SUCCESS;}                               /* ifInOctets_get *//*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifInUcastPkts * ifInUcastPkts is subid 11 of ifEntry. * Its status is Current, and its access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.11 * Description:The number of packets, delivered by this sub-layer to a            higher (sub-)layer, which were not addressed to a multicast            or broadcast address at this sub-layer.            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            ifCounterDiscontinuityTime. * * 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 ifInUcastPkts data. * * Set a value using the data context for the row. * * @param rowreq_ctx *        Pointer to the row request context. * @param ifInUcastPkts_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 */intifInUcastPkts_get(ifTable_rowreq_ctx * rowreq_ctx,                  u_long * ifInUcastPkts_val_ptr){   /** we should have a non-NULL pointer */    netsnmp_assert(NULL != ifInUcastPkts_val_ptr);    DEBUGMSGTL(("verbose:ifTable:ifInUcastPkts_get", "called\n"));    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:231:o: |-> Extract the current value of the ifInUcastPkts data.     * copy (* ifInUcastPkts_val_ptr ) from rowreq_ctx->data     */    (*ifInUcastPkts_val_ptr) = rowreq_ctx->data.ifInUcastPkts;    return MFD_SUCCESS;}                               /* ifInUcastPkts_get *//*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifInNUcastPkts * ifInNUcastPkts is subid 12 of ifEntry. * Its status is Deprecated, and its access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.12 * Description:The number of packets, delivered by this sub-layer to a            higher (sub-)layer, which were addressed to a multicast or            broadcast address at this sub-layer.            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            ifCounterDiscontinuityTime.            This object is deprecated in favour of ifInMulticastPkts and            ifInBroadcastPkts. * * 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 ifInNUcastPkts data. * * Set a value using the data context for the row. * * @param rowreq_ctx *        Pointer to the row request context. * @param ifInNUcastPkts_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 */

⌨️ 快捷键说明

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