📄 snmpnotifyfiltertable.c
字号:
* SNMP-NOTIFICATION-MIB::snmpNotifyFilterTable is subid 3 of snmpNotifyObjects. * Its status is Current. * OID: .1.3.6.1.6.3.13.1.3, length: 9 */ /* * NOTE: if you update this chart, please update the versions in * local/mib2c-conf.d/parent-set.m2i * agent/mibgroup/helpers/baby_steps.c * while you're at it. */ /* *********************************************************************** * Baby Steps Flow Chart (2004.06.05) * * * * +--------------+ +================+ U = unconditional path * * |optional state| ||required state|| S = path for success * * +--------------+ +================+ E = path for error * *********************************************************************** * * +--------------+ * | pre | * | request | * +--------------+ * | U * +-------------+ +==============+ * | row |f|<-------|| object || * | create |1| E || lookup || * +-------------+ +==============+ * E | | S | S * | +------------------>| * | +==============+ * | E || check || * |<---------------|| values || * | +==============+ * | | S * | +==============+ * | +<-------|| undo || * | | E || setup || * | | +==============+ * | | | S * | | +==============+ * | | || set ||-------------------------->+ * | | || value || E | * | | +==============+ | * | | | S | * | | +--------------+ | * | | | check |-------------------------->| * | | | consistency | E | * | | +--------------+ | * | | | S | * | | +==============+ +==============+ | * | | || commit ||-------->|| undo || | * | | || || E || commit || | * | | +==============+ +==============+ | * | | | S U |<--------+ * | | +--------------+ +==============+ * | | | irreversible | || undo || * | | | commit | || set || * | | +--------------+ +==============+ * | | | U U | * | +-------------->|<------------------------+ * | +==============+ * | || undo || * | || cleanup || * | +==============+ * +---------------------->| U * | * (err && f1)------------------->+ * | | * +--------------+ +--------------+ * | post |<--------| row | * | request | U | release | * +--------------+ +--------------+ * *//** * Setup up context with information needed to undo a set request. * * This function will be called before the individual node undo setup * functions are called. If you need to do any undo setup that is not * related to a specific column, you can do it here. * * Note that the undo context has been allocated with * snmpNotifyFilterTable_allocate_data(), but may need extra * initialization similar to what you may have done in * snmpNotifyFilterTable_rowreq_ctx_init(). * Note that an individual node's undo_setup function will only be called * if that node is being set to a new value. * * If there is any setup specific to a particular column (e.g. allocating * memory for a string), you should do that setup in the node's undo_setup * function, so it won't be done unless it is necessary. * * @param rowreq_ctx * Pointer to the table context (snmpNotifyFilterTable_rowreq_ctx) * * @retval MFD_SUCCESS : success * @retval MFD_ERROR : error. set will fail. */intsnmpNotifyFilterTable_undo_setup(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx){ int rc = MFD_SUCCESS; DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_undo_setup", "called\n")); /** we should have a non-NULL pointer */ netsnmp_assert(NULL != rowreq_ctx); /* * TODO:451:M: |-> Setup snmpNotifyFilterTable undo. * set up snmpNotifyFilterTable undo information, in preparation for a set. * Undo storage is in (* snmpNotifyFilterRowStatus_val_ptr )* */ return rc;} /* snmpNotifyFilterTable_undo_setup *//** * Undo a set request. * * This function will be called before the individual node undo * functions are called. If you need to do any undo that is not * related to a specific column, you can do it here. * * Note that an individual node's undo function will only be called * if that node is being set to a new value. * * If there is anything specific to a particular column (e.g. releasing * memory for a string), you should do that setup in the node's undo * function, so it won't be done unless it is necessary. * * @param rowreq_ctx * Pointer to the table context (snmpNotifyFilterTable_rowreq_ctx) * * @retval MFD_SUCCESS : success * @retval MFD_ERROR : error. set will fail. */intsnmpNotifyFilterTable_undo(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx){ int rc = MFD_SUCCESS; DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_undo", "called\n")); /** we should have a non-NULL pointer */ netsnmp_assert(NULL != rowreq_ctx); /* * TODO:451:M: |-> snmpNotifyFilterTable undo. * snmpNotifyFilterTable undo information, in response to a failed set. * Undo storage is in (* snmpNotifyFilterRowStatus_val_ptr )* */ return rc;} /* snmpNotifyFilterTable_undo_setup *//** * Cleanup up context undo information. * * This function will be called after set/commit processing. If you * allocated any resources in undo_setup, this is the place to release * those resources. * * This function is called regardless of the success or failure of the set * request. If you need to perform different steps for cleanup depending * on success or failure, you can add a flag to the rowreq_ctx. * * @param rowreq_ctx * Pointer to the table context (snmpNotifyFilterTable_rowreq_ctx) * * @retval MFD_SUCCESS : success * @retval MFD_ERROR : error */intsnmpNotifyFilterTable_undo_cleanup(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx){ int rc = MFD_SUCCESS; DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_undo_cleanup", "called\n")); /** we should have a non-NULL pointer */ netsnmp_assert(NULL != rowreq_ctx); /* * TODO:452:M: |-> Cleanup snmpNotifyFilterTable undo. * Undo storage is in (* snmpNotifyFilterRowStatus_val_ptr )* */ return rc;} /* snmpNotifyFilterTable_undo_cleanup *//** * commit new values. * * At this point, you should have done everything you can to ensure that * this commit will not fail. * * Should you need different behavior depending on which columns were * set, rowreq_ctx->column_set_flags will indicate which writeable columns were * set. The definitions for the COLUMN_*_FLAG bits can be found in * snmpNotifyFilterTable.h. * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. * * @param rowreq_ctx * Pointer to the users context. * * @retval MFD_SUCCESS : success * @retval MFD_ERROR : error */intsnmpNotifyFilterTable_commit(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx){ int rc = MFD_SUCCESS; DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_commit", "called\n")); /** we should have a non-NULL pointer */ netsnmp_assert(NULL != rowreq_ctx); /* * commit snmpNotifyFilterTable data */ /* * if we successfully commited this row, set the dirty flag. */ rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY; return rc;} /* snmpNotifyFilterTable_commit *//** * undo commit new values. * * Should you need different behavior depending on which columns were * set, rowreq_ctx->column_set_flags will indicate which writeable columns were * set. The definitions for the COLUMN_*_FLAG bits can be found in * snmpNotifyFilterTable.h. * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. * * @param rowreq_ctx * Pointer to the users context. * * @retval MFD_SUCCESS : success * @retval MFD_ERROR : error */intsnmpNotifyFilterTable_undo_commit(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx){ int rc = MFD_SUCCESS; DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_undo_commit", "called\n")); /** we should have a non-NULL pointer */ netsnmp_assert(NULL != rowreq_ctx); /* * TODO:485:M: |-> Undo snmpNotifyFilterTable commit. * check the column's flag in rowreq_ctx->column_set_flags to see * if it was set during commit, then undo it. * * eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {} */ /* * if we successfully un-commited this row, clear the dirty flag. */ if (MFD_SUCCESS == rc) { rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY; } return rc;} /* snmpNotifyFilterTable_undo_commit *//* * TODO:440:M: Implement snmpNotifyFilterTable node value checks. * TODO:450:M: Implement snmpNotifyFilterTable undo functions. * TODO:460:M: Implement snmpNotifyFilterTable set functions. * TODO:480:M: Implement snmpNotifyFilterTable commit functions. *//*--------------------------------------------------------------------- * SNMP-NOTIFICATION-MIB::snmpNotifyFilterEntry.snmpNotifyFilterMask * snmpNotifyFilterMask is subid 2 of snmpNotifyFilterEntry. * Its status is Current, and its access level is Create. * OID: .1.3.6.1.6.3.13.1.3.1.2 * Description:The bit mask which, in combination with the corresponding instance of snmpNotifyFilterSubtree, defines a family of subtrees which are included in or excluded from the filter profile. Each bit of this bit mask corresponds to a sub-identifier of snmpNotifyFilterSubtree, with the most significant bit of the i-th octet of this octet string value (extended if necessary, see below) corresponding to the (8*i - 7)-th sub-identifier, and the least significant bit of the i-th octet of this octet string corresponding to the (8*i)-th sub-identifier, where i is in the range 1 through 16. Each bit of this bit mask specifies whether or not the corresponding sub-identifiers must match when determining if an OBJECT IDENTIFIER matches this family of filter subtrees; a '1' indicates that an exact match must occur; a '0' indicates 'wild card', i.e., any sub-identifier value matches. Thus, the OBJECT IDENTIFIER X of an object instance is contained in a family of filter subtrees if, for each sub-identifier of the value of snmpNotifyFilterSubtree, either: the i-th bit of snmpNotifyFilterMask is 0, or the i-th sub-identifier of X is equal to the i-th sub-identifier of the value of snmpNotifyFilterSubtree. If the value of this bit mask is M bits long and there are more than M sub-identifiers in the corresponding instance of snmpNotifyFilterSubtree, then the bit mask is extended with 1's to be the required length. Note that when the value of this object is the zero-length string, this extension rule results in a mask of all-1's being used (i.e., no 'wild card'), and the family of filter subtrees is the one subtree uniquely identified by the corresponding instance of snmpNotifyFilterSubtree. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 1 * readable 1 iscolumn 1 ranges 1 hashint 0 * settable 1 * defval: 0 * * Ranges: 0 - 16; * * Its syntax is OCTETSTR (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 16) *//** * Check that the proposed new value is potentially valid. * * @param rowreq_ctx * Pointer to the row request context. * @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 * * @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). *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -