📄 snmpnotifyfiltertable.c
字号:
*@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 * snmpNotifyFilterTable_check_dependencies() function. * * The following checks have already been done for you: * The syntax is ASN_OCTET_STR * The length is < sizeof(rowreq_ctx->data.snmpNotifyFilterMask). * The length is in (one of) the range set(s): 0 - 16 * * If there a no other checks you need to do, simply return MFD_SUCCESS. * */intsnmpNotifyFilterMask_check_value(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx, char *snmpNotifyFilterMask_val_ptr, size_t snmpNotifyFilterMask_val_ptr_len){ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterMask_check_value", "called\n")); /** should never get a NULL pointer */ netsnmp_assert(NULL != rowreq_ctx); netsnmp_assert(NULL != snmpNotifyFilterMask_val_ptr); /* * TODO:441:o: |-> Check for valid snmpNotifyFilterMask value. */ return MFD_SUCCESS; /* snmpNotifyFilterMask value not illegal */} /* snmpNotifyFilterMask_check_value *//** * Save old value information * * @param rowreq_ctx * Pointer to the table context (snmpNotifyFilterTable_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 * snmpNotifyFilterTable_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. */intsnmpNotifyFilterMask_undo_setup(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx){ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterMask_undo_setup", "called\n")); /** should never get a NULL pointer */ netsnmp_assert(NULL != rowreq_ctx); /* * TODO:455:o: |-> Setup snmpNotifyFilterMask undo. */ /* * copy snmpNotifyFilterMask and snmpNotifyFilterMask_len data * set rowreq_ctx->undo->snmpNotifyFilterMask from rowreq_ctx->data.snmpNotifyFilterMask */ memcpy(rowreq_ctx->undo->snmpNotifyFilterMask, rowreq_ctx->data.snmpNotifyFilterMask, (rowreq_ctx->data.snmpNotifyFilterMask_len * sizeof(rowreq_ctx->undo->snmpNotifyFilterMask[0]))); rowreq_ctx->undo->snmpNotifyFilterMask_len = rowreq_ctx->data.snmpNotifyFilterMask_len; return MFD_SUCCESS;} /* snmpNotifyFilterMask_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 snmpNotifyFilterMask_val_ptr * A char containing the new value. * @param snmpNotifyFilterMask_val_ptr_len * The size (in bytes) of the data pointed to by snmpNotifyFilterMask_val_ptr */intsnmpNotifyFilterMask_set(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx, char *snmpNotifyFilterMask_val_ptr, size_t snmpNotifyFilterMask_val_ptr_len){ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterMask_set", "called\n")); /** should never get a NULL pointer */ netsnmp_assert(NULL != rowreq_ctx); netsnmp_assert(NULL != snmpNotifyFilterMask_val_ptr); /* * TODO:461:M: |-> Set snmpNotifyFilterMask value. * set snmpNotifyFilterMask value in rowreq_ctx->data */ memcpy(rowreq_ctx->data.snmpNotifyFilterMask, snmpNotifyFilterMask_val_ptr, snmpNotifyFilterMask_val_ptr_len); /** convert bytes to number of char */ rowreq_ctx->data.snmpNotifyFilterMask_len = snmpNotifyFilterMask_val_ptr_len / sizeof(snmpNotifyFilterMask_val_ptr[0]); return MFD_SUCCESS;} /* snmpNotifyFilterMask_set *//** * undo the previous set. * * @param rowreq_ctx * Pointer to the users context. */intsnmpNotifyFilterMask_undo(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx){ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterMask_undo", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * TODO:456:o: |-> Clean up snmpNotifyFilterMask undo. */ /* * copy snmpNotifyFilterMask and snmpNotifyFilterMask_len data * set rowreq_ctx->data.snmpNotifyFilterMask from rowreq_ctx->undo->snmpNotifyFilterMask */ memcpy(rowreq_ctx->data.snmpNotifyFilterMask, rowreq_ctx->undo->snmpNotifyFilterMask, (rowreq_ctx->undo->snmpNotifyFilterMask_len * sizeof(rowreq_ctx->data.snmpNotifyFilterMask[0]))); rowreq_ctx->data.snmpNotifyFilterMask_len = rowreq_ctx->undo->snmpNotifyFilterMask_len; return MFD_SUCCESS;} /* snmpNotifyFilterMask_undo *//*--------------------------------------------------------------------- * SNMP-NOTIFICATION-MIB::snmpNotifyFilterEntry.snmpNotifyFilterType * snmpNotifyFilterType is subid 3 of snmpNotifyFilterEntry. * Its status is Current, and its access level is Create. * OID: .1.3.6.1.6.3.13.1.3.1.3 * Description:This object indicates whether the family of filter subtrees defined by this entry are included in or excluded from a filter. A more detailed discussion of the use of this object can be found in section 6. of [SNMP-APPL]. * * Attributes: * accessible 1 isscalar 0 enums 1 hasdefval 1 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 1 * defval: included * * Enum range: 2/8. Values: included(1), excluded(2) * * 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 snmpNotifyFilterType_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 * snmpNotifyFilterTable_check_dependencies() function. * * The following checks have already been done for you: * The syntax is ASN_INTEGER * The value is one of included(1), excluded(2) * * If there a no other checks you need to do, simply return MFD_SUCCESS. * */intsnmpNotifyFilterType_check_value(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx, u_long snmpNotifyFilterType_val){ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterType_check_value", "called\n")); /** should never get a NULL pointer */ netsnmp_assert(NULL != rowreq_ctx); /* * TODO:441:o: |-> Check for valid snmpNotifyFilterType value. */ return MFD_SUCCESS; /* snmpNotifyFilterType value not illegal */} /* snmpNotifyFilterType_check_value *//** * Save old value information * * @param rowreq_ctx * Pointer to the table context (snmpNotifyFilterTable_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 * snmpNotifyFilterTable_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. */intsnmpNotifyFilterType_undo_setup(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx){ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterType_undo_setup", "called\n")); /** should never get a NULL pointer */ netsnmp_assert(NULL != rowreq_ctx); /* * TODO:455:o: |-> Setup snmpNotifyFilterType undo. */ /* * copy snmpNotifyFilterType data * set rowreq_ctx->undo->snmpNotifyFilterType from rowreq_ctx->data.snmpNotifyFilterType */ rowreq_ctx->undo->snmpNotifyFilterType = rowreq_ctx->data.snmpNotifyFilterType; return MFD_SUCCESS;} /* snmpNotifyFilterType_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 snmpNotifyFilterType_val * A long containing the new value. */intsnmpNotifyFilterType_set(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx, u_long snmpNotifyFilterType_val){ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterType_set", "called\n")); /** should never get a NULL pointer */ netsnmp_assert(NULL != rowreq_ctx); /* * TODO:461:M: |-> Set snmpNotifyFilterType value. * set snmpNotifyFilterType value in rowreq_ctx->data */ rowreq_ctx->data.snmpNotifyFilterType = snmpNotifyFilterType_val; return MFD_SUCCESS;} /* snmpNotifyFilterType_set *//** * undo the previous set. * * @param rowreq_ctx * Pointer to the users context. */intsnmpNotifyFilterType_undo(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx){ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterType_undo", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * TODO:456:o: |-> Clean up snmpNotifyFilterType undo. */ /* * copy snmpNotifyFilterType data * set rowreq_ctx->data.snmpNotifyFilterType from rowreq_ctx->undo->snmpNotifyFilterType */ rowreq_ctx->data.snmpNotifyFilterType = rowreq_ctx->undo->snmpNotifyFilterType; return MFD_SUCCESS;} /* snmpNotifyFilterType_undo *//*--------------------------------------------------------------------- * SNMP-NOTIFICATION-MIB::snmpNotifyFilterEntry.snmpNotifyFilterStorageType * snmpNotifyFilterStorageType is subid 4 of snmpNotifyFilterEntry. * Its status is Current, and its access level is Create. * OID: .1.3.6.1.6.3.13.1.3.1.4 * Description:The storage type for this conceptual row. Conceptual rows having the value 'permanent' need not allow write-access to any columnar objects in the row. * * Attributes: * accessible 1 isscalar 0 enums 1 hasdefval 1 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 1 * defval: nonVolatile * * Enum range: 4/8. Values: other(1), volatile(2), nonVolatile(3), permanent(4), readOnly(5) * * Its syntax is StorageType (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 snmpNotifyFilterStorageType_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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -