📄 ipaddresstable.c
字号:
* Set the new value. * * @param rowreq_ctx * Pointer to the users context. You should know how to * manipulate the value from this object. * @param ipAddressIfIndex_val * A long containing the new value. */intipAddressIfIndex_set(ipAddressTable_rowreq_ctx * rowreq_ctx, long ipAddressIfIndex_val){ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressIfIndex_set", "called\n")); /** should never get a NULL pointer */ netsnmp_assert(NULL != rowreq_ctx); /* * TODO:461:M: |-> Set ipAddressIfIndex value. * set ipAddressIfIndex value in rowreq_ctx->data */ if (rowreq_ctx->data->if_index != ipAddressIfIndex_val) rowreq_ctx->data->if_index = ipAddressIfIndex_val; else rowreq_ctx->column_set_flags &= ~FLAG_IPADDRESSIFINDEX; return MFD_SUCCESS;} /* ipAddressIfIndex_set *//** * undo the previous set. * * @param rowreq_ctx * Pointer to the users context. */intipAddressIfIndex_undo(ipAddressTable_rowreq_ctx * rowreq_ctx){ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressIfIndex_undo", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * TODO:456:o: |-> Clean up ipAddressIfIndex undo. */ /* * copy ipAddressIfIndex data * set rowreq_ctx->data->ipAddressIfIndex from rowreq_ctx->undo->ipAddressIfIndex */ rowreq_ctx->data->if_index = rowreq_ctx->undo->if_index; return MFD_SUCCESS;} /* ipAddressIfIndex_undo *//*--------------------------------------------------------------------- * IP-MIB::ipAddressEntry.ipAddressType * ipAddressType is subid 4 of ipAddressEntry. * Its status is Current, and its access level is Create. * OID: .1.3.6.1.2.1.4.34.1.4 * Description:The type of address. broadcast(3) is not a valid value for IPv6 addresses (RFC3513). * * Attributes: * accessible 1 isscalar 0 enums 1 hasdefval 1 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 1 * defval: unicast * * Enum range: 2/8. Values: unicast(1), anycast(2), broadcast(3) * * Its syntax is INTEGER (based on perltype INTEGER) * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) *//** * Check that the proposed new value is potentially valid. * * @param rowreq_ctx * Pointer to the row request context. * @param ipAddressType_val * A long containing the new value. * * @retval MFD_SUCCESS : incoming value is legal * @retval MFD_NOT_VALID_NOW : incoming value is not valid now * @retval MFD_NOT_VALID_EVER : incoming value is never valid * * This is the place to check for requirements that are not * expressed in the mib syntax (for example, a requirement that * is detailed in the description for an object). * * You should check that the requested change between the undo value and the * new value is legal (ie, the transistion from one value to another * is legal). * *@note * This check is only to determine if the new value * is \b potentially valid. This is the first check of many, and * is one of the simplest ones. * *@note * this is not the place to do any checks for values * which depend on some other value in the mib. Those * types of checks should be done in the * ipAddressTable_check_dependencies() function. * * The following checks have already been done for you: * The syntax is ASN_INTEGER * The value is one of unicast(1), anycast(2), broadcast(3) * * If there a no other checks you need to do, simply return MFD_SUCCESS. * */intipAddressType_check_value(ipAddressTable_rowreq_ctx * rowreq_ctx, u_long ipAddressType_val){ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressType_check_value", "called\n")); /** should never get a NULL pointer */ netsnmp_assert(NULL != rowreq_ctx); /* * TODO:441:o: |-> Check for valid ipAddressType value. * * no support for anything but unicast yet */ if (ipAddressType_val != IPADDRESSTYPE_UNICAST) return MFD_NOT_VALID_EVER; return MFD_SUCCESS; /* ipAddressType value not illegal */} /* ipAddressType_check_value *//** * Save old value information * * @param rowreq_ctx * Pointer to the table context (ipAddressTable_rowreq_ctx) * * @retval MFD_SUCCESS : success * @retval MFD_ERROR : error. set will fail. * * This function will be called after the table level undo setup function * ipAddressTable_undo_setup has been called. * *@note * this function will only be called if a new value is set for this column. * * If there is any setup specific to a particular column (e.g. allocating * memory for a string), you should do that setup in this function, so it * won't be done unless it is necessary. */intipAddressType_undo_setup(ipAddressTable_rowreq_ctx * rowreq_ctx){ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressType_undo_setup", "called\n")); /** should never get a NULL pointer */ netsnmp_assert(NULL != rowreq_ctx); /* * TODO:455:o: |-> Setup ipAddressType undo. */ /* * handled in ipAddressTable_undo_setup */ return MFD_SUCCESS;} /* ipAddressType_undo_setup *//** * Set the new value. * * @param rowreq_ctx * Pointer to the users context. You should know how to * manipulate the value from this object. * @param ipAddressType_val * A long containing the new value. */intipAddressType_set(ipAddressTable_rowreq_ctx * rowreq_ctx, u_long ipAddressType_val){ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressType_set", "called\n")); /** should never get a NULL pointer */ netsnmp_assert(NULL != rowreq_ctx); /* * TODO:461:M: |-> Set ipAddressType value. * set ipAddressType value in rowreq_ctx->data */ rowreq_ctx->data->ia_type = ipAddressType_val; return MFD_SUCCESS;} /* ipAddressType_set *//** * undo the previous set. * * @param rowreq_ctx * Pointer to the users context. */intipAddressType_undo(ipAddressTable_rowreq_ctx * rowreq_ctx){ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressType_undo", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * TODO:456:o: |-> Clean up ipAddressType undo. */ /* * copy ipAddressType data * set rowreq_ctx->data->ipAddressType from rowreq_ctx->undo->ipAddressType */ rowreq_ctx->data->ia_type = rowreq_ctx->undo->ia_type; return MFD_SUCCESS;} /* ipAddressType_undo *//*--------------------------------------------------------------------- * IP-MIB::ipAddressEntry.ipAddressStatus * ipAddressStatus is subid 7 of ipAddressEntry. * Its status is Current, and its access level is Create. * OID: .1.3.6.1.2.1.4.34.1.7 * Description:The status of the address, describing if the address can be used for communication. In the absence of other information, an IPv4 address is always preferred(1). * * Attributes: * accessible 1 isscalar 0 enums 1 hasdefval 1 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 1 * defval: preferred * * Enum range: 5/8. Values: preferred(1), invalid(3), inaccessible(4), unknown(5), tentative(6), duplicate(7) * * Its syntax is IpAddressStatusTC (based on perltype INTEGER) * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) *//** * Check that the proposed new value is potentially valid. * * @param rowreq_ctx * Pointer to the row request context. * @param ipAddressStatus_val * A long containing the new value. * * @retval MFD_SUCCESS : incoming value is legal * @retval MFD_NOT_VALID_NOW : incoming value is not valid now * @retval MFD_NOT_VALID_EVER : incoming value is never valid * * This is the place to check for requirements that are not * expressed in the mib syntax (for example, a requirement that * is detailed in the description for an object). * * You should check that the requested change between the undo value and the * new value is legal (ie, the transistion from one value to another * is legal). * *@note * This check is only to determine if the new value * is \b potentially valid. This is the first check of many, and * is one of the simplest ones. * *@note * this is not the place to do any checks for values * which depend on some other value in the mib. Those * types of checks should be done in the * ipAddressTable_check_dependencies() function. * * The following checks have already been done for you: * The syntax is ASN_INTEGER * The value is one of preferred(1), invalid(3), inaccessible(4), unknown(5), tentative(6), duplicate(7) * * If there a no other checks you need to do, simply return MFD_SUCCESS. * */intipAddressStatus_check_value(ipAddressTable_rowreq_ctx * rowreq_ctx, u_long ipAddressStatus_val){ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressStatus_check_value", "called\n")); /** should never get a NULL pointer */ netsnmp_assert(NULL != rowreq_ctx); /* * TODO:441:o: |-> Check for valid ipAddressStatus value. * * nothing but preferred supported yet */ if (IPADDRESSSTATUSTC_PREFERRED != ipAddressStatus_val) return MFD_NOT_VALID_EVER; return MFD_SUCCESS; /* ipAddressStatus value not illegal */} /* ipAddressStatus_check_value *//** * Save old value information * * @param rowreq_ctx * Pointer to the table context (ipAddressTable_rowreq_ctx) * * @retval MFD_SUCCESS : success * @retval MFD_ERROR : error. set will fail. * * This function will be called after the table level undo setup function * ipAddressTable_undo_setup has been called. * *@note * this function will only be called if a new value is set for this column. * * If there is any setup specific to a particular column (e.g. allocating * memory for a string), you should do that setup in this function, so it * won't be done unless it is necessary. */intipAddressStatus_undo_setup(ipAddressTable_rowreq_ctx * rowreq_ctx){ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressStatus_undo_setup", "called\n")); /** should never get a NULL pointer */ netsnmp_assert(NULL != rowreq_ctx); /* * TODO:455:o: |-> Setup ipAddressStatus undo. */ /* * handled in ipAddressTable_undo_setup */ return MFD_SUCCESS;} /* ipAddressStatus_undo_setup *//** * Set the new value. * * @param rowreq_ctx * Pointer to the users context. You should know how to * manipulate the value from this object. * @param ipAddressStatus_val * A long containing the new value. */intipAddressStatus_set(ipAddressTable_rowreq_ctx * rowreq_ctx, u_long ipAddressStatus_val){ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressStatus_set", "called\n")); /** should never get a NULL pointer */ netsnmp_assert(NULL != rowreq_ctx); /* * TODO:461:M: |-> Set ipAddressStatus value. * set ipAddressStatus value in rowreq_ctx->data */ rowreq_ctx->data->ia_status = ipAddressStatus_val; return MFD_SUCCESS;} /* ipAddressStatus_set *//** * undo the previous set. * * @param rowreq_ctx * Pointer to the users context. */intipAddressStatus_undo(ipAddressTable_rowreq_ctx * rowreq_ctx){ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressStatus_undo", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * TODO:456:o: |-> Clean up ipAddressS
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -