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

📄 snmpnotifyfiltertable.c

📁 开发snmp的开发包有两个开放的SNMP开发库
💻 C
📖 第 1 页 / 共 5 页
字号:
/** * @internal * set row context indexes * * @param rowreq_ctx the row context that needs updated indexes * @param snmpNotifyFilterProfileName_val_ptr * @param snmpNotifyFilterProfileName_val_ptr_len * @param snmpNotifyFilterSubtree_val_ptr * @param snmpNotifyFilterSubtree_val_ptr_len * * @retval MFD_SUCCESS     : success. * @retval MFD_ERROR       : other error. * * @remark *  This function sets the mib indexs, then updates the oid indexs *  from the mib index. */intsnmpNotifyFilterTable_indexes_set(snmpNotifyFilterTable_rowreq_ctx *                                  rowreq_ctx, char                                  *snmpNotifyFilterProfileName_val_ptr,                                  size_t                                  snmpNotifyFilterProfileName_val_ptr_len,                                  oid * snmpNotifyFilterSubtree_val_ptr,                                  size_t                                  snmpNotifyFilterSubtree_val_ptr_len){    DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_indexes_set", "called\n"));    if (MFD_SUCCESS !=        snmpNotifyFilterTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx,                                                  snmpNotifyFilterProfileName_val_ptr,                                                  snmpNotifyFilterProfileName_val_ptr_len,                                                  snmpNotifyFilterSubtree_val_ptr,                                                  snmpNotifyFilterSubtree_val_ptr_len))        return MFD_ERROR;    /*     * convert mib index to oid index     */    rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);    if (0 != snmpNotifyFilterTable_index_to_oid(&rowreq_ctx->oid_idx,                                                &rowreq_ctx->tbl_idx)) {        return MFD_ERROR;    }    return MFD_SUCCESS;}                               /* snmpNotifyFilterTable_indexes_set *//*--------------------------------------------------------------------- * 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) *//** * Extract the current value of the snmpNotifyFilterMask data. * * Set a value using the data context for the row. * * @param rowreq_ctx *        Pointer to the row request context. * @param snmpNotifyFilterMask_val_ptr_ptr *        Pointer to storage for a char variable * @param snmpNotifyFilterMask_val_ptr_len_ptr *        Pointer to a size_t. On entry, it will contain the size (in bytes) *        pointed to by snmpNotifyFilterMask. *        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 (*snmpNotifyFilterMask_val_ptr_len_ptr) bytes of memory, *       allocate it using malloc() and update snmpNotifyFilterMask_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.) */intsnmpNotifyFilterMask_get(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,                         char **snmpNotifyFilterMask_val_ptr_ptr,                         size_t * snmpNotifyFilterMask_val_ptr_len_ptr){   /** we should have a non-NULL pointer and enough storage */    netsnmp_assert((NULL != snmpNotifyFilterMask_val_ptr_ptr)                   && (NULL != *snmpNotifyFilterMask_val_ptr_ptr));    netsnmp_assert(NULL != snmpNotifyFilterMask_val_ptr_len_ptr);    DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterMask_get",                "called\n"));    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:231:o: |-> Extract the current value of the snmpNotifyFilterMask data.     * copy (* snmpNotifyFilterMask_val_ptr_ptr ) data and (* snmpNotifyFilterMask_val_ptr_len_ptr ) from rowreq_ctx->data     */    /*     * make sure there is enough space for snmpNotifyFilterMask data     */    if ((NULL == (*snmpNotifyFilterMask_val_ptr_ptr)) ||        ((*snmpNotifyFilterMask_val_ptr_len_ptr) <         (rowreq_ctx->data.snmpNotifyFilterMask_len *          sizeof(rowreq_ctx->data.snmpNotifyFilterMask[0])))) {        /*         * allocate space for snmpNotifyFilterMask data         */        (*snmpNotifyFilterMask_val_ptr_ptr) =            malloc(rowreq_ctx->data.snmpNotifyFilterMask_len *                   sizeof(rowreq_ctx->data.snmpNotifyFilterMask[0]));        if (NULL == (*snmpNotifyFilterMask_val_ptr_ptr)) {            snmp_log(LOG_ERR, "could not allocate memory\n");            return MFD_ERROR;        }    }    (*snmpNotifyFilterMask_val_ptr_len_ptr) =        rowreq_ctx->data.snmpNotifyFilterMask_len *        sizeof(rowreq_ctx->data.snmpNotifyFilterMask[0]);    memcpy((*snmpNotifyFilterMask_val_ptr_ptr),           rowreq_ctx->data.snmpNotifyFilterMask,           rowreq_ctx->data.snmpNotifyFilterMask_len *           sizeof(rowreq_ctx->data.snmpNotifyFilterMask[0]));    return MFD_SUCCESS;}                               /* snmpNotifyFilterMask_get *//*--------------------------------------------------------------------- * 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) *//** * Extract the current value of the snmpNotifyFilterType data. * * Set a value using the data context for the row. * * @param rowreq_ctx *        Pointer to the row request context. * @param snmpNotifyFilterType_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 */intsnmpNotifyFilterType_get(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,                         u_long * snmpNotifyFilterType_val_ptr){   /** we should have a non-NULL pointer */    netsnmp_assert(NULL != snmpNotifyFilterType_val_ptr);    DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterType_get",                "called\n"));    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:231:o: |-> Extract the current value of the snmpNotifyFilterType data.     * copy (* snmpNotifyFilterType_val_ptr ) from rowreq_ctx->data     */    (*snmpNotifyFilterType_val_ptr) =        rowreq_ctx->data.snmpNotifyFilterType;    return MFD_SUCCESS;}                               /* snmpNotifyFilterType_get *//*--------------------------------------------------------------------- * 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) *//** * Extract the current value of the snmpNotifyFilterStorageType data. * * Set a value using the data context for the row. * * @param rowreq_ctx *        Pointer to the row request context. * @param snmpNotifyFilterStorageType_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 */intsnmpNotifyFilterStorageType_get(snmpNotifyFilterTable_rowreq_ctx *                                rowreq_ctx,                                u_long *                                snmpNotifyFilterStorageType_val_ptr){   /** we should have a non-NULL pointer */    netsnmp_assert(NULL != snmpNotifyFilterStorageType_val_ptr);    DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterStorageType_get", "called\n"));    netsnmp_assert(NULL != rowreq_ctx);    /*     * TODO:231:o: |-> Extract the current value of the snmpNotifyFilterStorageType data.     * copy (* snmpNotifyFilterStorageType_val_ptr ) from rowreq_ctx->data     */    (*snmpNotifyFilterStorageType_val_ptr) =        rowreq_ctx->data.snmpNotifyFilterStorageType;    return MFD_SUCCESS;}                               /* snmpNotifyFilterStorageType_get *//*--------------------------------------------------------------------- * SNMP-NOTIFICATION-MIB::snmpNotifyFilterEntry.snmpNotifyFilterRowStatus * snmpNotifyFilterRowStatus is subid 5 of snmpNotifyFilterEntry. * Its status is Current, and its access level is Create. * OID: .1.3.6.1.6.3.13.1.3.1.5 * Description:The status of this conceptual row.         To create a row in this table, a manager must         set this object to either createAndGo(4) or         createAndWait(5). * * Attributes: *   accessible 1     isscalar 0     enums  1      hasdefval 0 *   readable   1     iscolumn 1     ranges 0      hashint   0 *   settable   1 * * Enum range: 3/8. Values:  active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6) * * Its syntax is RowStatus (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 snmpNotifyFilterRowStatus data. * * Set a value using the data context for the row. * * @param rowreq_ctx *        Pointer to the row request context. * @param snmpNotifyFilterRowStatus_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 */intsnmpNotifyFilterRowStatus_get(snmpNotifyFilterTable_rowreq_ctx *                              rowreq_ctx,                              u_long * snmpNotifyFilterRowStatus_val_ptr){   /** we should have a non-NULL pointer */    netsnmp_assert(NULL != snmpNotifyFilterRowStatus_val_ptr);    (*snmpNotifyFilterRowStatus_val_ptr) =        rowreq_ctx->data.snmpNotifyFilterRowStatus;    return MFD_SUCCESS;}                               /* snmpNotifyFilterRowStatus_get *//** @} *//********************************************************************** ********************************************************************** *** *** Table snmpNotifyFilterTable *** ********************************************************************** **********************************************************************//*

⌨️ 快捷键说明

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