diff options
Diffstat (limited to 'agent/mibgroup/snmp-notification-mib')
8 files changed, 6396 insertions, 0 deletions
diff --git a/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable.h b/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable.h new file mode 100644 index 0000000..f9b6173 --- /dev/null +++ b/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable.h @@ -0,0 +1 @@ +config_require(snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable) diff --git a/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable.c b/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable.c new file mode 100644 index 0000000..d1c575f --- /dev/null +++ b/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable.c @@ -0,0 +1,1933 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.48 $ of : mfd-top.m2c,v $ + * + * $Id$ + */ +/** \page MFD helper for snmpNotifyFilterTable + * + * \section intro Introduction + * Introductory text. + * + */ +/* + * standard Net-SNMP includes + */ +#include <net-snmp/net-snmp-config.h> +#include <net-snmp/net-snmp-features.h> +#include <net-snmp/net-snmp-includes.h> +#include <net-snmp/agent/net-snmp-agent-includes.h> + +/* + * include our parent header + */ +#include "snmpNotifyFilterTable.h" + +#include <net-snmp/agent/mib_modules.h> + +#include "snmpNotifyFilterTable_interface.h" + +netsnmp_feature_require(check_storage_transition) + +const oid snmpNotifyFilterTable_oid[] = + { SNMPNOTIFYFILTERTABLE_OID }; +const int snmpNotifyFilterTable_oid_size = +OID_LENGTH(snmpNotifyFilterTable_oid); + +snmpNotifyFilterTable_registration snmpNotifyFilterTable_user_context; +static snmpNotifyFilterTable_registration *snmpNotifyFilterTable_user_context_p; + +void initialize_table_snmpNotifyFilterTable(void); +void shutdown_table_snmpNotifyFilterTable(void); + + +/** + * Initializes the snmpNotifyFilterTable module + */ +void +init_snmpNotifyFilterTable(void) +{ + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:init_snmpNotifyFilterTable", + "called\n")); + + /* + * TODO:300:o: Perform snmpNotifyFilterTable one-time module initialization. + */ + + /* + * here we initialize all the tables we're planning on supporting + */ + if (should_init("snmpNotifyFilterTable")) + initialize_table_snmpNotifyFilterTable(); + +} /* init_snmpNotifyFilterTable */ + +/** + * Shut-down the snmpNotifyFilterTable module (agent is exiting) + */ +void +shutdown_snmpNotifyFilterTable(void) +{ + if (should_init("snmpNotifyFilterTable")) + shutdown_table_snmpNotifyFilterTable(); + +} + +/** + * Initialize the table snmpNotifyFilterTable + * (Define its contents and how it's structured) + */ +void +initialize_table_snmpNotifyFilterTable(void) +{ + u_long flags; + + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:initialize_table_snmpNotifyFilterTable", "called\n")); + + /* + * TODO:301:o: Perform snmpNotifyFilterTable one-time table initialization. + */ + + /* + * TODO:302:o: |->Initialize snmpNotifyFilterTable user context + * if you'd like to pass in a pointer to some data for this + * table, allocate or set it up here. + */ + /* + * a netsnmp_data_list is a simple way to store void pointers. A simple + * string token is used to add, find or remove pointers. + */ + snmpNotifyFilterTable_user_context_p = + netsnmp_create_data_list("snmpNotifyFilterTable", NULL, NULL); + + /* + * No support for any flags yet, but in the future you would + * set any flags here. + */ + flags = 0; + + /* + * call interface initialization code + */ + _snmpNotifyFilterTable_initialize_interface + (snmpNotifyFilterTable_user_context_p, flags); +} /* initialize_table_snmpNotifyFilterTable */ + +/** + * Shutdown the table snmpNotifyFilterTable + */ +void +shutdown_table_snmpNotifyFilterTable(void) +{ + /* + * call interface shutdown code + */ + _snmpNotifyFilterTable_shutdown_interface + (snmpNotifyFilterTable_user_context_p); + netsnmp_free_all_list_data(snmpNotifyFilterTable_user_context_p); + snmpNotifyFilterTable_user_context_p = NULL; +} + +/** + * extra context initialization (eg default values) + * + * @param rowreq_ctx : row request context + * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate) + * + * @retval MFD_SUCCESS : no errors + * @retval MFD_ERROR : error (context allocate will fail) + */ +int +snmpNotifyFilterTable_rowreq_ctx_init(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx, void *user_init_ctx) +{ + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_rowreq_ctx_init", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:210:o: |-> Perform extra snmpNotifyFilterTable rowreq initialization. (eg DEFVALS) + */ + /* + * strings and oids are hard to handle automagically. + * so all we've got for you is a hint: + * + * memcpy(rowreq_ctx->data.snmpNotifyFilterMask, 0, + * len(0) * sizeof(snmpNotifyFilterMask[0]); + */ + + rowreq_ctx->data.snmpNotifyFilterType = SNMPNOTIFYFILTERTYPE_INCLUDED; + + rowreq_ctx->data.snmpNotifyFilterStorageType = STORAGETYPE_NONVOLATILE; + + + return MFD_SUCCESS; +} /* snmpNotifyFilterTable_rowreq_ctx_init */ + +/** + * extra context cleanup + * @param rowreq_ctx + */ +void +snmpNotifyFilterTable_rowreq_ctx_cleanup(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx) +{ + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_rowreq_ctx_cleanup", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:211:o: |-> Perform extra snmpNotifyFilterTable rowreq cleanup. + */ +} /* snmpNotifyFilterTable_rowreq_ctx_cleanup */ + +/************************************************************ + * the *_should_save routine is called to determine if a row + * should be stored persistently. + * + * Note that this is not a 'dirty' check (i.e. if a row has changed), + * but a check for volatile rows that should not be saved between + * restarts. + * @param rowreq_ctx + * @retval 1 if the row should be stored + * @retval 0 if the row should not be stored + */ +int + + + + + + + + + + + + + + + + snmpNotifyFilterTable_container_should_save + (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx) { + if (SNMP_STORAGE_VOLATILE == + rowreq_ctx->data.snmpNotifyFilterStorageType) + return 0; + + return 1; /* save the row */ +} + +/** + * pre-request callback + * + * @param user_context + * @retval MFD_SUCCESS : success. + * @retval MFD_ERROR : other error + */ +int +snmpNotifyFilterTable_pre_request(snmpNotifyFilterTable_registration * + user_context) +{ + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_pre_request", "called\n")); + + /* + * TODO:510:o: Perform snmpNotifyFilterTable pre-request actions. + */ + + return MFD_SUCCESS; +} /* snmpNotifyFilterTable_pre_request */ + +/** + * post-request callback + * + * Note: + * New rows have been inserted into the container, and + * deleted rows have been removed from the container and + * released. + * @param user_context + * @param rc : MFD_SUCCESS if all requests succeeded + * + * @retval MFD_SUCCESS : success. + * @retval MFD_ERROR : other error (ignored) + */ +int +snmpNotifyFilterTable_post_request(snmpNotifyFilterTable_registration * + user_context, int rc) +{ + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_post_request", "called\n")); + + /* + * TODO:511:o: Perform snmpNotifyFilterTable post-request actions. + */ + + /* + * check to set if any rows were changed. + */ + if (snmpNotifyFilterTable_dirty_get()) { + /* + * check if request was successful. If so, this would be + * a good place to save data to its persistent store. + */ + if (MFD_SUCCESS == rc) { + /* + * notify library to save changed rows + */ + snmp_store_needed(netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, + NETSNMP_DS_LIB_APPTYPE)); + } + + snmpNotifyFilterTable_dirty_set(0); /* clear table dirty flag */ + } + + return MFD_SUCCESS; +} /* snmpNotifyFilterTable_post_request */ + + +/********************************************************************** + ********************************************************************** + *** + *** Table snmpNotifyFilterTable + *** + ********************************************************************** + **********************************************************************/ +/* + * 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 + */ + +/* + * --------------------------------------------------------------------- + * * TODO:200:r: Implement snmpNotifyFilterTable data context functions. + */ + + +/** + * set mib index(es) + * + * @param tbl_idx mib index structure + * @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 convenience function is useful for setting all the MIB index + * components with a single function call. It is assume that the C values + * have already been mapped from their native/rawformat to the MIB format. + */ +int +snmpNotifyFilterTable_indexes_set_tbl_idx(snmpNotifyFilterTable_mib_index * + tbl_idx, 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_tbl_idx", "called\n")); + + /* + * snmpNotifyFilterProfileName(1)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H + */ + tbl_idx->snmpNotifyFilterProfileName_len = sizeof(tbl_idx->snmpNotifyFilterProfileName) / sizeof(tbl_idx->snmpNotifyFilterProfileName[0]); /* max length */ + /* + * make sure there is enough space for snmpNotifyFilterProfileName data + */ + if ((NULL == tbl_idx->snmpNotifyFilterProfileName) || + (tbl_idx->snmpNotifyFilterProfileName_len < + (snmpNotifyFilterProfileName_val_ptr_len))) { + snmp_log(LOG_ERR, "not enough space for value\n"); + return MFD_ERROR; + } + tbl_idx->snmpNotifyFilterProfileName_len = + snmpNotifyFilterProfileName_val_ptr_len; + memcpy(tbl_idx->snmpNotifyFilterProfileName, + snmpNotifyFilterProfileName_val_ptr, + snmpNotifyFilterProfileName_val_ptr_len * + sizeof(snmpNotifyFilterProfileName_val_ptr[0])); + + /* + * snmpNotifyFilterSubtree(1)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h + */ + tbl_idx->snmpNotifyFilterSubtree_len = sizeof(tbl_idx->snmpNotifyFilterSubtree) / sizeof(tbl_idx->snmpNotifyFilterSubtree[0]); /* max length */ + /* + * make sure there is enough space for snmpNotifyFilterSubtree data + */ + if ((NULL == tbl_idx->snmpNotifyFilterSubtree) || + (tbl_idx->snmpNotifyFilterSubtree_len < + (snmpNotifyFilterSubtree_val_ptr_len))) { + snmp_log(LOG_ERR, "not enough space for value\n"); + return MFD_ERROR; + } + tbl_idx->snmpNotifyFilterSubtree_len = + snmpNotifyFilterSubtree_val_ptr_len; + memcpy(tbl_idx->snmpNotifyFilterSubtree, + snmpNotifyFilterSubtree_val_ptr, + snmpNotifyFilterSubtree_val_ptr_len * + sizeof(snmpNotifyFilterSubtree_val_ptr[0])); + + + return MFD_SUCCESS; +} /* snmpNotifyFilterTable_indexes_set_tbl_idx */ + +/** + * @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. + */ +int +snmpNotifyFilterTable_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.) + */ +int +snmpNotifyFilterMask_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) = (char*) + 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 + */ +int +snmpNotifyFilterType_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 + */ +int +snmpNotifyFilterStorageType_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 + */ +int +snmpNotifyFilterRowStatus_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 + *** + ********************************************************************** + **********************************************************************/ +/* + * 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. + */ +int +snmpNotifyFilterTable_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. + */ +int +snmpNotifyFilterTable_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 + */ +int +snmpNotifyFilterTable_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 + */ +int +snmpNotifyFilterTable_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 + */ +int +snmpNotifyFilterTable_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). + * + *@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. + * + */ +int +snmpNotifyFilterMask_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. + */ +int +snmpNotifyFilterMask_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 + */ +int +snmpNotifyFilterMask_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. + */ +int +snmpNotifyFilterMask_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. + * + */ +int +snmpNotifyFilterType_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. + */ +int +snmpNotifyFilterType_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. + */ +int +snmpNotifyFilterType_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. + */ +int +snmpNotifyFilterType_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 + * 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 other(1), volatile(2), nonVolatile(3), permanent(4), readOnly(5) + * + * If there a no other checks you need to do, simply return MFD_SUCCESS. + * + */ +int +snmpNotifyFilterStorageType_check_value(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx, + u_long + snmpNotifyFilterStorageType_val) +{ + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterStorageType_check_value", "called\n")); + + /** should never get a NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:441:o: |-> Check for valid snmpNotifyFilterStorageType value. + */ + + return MFD_SUCCESS; /* snmpNotifyFilterStorageType value not illegal */ +} /* snmpNotifyFilterStorageType_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. + */ +int +snmpNotifyFilterStorageType_undo_setup(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx) +{ + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterStorageType_undo_setup", "called\n")); + + /** should never get a NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:455:o: |-> Setup snmpNotifyFilterStorageType undo. + */ + /* + * copy snmpNotifyFilterStorageType data + * set rowreq_ctx->undo->snmpNotifyFilterStorageType from rowreq_ctx->data.snmpNotifyFilterStorageType + */ + rowreq_ctx->undo->snmpNotifyFilterStorageType = + rowreq_ctx->data.snmpNotifyFilterStorageType; + + + return MFD_SUCCESS; +} /* snmpNotifyFilterStorageType_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 snmpNotifyFilterStorageType_val + * A long containing the new value. + */ +int +snmpNotifyFilterStorageType_set(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx, + u_long snmpNotifyFilterStorageType_val) +{ + + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterStorageType_set", "called\n")); + + /** should never get a NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:461:M: |-> Set snmpNotifyFilterStorageType value. + * set snmpNotifyFilterStorageType value in rowreq_ctx->data + */ + rowreq_ctx->data.snmpNotifyFilterStorageType = + snmpNotifyFilterStorageType_val; + + return MFD_SUCCESS; +} /* snmpNotifyFilterStorageType_set */ + +/** + * undo the previous set. + * + * @param rowreq_ctx + * Pointer to the users context. + */ +int +snmpNotifyFilterStorageType_undo(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx) +{ + + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterStorageType_undo", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:456:o: |-> Clean up snmpNotifyFilterStorageType undo. + */ + /* + * copy snmpNotifyFilterStorageType data + * set rowreq_ctx->data.snmpNotifyFilterStorageType from rowreq_ctx->undo->snmpNotifyFilterStorageType + */ + rowreq_ctx->data.snmpNotifyFilterStorageType = + rowreq_ctx->undo->snmpNotifyFilterStorageType; + + + return MFD_SUCCESS; +} /* snmpNotifyFilterStorageType_undo */ + +/*--------------------------------------------------------------------- + * 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) + */ +/** + * Check that the proposed new value is potentially valid. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param snmpNotifyFilterRowStatus_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 active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6) + * + * If there a no other checks you need to do, simply return MFD_SUCCESS. + * + */ +int +snmpNotifyFilterRowStatus_check_value(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx, + u_long snmpNotifyFilterRowStatus_val) +{ + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterRowStatus_check_value", "called\n")); + + /** should never get a NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:441:o: |-> Check for valid snmpNotifyFilterRowStatus value. + */ + + return MFD_SUCCESS; /* snmpNotifyFilterRowStatus value not illegal */ +} /* snmpNotifyFilterRowStatus_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. + */ +int +snmpNotifyFilterRowStatus_undo_setup(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx) +{ + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterRowStatus_undo_setup", "called\n")); + + /** should never get a NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:455:o: |-> Setup snmpNotifyFilterRowStatus undo. + */ + /* + * copy snmpNotifyFilterRowStatus data + * set rowreq_ctx->undo->snmpNotifyFilterRowStatus from rowreq_ctx->data.snmpNotifyFilterRowStatus + */ + rowreq_ctx->undo->snmpNotifyFilterRowStatus = + rowreq_ctx->data.snmpNotifyFilterRowStatus; + + + return MFD_SUCCESS; +} /* snmpNotifyFilterRowStatus_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 snmpNotifyFilterRowStatus_val + * A long containing the new value. + */ +int +snmpNotifyFilterRowStatus_set(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx, + u_long snmpNotifyFilterRowStatus_val) +{ + + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterRowStatus_set", "called\n")); + + /** should never get a NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:461:M: |-> Set snmpNotifyFilterRowStatus value. + * set snmpNotifyFilterRowStatus value in rowreq_ctx->data + */ + rowreq_ctx->data.snmpNotifyFilterRowStatus = + snmpNotifyFilterRowStatus_val; + + return MFD_SUCCESS; +} /* snmpNotifyFilterRowStatus_set */ + +/** + * undo the previous set. + * + * @param rowreq_ctx + * Pointer to the users context. + */ +int +snmpNotifyFilterRowStatus_undo(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx) +{ + + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterRowStatus_undo", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:456:o: |-> Clean up snmpNotifyFilterRowStatus undo. + */ + /* + * copy snmpNotifyFilterRowStatus data + * set rowreq_ctx->data.snmpNotifyFilterRowStatus from rowreq_ctx->undo->snmpNotifyFilterRowStatus + */ + rowreq_ctx->data.snmpNotifyFilterRowStatus = + rowreq_ctx->undo->snmpNotifyFilterRowStatus; + + + return MFD_SUCCESS; +} /* snmpNotifyFilterRowStatus_undo */ + +/** + * check dependencies + * + * This is useful for for tables which have dependencies between columns + * (or rows, or tables). For example, two columns allocating a percentage + * of something add up 100%. + * + * 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. + * + * @retval MFD_SUCCESS all the changes to the row are legal + * @retval MFD_ERROR one or more changes are not legal + * + * (see README-table-snmpNotifyFilterTable if you don't have dependencies) + */ +int +snmpNotifyFilterTable_check_dependencies(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx) +{ + int rc = MFD_SUCCESS; + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:snmpNotifyFilterTable_check_dependencies", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:470:o: Check snmpNotifyFilterTable row dependencies. + * check that all new value are legal and consistent with each other + */ + /* + * check for valid StorageType transition (old, new) + */ + rc = check_storage_transition(rowreq_ctx->undo-> + snmpNotifyFilterStorageType, + rowreq_ctx->data. + snmpNotifyFilterStorageType); + if (MFD_SUCCESS != rc) + return rc; + + /* + * check RowStatus dependencies + */ + if (rowreq_ctx-> + column_set_flags & COLUMN_SNMPNOTIFYFILTERROWSTATUS_FLAG) { + /* + * check for valid RowStatus transition (old, new) + * (Note: move transition check to + * to catch errors earlier) + */ + rc = check_rowstatus_transition(rowreq_ctx->undo-> + snmpNotifyFilterRowStatus, + rowreq_ctx->data. + snmpNotifyFilterRowStatus); + if (MFD_SUCCESS != rc) + return rc; + + /* + * row creation requirements + */ + if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) { + if (ROWSTATUS_DESTROY == + rowreq_ctx->data.snmpNotifyFilterRowStatus) { + rowreq_ctx->rowreq_flags |= MFD_ROW_DELETED; + } else if (ROWSTATUS_CREATEANDGO == + rowreq_ctx->data.snmpNotifyFilterRowStatus) { + if ((rowreq_ctx-> + column_set_flags & + SNMPNOTIFYFILTERTABLE_REQUIRED_COLS) + != SNMPNOTIFYFILTERTABLE_REQUIRED_COLS) { + DEBUGMSGTL(("snmpNotifyFilterTable", + "required columns missing (0x%0x != 0x%0x)\n", + rowreq_ctx->column_set_flags, + SNMPNOTIFYFILTERTABLE_REQUIRED_COLS)); + return MFD_CANNOT_CREATE_NOW; + } + rowreq_ctx->data.snmpNotifyFilterRowStatus = + ROWSTATUS_ACTIVE; + } + } /* row creation */ + else { + /* + * row change requirements + */ + /* + * don't allow a destroy if any other value was changed, since + * that might call data access routines with bad info. + * + * you may or may not require the row be notInService before it + * can be destroyed. + */ + if (ROWSTATUS_DESTROY == + rowreq_ctx->data.snmpNotifyFilterRowStatus) { + if (rowreq_ctx-> + column_set_flags & + ~COLUMN_SNMPNOTIFYFILTERROWSTATUS_FLAG) { + DEBUGMSGTL(("snmpNotifyFilterTable", + "destroy must be only varbind for row\n")); + return MFD_NOT_VALID_NOW; + } + rowreq_ctx->rowreq_flags |= MFD_ROW_DELETED; + + } /* row destroy */ + } /* row change */ + } else { + /* + * must have row status to create a row + */ + if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) { + DEBUGMSGTL(("snmpNotifyFilterTable", + "must use RowStatus to create rows\n")); + return MFD_CANNOT_CREATE_NOW; + } + } /* row status not set */ + + if (MFD_SUCCESS != rc) + return rc; + + return rc; +} /* snmpNotifyFilterTable_check_dependencies */ + +/** @} */ +/** @{ */ diff --git a/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable.h b/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable.h new file mode 100644 index 0000000..3ff2f94 --- /dev/null +++ b/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable.h @@ -0,0 +1,933 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.48 $ of : mfd-top.m2c,v $ + * + * $Id$ + */ +#ifndef SNMPNOTIFYFILTERTABLE_H +#define SNMPNOTIFYFILTERTABLE_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/** @addtogroup misc misc: Miscellaneous routines + * + * @{ + */ +#include <net-snmp/library/asn1.h> + + /* + * other required module components + */ + /* *INDENT-OFF* */ +config_require(snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_interface) +config_require(snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_data_access) + /* *INDENT-ON* */ + + /* + * OID, column number and enum definions for snmpNotifyFilterTable + */ +#include "snmpNotifyFilterTable_constants.h" + + /* + ********************************************************************* + * function declarations + */ + void init_snmpNotifyFilterTable(void); + void shutdown_snmpNotifyFilterTable(void); + + /* + ********************************************************************* + * Table declarations + */ +/********************************************************************** + ********************************************************************** + *** + *** Table snmpNotifyFilterTable + *** + ********************************************************************** + **********************************************************************/ + /* + * 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 + */ + /* + ********************************************************************* + * When you register your mib, you get to provide a generic + * pointer that will be passed back to you for most of the + * functions calls. + * + * TODO:100:r: Review all context structures + */ + /* + * TODO:101:o: |-> Review snmpNotifyFilterTable registration context. + */ + typedef netsnmp_data_list snmpNotifyFilterTable_registration; + +/**********************************************************************/ + /* + * TODO:110:r: |-> Review snmpNotifyFilterTable data context structure. + * This structure is used to represent the data for snmpNotifyFilterTable. + */ + /* + * This structure contains storage for all the columns defined in the + * snmpNotifyFilterTable. + */ + typedef struct snmpNotifyFilterTable_data_s { + + /* + * snmpNotifyFilterMask(2)/OCTETSTR/ASN_OCTET_STR/char(char)//L/A/W/e/R/D/h + */ + char snmpNotifyFilterMask[16]; + size_t snmpNotifyFilterMask_len; /* # of char elements, not bytes */ + + /* + * snmpNotifyFilterType(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h + */ + u_long snmpNotifyFilterType; + + /* + * snmpNotifyFilterStorageType(4)/StorageType/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h + */ + u_long snmpNotifyFilterStorageType; + + /* + * snmpNotifyFilterRowStatus(5)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h + */ + u_long snmpNotifyFilterRowStatus; + + } snmpNotifyFilterTable_data; + + + /* + ********************************************************************* + * TODO:115:o: |-> Review snmpNotifyFilterTable undo context. + * We're just going to use the same data structure for our + * undo_context. If you want to do something more efficent, + * define your typedef here. + */ + typedef snmpNotifyFilterTable_data snmpNotifyFilterTable_undo_data; + + /* + * TODO:120:r: |-> Review snmpNotifyFilterTable mib index. + * This structure is used to represent the index for snmpNotifyFilterTable. + */ + typedef struct snmpNotifyFilterTable_mib_index_s { + + /* + * snmpNotifyFilterProfileName(1)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H + */ + char snmpNotifyFilterProfileName[32]; + size_t snmpNotifyFilterProfileName_len; + + /* + * snmpNotifyFilterSubtree(1)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h + */ + /** 128 - 1(other indexes) - oid length(11) = 115 */ + oid snmpNotifyFilterSubtree[115]; + size_t snmpNotifyFilterSubtree_len; + + + } snmpNotifyFilterTable_mib_index; + + /* + * TODO:121:r: | |-> Review snmpNotifyFilterTable max index length. + * If you KNOW that your indexes will never exceed a certain + * length, update this macro to that length. + * + * BE VERY CAREFUL TO TAKE INTO ACCOUNT THE MAXIMUM + * POSSIBLE LENGHT FOR EVERY VARIABLE LENGTH INDEX! + * Guessing 128 - col/entry(2) - oid len(9) + */ +#define MAX_snmpNotifyFilterTable_IDX_LEN 117 + + + /* + ********************************************************************* + * TODO:130:o: |-> Review snmpNotifyFilterTable Row request (rowreq) context. + * When your functions are called, you will be passed a + * snmpNotifyFilterTable_rowreq_ctx pointer. + */ + typedef struct snmpNotifyFilterTable_rowreq_ctx_s { + + /** this must be first for container compare to work */ + netsnmp_index oid_idx; + oid oid_tmp[MAX_snmpNotifyFilterTable_IDX_LEN]; + + snmpNotifyFilterTable_mib_index tbl_idx; + + snmpNotifyFilterTable_data data; + snmpNotifyFilterTable_undo_data *undo; + unsigned int column_set_flags; /* flags for set columns */ + + + /* + * flags per row. Currently, the first (lower) 8 bits are reserved + * for the user. See mfd.h for other flags. + */ + u_int rowreq_flags; + + /* + * TODO:131:o: | |-> Add useful data to snmpNotifyFilterTable rowreq context. + */ + + /* + * storage for future expansion + */ + netsnmp_data_list *snmpNotifyFilterTable_data_list; + + } snmpNotifyFilterTable_rowreq_ctx; + + typedef struct snmpNotifyFilterTable_ref_rowreq_ctx_s { + snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx; + } snmpNotifyFilterTable_ref_rowreq_ctx; + + /* + ********************************************************************* + * function prototypes + */ + int + + + + + + + + + + + + + + + + snmpNotifyFilterTable_pre_request + (snmpNotifyFilterTable_registration * user_context); + int + + + + + + + + + + + + + + + + snmpNotifyFilterTable_post_request + (snmpNotifyFilterTable_registration * user_context, int rc); + + int + + + + + + + + + + + + + + + + snmpNotifyFilterTable_rowreq_ctx_init + (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx, + void *user_init_ctx); + void + + + + + + + + + + + + + + + + snmpNotifyFilterTable_rowreq_ctx_cleanup + (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx); + + int + + + + + + + + + + + + + + + + snmpNotifyFilterTable_check_dependencies + (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx); + int + + + + + + + + + + + + + + + + snmpNotifyFilterTable_commit(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx); + + + + + + + + snmpNotifyFilterTable_rowreq_ctx + * snmpNotifyFilterTable_row_find_by_mib_index + (snmpNotifyFilterTable_mib_index * mib_idx); + + extern const oid snmpNotifyFilterTable_oid[]; + extern const int snmpNotifyFilterTable_oid_size; + + +#include "snmpNotifyFilterTable_interface.h" +#include "snmpNotifyFilterTable_data_access.h" + /* + ********************************************************************* + * GET function declarations + */ + + /* + ********************************************************************* + * GET Table declarations + */ +/********************************************************************** + ********************************************************************** + *** + *** Table snmpNotifyFilterTable + *** + ********************************************************************** + **********************************************************************/ + /* + * 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 + */ + /* + * indexes + */ + + int + + + + + + + + + + + + + + + + snmpNotifyFilterMask_get(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx, + char **snmpNotifyFilterMask_val_ptr_ptr, + size_t + * snmpNotifyFilterMask_val_ptr_len_ptr); + int + + + + + + + + + + + + + + + + snmpNotifyFilterType_get(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx, + u_long * snmpNotifyFilterType_val_ptr); + int + + + + + + + + + + + + + + + + snmpNotifyFilterStorageType_get(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx, + u_long * + snmpNotifyFilterStorageType_val_ptr); + int + + + + + + + + + + + + + + + + snmpNotifyFilterRowStatus_get(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx, + u_long * + snmpNotifyFilterRowStatus_val_ptr); + + + int + + + + + + + + + + + + + + + + snmpNotifyFilterTable_indexes_set_tbl_idx + (snmpNotifyFilterTable_mib_index * tbl_idx, + char *snmpNotifyFilterProfileName_val_ptr, + size_t snmpNotifyFilterProfileName_val_ptr_len, + oid * snmpNotifyFilterSubtree_val_ptr, + size_t snmpNotifyFilterSubtree_val_ptr_len); + int + + + + + + + + + + + + + + + + snmpNotifyFilterTable_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); + + + + /* + ********************************************************************* + * SET function declarations + */ + + /* + ********************************************************************* + * SET Table declarations + */ +/********************************************************************** + ********************************************************************** + *** + *** Table snmpNotifyFilterTable + *** + ********************************************************************** + **********************************************************************/ + /* + * 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 + */ + + + int + + + + + + + + + + + + + + + + snmpNotifyFilterTable_undo_setup(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx); + int + + + + + + + + + + + + + + + + snmpNotifyFilterTable_undo_cleanup(snmpNotifyFilterTable_rowreq_ctx + * rowreq_ctx); + int + + + + + + + + + + + + + + + + snmpNotifyFilterTable_undo(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx); + int + + + + + + + + + + + + + + + + snmpNotifyFilterTable_commit(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx); + int + + + + + + + + + + + + + + + + snmpNotifyFilterTable_undo_commit(snmpNotifyFilterTable_rowreq_ctx + * rowreq_ctx); + + + int + + + + + + + + + + + + + + + + snmpNotifyFilterMask_check_value(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx, char + *snmpNotifyFilterMask_val_ptr, + size_t + snmpNotifyFilterMask_val_ptr_len); + int + + + + + + + + + + + + + + + + snmpNotifyFilterMask_undo_setup(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx); + int + + + + + + + + + + + + + + + + snmpNotifyFilterMask_set(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx, + char *snmpNotifyFilterMask_val_ptr, + size_t snmpNotifyFilterMask_val_ptr_len); + int + + + + + + + + + + + + + + + + snmpNotifyFilterMask_undo(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx); + + int + + + + + + + + + + + + + + + + snmpNotifyFilterType_check_value(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx, + u_long snmpNotifyFilterType_val); + int + + + + + + + + + + + + + + + + snmpNotifyFilterType_undo_setup(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx); + int + + + + + + + + + + + + + + + + snmpNotifyFilterType_set(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx, + u_long snmpNotifyFilterType_val); + int + + + + + + + + + + + + + + + + snmpNotifyFilterType_undo(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx); + + int + + + + + + + + + + + + + + + + snmpNotifyFilterStorageType_check_value + (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx, + u_long snmpNotifyFilterStorageType_val); + int + + + + + + + + + + + + + + + + snmpNotifyFilterStorageType_undo_setup + (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx); + int + + + + + + + + + + + + + + + + snmpNotifyFilterStorageType_set(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx, + u_long + snmpNotifyFilterStorageType_val); + int + + + + + + + + + + + + + + + + snmpNotifyFilterStorageType_undo(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx); + + int + + + + + + + + + + + + + + + + snmpNotifyFilterRowStatus_check_value + (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx, + u_long snmpNotifyFilterRowStatus_val); + int + + + + + + + + + + + + + + + + snmpNotifyFilterRowStatus_undo_setup + (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx); + int + + + + + + + + + + + + + + + + snmpNotifyFilterRowStatus_set(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx, + u_long + snmpNotifyFilterRowStatus_val); + int + + + + + + + + + + + + + + + + snmpNotifyFilterRowStatus_undo(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx); + + + int + + + + + + + + + + + + + + + + snmpNotifyFilterTable_check_dependencies + (snmpNotifyFilterTable_rowreq_ctx * ctx); + + + /* + * DUMMY markers, ignore + * + * TODO:099:x: ************************************************************* + * TODO:199:x: ************************************************************* + * TODO:299:x: ************************************************************* + * TODO:399:x: ************************************************************* + * TODO:499:x: ************************************************************* + */ + +#ifdef __cplusplus +} +#endif +#endif /* SNMPNOTIFYFILTERTABLE_H */ +/** @} */ + diff --git a/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_constants.h b/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_constants.h new file mode 100644 index 0000000..f0c0e60 --- /dev/null +++ b/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_constants.h @@ -0,0 +1,131 @@ +/* + * Note: this file originally auto-generated by mib2c using + * : generic-table-constants.m2c,v 1.5 2005/07/15 22:41:16 rstory Exp $ + * + * $Id$ + */ +#ifndef SNMPNOTIFYFILTERTABLE_CONSTANTS_H +#define SNMPNOTIFYFILTERTABLE_CONSTANTS_H + +#ifdef __cplusplus +extern "C" { +#endif + + + /* + * column number definitions for table snmpNotifyFilterTable + */ +#define SNMPNOTIFYFILTERTABLE_OID 1,3,6,1,6,3,13,1,3 + +#define COLUMN_SNMPNOTIFYFILTERSUBTREE 1 + +#define COLUMN_SNMPNOTIFYFILTERMASK 2 +#define COLUMN_SNMPNOTIFYFILTERMASK_FLAG (0x1 << 1) + +#define COLUMN_SNMPNOTIFYFILTERTYPE 3 +#define COLUMN_SNMPNOTIFYFILTERTYPE_FLAG (0x1 << 2) + +#define COLUMN_SNMPNOTIFYFILTERSTORAGETYPE 4 +#define COLUMN_SNMPNOTIFYFILTERSTORAGETYPE_FLAG (0x1 << 3) + +#define COLUMN_SNMPNOTIFYFILTERROWSTATUS 5 +#define COLUMN_SNMPNOTIFYFILTERROWSTATUS_FLAG (0x1 << 4) + + +#define SNMPNOTIFYFILTERTABLE_MIN_COL COLUMN_SNMPNOTIFYFILTERMASK +#define SNMPNOTIFYFILTERTABLE_MAX_COL COLUMN_SNMPNOTIFYFILTERROWSTATUS + + + /* + * TODO:405:r: Review SNMPNOTIFYFILTERTABLE_SETTABLE_COLS macro. + * OR together all the writable cols. + */ +#define SNMPNOTIFYFILTERTABLE_SETTABLE_COLS (COLUMN_SNMPNOTIFYFILTERMASK_FLAG | COLUMN_SNMPNOTIFYFILTERTYPE_FLAG | COLUMN_SNMPNOTIFYFILTERSTORAGETYPE_FLAG | COLUMN_SNMPNOTIFYFILTERROWSTATUS_FLAG) + /* + * TODO:405:r: Review SNMPNOTIFYFILTERTABLE_REQUIRED_COLS macro. + * OR together all the required rows for row creation. + * default is writable cols w/out defaults. + */ +#define SNMPNOTIFYFILTERTABLE_REQUIRED_COLS (COLUMN_SNMPNOTIFYFILTERROWSTATUS_FLAG) + + /* + * NOTES on enums + * ============== + * + * Value Mapping + * ------------- + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them + * below. For example, a boolean flag (1/0) is usually represented + * as a TruthValue in a MIB, which maps to the values (1/2). + * + */ +/************************************************************************* + ************************************************************************* + * + * enum definitions for table snmpNotifyFilterTable + * + ************************************************************************* + *************************************************************************/ + +/************************************************************* + * constants for enums for the MIB node + * snmpNotifyFilterType (INTEGER / ASN_INTEGER) + * + * since a Textual Convention may be referenced more than once in a + * MIB, protect againt redefinitions of the enum values. + */ +#ifndef SNMPNOTIFYFILTERTYPE_ENUMS +#define SNMPNOTIFYFILTERTYPE_ENUMS + +#define SNMPNOTIFYFILTERTYPE_INCLUDED 1 +#define SNMPNOTIFYFILTERTYPE_EXCLUDED 2 + +#endif /* SNMPNOTIFYFILTERTYPE_ENUMS */ + + +/************************************************************* + * constants for enums for the MIB node + * snmpNotifyFilterStorageType (StorageType / ASN_INTEGER) + * + * since a Textual Convention may be referenced more than once in a + * MIB, protect againt redefinitions of the enum values. + */ +#ifndef STORAGETYPE_ENUMS +#define STORAGETYPE_ENUMS + +#define STORAGETYPE_OTHER 1 +#define STORAGETYPE_VOLATILE 2 +#define STORAGETYPE_NONVOLATILE 3 +#define STORAGETYPE_PERMANENT 4 +#define STORAGETYPE_READONLY 5 + +#endif /* STORAGETYPE_ENUMS */ + + +/************************************************************* + * constants for enums for the MIB node + * snmpNotifyFilterRowStatus (RowStatus / ASN_INTEGER) + * + * since a Textual Convention may be referenced more than once in a + * MIB, protect againt redefinitions of the enum values. + */ +#ifndef ROWSTATUS_ENUMS +#define ROWSTATUS_ENUMS + +#define ROWSTATUS_ACTIVE 1 +#define ROWSTATUS_NOTINSERVICE 2 +#define ROWSTATUS_NOTREADY 3 +#define ROWSTATUS_CREATEANDGO 4 +#define ROWSTATUS_CREATEANDWAIT 5 +#define ROWSTATUS_DESTROY 6 + +#endif /* ROWSTATUS_ENUMS */ + + + + +#ifdef __cplusplus +} +#endif +#endif /* SNMPNOTIFYFILTERTABLE_OIDS_H */ diff --git a/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_data_access.c b/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_data_access.c new file mode 100644 index 0000000..942a865 --- /dev/null +++ b/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_data_access.c @@ -0,0 +1,591 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.17 $ of : mfd-data-access.m2c,v $ + * + * $Id$ + */ +/* + * standard Net-SNMP includes + */ +#include <net-snmp/net-snmp-config.h> +#include <net-snmp/net-snmp-features.h> +#include <net-snmp/net-snmp-includes.h> +#include <net-snmp/agent/net-snmp-agent-includes.h> +#include <net-snmp/library/vacm.h> + +/* + * include our parent header + */ +#include "snmpNotifyFilterTable.h" + + +#include "snmpNotifyFilterTable_data_access.h" + +netsnmp_feature_require(snmpNotifyFilterTable_container_get) + +/** @ingroup interface + * @addtogroup data_access data_access: Routines to access data + * + * These routines are used to locate the data used to satisfy + * requests. + * + * @{ + */ +/********************************************************************** + ********************************************************************** + *** + *** Table snmpNotifyFilterTable + *** + ********************************************************************** + **********************************************************************/ +/* + * 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 + */ + +/** + * initialization for snmpNotifyFilterTable data access + * + * This function is called during startup to allow you to + * allocate any resources you need for the data table. + * + * @param snmpNotifyFilterTable_reg + * Pointer to snmpNotifyFilterTable_registration + * + * @retval MFD_SUCCESS : success. + * @retval MFD_ERROR : unrecoverable error. + */ +int +snmpNotifyFilterTable_init_data(snmpNotifyFilterTable_registration * + snmpNotifyFilterTable_reg) +{ + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_init_data", "called\n")); + + /* + * TODO:303:o: Initialize snmpNotifyFilterTable data. + */ + + return MFD_SUCCESS; +} /* snmpNotifyFilterTable_init_data */ + +/** + * container overview + * + */ + +/** + * container initialization + * + * @param container_ptr_ptr A pointer to a container pointer. If you + * create a custom container, use this parameter to return it + * to the MFD helper. If set to NULL, the MFD helper will + * allocate a container for you. + * + * This function is called at startup to allow you to customize certain + * aspects of the access method. For the most part, it is for advanced + * users. The default code should suffice for most cases. If no custom + * container is allocated, the MFD code will create one for your. + * + * @remark + * This would also be a good place to do any initialization needed + * for you data source. For example, opening a connection to another + * process that will supply the data, opening a database, etc. + */ +void +snmpNotifyFilterTable_container_init(netsnmp_container **container_ptr_ptr) +{ + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_container_init", "called\n")); + + if (NULL == container_ptr_ptr) { + snmp_log(LOG_ERR, + "bad container param to snmpNotifyFilterTable_container_init\n"); + return; + } + + /* + * For advanced users, you can use a custom container. If you + * do not create one, one will be created for you. + */ + *container_ptr_ptr = NULL; + +} /* snmpNotifyFilterTable_container_init */ + +/** + * container shutdown + * + * @param container_ptr A pointer to the container. + * + * This function is called at shutdown to allow you to customize certain + * aspects of the access method. For the most part, it is for advanced + * users. The default code should suffice for most cases. + * + * This function is called before snmpNotifyFilterTable_container_free(). + * + * @remark + * This would also be a good place to do any cleanup needed + * for you data source. For example, closing a connection to another + * process that supplied the data, closing a database, etc. + */ +void +snmpNotifyFilterTable_container_shutdown(netsnmp_container *container_ptr) +{ + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_container_shutdown", "called\n")); + + if (NULL == container_ptr) { + snmp_log(LOG_ERR, + "bad params to snmpNotifyFilterTable_container_shutdown\n"); + return; + } + +} /* snmpNotifyFilterTable_container_shutdown */ + +/** + * load initial data + * + * TODO:350:M: Implement snmpNotifyFilterTable data load + * + * @param container container to which items should be inserted + * + * @retval MFD_SUCCESS : success. + * @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source + * @retval MFD_ERROR : other error. + * + * This function is called to load the index(es) (and data, optionally) + * for the every row in the data set. + * + * @remark + * While loading the data, the only important thing is the indexes. + * If access to your data is cheap/fast (e.g. you have a pointer to a + * structure in memory), it would make sense to update the data here. + * If, however, the accessing the data invovles more work (e.g. parsing + * some other existing data, or peforming calculations to derive the data), + * then you can limit yourself to setting the indexes and saving any + * information you will need later. Then use the saved information in + * snmpNotifyFilterTable_row_prep() for populating data. + * + * @note + * If you need consistency between rows (like you want statistics + * for each row to be from the same time frame), you should set all + * data here. + * + */ +int +snmpNotifyFilterTable_container_load(netsnmp_container *container) +{ + snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx; + size_t count = 0; + + /* + * temporary storage for index values + */ + /* + * snmpNotifyFilterProfileName(1)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H + */ + char snmpNotifyFilterProfileName[32]; + size_t snmpNotifyFilterProfileName_len; + /* + * snmpNotifyFilterSubtree(1)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h + */ + /** 128 - 1(entry) - 1(col) - 1(other indexes) = 114 */ + oid snmpNotifyFilterSubtree[114]; + size_t snmpNotifyFilterSubtree_len; + + + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_container_load", "called\n")); + + /* + * TODO:351:M: |-> Load/update data in the snmpNotifyFilterTable container. + * loop over your snmpNotifyFilterTable data, allocate a rowreq context, + * set the index(es) [and data, optionally] and insert into + * the container. + */ + while (1) { + /* + * check for end of data; bail out if there is no more data + */ + if (1) + break; + + /* + * TODO:352:M: | |-> set indexes in new snmpNotifyFilterTable rowreq context. + * data context will be set from the param (unless NULL, + * in which case a new data context will be allocated) + */ + rowreq_ctx = snmpNotifyFilterTable_allocate_rowreq_ctx(NULL); + if (NULL == rowreq_ctx) { + snmp_log(LOG_ERR, "memory allocation failed\n"); + return MFD_RESOURCE_UNAVAILABLE; + } + if (MFD_SUCCESS != + snmpNotifyFilterTable_indexes_set(rowreq_ctx, + snmpNotifyFilterProfileName, + snmpNotifyFilterProfileName_len, + snmpNotifyFilterSubtree, + snmpNotifyFilterSubtree_len)) + { + snmp_log(LOG_ERR, + "error setting index while loading " + "snmpNotifyFilterTable data.\n"); + snmpNotifyFilterTable_release_rowreq_ctx(rowreq_ctx); + continue; + } + + /* + * TODO:352:r: | |-> populate snmpNotifyFilterTable data context. + * Populate data context here. (optionally, delay until row prep) + */ + /* + * non-TRANSIENT data: no need to copy. set pointer to data + */ + + /* + * insert into table container + */ + CONTAINER_INSERT(container, rowreq_ctx); + ++count; + } + + DEBUGMSGT(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_container_load", + "inserted %" NETSNMP_PRIz "u records\n", count)); + + return MFD_SUCCESS; +} /* snmpNotifyFilterTable_container_load */ + +/** + * container clean up + * + * @param container container with all current items + * + * This optional callback is called prior to all + * item's being removed from the container. If you + * need to do any processing before that, do it here. + * + * @note + * The MFD helper will take care of releasing all the row contexts. + * + */ +void +snmpNotifyFilterTable_container_free(netsnmp_container *container) +{ + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_container_free", "called\n")); + + /* + * TODO:380:M: Free snmpNotifyFilterTable container data. + */ +} /* snmpNotifyFilterTable_container_free */ + +/** + * prepare row for processing. + * + * When the agent has located the row for a request, this function is + * called to prepare the row for processing. If you fully populated + * the data context during the index setup phase, you may not need to + * do anything. + * + * @param rowreq_ctx pointer to a context. + * + * @retval MFD_SUCCESS : success. + * @retval MFD_ERROR : other error. + */ +int +snmpNotifyFilterTable_row_prep(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx) +{ + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_row_prep", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:390:o: Prepare row for request. + * If populating row data was delayed, this is the place to + * fill in the row for this request. + */ + + return MFD_SUCCESS; +} /* snmpNotifyFilterTable_row_prep */ + +/* + * TODO:420:r: Implement snmpNotifyFilterTable index validation. + */ +/*--------------------------------------------------------------------- + * SNMP-NOTIFICATION-MIB::snmpNotifyFilterProfileEntry.snmpNotifyFilterProfileName + * snmpNotifyFilterProfileName is subid 1 of snmpNotifyFilterProfileEntry. + * Its status is Current, and its access level is Create. + * OID: .1.3.6.1.6.3.13.1.2.1.1 + * Description: +The name of the filter profile to be used when generating + notifications using the corresponding entry in the + snmpTargetAddrTable. + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 1 hashint 1 + * settable 1 + * hint: 255t + * + * Ranges: 1 - 32; + * + * Its syntax is SnmpAdminString (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 32) + */ +/** + * check validity of snmpNotifyFilterProfileName external index portion + * + * NOTE: this is not the place to do any checks for the sanity + * of multiple indexes. Those types of checks should be done in the + * snmpNotifyFilterTable_validate_index() function. + * + * @retval MFD_SUCCESS : the incoming value is legal + * @retval MFD_ERROR : the incoming value is NOT legal + */ +int + + + + + + + + + + + + + + + + snmpNotifyFilterTable_snmpNotifyFilterProfileName_check_index + (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx) { + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_snmpNotifyFilterProfileName_check_index", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:424:M: |-> Check snmpNotifyFilterTable external index snmpNotifyFilterProfileName. + * check that index value in the table context (rowreq_ctx) + * for the external index snmpNotifyFilterProfileName is legal. + */ + + return MFD_SUCCESS; /* external index snmpNotifyFilterProfileName ok */ +} /* snmpNotifyFilterTable_snmpNotifyFilterProfileName_check_index */ + +/*--------------------------------------------------------------------- + * SNMP-NOTIFICATION-MIB::snmpNotifyFilterEntry.snmpNotifyFilterSubtree + * snmpNotifyFilterSubtree is subid 1 of snmpNotifyFilterEntry. + * Its status is Current, and its access level is NoAccess. + * OID: .1.3.6.1.6.3.13.1.3.1.1 + * Description: +The MIB subtree which, when combined with the corresponding + instance of snmpNotifyFilterMask, defines a family of + subtrees which are included in or excluded from the + filter profile. + * + * Attributes: + * accessible 0 isscalar 0 enums 0 hasdefval 0 + * readable 0 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is OBJECTID (based on perltype OBJECTID) + * The net-snmp type is ASN_OBJECT_ID. The C type decl is oid (oid) + * This data type requires a length. + * + * + * + * NOTE: NODE snmpNotifyFilterSubtree IS NOT ACCESSIBLE + * + * + */ +/** + * check validity of snmpNotifyFilterSubtree index portion + * + * @retval MFD_SUCCESS : the incoming value is legal + * @retval MFD_ERROR : the incoming value is NOT legal + * + * @note this is not the place to do any checks for the sanity + * of multiple indexes. Those types of checks should be done in the + * snmpNotifyFilterTable_validate_index() function. + * + * @note Also keep in mind that if the index refers to a row in this or + * some other table, you can't check for that row here to make + * decisions, since that row might not be created yet, but may + * be created during the processing this request. If you have + * such checks, they should be done in the check_dependencies + * function, because any new/deleted/changed rows should be + * available then. + * + * The following checks have already been done for you: + * + * If there a no other checks you need to do, simply return MFD_SUCCESS. + */ +int +snmpNotifyFilterSubtree_check_index(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx) +{ + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterSubtree_check_index", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:426:M: |-> Check snmpNotifyFilterTable index snmpNotifyFilterSubtree. + * check that index value in the table context is legal. + * (rowreq_ctx->tbl_index.snmpNotifyFilterSubtree) + */ + + return MFD_SUCCESS; /* snmpNotifyFilterSubtree index ok */ +} /* snmpNotifyFilterSubtree_check_index */ + +/** + * verify specified index is valid. + * + * This check is independent of whether or not the values specified for + * the columns of the new row are valid. Column values and row consistency + * will be checked later. At this point, only the index values should be + * checked. + * + * All of the individual index validation functions have been called, so this + * is the place to make sure they are valid as a whole when combined. If + * you only have one index, then you probably don't need to do anything else + * here. + * + * @note Keep in mind that if the indexes refer to a row in this or + * some other table, you can't check for that row here to make + * decisions, since that row might not be created yet, but may + * be created during the processing this request. If you have + * such checks, they should be done in the check_dependencies + * function, because any new/deleted/changed rows should be + * available then. + * + * + * @param snmpNotifyFilterTable_reg + * Pointer to the user registration data + * @param rowreq_ctx + * Pointer to the users context. + * @retval MFD_SUCCESS : success + * @retval MFD_CANNOT_CREATE_NOW : index not valid right now + * @retval MFD_CANNOT_CREATE_EVER : index never valid + */ +int +snmpNotifyFilterTable_validate_index(snmpNotifyFilterTable_registration * + snmpNotifyFilterTable_reg, + snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx) +{ + int rc = MFD_SUCCESS; + + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_validate_index", "called\n")); + + /** we should have a non-NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:430:M: |-> Validate potential snmpNotifyFilterTable index. + */ + + return rc; +} /* snmpNotifyFilterTable_validate_index */ + +/** @} */ + +/* + * ugly, inefficient hack: create a dummy viewEntry list from the filter table + * entries matching a profile name. This lets us use the existing vacm + * routines for matching oids to views. + */ +struct vacm_viewEntry * +snmpNotifyFilterTable_vacm_view_subtree(const char *profile) +{ + oid tmp_oid[MAX_OID_LEN]; + netsnmp_index tmp_idx; + size_t i, j; + netsnmp_void_array *s; + struct vacm_viewEntry *tmp; + snmpNotifyFilterTable_rowreq_ctx *rowreq; + netsnmp_container *c; + + tmp_idx.len = 0; + tmp_idx.oids = tmp_oid; + + /* + * get the container + */ + c = snmpNotifyFilterTable_container_get(); + if ((NULL == profile) || (NULL == c)) + return NULL; + + /* + * get the profile subset + */ + tmp_idx.oids[0] = strlen(profile); + tmp_idx.len = tmp_idx.oids[0] + 1; + for (i = 0; i < tmp_idx.len; ++i) + tmp_idx.oids[i + 1] = profile[i]; + s = c->get_subset(c, &tmp_idx); + if (NULL == s) + return NULL; + + /* + * allocate temporary storage + */ + tmp = (struct vacm_viewEntry*)calloc(sizeof(struct vacm_viewEntry), s->size + 1); + if (NULL == tmp) { + free(s->array); + free(s); + return NULL; + } + + /* + * copy data + */ + for (i = 0, j = 0; i < s->size; ++i) { + rowreq = (snmpNotifyFilterTable_rowreq_ctx *) s->array[i]; + + /* + * must match profile name exactly, and subset will return + * longer matches, if they exist. + */ + if (tmp_idx.oids[0] != + rowreq->tbl_idx.snmpNotifyFilterProfileName_len) + continue; + + /* + * exact match, copy data + * vacm_viewEntry viewName and viewSubtree are prefixed with length + */ + + tmp[j].viewName[0] = + rowreq->tbl_idx.snmpNotifyFilterProfileName_len; + memcpy(&tmp[j].viewName[1], + rowreq->tbl_idx.snmpNotifyFilterProfileName, + tmp[j].viewName[0]); + + tmp[j].viewSubtree[0] = + rowreq->tbl_idx.snmpNotifyFilterSubtree_len; + memcpy(&tmp[j].viewSubtree[1], + rowreq->tbl_idx.snmpNotifyFilterSubtree, + tmp[j].viewSubtree[0] * sizeof(oid)); + tmp[j].viewSubtreeLen = tmp[j].viewSubtree[0] + 1; + + tmp[j].viewMaskLen = rowreq->data.snmpNotifyFilterMask_len; + memcpy(tmp[j].viewMask, rowreq->data.snmpNotifyFilterMask, + tmp[j].viewMaskLen * sizeof(oid)); + + + tmp[j].viewType = rowreq->data.snmpNotifyFilterType; + + tmp[j].next = &tmp[j + 1]; + ++j; + } + if (j) + tmp[j - 1].next = NULL; + else { + SNMP_FREE(tmp); + } + + free(s->array); + free(s); + + return tmp; +} diff --git a/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_data_access.h b/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_data_access.h new file mode 100644 index 0000000..4615db4 --- /dev/null +++ b/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_data_access.h @@ -0,0 +1,133 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.17 $ of : mfd-data-access.m2c,v $ + * + * $Id$ + */ +#ifndef SNMPNOTIFYFILTERTABLE_DATA_ACCESS_H +#define SNMPNOTIFYFILTERTABLE_DATA_ACCESS_H + +#ifdef __cplusplus +extern "C" { +#endif + + + /* + ********************************************************************* + * function declarations + */ + + /* + ********************************************************************* + * Table declarations + */ +/********************************************************************** + ********************************************************************** + *** + *** Table snmpNotifyFilterTable + *** + ********************************************************************** + **********************************************************************/ + /* + * 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 + */ + + + int + + + + + + + + + + + + + + + + snmpNotifyFilterTable_init_data(snmpNotifyFilterTable_registration + * snmpNotifyFilterTable_reg); + + + void snmpNotifyFilterTable_container_init(netsnmp_container + **container_ptr_ptr); + void + + + + + + + + + + + + + + + + snmpNotifyFilterTable_container_shutdown(netsnmp_container + *container_ptr); + + int snmpNotifyFilterTable_container_load(netsnmp_container + *container); + void snmpNotifyFilterTable_container_free(netsnmp_container + *container); + + int + + + + + + + + + + + + + + + + snmpNotifyFilterTable_row_prep(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx); + + int + + + + + + + + + + + + + + + + snmpNotifyFilterTable_validate_index + (snmpNotifyFilterTable_registration * snmpNotifyFilterTable_reg, + snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx); + int snmpNotifyFilterTable_snmpNotifyFilterProfileName_check_index(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx); /* external */ + int snmpNotifyFilterSubtree_check_index(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx); /* internal */ + + struct vacm_viewEntry *snmpNotifyFilterTable_vacm_view_subtree(const + char + *profile); + + +#ifdef __cplusplus +} +#endif +#endif /* SNMPNOTIFYFILTERTABLE_DATA_ACCESS_H */ diff --git a/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_interface.c b/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_interface.c new file mode 100644 index 0000000..ed3beaa --- /dev/null +++ b/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_interface.c @@ -0,0 +1,2464 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.67 $ of : mfd-interface.m2c,v $ + * + * $Id$ + */ +/* + * ********************************************************************* + * ********************************************************************* + * ********************************************************************* + * *** *** + * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE *** + * *** *** + * *** *** + * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. *** + * *** *** + * *** *** + * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND *** + * *** *** + * *** *** + * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. *** + * *** *** + * *** *** + * ********************************************************************* + * ********************************************************************* + * ********************************************************************* + */ + +/* + * standard Net-SNMP includes + */ +#include <net-snmp/net-snmp-config.h> +#include <net-snmp/net-snmp-features.h> +#include <net-snmp/net-snmp-includes.h> +#include <net-snmp/agent/net-snmp-agent-includes.h> + +/* + * include our parent header + */ +#include "snmpNotifyFilterTable.h" + + +#include <net-snmp/agent/table_container.h> +#include <net-snmp/library/container.h> + +#include "snmpNotifyFilterTable_interface.h" + +#include <ctype.h> + +netsnmp_feature_child_of(snmpNotifyFilterTable_external_access, libnetsnmpmibs) + +netsnmp_feature_require(row_merge) +netsnmp_feature_require(baby_steps) +netsnmp_feature_require(table_container_row_insert) +netsnmp_feature_require(check_all_requests_error) +#ifndef NETSNMP_NO_WRITE_SUPPORT +netsnmp_feature_require(check_vb_type_and_max_size) +#endif /* NETSNMP_NO_WRITE_SUPPORT */ + + +netsnmp_feature_child_of(snmpNotifyFilterTable_container_size, snmpNotifyFilterTable_external_access) +netsnmp_feature_child_of(snmpNotifyFilterTable_registration_set, snmpNotifyFilterTable_external_access) +netsnmp_feature_child_of(snmpNotifyFilterTable_registration_get, snmpNotifyFilterTable_external_access) +netsnmp_feature_child_of(snmpNotifyFilterTable_container_get, snmpNotifyFilterTable_external_access) + +/********************************************************************** + ********************************************************************** + *** + *** Table snmpNotifyFilterTable + *** + ********************************************************************** + **********************************************************************/ +/* + * 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 + */ +typedef struct snmpNotifyFilterTable_interface_ctx_s { + + netsnmp_container *container; + + snmpNotifyFilterTable_registration *user_ctx; + + netsnmp_table_registration_info tbl_info; + + netsnmp_baby_steps_access_methods access_multiplexer; + + u_int table_dirty; + +} snmpNotifyFilterTable_interface_ctx; + +static snmpNotifyFilterTable_interface_ctx snmpNotifyFilterTable_if_ctx; + +static void + _snmpNotifyFilterTable_container_init(snmpNotifyFilterTable_interface_ctx * + if_ctx); +static void + + + + + + + + + + + + + + + + _snmpNotifyFilterTable_container_shutdown + (snmpNotifyFilterTable_interface_ctx * if_ctx); + +#ifndef NETSNMP_FEATURE_REMOVE_SNMPNOTIFYFILTERTABLE_CONTAINER_GET +netsnmp_container * +snmpNotifyFilterTable_container_get(void) +{ + return snmpNotifyFilterTable_if_ctx.container; +} +#endif /* NETSNMP_FEATURE_REMOVE_SNMPNOTIFYFILTERTABLE_CONTAINER_GET */ + +#ifndef NETSNMP_FEATURE_REMOVE_SNMPNOTIFYFILTERTABLE_REGISTRATION_GET +snmpNotifyFilterTable_registration * +snmpNotifyFilterTable_registration_get(void) +{ + return snmpNotifyFilterTable_if_ctx.user_ctx; +} +#endif /* NETSNMP_FEATURE_REMOVE_SNMPNOTIFYFILTERTABLE_REGISTRATION_GET */ + +#ifndef NETSNMP_FEATURE_REMOVE_SNMPNOTIFYFILTERTABLE_REGISTRATION_SET +snmpNotifyFilterTable_registration * +snmpNotifyFilterTable_registration_set(snmpNotifyFilterTable_registration * + newreg) +{ + snmpNotifyFilterTable_registration *old = + snmpNotifyFilterTable_if_ctx.user_ctx; + snmpNotifyFilterTable_if_ctx.user_ctx = newreg; + return old; +} +#endif /* NETSNMP_FEATURE_REMOVE_SNMPNOTIFYFILTERTABLE_REGISTRATION_SET */ + +#ifndef NETSNMP_FEATURE_REMOVE_SNMPNOTIFYFILTERTABLE_CONTAINER_SIZE +int +snmpNotifyFilterTable_container_size(void) +{ + return CONTAINER_SIZE(snmpNotifyFilterTable_if_ctx.container); +} +#endif /* NETSNMP_FEATURE_REMOVE_SNMPNOTIFYFILTERTABLE_CONTAINER_SIZE */ + +u_int +snmpNotifyFilterTable_dirty_get(void) +{ + return snmpNotifyFilterTable_if_ctx.table_dirty; +} + +void +snmpNotifyFilterTable_dirty_set(u_int status) +{ + DEBUGMSGTL(("snmpNotifyFilterTable:snmpNotifyFilterTable_dirty_set", + "called. was %d, now %d\n", + snmpNotifyFilterTable_if_ctx.table_dirty, status)); + snmpNotifyFilterTable_if_ctx.table_dirty = status; +} + +/* + * mfd multiplexer modes + */ +static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_pre_request; +static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_post_request; +static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_object_lookup; +static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_get_values; +#ifndef NETSNMP_DISABLE_SET_SUPPORT +static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_check_objects; +static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_undo_setup; +static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_set_values; +static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_undo_cleanup; +static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_undo_values; +static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_commit; +static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_undo_commit; +static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_irreversible_commit; +static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_check_dependencies; + +NETSNMP_STATIC_INLINE int + _snmpNotifyFilterTable_undo_column(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx, + netsnmp_variable_list * + var, int column); +#endif + +NETSNMP_STATIC_INLINE int + _snmpNotifyFilterTable_check_indexes(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx); + +snmpNotifyFilterTable_data *snmpNotifyFilterTable_allocate_data(void); + +/** + * @internal + * Initialize the table snmpNotifyFilterTable + * (Define its contents and how it's structured) + */ +void + + + + + + + + + + + + + + + + _snmpNotifyFilterTable_initialize_interface + (snmpNotifyFilterTable_registration * reg_ptr, u_long flags) { + netsnmp_baby_steps_access_methods *access_multiplexer = + &snmpNotifyFilterTable_if_ctx.access_multiplexer; + netsnmp_table_registration_info *tbl_info = + &snmpNotifyFilterTable_if_ctx.tbl_info; + netsnmp_handler_registration *reginfo; + netsnmp_mib_handler *handler; + int mfd_modes = 0; + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_initialize_interface", "called\n")); + + + /************************************************* + * + * save interface context for snmpNotifyFilterTable + */ + /* + * Setting up the table's definition + */ + netsnmp_table_helper_add_indexes(tbl_info, ASN_OCTET_STR, + /** index: snmpNotifyFilterProfileName */ + ASN_PRIV_IMPLIED_OBJECT_ID, + /** index: snmpNotifyFilterSubtree */ + 0); + + /* + * Define the minimum and maximum accessible columns. This + * optimizes retrieval. + */ + tbl_info->min_column = SNMPNOTIFYFILTERTABLE_MIN_COL; + tbl_info->max_column = SNMPNOTIFYFILTERTABLE_MAX_COL; + + /* + * save users context + */ + snmpNotifyFilterTable_if_ctx.user_ctx = reg_ptr; + + /* + * call data access initialization code + */ + snmpNotifyFilterTable_init_data(reg_ptr); + + /* + * set up the container + */ + _snmpNotifyFilterTable_container_init(&snmpNotifyFilterTable_if_ctx); + if (NULL == snmpNotifyFilterTable_if_ctx.container) { + snmp_log(LOG_ERR, + "could not initialize container for snmpNotifyFilterTable\n"); + return; + } + + /* + * access_multiplexer: REQUIRED wrapper for get request handling + */ + access_multiplexer->object_lookup = + _mfd_snmpNotifyFilterTable_object_lookup; + access_multiplexer->get_values = _mfd_snmpNotifyFilterTable_get_values; + + /* + * no wrappers yet + */ + access_multiplexer->pre_request = + _mfd_snmpNotifyFilterTable_pre_request; + access_multiplexer->post_request = + _mfd_snmpNotifyFilterTable_post_request; + + +#if !(defined(NETSNMP_NO_WRITE_SUPPORT) || defined(NETSNMP_DISABLE_SET_SUPPORT)) + /* + * REQUIRED wrappers for set request handling + */ + access_multiplexer->object_syntax_checks = + _mfd_snmpNotifyFilterTable_check_objects; + access_multiplexer->undo_setup = _mfd_snmpNotifyFilterTable_undo_setup; + access_multiplexer->undo_cleanup = + _mfd_snmpNotifyFilterTable_undo_cleanup; + access_multiplexer->set_values = _mfd_snmpNotifyFilterTable_set_values; + access_multiplexer->undo_sets = _mfd_snmpNotifyFilterTable_undo_values; + + /* + * no wrappers yet + */ + access_multiplexer->commit = _mfd_snmpNotifyFilterTable_commit; + access_multiplexer->undo_commit = + _mfd_snmpNotifyFilterTable_undo_commit; + access_multiplexer->irreversible_commit = + _mfd_snmpNotifyFilterTable_irreversible_commit; + + /* + * REQUIRED for tables with dependencies + */ + access_multiplexer->consistency_checks = + _mfd_snmpNotifyFilterTable_check_dependencies; +#endif /* NETSNMP_NO_WRITE_SUPPORT || NETSNMP_DISABLE_SET_SUPPORT */ + + /************************************************* + * + * Create a registration, save our reg data, register table. + */ + DEBUGMSGTL(("snmpNotifyFilterTable:init_snmpNotifyFilterTable", + "Registering snmpNotifyFilterTable as a mibs-for-dummies table.\n")); + handler = + netsnmp_baby_steps_access_multiplexer_get(access_multiplexer); + reginfo = + netsnmp_handler_registration_create("snmpNotifyFilterTable", + handler, + snmpNotifyFilterTable_oid, + snmpNotifyFilterTable_oid_size, + HANDLER_CAN_BABY_STEP +#if !(defined(NETSNMP_NO_WRITE_SUPPORT) || defined(NETSNMP_DISABLE_SET_SUPPORT)) + | HANDLER_CAN_RWRITE +#endif + ); + if (NULL == reginfo) { + snmp_log(LOG_ERR, + "error registering table snmpNotifyFilterTable\n"); + return; + } + reginfo->my_reg_void = &snmpNotifyFilterTable_if_ctx; + + /************************************************* + * + * set up baby steps handler, create it and inject it + */ + if (access_multiplexer->object_lookup) + mfd_modes |= BABY_STEP_OBJECT_LOOKUP; + if (access_multiplexer->pre_request) + mfd_modes |= BABY_STEP_PRE_REQUEST; + if (access_multiplexer->post_request) + mfd_modes |= BABY_STEP_POST_REQUEST; + +#if !(defined(NETSNMP_NO_WRITE_SUPPORT) || defined(NETSNMP_DISABLE_SET_SUPPORT)) + if (access_multiplexer->set_values) + mfd_modes |= BABY_STEP_SET_VALUES; + if (access_multiplexer->irreversible_commit) + mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT; + if (access_multiplexer->object_syntax_checks) + mfd_modes |= BABY_STEP_CHECK_OBJECT; + + if (access_multiplexer->undo_setup) + mfd_modes |= BABY_STEP_UNDO_SETUP; + if (access_multiplexer->undo_cleanup) + mfd_modes |= BABY_STEP_UNDO_CLEANUP; + if (access_multiplexer->undo_sets) + mfd_modes |= BABY_STEP_UNDO_SETS; + + if (access_multiplexer->row_creation) + mfd_modes |= BABY_STEP_ROW_CREATE; + if (access_multiplexer->consistency_checks) + mfd_modes |= BABY_STEP_CHECK_CONSISTENCY; + if (access_multiplexer->commit) + mfd_modes |= BABY_STEP_COMMIT; + if (access_multiplexer->undo_commit) + mfd_modes |= BABY_STEP_UNDO_COMMIT; +#endif /* NETSNMP_NO_WRITE_SUPPORT || NETSNMP_DISABLE_SET_SUPPORT */ + + handler = netsnmp_baby_steps_handler_get(mfd_modes); + netsnmp_inject_handler(reginfo, handler); + + /************************************************* + * + * inject row_merge helper with prefix rootoid_len + 2 (entry.col) + */ + handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2); + netsnmp_inject_handler(reginfo, handler); + + /************************************************* + * + * inject container_table helper + */ + handler = + netsnmp_container_table_handler_get(tbl_info, + snmpNotifyFilterTable_if_ctx. + container, + TABLE_CONTAINER_KEY_NETSNMP_INDEX); + netsnmp_inject_handler(reginfo, handler); + + /* + * register table + */ + netsnmp_register_table(reginfo, tbl_info); + + /* + * register config/persistence callbacks + */ + snmpNotifyFilterTable_container_init_persistence + (snmpNotifyFilterTable_if_ctx.container); + +} /* _snmpNotifyFilterTable_initialize_interface */ + +/** + * @internal + * Shutdown the table snmpNotifyFilterTable + */ +void + + + + + + + + + + + + + + + + _snmpNotifyFilterTable_shutdown_interface + (snmpNotifyFilterTable_registration * reg_ptr) { + /* + * shutdown the container + */ + _snmpNotifyFilterTable_container_shutdown + (&snmpNotifyFilterTable_if_ctx); +} + +void +snmpNotifyFilterTable_valid_columns_set(netsnmp_column_info *vc) +{ + snmpNotifyFilterTable_if_ctx.tbl_info.valid_columns = vc; +} /* snmpNotifyFilterTable_valid_columns_set */ + +/** + * @internal + * convert the index component stored in the context to an oid + */ +int +snmpNotifyFilterTable_index_to_oid(netsnmp_index * oid_idx, + snmpNotifyFilterTable_mib_index * + mib_idx) +{ + int err = SNMP_ERR_NOERROR; + + /* + * temp storage for parsing indexes + */ + /* + * snmpNotifyFilterProfileName(1)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H + */ + netsnmp_variable_list var_snmpNotifyFilterProfileName; + /* + * snmpNotifyFilterSubtree(1)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h + */ + netsnmp_variable_list var_snmpNotifyFilterSubtree; + + /* + * set up varbinds + */ + memset(&var_snmpNotifyFilterProfileName, 0x00, + sizeof(var_snmpNotifyFilterProfileName)); + var_snmpNotifyFilterProfileName.type = ASN_OCTET_STR; + memset(&var_snmpNotifyFilterSubtree, 0x00, + sizeof(var_snmpNotifyFilterSubtree)); + var_snmpNotifyFilterSubtree.type = ASN_PRIV_IMPLIED_OBJECT_ID; + + /* + * chain temp index varbinds together + */ + var_snmpNotifyFilterProfileName.next_variable = + &var_snmpNotifyFilterSubtree; + var_snmpNotifyFilterSubtree.next_variable = NULL; + + + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_index_to_oid", "called\n")); + + /* + * snmpNotifyFilterProfileName(1)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H + */ + snmp_set_var_value(&var_snmpNotifyFilterProfileName, + (u_char *) & mib_idx->snmpNotifyFilterProfileName, + mib_idx->snmpNotifyFilterProfileName_len * + sizeof(mib_idx->snmpNotifyFilterProfileName[0])); + + /* + * snmpNotifyFilterSubtree(1)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h + */ + snmp_set_var_value(&var_snmpNotifyFilterSubtree, + (u_char *) & mib_idx->snmpNotifyFilterSubtree, + mib_idx->snmpNotifyFilterSubtree_len * + sizeof(mib_idx->snmpNotifyFilterSubtree[0])); + + + err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len, + NULL, 0, &var_snmpNotifyFilterProfileName); + if (err) + snmp_log(LOG_ERR, "error %d converting index to oid\n", err); + + /* + * parsing may have allocated memory. free it. + */ + snmp_reset_var_buffers(&var_snmpNotifyFilterProfileName); + + return err; +} /* snmpNotifyFilterTable_index_to_oid */ + +/** + * extract snmpNotifyFilterTable indexes from a netsnmp_index + * + * @retval SNMP_ERR_NOERROR : no error + * @retval SNMP_ERR_GENERR : error + */ +int +snmpNotifyFilterTable_index_from_oid(netsnmp_index * oid_idx, + snmpNotifyFilterTable_mib_index * + mib_idx) +{ + int err = SNMP_ERR_NOERROR; + + /* + * temp storage for parsing indexes + */ + /* + * snmpNotifyFilterProfileName(1)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H + */ + netsnmp_variable_list var_snmpNotifyFilterProfileName; + /* + * snmpNotifyFilterSubtree(1)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h + */ + netsnmp_variable_list var_snmpNotifyFilterSubtree; + + /* + * set up varbinds + */ + memset(&var_snmpNotifyFilterProfileName, 0x00, + sizeof(var_snmpNotifyFilterProfileName)); + var_snmpNotifyFilterProfileName.type = ASN_OCTET_STR; + memset(&var_snmpNotifyFilterSubtree, 0x00, + sizeof(var_snmpNotifyFilterSubtree)); + var_snmpNotifyFilterSubtree.type = ASN_PRIV_IMPLIED_OBJECT_ID; + + /* + * chain temp index varbinds together + */ + var_snmpNotifyFilterProfileName.next_variable = + &var_snmpNotifyFilterSubtree; + var_snmpNotifyFilterSubtree.next_variable = NULL; + + + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_index_from_oid", "called\n")); + + /* + * parse the oid into the individual index components + */ + err = parse_oid_indexes(oid_idx->oids, oid_idx->len, + &var_snmpNotifyFilterProfileName); + if (err == SNMP_ERR_NOERROR) { + /* + * copy out values + */ + /* + * NOTE: val_len is in bytes, snmpNotifyFilterProfileName_len might not be + */ + if (var_snmpNotifyFilterProfileName.val_len > + sizeof(mib_idx->snmpNotifyFilterProfileName)) + err = SNMP_ERR_GENERR; + else { + memcpy(mib_idx->snmpNotifyFilterProfileName, + var_snmpNotifyFilterProfileName.val.string, + var_snmpNotifyFilterProfileName.val_len); + mib_idx->snmpNotifyFilterProfileName_len = + var_snmpNotifyFilterProfileName.val_len / + sizeof(mib_idx->snmpNotifyFilterProfileName[0]); + } + /* + * NOTE: val_len is in bytes, snmpNotifyFilterSubtree_len might not be + */ + if (var_snmpNotifyFilterSubtree.val_len > + sizeof(mib_idx->snmpNotifyFilterSubtree)) + err = SNMP_ERR_GENERR; + else { + memcpy(mib_idx->snmpNotifyFilterSubtree, + var_snmpNotifyFilterSubtree.val.string, + var_snmpNotifyFilterSubtree.val_len); + mib_idx->snmpNotifyFilterSubtree_len = + var_snmpNotifyFilterSubtree.val_len / + sizeof(mib_idx->snmpNotifyFilterSubtree[0]); + } + + + } + + /* + * parsing may have allocated memory. free it. + */ + snmp_reset_var_buffers(&var_snmpNotifyFilterProfileName); + + return err; +} /* snmpNotifyFilterTable_index_from_oid */ + + +/* + * snmpNotifyFilterTable_allocate_data + * + * Purpose: create new snmpNotifyFilterTable_data. + */ +snmpNotifyFilterTable_data * +snmpNotifyFilterTable_allocate_data(void) +{ + snmpNotifyFilterTable_data *rtn = + SNMP_MALLOC_TYPEDEF(snmpNotifyFilterTable_data); + + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_allocate_data", "called\n")); + + if (NULL == rtn) { + snmp_log(LOG_ERR, "unable to malloc memory for new " + "snmpNotifyFilterTable_data.\n"); + } + + return rtn; +} /* snmpNotifyFilterTable_allocate_data */ + +/* + * snmpNotifyFilterTable_release_data + * + * Purpose: release snmpNotifyFilterTable data. + */ +void +snmpNotifyFilterTable_release_data(snmpNotifyFilterTable_data * data) +{ + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_release_data", "called\n")); + + free(data); +} /* snmpNotifyFilterTable_release_data */ + +/* + ********************************************************************* + * @internal + * allocate resources for a snmpNotifyFilterTable_rowreq_ctx + */ +snmpNotifyFilterTable_rowreq_ctx * +snmpNotifyFilterTable_allocate_rowreq_ctx(void *user_init_ctx) +{ + snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx = + SNMP_MALLOC_TYPEDEF(snmpNotifyFilterTable_rowreq_ctx); + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:snmpNotifyFilterTable_allocate_rowreq_ctx", "called\n")); + + if (NULL == rowreq_ctx) { + snmp_log(LOG_ERR, "Couldn't allocate memory for a " + "snmpNotifyFilterTable_rowreq_ctx.\n"); + return NULL; + } + + rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp; + + rowreq_ctx->snmpNotifyFilterTable_data_list = NULL; + + /* + * if we allocated data, call init routine + */ + if (!(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) { + if (SNMPERR_SUCCESS != + snmpNotifyFilterTable_rowreq_ctx_init(rowreq_ctx, + user_init_ctx)) { + snmpNotifyFilterTable_release_rowreq_ctx(rowreq_ctx); + rowreq_ctx = NULL; + } + } + + return rowreq_ctx; +} /* snmpNotifyFilterTable_allocate_rowreq_ctx */ + +/* + * @internal + * release resources for a snmpNotifyFilterTable_rowreq_ctx + */ +void +snmpNotifyFilterTable_release_rowreq_ctx(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx) +{ + DEBUGMSGTL(("internal:snmpNotifyFilterTable:snmpNotifyFilterTable_release_rowreq_ctx", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + snmpNotifyFilterTable_rowreq_ctx_cleanup(rowreq_ctx); + + if (rowreq_ctx->undo) + snmpNotifyFilterTable_release_data(rowreq_ctx->undo); + + /* + * free index oid pointer + */ + if (rowreq_ctx->oid_idx.oids != rowreq_ctx->oid_tmp) + free(rowreq_ctx->oid_idx.oids); + + SNMP_FREE(rowreq_ctx); +} /* snmpNotifyFilterTable_release_rowreq_ctx */ + +/** + * @internal + * wrapper + */ +static int +_mfd_snmpNotifyFilterTable_pre_request(netsnmp_mib_handler *handler, netsnmp_handler_registration + *reginfo, netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + int rc; + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_pre_request", "called\n")); + + if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) { + DEBUGMSGTL(("internal:snmpNotifyFilterTable", + "skipping additional pre_request\n")); + return SNMP_ERR_NOERROR; + } + + rc = snmpNotifyFilterTable_pre_request(snmpNotifyFilterTable_if_ctx. + user_ctx); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("snmpNotifyFilterTable", "error %d from " + "snmpNotifyFilterTable_pre_request\n", rc)); + netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); + } + + return SNMP_ERR_NOERROR; +} /* _mfd_snmpNotifyFilterTable_pre_request */ + +/** + * @internal + * wrapper + */ +static int +_mfd_snmpNotifyFilterTable_post_request(netsnmp_mib_handler *handler, netsnmp_handler_registration + *reginfo, netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx = (snmpNotifyFilterTable_rowreq_ctx*) + netsnmp_container_table_row_extract(requests); + int rc, packet_rc; + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_post_request", "called\n")); + + /* + * release row context, if deleted + */ + if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED)) + snmpNotifyFilterTable_release_rowreq_ctx(rowreq_ctx); + + /* + * wait for last call before calling user + */ + if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) { + DEBUGMSGTL(("internal:snmpNotifyFilterTable", + "waiting for last post_request\n")); + return SNMP_ERR_NOERROR; + } + + packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0); + if ((MFD_SUCCESS != packet_rc) && snmpNotifyFilterTable_dirty_get()) { + /* + * we shouldn't get here. the undo steps should also clear + * the dirty flags. + */ + snmp_log(LOG_WARNING, + "snmpNotifyFilterTable dirty flag set in post_request " + "but status != SUCCESS.\n"); + } + + rc = snmpNotifyFilterTable_post_request(snmpNotifyFilterTable_if_ctx. + user_ctx, packet_rc); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("snmpNotifyFilterTable", "error %d from " + "snmpNotifyFilterTable_post_request\n", rc)); + } + + return SNMP_ERR_NOERROR; +} /* _mfd_snmpNotifyFilterTable_post_request */ + + +/** + * @internal + * wrapper + */ +static snmpNotifyFilterTable_rowreq_ctx * +_mfd_snmpNotifyFilterTable_rowreq_from_index(netsnmp_index * oid_idx, + int *rc_ptr) +{ + snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx; + snmpNotifyFilterTable_mib_index mib_idx; + int rc; + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_rowreq_from_index", "called\n")); + + if (NULL == rc_ptr) + rc_ptr = &rc; + *rc_ptr = MFD_SUCCESS; + + memset(&mib_idx, 0x0, sizeof(mib_idx)); + + /* + * try to parse oid + */ + *rc_ptr = snmpNotifyFilterTable_index_from_oid(oid_idx, &mib_idx); + if (MFD_SUCCESS != *rc_ptr) { + DEBUGMSGT(("snmpNotifyFilterTable", "error parsing index\n")); + return NULL; + } + + /* + * allocate new context + */ + rowreq_ctx = snmpNotifyFilterTable_allocate_rowreq_ctx(NULL); + if (NULL == rowreq_ctx) { + *rc_ptr = MFD_ERROR; + return NULL; /* msg already logged */ + } + + memcpy(&rowreq_ctx->tbl_idx, &mib_idx, sizeof(mib_idx)); + + /* + * check indexes + */ + *rc_ptr = _snmpNotifyFilterTable_check_indexes(rowreq_ctx); + if (MFD_SUCCESS != *rc_ptr) { + netsnmp_assert((*rc_ptr == SNMP_ERR_NOCREATION) || + (*rc_ptr == SNMP_ERR_INCONSISTENTNAME)); + snmpNotifyFilterTable_release_rowreq_ctx(rowreq_ctx); + return NULL; + } + + /* + * copy indexes + */ + rowreq_ctx->oid_idx.len = oid_idx->len; + memcpy(rowreq_ctx->oid_idx.oids, oid_idx->oids, + oid_idx->len * sizeof(oid)); + + return rowreq_ctx; +} /* _mfd_snmpNotifyFilterTable_rowreq_from_index */ + + +/** + * @internal + * wrapper + */ +static int +_mfd_snmpNotifyFilterTable_object_lookup(netsnmp_mib_handler *handler, netsnmp_handler_registration + *reginfo, netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + int rc = SNMP_ERR_NOERROR; + snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx = (snmpNotifyFilterTable_rowreq_ctx*) + netsnmp_container_table_row_extract(requests); + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_object_lookup", "called\n")); + + /* + * get our context from mfd + * snmpNotifyFilterTable_interface_ctx *if_ctx = + * (snmpNotifyFilterTable_interface_ctx *)reginfo->my_reg_void; + */ + + if (NULL == rowreq_ctx) { + netsnmp_table_request_info *tblreq_info; + netsnmp_index oid_idx; + + tblreq_info = netsnmp_extract_table_info(requests); + if (NULL == tblreq_info) { + snmp_log(LOG_ERR, "request had no table info\n"); + return MFD_ERROR; + } + + /* + * try create rowreq + */ + oid_idx.oids = tblreq_info->index_oid; + oid_idx.len = tblreq_info->index_oid_len; + + rowreq_ctx = + _mfd_snmpNotifyFilterTable_rowreq_from_index(&oid_idx, &rc); + if (MFD_SUCCESS == rc) { + netsnmp_assert(NULL != rowreq_ctx); + rowreq_ctx->rowreq_flags |= MFD_ROW_CREATED; + /* + * add rowreq_ctx to request data lists + */ + netsnmp_container_table_row_insert(requests, (netsnmp_index *) + rowreq_ctx); + } + } + + if (MFD_SUCCESS != rc) + netsnmp_request_set_error_all(requests, rc); + else + snmpNotifyFilterTable_row_prep(rowreq_ctx); + + return SNMP_VALIDATE_ERR(rc); +} /* _mfd_snmpNotifyFilterTable_object_lookup */ + +/*********************************************************************** + * + * GET processing + * + ***********************************************************************/ +/* + * @internal + * Retrieve the value for a particular column + */ +NETSNMP_STATIC_INLINE int +_snmpNotifyFilterTable_get_column(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx, netsnmp_variable_list * var, + int column) +{ + int rc = SNMPERR_SUCCESS; + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_get_column", "called for %d\n", column)); + + + netsnmp_assert(NULL != rowreq_ctx); + + switch (column) { + + /* + * snmpNotifyFilterMask(2)/OCTETSTR/ASN_OCTET_STR/char(char)//L/A/W/e/R/D/h + */ + case COLUMN_SNMPNOTIFYFILTERMASK: + var->type = ASN_OCTET_STR; + rc = snmpNotifyFilterMask_get(rowreq_ctx, + (char **) &var->val.string, + &var->val_len); + break; + + /* + * snmpNotifyFilterType(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h + */ + case COLUMN_SNMPNOTIFYFILTERTYPE: + var->val_len = sizeof(u_long); + var->type = ASN_INTEGER; + rc = snmpNotifyFilterType_get(rowreq_ctx, + (u_long *) var->val.string); + break; + + /* + * snmpNotifyFilterStorageType(4)/StorageType/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h + */ + case COLUMN_SNMPNOTIFYFILTERSTORAGETYPE: + var->val_len = sizeof(u_long); + var->type = ASN_INTEGER; + rc = snmpNotifyFilterStorageType_get(rowreq_ctx, + (u_long *) var->val.string); + break; + + /* + * snmpNotifyFilterRowStatus(5)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h + */ + case COLUMN_SNMPNOTIFYFILTERROWSTATUS: + var->val_len = sizeof(u_long); + var->type = ASN_INTEGER; + rc = snmpNotifyFilterRowStatus_get(rowreq_ctx, + (u_long *) var->val.string); + break; + + default: + snmp_log(LOG_ERR, + "unknown column %d in _snmpNotifyFilterTable_get_column\n", + column); + break; + } + + return rc; +} /* _snmpNotifyFilterTable_get_column */ + +int +_mfd_snmpNotifyFilterTable_get_values(netsnmp_mib_handler *handler, netsnmp_handler_registration + *reginfo, netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx = (snmpNotifyFilterTable_rowreq_ctx*) + netsnmp_container_table_row_extract(requests); + netsnmp_table_request_info *tri; + u_char *old_string; + void (*dataFreeHook) (void *); + int rc; + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_get_values", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + for (; requests; requests = requests->next) { + /* + * save old pointer, so we can free it if replaced + */ + old_string = requests->requestvb->val.string; + dataFreeHook = requests->requestvb->dataFreeHook; + if (NULL == requests->requestvb->val.string) { + requests->requestvb->val.string = requests->requestvb->buf; + requests->requestvb->val_len = + sizeof(requests->requestvb->buf); + } else if (requests->requestvb->buf == + requests->requestvb->val.string) { + if (requests->requestvb->val_len != + sizeof(requests->requestvb->buf)) + requests->requestvb->val_len = + sizeof(requests->requestvb->buf); + } + + /* + * get column data + */ + tri = netsnmp_extract_table_info(requests); + if (NULL == tri) + continue; + + rc = _snmpNotifyFilterTable_get_column(rowreq_ctx, + requests->requestvb, + tri->colnum); + if (rc) { + if (MFD_SKIP == rc) { + requests->requestvb->type = SNMP_NOSUCHINSTANCE; + rc = SNMP_ERR_NOERROR; + } + } else if (NULL == requests->requestvb->val.string) { + snmp_log(LOG_ERR, "NULL varbind data pointer!\n"); + rc = SNMP_ERR_GENERR; + } + if (rc) + netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc)); + + /* + * if the buffer wasn't used previously for the old data (i.e. it + * was allcoated memory) and the get routine replaced the pointer, + * we need to free the previous pointer. + */ + if (old_string && (old_string != requests->requestvb->buf) && + (requests->requestvb->val.string != old_string)) { + if (dataFreeHook) + (*dataFreeHook) (old_string); + else + free(old_string); + } + } /* for results */ + + return SNMP_ERR_NOERROR; +} /* _mfd_snmpNotifyFilterTable_get_values */ + +NETSNMP_STATIC_INLINE int +_snmpNotifyFilterTable_check_indexes(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx) +{ + int rc = SNMPERR_SUCCESS; + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_check_indexes", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * check that the corresponding EXTERNAL row exists + */ + + /* + * (INDEX) snmpNotifyFilterProfileName(1)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H + */ + rc = snmpNotifyFilterTable_snmpNotifyFilterProfileName_check_index + (rowreq_ctx); + if (MFD_SUCCESS != rc) + return SNMP_ERR_NOCREATION; + + + /* + * (INDEX) snmpNotifyFilterSubtree(1)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h + */ + if (MFD_SUCCESS != rc) + return rc; + rc = snmpNotifyFilterSubtree_check_index(rowreq_ctx); + if (MFD_SUCCESS != rc) + return SNMP_ERR_NOCREATION; + + /* + * if individual parts look ok, check them as a whole + */ + return + snmpNotifyFilterTable_validate_index(snmpNotifyFilterTable_if_ctx. + user_ctx, rowreq_ctx); +} /* _snmpNotifyFilterTable_check_indexes */ + +#if !(defined(NETSNMP_NO_WRITE_SUPPORT) || defined(NETSNMP_DISABLE_SET_SUPPORT)) +/*********************************************************************** + * + * SET processing + * + ***********************************************************************/ + +/*---------------------------------------------------------------------- + * + * SET: Syntax checks + * + *---------------------------------------------------------------------*/ +/* + * @internal + * Check the syntax for a particular column + */ +NETSNMP_STATIC_INLINE int +_snmpNotifyFilterTable_check_column(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx, + netsnmp_variable_list * var, + int column) +{ + int rc = SNMPERR_SUCCESS; + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_check_column", "called for %d\n", column)); + + netsnmp_assert(NULL != rowreq_ctx); + + switch (column) { + /* + * (INDEX) snmpNotifyFilterSubtree(1)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h + */ + case COLUMN_SNMPNOTIFYFILTERSUBTREE: + rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */ + break; + + /* + * snmpNotifyFilterMask(2)/OCTETSTR/ASN_OCTET_STR/char(char)//L/A/W/e/R/D/h + */ + case COLUMN_SNMPNOTIFYFILTERMASK: + rc = netsnmp_check_vb_type_and_max_size(var, ASN_OCTET_STR, + sizeof(rowreq_ctx->data. + snmpNotifyFilterMask)); + /* + * check defined range(s). + */ + if ((SNMPERR_SUCCESS == rc) + && ((var->val_len < 0) || (var->val_len > 16)) + ) { + rc = SNMP_ERR_WRONGLENGTH; + } + if (SNMPERR_SUCCESS != rc) { + DEBUGMSGTL(("snmpNotifyFilterTable:_snmpNotifyFilterTable_check_column:snmpNotifyFilterMask", "varbind validation failed (eg bad type or size)\n")); + } else { + rc = snmpNotifyFilterMask_check_value(rowreq_ctx, + (char *) var->val.string, + var->val_len); + if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc) + && (MFD_NOT_VALID_NOW != rc)) { + snmp_log(LOG_ERR, + "bad rc %d from snmpNotifyFilterMask_check_value\n", + rc); + rc = SNMP_ERR_GENERR; + } + } + break; + + /* + * snmpNotifyFilterType(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h + */ + case COLUMN_SNMPNOTIFYFILTERTYPE: + rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER, + sizeof(rowreq_ctx->data. + snmpNotifyFilterType)); + /* + * check that the value is one of defined enums + */ + if ((SNMPERR_SUCCESS == rc) + && (*var->val.integer != SNMPNOTIFYFILTERTYPE_INCLUDED) + && (*var->val.integer != SNMPNOTIFYFILTERTYPE_EXCLUDED) + ) { + rc = SNMP_ERR_WRONGVALUE; + } + if (SNMPERR_SUCCESS != rc) { + DEBUGMSGTL(("snmpNotifyFilterTable:_snmpNotifyFilterTable_check_column:snmpNotifyFilterType", "varbind validation failed (eg bad type or size)\n")); + } else { + rc = snmpNotifyFilterType_check_value(rowreq_ctx, + *((u_long *) var->val. + string)); + if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc) + && (MFD_NOT_VALID_NOW != rc)) { + snmp_log(LOG_ERR, + "bad rc %d from snmpNotifyFilterType_check_value\n", + rc); + rc = SNMP_ERR_GENERR; + } + } + break; + + /* + * snmpNotifyFilterStorageType(4)/StorageType/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h + */ + case COLUMN_SNMPNOTIFYFILTERSTORAGETYPE: + rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER, + sizeof(rowreq_ctx->data. + snmpNotifyFilterStorageType)); + /* + * check that the value is one of defined enums + */ + if ((SNMPERR_SUCCESS == rc) + && (*var->val.integer != STORAGETYPE_OTHER) + && (*var->val.integer != STORAGETYPE_VOLATILE) + && (*var->val.integer != STORAGETYPE_NONVOLATILE) + && (*var->val.integer != STORAGETYPE_PERMANENT) + && (*var->val.integer != STORAGETYPE_READONLY) + ) { + rc = SNMP_ERR_WRONGVALUE; + } + if (SNMPERR_SUCCESS != rc) { + DEBUGMSGTL(("snmpNotifyFilterTable:_snmpNotifyFilterTable_check_column:snmpNotifyFilterStorageType", "varbind validation failed (eg bad type or size)\n")); + } else { + rc = snmpNotifyFilterStorageType_check_value(rowreq_ctx, + *((u_long *) var-> + val.string)); + if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc) + && (MFD_NOT_VALID_NOW != rc)) { + snmp_log(LOG_ERR, + "bad rc %d from snmpNotifyFilterStorageType_check_value\n", + rc); + rc = SNMP_ERR_GENERR; + } + } + break; + + /* + * snmpNotifyFilterRowStatus(5)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h + */ + case COLUMN_SNMPNOTIFYFILTERROWSTATUS: + rc = netsnmp_check_vb_rowstatus_value(var); + if (SNMPERR_SUCCESS != rc) { + DEBUGMSGTL(("snmpNotifyFilterTable:_snmpNotifyFilterTable_check_column:snmpNotifyFilterRowStatus", "varbind validation failed (eg bad type or size)\n")); + } else { + rc = snmpNotifyFilterRowStatus_check_value(rowreq_ctx, + *((u_long *) var-> + val.string)); + if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc) + && (MFD_NOT_VALID_NOW != rc)) { + snmp_log(LOG_ERR, + "bad rc %d from snmpNotifyFilterRowStatus_check_value\n", + rc); + rc = SNMP_ERR_GENERR; + } + } + break; + + default: /** We shouldn't get here */ + rc = SNMP_ERR_GENERR; + snmp_log(LOG_ERR, + "unknown column %d in _snmpNotifyFilterTable_check_column\n", + column); + } + + return rc; +} /* _snmpNotifyFilterTable_check_column */ + +int +_mfd_snmpNotifyFilterTable_check_objects(netsnmp_mib_handler *handler, netsnmp_handler_registration + *reginfo, netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx = (snmpNotifyFilterTable_rowreq_ctx*) + netsnmp_container_table_row_extract(requests); + netsnmp_table_request_info *tri; + int rc; + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_check_objects", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + for (; requests; requests = requests->next) { + + /* + * get column number from table request info, and check that column + */ + tri = netsnmp_extract_table_info(requests); + if (NULL == tri) + continue; + + rc = _snmpNotifyFilterTable_check_column(rowreq_ctx, + requests->requestvb, + tri->colnum); + if (rc) { + netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc)); + break; + } + + } /* for results */ + + return SNMP_ERR_NOERROR; +} /* _mfd_snmpNotifyFilterTable_check_objects */ + + +/*---------------------------------------------------------------------- + * + * SET: check dependencies + * + *---------------------------------------------------------------------*/ +/* + * @internal + * Check dependencies wrapper + */ +static int +_mfd_snmpNotifyFilterTable_check_dependencies(netsnmp_mib_handler *handler, netsnmp_handler_registration + *reginfo, netsnmp_agent_request_info + *agtreq_info, netsnmp_request_info + *requests) +{ + int rc; + snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx = (snmpNotifyFilterTable_rowreq_ctx*) + netsnmp_container_table_row_extract(requests); + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_check_dependencies", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + rc = snmpNotifyFilterTable_check_dependencies(rowreq_ctx); + if (rc) { + DEBUGMSGTL(("snmpNotifyFilterTable:mfd", "error %d from " + "snmpNotifyFilterTable_check_dependencies\n", rc)); + netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); + } + + return SNMP_ERR_NOERROR; +} /* _mfd_snmpNotifyFilterTable_check_dependencies */ + +/*---------------------------------------------------------------------- + * + * SET: Undo setup + * + *---------------------------------------------------------------------*/ +/* + * @internal + * Set the value for a particular column + */ +NETSNMP_STATIC_INLINE int +_snmpNotifyFilterTable_undo_setup_column(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx, int column) +{ + int rc = SNMPERR_SUCCESS; + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_undo_setup_column", "called for %d\n", column)); + + netsnmp_assert(NULL != rowreq_ctx); + + switch (column) { + + /* + * snmpNotifyFilterMask(2)/OCTETSTR/ASN_OCTET_STR/char(char)//L/A/W/e/R/D/h + */ + case COLUMN_SNMPNOTIFYFILTERMASK: + rowreq_ctx->column_set_flags |= COLUMN_SNMPNOTIFYFILTERMASK_FLAG; + rc = snmpNotifyFilterMask_undo_setup(rowreq_ctx); + break; + + /* + * snmpNotifyFilterType(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h + */ + case COLUMN_SNMPNOTIFYFILTERTYPE: + rowreq_ctx->column_set_flags |= COLUMN_SNMPNOTIFYFILTERTYPE_FLAG; + rc = snmpNotifyFilterType_undo_setup(rowreq_ctx); + break; + + /* + * snmpNotifyFilterStorageType(4)/StorageType/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h + */ + case COLUMN_SNMPNOTIFYFILTERSTORAGETYPE: + rowreq_ctx->column_set_flags |= + COLUMN_SNMPNOTIFYFILTERSTORAGETYPE_FLAG; + rc = snmpNotifyFilterStorageType_undo_setup(rowreq_ctx); + break; + + /* + * snmpNotifyFilterRowStatus(5)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h + */ + case COLUMN_SNMPNOTIFYFILTERROWSTATUS: + rowreq_ctx->column_set_flags |= + COLUMN_SNMPNOTIFYFILTERROWSTATUS_FLAG; + rc = snmpNotifyFilterRowStatus_undo_setup(rowreq_ctx); + break; + + default: + snmp_log(LOG_ERR, + "unknown column %d in _snmpNotifyFilterTable_undo_setup_column\n", + column); + break; + } + + return rc; +} /* _snmpNotifyFilterTable_undo_setup_column */ + + +/** + * @internal + * undo setup + */ +int +_mfd_snmpNotifyFilterTable_undo_setup(netsnmp_mib_handler *handler, netsnmp_handler_registration + *reginfo, netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + int rc; + snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx = (snmpNotifyFilterTable_rowreq_ctx*) + netsnmp_container_table_row_extract(requests); + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_undo_setup", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * allocate undo context + */ + rowreq_ctx->undo = snmpNotifyFilterTable_allocate_data(); + if (NULL == rowreq_ctx->undo) { + /** msg already logged */ + netsnmp_request_set_error_all(requests, + SNMP_ERR_RESOURCEUNAVAILABLE); + return SNMP_ERR_NOERROR; + } + + /* + * row undo setup + */ + rowreq_ctx->column_set_flags = 0; + rc = snmpNotifyFilterTable_undo_setup(rowreq_ctx); + if (MFD_SUCCESS != rc) { + DEBUGMSGTL(("snmpNotifyFilterTable:mfd", "error %d from " + "snmpNotifyFilterTable_undo_setup\n", rc)); + netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); + } else { + /* + * column undo setup + */ + netsnmp_table_request_info *tri; + for (; requests; requests = requests->next) { + /* + * set column data + */ + tri = netsnmp_extract_table_info(requests); + if (NULL == tri) + continue; + + rc = _snmpNotifyFilterTable_undo_setup_column(rowreq_ctx, + tri->colnum); + if (MFD_SUCCESS != rc) { + DEBUGMSGTL(("snmpNotifyFilterTable:mfd", "error %d from " + "snmpNotifyFilterTable_undo_setup_column\n", + rc)); + netsnmp_set_request_error(agtreq_info, requests, + SNMP_VALIDATE_ERR(rc)); + } + } /* for results */ + } + + return SNMP_ERR_NOERROR; +} /* _mfd_snmpNotifyFilterTable_undo_setup */ + +/** + * @internal + * undo setup + */ +int +_mfd_snmpNotifyFilterTable_undo_cleanup(netsnmp_mib_handler *handler, netsnmp_handler_registration + *reginfo, netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx = (snmpNotifyFilterTable_rowreq_ctx*) + netsnmp_container_table_row_extract(requests); + int rc; + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_undo_cleanup", "called\n")); + + /* + * failed row create in early stages has no rowreq_ctx + */ + if (NULL == rowreq_ctx) + return MFD_SUCCESS; + + /* + * call user cleanup + */ + rc = snmpNotifyFilterTable_undo_cleanup(rowreq_ctx); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("snmpNotifyFilterTable:mfd", "error %d from " + "snmpNotifyFilterTable_undo_cleanup\n", rc)); + } + + /* + * release undo context, if needed + */ + if (rowreq_ctx->undo) { + snmpNotifyFilterTable_release_data(rowreq_ctx->undo); + rowreq_ctx->undo = NULL; + } + + + return SNMP_ERR_NOERROR; +} /* _mfd_snmpNotifyFilterTable_undo_cleanup */ + +/*---------------------------------------------------------------------- + * + * SET: Set values + * + *---------------------------------------------------------------------*/ +/* + * @internal + * Set the value for a particular column + */ +NETSNMP_STATIC_INLINE int +_snmpNotifyFilterTable_set_column(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx, netsnmp_variable_list * var, + int column) +{ + int rc = SNMPERR_SUCCESS; + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_set_column", "called for %d\n", column)); + + netsnmp_assert(NULL != rowreq_ctx); + + switch (column) { + + /* + * snmpNotifyFilterMask(2)/OCTETSTR/ASN_OCTET_STR/char(char)//L/A/W/e/R/D/h + */ + case COLUMN_SNMPNOTIFYFILTERMASK: + rowreq_ctx->column_set_flags |= COLUMN_SNMPNOTIFYFILTERMASK_FLAG; + rc = snmpNotifyFilterMask_set(rowreq_ctx, (char *) var->val.string, + var->val_len); + break; + + /* + * snmpNotifyFilterType(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h + */ + case COLUMN_SNMPNOTIFYFILTERTYPE: + rowreq_ctx->column_set_flags |= COLUMN_SNMPNOTIFYFILTERTYPE_FLAG; + rc = snmpNotifyFilterType_set(rowreq_ctx, + *((u_long *) var->val.string)); + break; + + /* + * snmpNotifyFilterStorageType(4)/StorageType/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h + */ + case COLUMN_SNMPNOTIFYFILTERSTORAGETYPE: + rowreq_ctx->column_set_flags |= + COLUMN_SNMPNOTIFYFILTERSTORAGETYPE_FLAG; + rc = snmpNotifyFilterStorageType_set(rowreq_ctx, + *((u_long *) var->val. + string)); + break; + + /* + * snmpNotifyFilterRowStatus(5)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h + */ + case COLUMN_SNMPNOTIFYFILTERROWSTATUS: + rowreq_ctx->column_set_flags |= + COLUMN_SNMPNOTIFYFILTERROWSTATUS_FLAG; + rc = snmpNotifyFilterRowStatus_set(rowreq_ctx, + *((u_long *) var->val.string)); + break; + + default: + snmp_log(LOG_ERR, + "unknown column %d in _snmpNotifyFilterTable_set_column\n", + column); + rc = SNMP_ERR_GENERR; + break; + } + + return rc; +} /* _snmpNotifyFilterTable_set_column */ + +int +_mfd_snmpNotifyFilterTable_set_values(netsnmp_mib_handler *handler, netsnmp_handler_registration + *reginfo, netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx = (snmpNotifyFilterTable_rowreq_ctx*) + netsnmp_container_table_row_extract(requests); + netsnmp_table_request_info *tri; + int rc = SNMP_ERR_NOERROR; + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_set_values", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + rowreq_ctx->column_set_flags = 0; + for (; requests; requests = requests->next) { + /* + * set column data + */ + tri = netsnmp_extract_table_info(requests); + if (NULL == tri) + continue; + + rc = _snmpNotifyFilterTable_set_column(rowreq_ctx, + requests->requestvb, + tri->colnum); + if (MFD_SUCCESS != rc) { + DEBUGMSGTL(("snmpNotifyFilterTable:mfd", "error %d from " + "snmpNotifyFilterTable_set_column\n", rc)); + netsnmp_set_request_error(agtreq_info, requests, + SNMP_VALIDATE_ERR(rc)); + } + } /* for results */ + + return SNMP_ERR_NOERROR; +} /* _mfd_snmpNotifyFilterTable_set_values */ + +/*---------------------------------------------------------------------- + * + * SET: commit + * + *---------------------------------------------------------------------*/ +/** + * @internal + * commit the values + */ +int +_mfd_snmpNotifyFilterTable_commit(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *agtreq_info, + netsnmp_request_info *requests) +{ + int rc; + snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx = (snmpNotifyFilterTable_rowreq_ctx*) + netsnmp_container_table_row_extract(requests); + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_commit", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + rc = snmpNotifyFilterTable_commit(rowreq_ctx); + if (MFD_SUCCESS != rc) { + DEBUGMSGTL(("snmpNotifyFilterTable:mfd", "error %d from " + "snmpNotifyFilterTable_commit\n", rc)); + netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); + } + + if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) { + /* + * if we successfully commited this row, set the dirty flag. Use the + * current value + 1 (i.e. dirty = # rows changed). + * this is checked in post_request... + */ + snmpNotifyFilterTable_dirty_set(snmpNotifyFilterTable_dirty_get() + 1); /* set table dirty flag */ + } + + return SNMP_ERR_NOERROR; +} + +int +_mfd_snmpNotifyFilterTable_undo_commit(netsnmp_mib_handler *handler, netsnmp_handler_registration + *reginfo, netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + int rc; + snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx = (snmpNotifyFilterTable_rowreq_ctx*) + netsnmp_container_table_row_extract(requests); + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_undo_commit", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) { + u_int d = snmpNotifyFilterTable_dirty_get(); + + netsnmp_assert(d != 0); + if (d) + snmpNotifyFilterTable_dirty_set(d - 1); + } + + rc = snmpNotifyFilterTable_undo_commit(rowreq_ctx); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("snmpNotifyFilterTable:mfd", "error %d from " + "snmpNotifyFilterTable_undo_commit\n", rc)); + } + + if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) { + snmp_log(LOG_WARNING, + "snmpNotifyFilterTable row dirty flag still set after undo_commit\n"); + rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY; + } + + return SNMP_ERR_NOERROR; +} /* _mfd_snmpNotifyFilterTable_commit */ + +/*---------------------------------------------------------------------- + * + * SET: Undo + * + *---------------------------------------------------------------------*/ +/** + * @internal + * undo the value for a particular column + */ +NETSNMP_STATIC_INLINE int +_snmpNotifyFilterTable_undo_column(snmpNotifyFilterTable_rowreq_ctx * + rowreq_ctx, netsnmp_variable_list * var, + int column) +{ + int rc = SNMPERR_SUCCESS; + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_undo_column", "called for %d\n", column)); + + netsnmp_assert(NULL != rowreq_ctx); + + switch (column) { + + /* + * snmpNotifyFilterMask(2)/OCTETSTR/ASN_OCTET_STR/char(char)//L/A/W/e/R/D/h + */ + case COLUMN_SNMPNOTIFYFILTERMASK: + rc = snmpNotifyFilterMask_undo(rowreq_ctx); + break; + + /* + * snmpNotifyFilterType(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h + */ + case COLUMN_SNMPNOTIFYFILTERTYPE: + rc = snmpNotifyFilterType_undo(rowreq_ctx); + break; + + /* + * snmpNotifyFilterStorageType(4)/StorageType/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h + */ + case COLUMN_SNMPNOTIFYFILTERSTORAGETYPE: + rc = snmpNotifyFilterStorageType_undo(rowreq_ctx); + break; + + /* + * snmpNotifyFilterRowStatus(5)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h + */ + case COLUMN_SNMPNOTIFYFILTERROWSTATUS: + rc = snmpNotifyFilterRowStatus_undo(rowreq_ctx); + break; + + default: + snmp_log(LOG_ERR, + "unknown column %d in _snmpNotifyFilterTable_undo_column\n", + column); + break; + } + + return rc; +} /* _snmpNotifyFilterTable_undo_column */ + +int +_mfd_snmpNotifyFilterTable_undo_values(netsnmp_mib_handler *handler, netsnmp_handler_registration + *reginfo, netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + int rc; + snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx = (snmpNotifyFilterTable_rowreq_ctx*) + netsnmp_container_table_row_extract(requests); + netsnmp_table_request_info *tri; + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_undo_values", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + rc = snmpNotifyFilterTable_undo(rowreq_ctx); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("snmpNotifyFilterTable:mfd", "error %d from " + "snmpNotifyFilterTable_undo\n", rc)); + } + + for (; requests; requests = requests->next) { + /* + * set column data + */ + tri = netsnmp_extract_table_info(requests); + if (NULL == tri) + continue; + + rc = _snmpNotifyFilterTable_undo_column(rowreq_ctx, + requests->requestvb, + tri->colnum); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("snmpNotifyFilterTable:mfd", "error %d from " + "snmpNotifyFilterTable_undo_column\n", rc)); + } + } /* for results */ + + return SNMP_ERR_NOERROR; +} /* _mfd_snmpNotifyFilterTable_undo_values */ + +/*---------------------------------------------------------------------- + * + * SET: irreversible commit + * + *---------------------------------------------------------------------*/ +/** + * @internal + * commit irreversible actions + */ +int +_mfd_snmpNotifyFilterTable_irreversible_commit(netsnmp_mib_handler + *handler, netsnmp_handler_registration + *reginfo, netsnmp_agent_request_info + *agtreq_info, netsnmp_request_info + *requests) +{ + snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx = (snmpNotifyFilterTable_rowreq_ctx*) + netsnmp_container_table_row_extract(requests); + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_irreversible:commit", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * check for and handle row creation/deletion + * and update column exist flags... + */ + if (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED) { + if (!(rowreq_ctx->rowreq_flags & MFD_ROW_CREATED)) + CONTAINER_REMOVE(snmpNotifyFilterTable_if_ctx.container, + rowreq_ctx); + } else { + if (rowreq_ctx->column_set_flags) { + rowreq_ctx->column_set_flags = 0; + } + if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) { + rowreq_ctx->rowreq_flags &= ~MFD_ROW_CREATED; + CONTAINER_INSERT(snmpNotifyFilterTable_if_ctx.container, + rowreq_ctx); + } + } + + return SNMP_ERR_NOERROR; +} /* _mfd_snmpNotifyFilterTable_irreversible_commit */ +#endif /* NETSNMP_NO_WRITE_SUPPORT || NETSNMP_DISABLE_SET_SUPPORT */ + +/*********************************************************************** + * + * DATA ACCESS + * + ***********************************************************************/ +/** + * @internal + */ +static void +_container_item_free(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx, + void *context) +{ + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_container_item_free", + "called\n")); + + if (NULL == rowreq_ctx) + return; + + snmpNotifyFilterTable_release_rowreq_ctx(rowreq_ctx); +} /* _container_item_free */ + +/** + * @internal + */ +static void +_container_free(netsnmp_container *container) +{ + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_container_free", + "called\n")); + + if (NULL == container) { + snmp_log(LOG_ERR, + "invalid container in snmpNotifyFilterTable_container_free\n"); + return; + } + + /* + * call user code + */ + snmpNotifyFilterTable_container_free(container); + + /* + * free all items. inefficient, but easy. + */ + CONTAINER_CLEAR(container, + (netsnmp_container_obj_func *) _container_item_free, + NULL); +} /* _container_free */ + +/** + * @internal + * initialize the container with functions or wrappers + */ +void +_snmpNotifyFilterTable_container_init(snmpNotifyFilterTable_interface_ctx * + if_ctx) +{ + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_container_init", "called\n")); + + /* + * container init + */ + snmpNotifyFilterTable_container_init(&if_ctx->container); + if (NULL == if_ctx->container) + if_ctx->container = + netsnmp_container_find + ("snmpNotifyFilterTable:table_container"); + if (NULL == if_ctx->container) { + snmp_log(LOG_ERR, "error creating container in " + "snmpNotifyFilterTable_container_init\n"); + return; + } + +} /* _snmpNotifyFilterTable_container_init */ + +/** + * @internal + * shutdown the container with functions or wrappers + */ +void + + + + + + + + + + + + + + + + _snmpNotifyFilterTable_container_shutdown + (snmpNotifyFilterTable_interface_ctx * if_ctx) { + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_container_shutdown", "called\n")); + + snmpNotifyFilterTable_container_shutdown(if_ctx->container); + + _container_free(if_ctx->container); + +} /* _snmpNotifyFilterTable_container_shutdown */ + +/*********************************************************************** + * + * PERSISTENCE + * + ***********************************************************************/ + +static int _snmpNotifyFilterTable_container_save_rows(int majorID, + int minorID, + void *serverarg, + void + *clientarg); +static void _snmpNotifyFilterTable_container_row_restore(const char + *token, + char *buf); +static int + _snmpNotifyFilterTable_container_row_save(snmpNotifyFilterTable_rowreq_ctx + * rowreq_ctx, + void *type); +static char + + + + + + + + + + + + + + + *_snmpNotifyFilterTable_container_col_restore + (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx, u_int col, char *buf); +static char + + + + + + + + + + + + + + + *_snmpNotifyFilterTable_container_col_save + (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx, u_int col, char *buf); + +static char row_token[] = "snmpNotifyFilterTable"; + +/************************************************************ + * *_init_persistence should be called from the main table + * init routine. + * + * If your table depends on rows in another table, + * you should register your callback after the other table, + * which should ensure the rows on which you depend are saved + * (and re-created) before the dependent rows. + */ +void +snmpNotifyFilterTable_container_init_persistence(netsnmp_container + *container) +{ + netsnmp_container **container_p; + int rc; + + register_config_handler(NULL, row_token, + _snmpNotifyFilterTable_container_row_restore, + NULL, NULL); + memdup((u_char **)&container_p, &container, sizeof(container)); + netsnmp_assert(container_p); + rc = snmp_register_callback(SNMP_CALLBACK_LIBRARY, + SNMP_CALLBACK_STORE_DATA, + _snmpNotifyFilterTable_container_save_rows, + container_p); + + if (rc != SNMP_ERR_NOERROR) + snmp_log(LOG_ERR, "error registering for STORE_DATA callback " + "in _snmpNotifyFilterTable_container_init_persistence\n"); +} + +static int +_snmpNotifyFilterTable_container_save_rows(int majorID, int minorID, + void *serverarg, + void *clientarg) +{ + char sep[] = + "##############################################################"; + char buf[] = + "#\n" "# snmpNotifyFilterTable persistent data\n" "#"; + char *type = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, + NETSNMP_DS_LIB_APPTYPE); + netsnmp_container *c = *(netsnmp_container **)clientarg; + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:" + "_snmpNotifyFilterTable_container_save_rows", + "saving %" NETSNMP_PRIz "u rows\n", CONTAINER_SIZE(c))); + + read_config_store((char *) type, sep); + read_config_store((char *) type, buf); + + /* + * save all rows + */ + CONTAINER_FOR_EACH(c, (netsnmp_container_obj_func *) + _snmpNotifyFilterTable_container_row_save, type); + + read_config_store((char *) type, sep); + read_config_store((char *) type, "\n"); + + /* + * never fails + */ + return SNMPERR_SUCCESS; +} + + + +/************************************************************ + * _snmpNotifyFilterTable_container_row_save + */ +static int +_snmpNotifyFilterTable_container_row_save(snmpNotifyFilterTable_rowreq_ctx + * rowreq_ctx, void *type) +{ + /* + * Allocate space for a line with all data for a row. An + * attempt is made to come up with a default maximum size, but + * there is no guarantee it will be enough. It probably will be, + * unless you are dealing with large values or you have external + * indexes. + * + * 1) allocate space for each column. Comment out columns you don't + * intend to save. You may also need to add room for any non- + * column data you want to store. Remeber, data will be stored in + * ASCII form, so you need to allow for that. Here are some + * general guidelines: + * + * Object ID : 12 * len [ASCII len of max int + 1 for .] + * Octet String: (2 * len) + 2 [2 ASCII chars per byte + "0x"] + * Integers : 12 [ASCII len for smallest negative number] + * + * 2) You also need to allocate space for the row index. This will + * be stored as an OID, which means that Octet Strings need to + * be treated a little differently. Specifically, you will need + * (4 * len) + 4 [3 ASCII chars per byte + 1 for ., + 4 for len]. + * + * 3) Also, remember to add space for the identifier and separator + * characters (for example, each column is prefixed by the + * column number and a semicolon. To allow for the maximum + * column values, 12 bytes [11 for oid + 1 for ':'] per + * column are added). + */ + +#define MAX_ROW_SIZE (sizeof(row_token) + 1 + \ + ( 12 * 128 ) + /* ASN_OBJECT_ID snmpNotifyFilterSubtree and */ \ + /* ASN_OCTET_STR snmpNotifyFilterProfileName indices */ \ + ( ( 2 * sizeof(rowreq_ctx->data.snmpNotifyFilterMask) ) + 3 ) + /* ASN_OCTET_STR */ \ + ( 12 ) + /* ASN_INTEGER snmpNotifyFilterType */ \ + ( 12 ) + /* ASN_INTEGER snmpNotifyFilterStorageType */ \ + ( 12 ) + /* ASN_INTEGER snmpNotifyFilterRowStatus */ \ + ( SNMPNOTIFYFILTERTABLE_MAX_COL * 12 ) + /* column num prefix + : */ \ + 2 /* LINE_TERM_CHAR + \n */ ) + + char buf[MAX_ROW_SIZE], *pos = buf, *max = + &buf[MAX_ROW_SIZE - 1]; + char *tmp; + int i; + + if (snmpNotifyFilterTable_container_should_save(rowreq_ctx) == 0) { + return SNMP_ERR_NOERROR; + } + + /* + * build the line + */ + pos += sprintf(pos, "%s ", row_token); + pos = read_config_save_objid(pos, rowreq_ctx->oid_idx.oids, + rowreq_ctx->oid_idx.len); + if (NULL == pos) { + snmp_log(LOG_ERR, "error saving snmpNotifyFilterTable row " + "to persistent file\n"); + return SNMP_ERR_GENERR; + } + *pos++ = ' '; + if (pos > max) { + snmp_log(LOG_ERR, "error saving snmpNotifyFilterTable row " + "to persistent file (too long)\n"); + return SNMP_ERR_GENERR; + } + + /* + * add each column + */ + for (i = SNMPNOTIFYFILTERTABLE_MIN_COL; + i <= SNMPNOTIFYFILTERTABLE_MAX_COL; ++i) { + + if ((0x1 << (i - 1)) & ~SNMPNOTIFYFILTERTABLE_SETTABLE_COLS) + continue; + + tmp = pos; + pos = + _snmpNotifyFilterTable_container_col_save(rowreq_ctx, i, pos); + if (NULL == pos) + pos = tmp; + else + *pos++ = ' '; + if (pos > max) { + snmp_log(LOG_ERR, "error saving snmpNotifyFilterTable row " + "to persistent file (too long)\n"); + return SNMP_ERR_GENERR; + } + } + + /* + * if you have non-column data, add it here + */ + + + /* + * store the line + */ + pos += sprintf(pos, "%c", LINE_TERM_CHAR); + if (pos > max) { + snmp_log(LOG_ERR, "error saving snmpNotifyFilterTable row " + "to persistent file (too long)\n"); + return SNMP_ERR_GENERR; + } + read_config_store((char *) type, buf); + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_container_row_save", "saving line '%s'\n", buf)); + + return SNMP_ERR_NOERROR; +} + +static void +_snmpNotifyFilterTable_container_row_restore(const char *token, char *buf) +{ + snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx; + netsnmp_index index; + oid tmp_oid[MAX_snmpNotifyFilterTable_IDX_LEN]; + u_int col = 0, found = 0; + + + if (strncmp(token, row_token, sizeof(row_token)) != 0) { + snmp_log(LOG_ERR, + "unknown token in _snmpNotifyFilterTable_container_row_restore\n"); + return; + } + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_container_row_restore", "parsing line '%s'\n", buf)); + + /* + * pull out index and create default row + */ + index.oids = tmp_oid; + index.len = OID_LENGTH(tmp_oid); + buf = read_config_read_objid(buf, &index.oids, &index.len); + if (NULL == buf) { + snmp_log(LOG_ERR, "error reading row index in " + "_snmpNotifyFilterTable_container_row_restore\n"); + return; + } + rowreq_ctx = + _mfd_snmpNotifyFilterTable_rowreq_from_index(&index, NULL); + if (NULL == rowreq_ctx) { + snmp_log(LOG_ERR, "error creating row index in " + "_snmpNotifyFilterTable_container_row_restore\n"); + return; + } + + /* + * loop through and get each column + */ + buf = skip_white(buf); + while ((NULL != buf) && isdigit((unsigned char)(*buf))) { + /* + * extract column, skip ':' + */ + col = (u_int) strtol(buf, &buf, 10); + if (NULL == buf) + break; + if (*buf != ':') { + buf = NULL; + break; + } + ++buf; /* skip : */ + + /* + * parse value + */ + DEBUGMSGTL(("_snmpNotifyFilterTable_container_row_restore", + "parsing column %d\n", col)); + buf = + _snmpNotifyFilterTable_container_col_restore(rowreq_ctx, col, + buf); + ++found; + } + if (0 == found) { + snmp_log(LOG_ERR, + "error parsing snmpNotifyFilterTable row; no columns found"); + snmpNotifyFilterTable_release_rowreq_ctx(rowreq_ctx); + return; + } + + /* + * if you added any non-column data, this is where + * you should handle it. + */ + + /* + * if the pointer is NULL and we didn't reach the + * end of the line, something went wrong. Log message, + * delete the row and bail. + */ + if ((buf == NULL) || (*buf != LINE_TERM_CHAR)) { + snmp_log(LOG_ERR, + "error parsing snmpNotifyFilterTable row around column %d", + col); + snmpNotifyFilterTable_release_rowreq_ctx(rowreq_ctx); + return; + } + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_container_row_restore", "inserting row\n")); + + /* + * copy oid index and insert row + */ + rowreq_ctx->oid_idx.len = index.len; + memcpy(rowreq_ctx->oid_idx.oids, index.oids, index.len * sizeof(oid)); + + CONTAINER_INSERT(snmpNotifyFilterTable_if_ctx.container, rowreq_ctx); +} + +/************************************************************ + * _snmpNotifyFilterTable_container_col_save + */ +static char * +_snmpNotifyFilterTable_container_col_save(snmpNotifyFilterTable_rowreq_ctx + * rowreq_ctx, u_int col, + char *buf) +{ + if ((NULL == rowreq_ctx) || (NULL == buf)) { + snmp_log(LOG_ERR, "bad parameter in " + "_snmpNotifyFilterTable_container_col_save\n"); + return NULL; + } + + DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_container_col_save", "processing column %d\n", col)); + + /* + * prefix with column number, so we don't ever depend on + * order saved. + */ + buf += sprintf(buf, "%u:", col); + + /* + * save data for the column + */ + switch (col) { + + case COLUMN_SNMPNOTIFYFILTERMASK: /** OCTETSTR = ASN_OCTET_STR */ + buf = + read_config_save_octet_string(buf, + (u_char *) rowreq_ctx->data. + snmpNotifyFilterMask, + rowreq_ctx->data. + snmpNotifyFilterMask_len); + break; + + case COLUMN_SNMPNOTIFYFILTERTYPE: /** INTEGER = ASN_INTEGER */ + buf += sprintf(buf, "%ld", rowreq_ctx->data.snmpNotifyFilterType); + break; + + case COLUMN_SNMPNOTIFYFILTERSTORAGETYPE: /** StorageType = ASN_INTEGER */ + buf += + sprintf(buf, "%ld", + rowreq_ctx->data.snmpNotifyFilterStorageType); + break; + + case COLUMN_SNMPNOTIFYFILTERROWSTATUS: /** RowStatus = ASN_INTEGER */ + buf += + sprintf(buf, "%ld", + rowreq_ctx->data.snmpNotifyFilterRowStatus); + break; + + default: + /** We shouldn't get here */ + snmp_log(LOG_ERR, "unknown column %d in " + "_snmpNotifyFilterTable_container_col_save\n", col); + return NULL; + } + + return buf; +} + +/************************************************************ + * _snmpNotifyFilterTable_container_col_restore + */ +static char *_snmpNotifyFilterTable_container_col_restore + (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx, u_int col, char *buf) { + size_t len; + if ((NULL == rowreq_ctx) || (NULL == buf)) { + snmp_log(LOG_ERR, "bad parameter in " + "_snmpNotifyFilterTable_container_col_restore\n"); + return NULL; + } + + DEBUGMSGTL(("verbose:snmpNotifyFilterTable:_snmpNotifyFilterTable_container_col_restore", "processing column %d\n", col)); + + /* + * restore data for the column + */ + switch (col) { + + case COLUMN_SNMPNOTIFYFILTERMASK: /** OCTETSTR = ASN_OCTET_STR */ + rowreq_ctx->data.snmpNotifyFilterMask_len = + sizeof(rowreq_ctx->data.snmpNotifyFilterMask); + buf = + read_config_read_memory(ASN_OCTET_STR, buf, + (char *) &rowreq_ctx->data. + snmpNotifyFilterMask, + (size_t *) & rowreq_ctx->data. + snmpNotifyFilterMask_len); + break; + + case COLUMN_SNMPNOTIFYFILTERTYPE: /** INTEGER = ASN_INTEGER */ + len = sizeof(rowreq_ctx->data.snmpNotifyFilterType); + buf = read_config_read_memory(ASN_INTEGER, buf, + (char *) &rowreq_ctx->data. + snmpNotifyFilterType, &len); + break; + + case COLUMN_SNMPNOTIFYFILTERSTORAGETYPE: /** StorageType = ASN_INTEGER */ + len = sizeof(rowreq_ctx->data.snmpNotifyFilterStorageType); + buf = read_config_read_memory(ASN_INTEGER, buf, + (char *) &rowreq_ctx->data. + snmpNotifyFilterStorageType, &len); + break; + + case COLUMN_SNMPNOTIFYFILTERROWSTATUS: /** RowStatus = ASN_INTEGER */ + len = sizeof(rowreq_ctx->data.snmpNotifyFilterRowStatus); + buf = read_config_read_memory(ASN_INTEGER, buf, + (char *) &rowreq_ctx->data. + snmpNotifyFilterRowStatus, &len); + break; + + default: + /** We shouldn't get here */ + snmp_log(LOG_ERR, "unknown column %d in " + "_snmpNotifyFilterTable_container_col_restore\n", col); + return NULL; + } + + return buf; +} + + +#ifndef NETSNMP_FEATURE_REMOVE_SNMPNOTIFYFILTERTABLE_EXTERNAL_ACCESS +snmpNotifyFilterTable_rowreq_ctx * +snmpNotifyFilterTable_row_find_by_mib_index(snmpNotifyFilterTable_mib_index + * mib_idx) +{ + snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx; + oid oid_tmp[MAX_OID_LEN]; + netsnmp_index oid_idx; + int rc; + + /* + * set up storage for OID + */ + oid_idx.oids = oid_tmp; + oid_idx.len = sizeof(oid_tmp) / sizeof(oid); + + /* + * convert + */ + rc = snmpNotifyFilterTable_index_to_oid(&oid_idx, mib_idx); + if (MFD_SUCCESS != rc) + return NULL; + + rowreq_ctx = (snmpNotifyFilterTable_rowreq_ctx*) + CONTAINER_FIND(snmpNotifyFilterTable_if_ctx.container, &oid_idx); + + return rowreq_ctx; +} +#endif /* NETSNMP_FEATURE_REMOVE_SNMPNOTIFYFILTERTABLE_EXTERNAL_ACCESS */ diff --git a/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_interface.h b/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_interface.h new file mode 100644 index 0000000..eb2da8a --- /dev/null +++ b/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_interface.h @@ -0,0 +1,210 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.67 $ of : mfd-interface.m2c,v $ + * + * $Id$ + */ +/** @ingroup interface Routines to interface to Net-SNMP + * + * \warning This code should not be modified, called directly, + * or used to interpret functionality. It is subject to + * change at any time. + * + * @{ + */ +/* + * ********************************************************************* + * ********************************************************************* + * ********************************************************************* + * *** *** + * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE *** + * *** *** + * *** *** + * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. *** + * *** *** + * *** *** + * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND *** + * *** *** + * *** *** + * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. *** + * *** *** + * *** *** + * ********************************************************************* + * ********************************************************************* + * ********************************************************************* + */ +#ifndef SNMPNOTIFYFILTERTABLE_INTERFACE_H +#define SNMPNOTIFYFILTERTABLE_INTERFACE_H + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "snmpNotifyFilterTable.h" + + + /* + ******************************************************************** + * Table declarations + */ + + /* + * PUBLIC interface initialization routine + */ + void + + + + + + + + + + + + + + + + _snmpNotifyFilterTable_initialize_interface + (snmpNotifyFilterTable_registration * user_ctx, u_long flags); + void + + + + + + + + + + + + + + + + _snmpNotifyFilterTable_shutdown_interface + (snmpNotifyFilterTable_registration * user_ctx); + + + + + + + + snmpNotifyFilterTable_registration + * snmpNotifyFilterTable_registration_get(void); + + + + + + + + snmpNotifyFilterTable_registration + * snmpNotifyFilterTable_registration_set + (snmpNotifyFilterTable_registration * newreg); + + netsnmp_container *snmpNotifyFilterTable_container_get(void); + int snmpNotifyFilterTable_container_size(void); + + u_int snmpNotifyFilterTable_dirty_get(void); + void snmpNotifyFilterTable_dirty_set(u_int status); + + + + + + + + snmpNotifyFilterTable_rowreq_ctx + * snmpNotifyFilterTable_allocate_rowreq_ctx(void *); + void + + + + + + + + + + + + + + + + snmpNotifyFilterTable_release_rowreq_ctx + (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx); + + int snmpNotifyFilterTable_index_to_oid(netsnmp_index * + oid_idx, + snmpNotifyFilterTable_mib_index + * mib_idx); + int snmpNotifyFilterTable_index_from_oid(netsnmp_index * + oid_idx, + snmpNotifyFilterTable_mib_index + * mib_idx); + + /* + ********************************************************************* + * Persistent declarations + */ + /* + * persistence + */ +#define LINE_TERM_CHAR '$' + + void + snmpNotifyFilterTable_container_init_persistence(netsnmp_container + *container); + int + + + + + + + + + + + + + + + + snmpNotifyFilterTable_container_should_save + (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx); + + + /* + * access to certain internals. use with caution! + */ + void + + + + + + + + + + + + + + snmpNotifyFilterTable_valid_columns_set(netsnmp_column_info *vc); + + +#ifdef __cplusplus +} +#endif +#endif /* SNMPNOTIFYFILTERTABLE_INTERFACE_H */ +/** @} */ + |