📄 ifxtable.c
字号:
By default, this object should have the value enabled(1) for interfaces which do not operate on 'top' of any other interface (as defined in the ifStackTable), and disabled(2) otherwise. * * Attributes: * accessible 1 isscalar 0 enums 1 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 1 * * Enum range: 2/8. Values: enabled(1), disabled(2) * * 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 ifLinkUpDownTrapEnable data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifLinkUpDownTrapEnable_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 */intifLinkUpDownTrapEnable_get(ifXTable_rowreq_ctx * rowreq_ctx, u_long * ifLinkUpDownTrapEnable_val_ptr){ /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ifLinkUpDownTrapEnable_val_ptr); DEBUGMSGTL(("verbose:ifXTable:ifLinkUpDownTrapEnable_get", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * TODO:231:o: |-> Extract the current value of the ifLinkUpDownTrapEnable data. * set (* ifLinkUpDownTrapEnable_val_ptr ) from rowreq_ctx->data */ (*ifLinkUpDownTrapEnable_val_ptr) = rowreq_ctx->data.ifLinkUpDownTrapEnable; return MFD_SUCCESS;} /* ifLinkUpDownTrapEnable_get *//*--------------------------------------------------------------------- * IF-MIB::ifXEntry.ifHighSpeed * ifHighSpeed is subid 15 of ifXEntry. * Its status is Current, and its access level is ReadOnly. * OID: .1.3.6.1.2.1.31.1.1.1.15 * Description:An estimate of the interface's current bandwidth in units of 1,000,000 bits per second. If this object reports a value of `n' then the speed of the interface is somewhere in the range of `n-500,000' to `n+499,999'. For interfaces which do not vary in bandwidth or for those where no accurate estimation can be made, this object should contain the nominal bandwidth. For a sub-layer which has no concept of bandwidth, this object should be zero. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 0 * * * Its syntax is GAUGE (based on perltype GAUGE) * The net-snmp type is ASN_GAUGE. The C type decl is u_long (u_long) *//** * Extract the current value of the ifHighSpeed data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifHighSpeed_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 */intifHighSpeed_get(ifXTable_rowreq_ctx * rowreq_ctx, u_long * ifHighSpeed_val_ptr){ /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ifHighSpeed_val_ptr); DEBUGMSGTL(("verbose:ifXTable:ifHighSpeed_get", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * TODO:231:o: |-> Extract the current value of the ifHighSpeed data. * set (* ifHighSpeed_val_ptr ) from rowreq_ctx->data */ (*ifHighSpeed_val_ptr) = rowreq_ctx->data.ifHighSpeed; return MFD_SUCCESS;} /* ifHighSpeed_get *//*--------------------------------------------------------------------- * IF-MIB::ifXEntry.ifPromiscuousMode * ifPromiscuousMode is subid 16 of ifXEntry. * Its status is Current, and its access level is ReadWrite. * OID: .1.3.6.1.2.1.31.1.1.1.16 * Description:This object has a value of false(2) if this interface only accepts packets/frames that are addressed to this station. This object has a value of true(1) when the station accepts all packets/frames transmitted on the media. The value true(1) is only legal on certain types of media. If legal, setting this object to a value of true(1) may require the interface to be reset before becoming effective. The value of ifPromiscuousMode does not affect the reception of broadcast and multicast packets/frames by the interface. * * Attributes: * accessible 1 isscalar 0 enums 1 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 1 * * Enum range: 2/8. Values: true(1), false(2) * * Its syntax is TruthValue (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 ifPromiscuousMode data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifPromiscuousMode_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 */intifPromiscuousMode_get(ifXTable_rowreq_ctx * rowreq_ctx, u_long * ifPromiscuousMode_val_ptr){ /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ifPromiscuousMode_val_ptr); DEBUGMSGTL(("verbose:ifXTable:ifPromiscuousMode_get", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * TODO:231:o: |-> Extract the current value of the ifPromiscuousMode data. * set (* ifPromiscuousMode_val_ptr ) from rowreq_ctx->data */ (*ifPromiscuousMode_val_ptr) = rowreq_ctx->data.ifPromiscuousMode; return MFD_SUCCESS;} /* ifPromiscuousMode_get *//*--------------------------------------------------------------------- * IF-MIB::ifXEntry.ifConnectorPresent * ifConnectorPresent is subid 17 of ifXEntry. * Its status is Current, and its access level is ReadOnly. * OID: .1.3.6.1.2.1.31.1.1.1.17 * Description:This object has the value 'true(1)' if the interface sublayer has a physical connector and the value 'false(2)' otherwise. * * Attributes: * accessible 1 isscalar 0 enums 1 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 0 * * Enum range: 2/8. Values: true(1), false(2) * * Its syntax is TruthValue (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 ifConnectorPresent data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifConnectorPresent_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 */intifConnectorPresent_get(ifXTable_rowreq_ctx * rowreq_ctx, u_long * ifConnectorPresent_val_ptr){ /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ifConnectorPresent_val_ptr); DEBUGMSGTL(("verbose:ifXTable:ifConnectorPresent_get", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * TODO:231:o: |-> Extract the current value of the ifConnectorPresent data. * set (* ifConnectorPresent_val_ptr ) from rowreq_ctx->data */ (*ifConnectorPresent_val_ptr) = rowreq_ctx->data.ifConnectorPresent; return MFD_SUCCESS;} /* ifConnectorPresent_get *//*--------------------------------------------------------------------- * IF-MIB::ifXEntry.ifAlias * ifAlias is subid 18 of ifXEntry. * Its status is Current, and its access level is ReadWrite. * OID: .1.3.6.1.2.1.31.1.1.1.18 * Description:This object is an 'alias' name for the interface as specified by a network manager, and provides a non-volatile 'handle' for the interface. On the first instantiation of an interface, the value of ifAlias associated with that interface is the zero-length string. As and when a value is written into an instance of ifAlias through a network management set operation, then the agent must retain the supplied value in the ifAlias instance associated with the same interface for as long as that interface remains instantiated, including across all re- initializations/reboots of the network management system, including those which result in a change of the interface's ifIndex value. An example of the value which a network manager might store in this object for a WAN interface is the (Telco's) circuit number/identifier of the interface. Some agents may support write-access only for interfaces having particular values of ifType. An agent which supports write access to this object is required to keep the value in non-volatile storage, but it may limit the length of new values depending on how much storage is already occupied by the current values for other interfaces. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 1 hashint 1 * settable 1 * hint: 255a * * Ranges: 0 - 64; * * Its syntax is DisplayString (based on perltype OCTETSTR) * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char) * This data type requires a length. (Max 64) *//** * Extract the current value of the ifAlias data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifAlias_val_ptr_ptr * Pointer to storage for a char variable * @param ifAlias_val_ptr_len_ptr * Pointer to a size_t. On entry, it will contain the size (in bytes) * pointed to by ifAlias. * On exit, this value should contain the data size (in bytes). * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error* * @note If you need more than (*ifAlias_val_ptr_len_ptr) bytes of memory, * allocate it using malloc() and update ifAlias_val_ptr_ptr. * <b>DO NOT</b> free the previous pointer. * The MFD helper will release the memory you allocate. * * @remark If you call this function yourself, you are responsible * for checking if the pointer changed, and freeing any * previously allocated memory. (Not necessary if you pass * in a pointer to static memory, obviously.) */intifAlias_get(ifXTable_rowreq_ctx * rowreq_ctx, char **ifAlias_val_ptr_ptr, size_t *ifAlias_val_ptr_len_ptr){ /** we should have a non-NULL pointer and enough storage */ netsnmp_assert((NULL != ifAlias_val_ptr_ptr) && (NULL != *ifAlias_val_ptr_ptr)); netsnmp_assert(NULL != ifAlias_val_ptr_len_ptr); DEBUGMSGTL(("verbose:ifXTable:ifAlias_get", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * TODO:231:o: |-> Extract the current value of the ifAlias data. * set (* ifAlias_val_ptr_ptr ) and (* ifAlias_val_ptr_len_ptr ) from rowreq_ctx->data */ /* * make sure there is enough space for ifAlias data */ if ((NULL == (*ifAlias_val_ptr_ptr)) || ((*ifAlias_val_ptr_len_ptr) < rowreq_ctx->data.ifAlias_len)) { /* * allocate space for ifAlias data */ (*ifAlias_val_ptr_ptr) = malloc(rowreq_ctx->data.ifAlias_len * sizeof((*ifAlias_val_ptr_ptr)[0])); if (NULL == (*ifAlias_val_ptr_ptr)) { snmp_log(LOG_ERR, "could not allocate memory\n"); return MFD_ERROR; } } (*ifAlias_val_ptr_len_ptr) = rowreq_ctx->data.ifAlias_len; memcpy((*ifAlias_val_ptr_ptr), rowreq_ctx->data.ifAlias, (*ifAlias_val_ptr_len_ptr) * sizeof((*ifAlias_val_ptr_ptr)[0])); return MFD_SUCCESS;} /* ifAlias_get *//*--------------------------------------------------------------------- * IF-MIB::ifXEntry.ifCounterDiscontinuityTime * ifCounterDiscontinuityTime is subid 19 of ifXEntry. * Its status is Current, and its access level is ReadOnly. * OID: .1.3.6.1.2.1.31.1.1.1.19 * Description:The value of sysUpTime on the most recent occasion at which any one or more of this interface's counters suffered a discontinuity. The relevant counters are the specific instances associated with this interface of any Counter32 or Counter64 object contained in the ifTable or ifXTable. If no such discontinuities have occurred since the last re- initialization of the local 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 TimeStamp (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 ifCounterDiscontinuityTime data. * * Set a value using the data context for the row. * * @param rowreq_ctx
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -