diff options
author | Hideki Yamane <henrich@debian.org> | 2013-04-11 10:21:22 +0900 |
---|---|---|
committer | Hideki Yamane <henrich@debian.org> | 2013-04-11 10:21:22 +0900 |
commit | e30beeedd5cbe6f72008c32122b3b8b617fd5ab2 (patch) | |
tree | 8bd5c28fc77a5a80d65cf70e2fd330b8af448c73 /agent/mibgroup/ip-mib/inetNetToMediaTable | |
parent | 2ebfa94e6e1fe2b88bb061d26f20fef9c0b78536 (diff) | |
download | pkg-net-snmp-e30beeedd5cbe6f72008c32122b3b8b617fd5ab2.tar.gz |
Imported Upstream version 5.4.3~dfsgupstream/5.4.3_dfsg
Diffstat (limited to 'agent/mibgroup/ip-mib/inetNetToMediaTable')
7 files changed, 5192 insertions, 0 deletions
diff --git a/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable.c b/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable.c new file mode 100644 index 0000000..640c2e2 --- /dev/null +++ b/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable.c @@ -0,0 +1,1818 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.48 $ of : mfd-top.m2c,v $ + * + * $Id: inetNetToMediaTable.c 14169 2006-01-25 16:28:12Z dts12 $ + */ +/** \page MFD helper for inetNetToMediaTable + * + * \section intro Introduction + * Introductory text. + * + */ +/* + * standard Net-SNMP includes + */ +#include <net-snmp/net-snmp-config.h> +#include <net-snmp/net-snmp-includes.h> +#include <net-snmp/agent/net-snmp-agent-includes.h> + +/* + * include our parent header + */ +#include "inetNetToMediaTable.h" + +#include <net-snmp/agent/mib_modules.h> + +#include "inetNetToMediaTable_interface.h" + +oid inetNetToMediaTable_oid[] = { INETNETTOMEDIATABLE_OID }; +int inetNetToMediaTable_oid_size = +OID_LENGTH(inetNetToMediaTable_oid); + +inetNetToMediaTable_registration inetNetToMediaTable_user_context; + +void initialize_table_inetNetToMediaTable(void); +void shutdown_table_inetNetToMediaTable(void); + + +/** + * Initializes the inetNetToMediaTable module + */ +void +init_inetNetToMediaTable(void) +{ + DEBUGMSGTL(("verbose:inetNetToMediaTable:init_inetNetToMediaTable", + "called\n")); + + /* + * TODO:300:o: Perform inetNetToMediaTable one-time module initialization. + */ + + /* + * here we initialize all the tables we're planning on supporting + */ + if (should_init("inetNetToMediaTable")) + initialize_table_inetNetToMediaTable(); + +} /* init_inetNetToMediaTable */ + +/** + * Shut-down the inetNetToMediaTable module (agent is exiting) + */ +void +shutdown_inetNetToMediaTable(void) +{ + if (should_init("inetNetToMediaTable")) + shutdown_table_inetNetToMediaTable(); + +} + +/** + * Initialize the table inetNetToMediaTable + * (Define its contents and how it's structured) + */ +void +initialize_table_inetNetToMediaTable(void) +{ + inetNetToMediaTable_registration *user_context; + u_long flags; + + DEBUGMSGTL(("verbose:inetNetToMediaTable:initialize_table_inetNetToMediaTable", "called\n")); + + /* + * TODO:301:o: Perform inetNetToMediaTable one-time table initialization. + */ + + /* + * TODO:302:o: |->Initialize inetNetToMediaTable 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. + */ + user_context = + netsnmp_create_data_list("inetNetToMediaTable", NULL, NULL); + + /* + * No support for any flags yet, but in the future you would + * set any flags here. + */ + flags = 0; + + /* + * call interface initialization code + */ + _inetNetToMediaTable_initialize_interface(user_context, flags); +} /* initialize_table_inetNetToMediaTable */ + +/** + * Shutdown the table inetNetToMediaTable + */ +void +shutdown_table_inetNetToMediaTable(void) +{ + /* + * call interface shutdown code + */ + _inetNetToMediaTable_shutdown_interface + (&inetNetToMediaTable_user_context); +} + +/** + * 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 +inetNetToMediaTable_rowreq_ctx_init(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx, void *user_init_ctx) +{ + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_rowreq_ctx_init", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:210:o: |-> Perform extra inetNetToMediaTable rowreq initialization. (eg DEFVALS) + */ + + return MFD_SUCCESS; +} /* inetNetToMediaTable_rowreq_ctx_init */ + +/** + * extra context cleanup + * + */ +void +inetNetToMediaTable_rowreq_ctx_cleanup(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx) +{ + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_rowreq_ctx_cleanup", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:211:o: |-> Perform extra inetNetToMediaTable rowreq cleanup. + */ +} /* inetNetToMediaTable_rowreq_ctx_cleanup */ + +/** + * pre-request callback + * + * + * @retval MFD_SUCCESS : success. + * @retval MFD_ERROR : other error + */ +int +inetNetToMediaTable_pre_request(inetNetToMediaTable_registration * + user_context) +{ + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_pre_request", "called\n")); + + /* + * TODO:510:o: Perform inetNetToMediaTable pre-request actions. + */ + + return MFD_SUCCESS; +} /* inetNetToMediaTable_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 +inetNetToMediaTable_post_request(inetNetToMediaTable_registration * + user_context, int rc) +{ + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_post_request", "called\n")); + + /* + * TODO:511:o: Perform inetNetToMediaTable post-request actions. + */ + + /* + * check to set if any rows were changed. + */ + if (inetNetToMediaTable_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) { + /* + * save changed rows, if you haven't already + */ + } + + inetNetToMediaTable_dirty_set(0); /* clear table dirty flag */ + } + + return MFD_SUCCESS; +} /* inetNetToMediaTable_post_request */ + + +/********************************************************************** + ********************************************************************** + *** + *** Table inetNetToMediaTable + *** + ********************************************************************** + **********************************************************************/ +/* + * IP-MIB::inetNetToMediaTable is subid 35 of ip. + * Its status is Current. + * OID: .1.3.6.1.2.1.4.35, length: 8 + */ + +/* + * --------------------------------------------------------------------- + * * TODO:200:r: Implement inetNetToMediaTable data context functions. + */ +/* + * inetNetToMediaTable_allocate_data + * + * Purpose: create new inetNetToMediaTable_data. + */ +inetNetToMediaTable_data * +inetNetToMediaTable_allocate_data(void) +{ + /* + * TODO:201:r: |-> allocate memory for the inetNetToMediaTable data context. + */ + /** this might not be right for netsnmp_inetmedia_entry */ + inetNetToMediaTable_data *rtn = netsnmp_access_arp_entry_create(); + + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_allocate_data", "called\n")); + + if (NULL == rtn) { + snmp_log(LOG_ERR, "unable to malloc memory for new " + "inetNetToMediaTable_data.\n"); + } + + return rtn; +} /* inetNetToMediaTable_allocate_data */ + +/* + * inetNetToMediaTable_release_data + * + * Purpose: release inetNetToMediaTable data. + */ +void +inetNetToMediaTable_release_data(inetNetToMediaTable_data * data) +{ + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_release_data", "called\n")); + + /* + * TODO:202:r: |-> release memory for the inetNetToMediaTable data context. + */ + netsnmp_access_arp_entry_free(data); +} /* inetNetToMediaTable_release_data */ + + + +/** + * set mib index(es) + * + * @param tbl_idx mib index structure + * @param inetNetToMediaIfIndex_val + * @param inetNetToMediaNetAddressType_val + * @param inetNetToMediaNetAddress_val_ptr + * @param inetNetToMediaNetAddress_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 +inetNetToMediaTable_indexes_set_tbl_idx(inetNetToMediaTable_mib_index * + tbl_idx, + long inetNetToMediaIfIndex_val, + u_long + inetNetToMediaNetAddressType_val, + char + *inetNetToMediaNetAddress_val_ptr, + size_t + inetNetToMediaNetAddress_val_ptr_len) +{ + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_indexes_set_tbl_idx", "called\n")); + + /* + * inetNetToMediaIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H + */ + /** WARNING: this code might not work for netsnmp_arp_entry */ + tbl_idx->inetNetToMediaIfIndex = inetNetToMediaIfIndex_val; + + /* + * inetNetToMediaNetAddressType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h + */ + /** WARNING: this code might not work for netsnmp_arp_entry */ + tbl_idx->inetNetToMediaNetAddressType = + inetNetToMediaNetAddressType_val; + + /* + * inetNetToMediaNetAddress(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h + */ + tbl_idx->inetNetToMediaNetAddress_len = sizeof(tbl_idx->inetNetToMediaNetAddress) / sizeof(tbl_idx->inetNetToMediaNetAddress[0]); /* max length */ + /** WARNING: this code might not work for netsnmp_arp_entry */ + /* + * make sure there is enough space for inetNetToMediaNetAddress data + */ + if (tbl_idx->inetNetToMediaNetAddress_len < + inetNetToMediaNetAddress_val_ptr_len) { + snmp_log(LOG_ERR, "not enough space for value\n"); + return MFD_ERROR; + } + tbl_idx->inetNetToMediaNetAddress_len = + inetNetToMediaNetAddress_val_ptr_len; + memcpy(tbl_idx->inetNetToMediaNetAddress, + inetNetToMediaNetAddress_val_ptr, + inetNetToMediaNetAddress_val_ptr_len * + sizeof(inetNetToMediaNetAddress_val_ptr[0])); + + + return MFD_SUCCESS; +} /* inetNetToMediaTable_indexes_set_tbl_idx */ + +/** + * @internal + * set row context indexes + * + * @param reqreq_ctx the row context that needs updated indexes + * + * @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 +inetNetToMediaTable_indexes_set(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx, long inetNetToMediaIfIndex_val, + u_long inetNetToMediaNetAddressType_val, + char *inetNetToMediaNetAddress_val_ptr, + size_t + inetNetToMediaNetAddress_val_ptr_len) +{ + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_indexes_set", "called\n")); + + if (MFD_SUCCESS != + inetNetToMediaTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx, + inetNetToMediaIfIndex_val, + inetNetToMediaNetAddressType_val, + inetNetToMediaNetAddress_val_ptr, + inetNetToMediaNetAddress_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 != inetNetToMediaTable_index_to_oid(&rowreq_ctx->oid_idx, + &rowreq_ctx->tbl_idx)) { + return MFD_ERROR; + } + + return MFD_SUCCESS; +} /* inetNetToMediaTable_indexes_set */ + + +/*--------------------------------------------------------------------- + * IP-MIB::inetNetToMediaEntry.inetNetToMediaPhysAddress + * inetNetToMediaPhysAddress is subid 4 of inetNetToMediaEntry. + * Its status is Current, and its access level is Create. + * OID: .1.3.6.1.2.1.4.35.1.4 + * Description: +The media-dependent `physical' address. + + + As the entries in this table are typically not persistent + when this object is written the entity SHOULD NOT save the + change to non-volatile storage. + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 1 hashint 1 + * settable 1 + * hint: 1x: + * + * Ranges: 0 - 65535; + * + * Its syntax is PhysAddress (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 65535) + */ +/** + * Extract the current value of the inetNetToMediaPhysAddress data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param inetNetToMediaPhysAddress_val_ptr_ptr + * Pointer to storage for a char variable + * @param inetNetToMediaPhysAddress_val_ptr_len_ptr + * Pointer to a size_t. On entry, it will contain the size (in bytes) + * pointed to by inetNetToMediaPhysAddress. + * 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 (*inetNetToMediaPhysAddress_val_ptr_len_ptr) bytes of memory, + * allocate it using malloc() and update inetNetToMediaPhysAddress_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 +inetNetToMediaPhysAddress_get(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, + char **inetNetToMediaPhysAddress_val_ptr_ptr, + size_t + * inetNetToMediaPhysAddress_val_ptr_len_ptr) +{ + /** we should have a non-NULL pointer and enough storage */ + netsnmp_assert((NULL != inetNetToMediaPhysAddress_val_ptr_ptr) + && (NULL != *inetNetToMediaPhysAddress_val_ptr_ptr)); + netsnmp_assert(NULL != inetNetToMediaPhysAddress_val_ptr_len_ptr); + + + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaPhysAddress_get", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:231:o: |-> Extract the current value of the inetNetToMediaPhysAddress data. + * copy (* inetNetToMediaPhysAddress_val_ptr_ptr ) data and (* inetNetToMediaPhysAddress_val_ptr_len_ptr ) from rowreq_ctx->data + */ + if ((*inetNetToMediaPhysAddress_val_ptr_len_ptr) < + rowreq_ctx->data->arp_physaddress_len) + return MFD_SKIP; + + memcpy((*inetNetToMediaPhysAddress_val_ptr_ptr), + rowreq_ctx->data->arp_physaddress, + rowreq_ctx->data->arp_physaddress_len); + (*inetNetToMediaPhysAddress_val_ptr_len_ptr) = + rowreq_ctx->data->arp_physaddress_len; + + return MFD_SUCCESS; +} /* inetNetToMediaPhysAddress_get */ + +/*--------------------------------------------------------------------- + * IP-MIB::inetNetToMediaEntry.inetNetToMediaLastUpdated + * inetNetToMediaLastUpdated is subid 5 of inetNetToMediaEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.2.1.4.35.1.5 + * Description: +The value of sysUpTime at the time this entry was last + updated. If this entry was updated prior to the last re- + initialization of the local network management subsystem, + then this object contains a zero value. + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is TimeStamp (based on perltype TICKS) + * The net-snmp type is ASN_TIMETICKS. The C type decl is u_long (u_long) + */ +/** + * Extract the current value of the inetNetToMediaLastUpdated data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param inetNetToMediaLastUpdated_val_ptr + * Pointer to storage for a u_long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +inetNetToMediaLastUpdated_get(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, + u_long * inetNetToMediaLastUpdated_val_ptr) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert(NULL != inetNetToMediaLastUpdated_val_ptr); + + + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaLastUpdated_get", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:231:o: |-> Extract the current value of the inetNetToMediaLastUpdated data. + * copy (* inetNetToMediaLastUpdated_val_ptr ) from rowreq_ctx->data + */ + /* + * xxx-rks: get this value? + */ + return MFD_SKIP; + + return MFD_SUCCESS; +} /* inetNetToMediaLastUpdated_get */ + +/*--------------------------------------------------------------------- + * IP-MIB::inetNetToMediaEntry.inetNetToMediaType + * inetNetToMediaType is subid 6 of inetNetToMediaEntry. + * Its status is Current, and its access level is Create. + * OID: .1.3.6.1.2.1.4.35.1.6 + * Description: +The type of mapping. + + + Setting this object to the value invalid(2) has the effect + of invalidating the corresponding entry in the + inetNetToMediaTable. That is, it effectively dis- + associates the interface identified with said entry from the + mapping identified with said entry. It is an + implementation- specific matter as to whether the agent + removes an invalidated entry from the table. Accordingly, + management stations must be prepared to receive tabular + information from agents that corresponds to entries not + currently in use. Proper interpretation of such entries + requires examination of the relevant inetNetToMediaType + object. + + + The 'dynamic(3)' type indicates that the IP address to + physical addresses mapping has been dynamically resolved + using e.g. IPv4 ARP or the IPv6 Neighbor Discovery protocol. + + + The 'static(4)' type indicates that the mapping has been + statically configured. Both of these refer to entries that + provide mappings for other entities addresses. + + + The 'local(5)' type indicates that the mapping is provided + for an entity's own interface address. + + + As the entries in this table are typically not persistent + when this object is written the entity SHOULD NOT save the + + + + + change to non-volatile storage. + * + * Attributes: + * accessible 1 isscalar 0 enums 1 hasdefval 1 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 1 + * defval: static + * + * Enum range: 5/8. Values: other(1), invalid(2), dynamic(3), static(4), local(5) + * + * 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 inetNetToMediaType data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param inetNetToMediaType_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 +inetNetToMediaType_get(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, + u_long * inetNetToMediaType_val_ptr) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert(NULL != inetNetToMediaType_val_ptr); + + + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaType_get", + "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:231:o: |-> Extract the current value of the inetNetToMediaType data. + * copy (* inetNetToMediaType_val_ptr ) from rowreq_ctx->data + */ + (*inetNetToMediaType_val_ptr) = rowreq_ctx->data->arp_type; + + return MFD_SUCCESS; +} /* inetNetToMediaType_get */ + +/*--------------------------------------------------------------------- + * IP-MIB::inetNetToMediaEntry.inetNetToMediaState + * inetNetToMediaState is subid 7 of inetNetToMediaEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.2.1.4.35.1.7 + * Description: +The Neighbor Unreachability Detection [4] state for the + interface when the address mapping in this entry is used. + If Neighbor Unreachability Detection is not in use (e.g. for + IPv4), this object is always unknown(6). + * + * Attributes: + * accessible 1 isscalar 0 enums 1 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * Enum range: 6/8. Values: reachable(1), stale(2), delay(3), probe(4), invalid(5), unknown(6), incomplete(7) + * + * 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 inetNetToMediaState data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param inetNetToMediaState_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 +inetNetToMediaState_get(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, + u_long * inetNetToMediaState_val_ptr) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert(NULL != inetNetToMediaState_val_ptr); + + + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaState_get", + "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:231:o: |-> Extract the current value of the inetNetToMediaState data. + * copy (* inetNetToMediaState_val_ptr ) from rowreq_ctx->data + */ + (*inetNetToMediaState_val_ptr) = rowreq_ctx->data->arp_state; + + return MFD_SUCCESS; +} /* inetNetToMediaState_get */ + +/*--------------------------------------------------------------------- + * IP-MIB::inetNetToMediaEntry.inetNetToMediaRowStatus + * inetNetToMediaRowStatus is subid 8 of inetNetToMediaEntry. + * Its status is Current, and its access level is Create. + * OID: .1.3.6.1.2.1.4.35.1.8 + * Description: +The status of this conceptual row. + + + The RowStatus TC requires that this DESCRIPTION clause + states under which circumstances other objects in this row + can be modified. The value of this object has no effect on + whether other objects in this conceptual row can be + modified. + + + A conceptual row can not be made active until the + inetNetToMediaPhysAddress object has been set. + + + + + Note that if the inetNetToMediaType is set to 'invalid' the + managed node may delete the entry independent of the state + of this object. + * + * 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 inetNetToMediaRowStatus data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param inetNetToMediaRowStatus_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 +inetNetToMediaRowStatus_get(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, + u_long * inetNetToMediaRowStatus_val_ptr) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert(NULL != inetNetToMediaRowStatus_val_ptr); + + (*inetNetToMediaRowStatus_val_ptr) = + rowreq_ctx->inetNetToMediaRowStatus; + + return MFD_SUCCESS; +} /* inetNetToMediaRowStatus_get */ + + + +/** @} */ +/********************************************************************** + ********************************************************************** + *** + *** Table inetNetToMediaTable + *** + ********************************************************************** + **********************************************************************/ +/* + * IP-MIB::inetNetToMediaTable is subid 35 of ip. + * Its status is Current. + * OID: .1.3.6.1.2.1.4.35, length: 8 + */ + /* + * 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 + * inetNetToMediaTable_allocate_data(), but may need extra + * initialization similar to what you may have done in + * inetNetToMediaTable_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 (inetNetToMediaTable_rowreq_ctx) + * + * @retval MFD_SUCCESS : success + * @retval MFD_ERROR : error. set will fail. + */ +int +inetNetToMediaTable_undo_setup(inetNetToMediaTable_rowreq_ctx * rowreq_ctx) +{ + int rc = MFD_SUCCESS; + + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_undo_setup", "called\n")); + + /** we should have a non-NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:451:M: |-> Setup inetNetToMediaTable undo. + * set up inetNetToMediaTable undo information, in preparation for a set. + * Undo storage is in (* inetNetToMediaRowStatus_val_ptr )* + */ + + return rc; +} /* inetNetToMediaTable_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 (inetNetToMediaTable_rowreq_ctx) + * + * @retval MFD_SUCCESS : success + * @retval MFD_ERROR : error. set will fail. + */ +int +inetNetToMediaTable_undo(inetNetToMediaTable_rowreq_ctx * rowreq_ctx) +{ + int rc = MFD_SUCCESS; + + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_undo", + "called\n")); + + /** we should have a non-NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:451:M: |-> inetNetToMediaTable undo. + * inetNetToMediaTable undo information, in response to a failed set. + * Undo storage is in (* inetNetToMediaRowStatus_val_ptr )* + */ + + return rc; +} /* inetNetToMediaTable_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 (inetNetToMediaTable_rowreq_ctx) + * + * @retval MFD_SUCCESS : success + * @retval MFD_ERROR : error + */ +int +inetNetToMediaTable_undo_cleanup(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx) +{ + int rc = MFD_SUCCESS; + + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_undo_cleanup", "called\n")); + + /** we should have a non-NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:452:M: |-> Cleanup inetNetToMediaTable undo. + * Undo storage is in (* inetNetToMediaRowStatus_val_ptr )* + */ + + return rc; +} /* inetNetToMediaTable_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 + * inetNetToMediaTable.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 +inetNetToMediaTable_commit(inetNetToMediaTable_rowreq_ctx * rowreq_ctx) +{ + int rc = MFD_SUCCESS; + int save_flags; + + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_commit", + "called\n")); + + /** we should have a non-NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * save flags, then clear until we actually do something + */ + save_flags = rowreq_ctx->column_set_flags; + rowreq_ctx->column_set_flags = 0; + + /* + * commit inetNetToMediaTable data + * 1) check the column's flag in save_flags to see if it was set. + * 2) clear the flag when you handle that column + * 3) set the column's flag in column_set_flags if it needs undo + * processing in case of a failure. + */ +#if 1 + /** xxx-rks:9 nettomedia commit */ +#else + if (save_flags & COLUMN_INETNETTOMEDIAPHYSADDRESS_FLAG) { + save_flags &= ~COLUMN_INETNETTOMEDIAPHYSADDRESS_FLAG; /* clear inetNetToMediaPhysAddress */ + /* + * TODO:482:o: |-> commit column inetNetToMediaPhysAddress. + */ + rc = -1; + if (-1 == rc) { + snmp_log(LOG_ERR, + "inetNetToMediaTable column inetNetToMediaPhysAddress commit failed\n"); + } else { + /* + * set flag, in case we need to undo inetNetToMediaPhysAddress + */ + rowreq_ctx->column_set_flags |= + COLUMN_INETNETTOMEDIAPHYSADDRESS_FLAG; + } + } + + if (save_flags & COLUMN_INETNETTOMEDIATYPE_FLAG) { + save_flags &= ~COLUMN_INETNETTOMEDIATYPE_FLAG; /* clear inetNetToMediaType */ + /* + * TODO:482:o: |-> commit column inetNetToMediaType. + */ + rc = -1; + if (-1 == rc) { + snmp_log(LOG_ERR, + "inetNetToMediaTable column inetNetToMediaType commit failed\n"); + } else { + /* + * set flag, in case we need to undo inetNetToMediaType + */ + rowreq_ctx->column_set_flags |= COLUMN_INETNETTOMEDIATYPE_FLAG; + } + } + + if (save_flags & COLUMN_INETNETTOMEDIAROWSTATUS_FLAG) { + save_flags &= ~COLUMN_INETNETTOMEDIAROWSTATUS_FLAG; /* clear inetNetToMediaRowStatus */ + /* + * TODO:482:o: |-> commit column inetNetToMediaRowStatus. + */ + rc = -1; + if (-1 == rc) { + snmp_log(LOG_ERR, + "inetNetToMediaTable column inetNetToMediaRowStatus commit failed\n"); + } else { + /* + * set flag, in case we need to undo inetNetToMediaRowStatus + */ + rowreq_ctx->column_set_flags |= + COLUMN_INETNETTOMEDIAROWSTATUS_FLAG; + } + } + + /* + * if we successfully commited this row, set the dirty flag. + */ + if (MFD_SUCCESS == rc) { + rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY; + } +#endif + + if (save_flags) { + snmp_log(LOG_ERR, "unhandled columns (0x%x) in commit\n", + save_flags); + return MFD_ERROR; + } + + return rc; +} /* inetNetToMediaTable_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 + * inetNetToMediaTable.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 +inetNetToMediaTable_undo_commit(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx) +{ + int rc = MFD_SUCCESS; + + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_undo_commit", "called\n")); + + /** we should have a non-NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:485:M: |-> Undo inetNetToMediaTable 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; +} /* inetNetToMediaTable_undo_commit */ + +/* + * TODO:440:M: Implement inetNetToMediaTable node value checks. + * TODO:450:M: Implement inetNetToMediaTable undo functions. + * TODO:460:M: Implement inetNetToMediaTable set functions. + * TODO:480:M: Implement inetNetToMediaTable commit functions. + */ +/*--------------------------------------------------------------------- + * IP-MIB::inetNetToMediaEntry.inetNetToMediaPhysAddress + * inetNetToMediaPhysAddress is subid 4 of inetNetToMediaEntry. + * Its status is Current, and its access level is Create. + * OID: .1.3.6.1.2.1.4.35.1.4 + * Description: +The media-dependent `physical' address. + + + As the entries in this table are typically not persistent + when this object is written the entity SHOULD NOT save the + change to non-volatile storage. + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 1 hashint 1 + * settable 1 + * hint: 1x: + * + * Ranges: 0 - 65535; + * + * Its syntax is PhysAddress (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 65535) + */ +/** + * Check that the proposed new value is potentially valid. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param inetNetToMediaPhysAddress_val_ptr + * A char containing the new value. + * @param inetNetToMediaPhysAddress_val_ptr_len + * The size (in bytes) of the data pointed to by inetNetToMediaPhysAddress_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). + * + * Since you aren't using a generated data context, you also need to + * check the length, to make sure you don't overflow your storage space. + * + * 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 + * inetNetToMediaTable_check_dependencies() function. + * + * The following checks have already been done for you: + * The syntax is ASN_OCTET_STR + * The length is in (one of) the range set(s): 0 - 65535 + * + * If there a no other checks you need to do, simply return MFD_SUCCESS. + * + */ +int +inetNetToMediaPhysAddress_check_value(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx, char + *inetNetToMediaPhysAddress_val_ptr, + size_t + inetNetToMediaPhysAddress_val_ptr_len) +{ + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaPhysAddress_check_value", "called\n")); + + /** should never get a NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + netsnmp_assert(NULL != inetNetToMediaPhysAddress_val_ptr); + + /* + * TODO:441:o: |-> Check for valid inetNetToMediaPhysAddress value. + */ + + return MFD_SUCCESS; /* inetNetToMediaPhysAddress value not illegal */ +} /* inetNetToMediaPhysAddress_check_value */ + +/** + * Save old value information + * + * @param rowreq_ctx + * Pointer to the table context (inetNetToMediaTable_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 + * inetNetToMediaTable_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 +inetNetToMediaPhysAddress_undo_setup(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx) +{ + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaPhysAddress_undo_setup", "called\n")); + + /** should never get a NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:455:o: |-> Setup inetNetToMediaPhysAddress undo. + */ + /* + * copy inetNetToMediaPhysAddress and inetNetToMediaPhysAddress_len data + * set rowreq_ctx->undo->inetNetToMediaPhysAddress from rowreq_ctx->data->inetNetToMediaPhysAddress + */ + + + return MFD_SUCCESS; +} /* inetNetToMediaPhysAddress_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 inetNetToMediaPhysAddress_val_ptr + * A char containing the new value. + * @param inetNetToMediaPhysAddress_val_ptr_len + * The size (in bytes) of the data pointed to by inetNetToMediaPhysAddress_val_ptr + */ +int +inetNetToMediaPhysAddress_set(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, + char *inetNetToMediaPhysAddress_val_ptr, + size_t inetNetToMediaPhysAddress_val_ptr_len) +{ + + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaPhysAddress_set", "called\n")); + + /** should never get a NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + netsnmp_assert(NULL != inetNetToMediaPhysAddress_val_ptr); + + /* + * TODO:461:M: |-> Set inetNetToMediaPhysAddress value. + * set inetNetToMediaPhysAddress value in rowreq_ctx->data + */ + + return MFD_SUCCESS; +} /* inetNetToMediaPhysAddress_set */ + +/** + * undo the previous set. + * + * @param rowreq_ctx + * Pointer to the users context. + */ +int +inetNetToMediaPhysAddress_undo(inetNetToMediaTable_rowreq_ctx * rowreq_ctx) +{ + + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaPhysAddress_undo", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:456:o: |-> Clean up inetNetToMediaPhysAddress undo. + */ + /* + * copy inetNetToMediaPhysAddress and inetNetToMediaPhysAddress_len data + * set rowreq_ctx->data->inetNetToMediaPhysAddress from rowreq_ctx->undo->inetNetToMediaPhysAddress + */ + + + return MFD_SUCCESS; +} /* inetNetToMediaPhysAddress_undo */ + +/*--------------------------------------------------------------------- + * IP-MIB::inetNetToMediaEntry.inetNetToMediaType + * inetNetToMediaType is subid 6 of inetNetToMediaEntry. + * Its status is Current, and its access level is Create. + * OID: .1.3.6.1.2.1.4.35.1.6 + * Description: +The type of mapping. + + + Setting this object to the value invalid(2) has the effect + of invalidating the corresponding entry in the + inetNetToMediaTable. That is, it effectively dis- + associates the interface identified with said entry from the + mapping identified with said entry. It is an + implementation- specific matter as to whether the agent + removes an invalidated entry from the table. Accordingly, + management stations must be prepared to receive tabular + information from agents that corresponds to entries not + currently in use. Proper interpretation of such entries + requires examination of the relevant inetNetToMediaType + object. + + + The 'dynamic(3)' type indicates that the IP address to + physical addresses mapping has been dynamically resolved + using e.g. IPv4 ARP or the IPv6 Neighbor Discovery protocol. + + + The 'static(4)' type indicates that the mapping has been + statically configured. Both of these refer to entries that + provide mappings for other entities addresses. + + + The 'local(5)' type indicates that the mapping is provided + for an entity's own interface address. + + + As the entries in this table are typically not persistent + when this object is written the entity SHOULD NOT save the + + + + + change to non-volatile storage. + * + * Attributes: + * accessible 1 isscalar 0 enums 1 hasdefval 1 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 1 + * defval: static + * + * Enum range: 5/8. Values: other(1), invalid(2), dynamic(3), static(4), local(5) + * + * 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 inetNetToMediaType_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 + * inetNetToMediaTable_check_dependencies() function. + * + * The following checks have already been done for you: + * The syntax is ASN_INTEGER + * The value is one of other(1), invalid(2), dynamic(3), static(4), local(5) + * + * If there a no other checks you need to do, simply return MFD_SUCCESS. + * + */ +int +inetNetToMediaType_check_value(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, + u_long inetNetToMediaType_val) +{ + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaType_check_value", "called\n")); + + /** should never get a NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:441:o: |-> Check for valid inetNetToMediaType value. + */ + + return MFD_SUCCESS; /* inetNetToMediaType value not illegal */ +} /* inetNetToMediaType_check_value */ + +/** + * Save old value information + * + * @param rowreq_ctx + * Pointer to the table context (inetNetToMediaTable_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 + * inetNetToMediaTable_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 +inetNetToMediaType_undo_setup(inetNetToMediaTable_rowreq_ctx * rowreq_ctx) +{ + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaType_undo_setup", "called\n")); + + /** should never get a NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:455:o: |-> Setup inetNetToMediaType undo. + */ + /* + * copy inetNetToMediaType data + * set rowreq_ctx->undo->inetNetToMediaType from rowreq_ctx->data->inetNetToMediaType + */ + + + return MFD_SUCCESS; +} /* inetNetToMediaType_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 inetNetToMediaType_val + * A long containing the new value. + */ +int +inetNetToMediaType_set(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, + u_long inetNetToMediaType_val) +{ + + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaType_set", + "called\n")); + + /** should never get a NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:461:M: |-> Set inetNetToMediaType value. + * set inetNetToMediaType value in rowreq_ctx->data + */ + + return MFD_SUCCESS; +} /* inetNetToMediaType_set */ + +/** + * undo the previous set. + * + * @param rowreq_ctx + * Pointer to the users context. + */ +int +inetNetToMediaType_undo(inetNetToMediaTable_rowreq_ctx * rowreq_ctx) +{ + + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaType_undo", + "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:456:o: |-> Clean up inetNetToMediaType undo. + */ + /* + * copy inetNetToMediaType data + * set rowreq_ctx->data->inetNetToMediaType from rowreq_ctx->undo->inetNetToMediaType + */ + + + return MFD_SUCCESS; +} /* inetNetToMediaType_undo */ + +/*--------------------------------------------------------------------- + * IP-MIB::inetNetToMediaEntry.inetNetToMediaRowStatus + * inetNetToMediaRowStatus is subid 8 of inetNetToMediaEntry. + * Its status is Current, and its access level is Create. + * OID: .1.3.6.1.2.1.4.35.1.8 + * Description: +The status of this conceptual row. + + + The RowStatus TC requires that this DESCRIPTION clause + states under which circumstances other objects in this row + can be modified. The value of this object has no effect on + whether other objects in this conceptual row can be + modified. + + + A conceptual row can not be made active until the + inetNetToMediaPhysAddress object has been set. + + + + + Note that if the inetNetToMediaType is set to 'invalid' the + managed node may delete the entry independent of the state + of this object. + * + * 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 inetNetToMediaRowStatus_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 + * inetNetToMediaTable_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 +inetNetToMediaRowStatus_check_value(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx, + u_long inetNetToMediaRowStatus_val) +{ + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaRowStatus_check_value", "called\n")); + + /** should never get a NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:441:o: |-> Check for valid inetNetToMediaRowStatus value. + */ + + return MFD_SUCCESS; /* inetNetToMediaRowStatus value not illegal */ +} /* inetNetToMediaRowStatus_check_value */ + +/** + * Save old value information + * + * @param rowreq_ctx + * Pointer to the table context (inetNetToMediaTable_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 + * inetNetToMediaTable_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 +inetNetToMediaRowStatus_undo_setup(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx) +{ + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaRowStatus_undo_setup", "called\n")); + + /** should never get a NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:455:o: |-> Setup inetNetToMediaRowStatus undo. + */ + /* + * copy inetNetToMediaRowStatus data + * set rowreq_ctx->undo->inetNetToMediaRowStatus from rowreq_ctx->data->inetNetToMediaRowStatus + */ + rowreq_ctx->inetNetToMediaRowStatus_undo = + rowreq_ctx->inetNetToMediaRowStatus; + + return MFD_SUCCESS; +} /* inetNetToMediaRowStatus_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 inetNetToMediaRowStatus_val + * A long containing the new value. + */ +int +inetNetToMediaRowStatus_set(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, + u_long inetNetToMediaRowStatus_val) +{ + + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaRowStatus_set", + "called\n")); + + /** should never get a NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:461:M: |-> Set inetNetToMediaRowStatus value. + * set inetNetToMediaRowStatus value in rowreq_ctx->data + */ + + return MFD_SUCCESS; +} /* inetNetToMediaRowStatus_set */ + +/** + * undo the previous set. + * + * @param rowreq_ctx + * Pointer to the users context. + */ +int +inetNetToMediaRowStatus_undo(inetNetToMediaTable_rowreq_ctx * rowreq_ctx) +{ + + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaRowStatus_undo", + "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:456:o: |-> Clean up inetNetToMediaRowStatus undo. + */ + /* + * copy inetNetToMediaRowStatus data + * set rowreq_ctx->data->inetNetToMediaRowStatus from rowreq_ctx->undo->inetNetToMediaRowStatus + */ + rowreq_ctx->inetNetToMediaRowStatus = + rowreq_ctx->inetNetToMediaRowStatus_undo; + + + return MFD_SUCCESS; +} /* inetNetToMediaRowStatus_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 + * inetNetToMediaTable.h. + * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. + * + * @param rowreq_ctx + * + * @retval MFD_SUCCESS all the changes to the row are legal + * @retval MFD_ERROR one or more changes are not legal + * + * (see README-table-inetNetToMediaTable if you don't have dependencies) + */ +int +inetNetToMediaTable_check_dependencies(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx) +{ + int rc = MFD_SUCCESS; + + DEBUGMSGTL(("internal:inetNetToMediaTable:inetNetToMediaTable_check_dependencies", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:470:o: Check inetNetToMediaTable row dependencies. + * check that all new value are legal and consistent with each other + */ + /* + * check RowStatus dependencies + */ + if (rowreq_ctx->column_set_flags & COLUMN_INETNETTOMEDIAROWSTATUS_FLAG) { + /* + * check for valid RowStatus transition (old, new) + * (Note: move transition check to + * to catch errors earlier) + */ + rc = check_rowstatus_transition(rowreq_ctx-> + inetNetToMediaRowStatus_undo, + rowreq_ctx-> + inetNetToMediaRowStatus); + if (MFD_SUCCESS != rc) + return rc; + + /* + * row creation requirements + */ + if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) { + if (ROWSTATUS_DESTROY == rowreq_ctx->inetNetToMediaRowStatus) { + rowreq_ctx->rowreq_flags |= MFD_ROW_DELETED; + } else if (ROWSTATUS_CREATEANDGO == + rowreq_ctx->inetNetToMediaRowStatus) { + if ((rowreq_ctx-> + column_set_flags & INETNETTOMEDIATABLE_REQUIRED_COLS) + != INETNETTOMEDIATABLE_REQUIRED_COLS) { + DEBUGMSGTL(("inetNetToMediaTable", + "required columns missing (0x%0x != 0x%0x)\n", + rowreq_ctx->column_set_flags, + INETNETTOMEDIATABLE_REQUIRED_COLS)); + return MFD_CANNOT_CREATE_NOW; + } + rowreq_ctx->inetNetToMediaRowStatus = 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->inetNetToMediaRowStatus) { + if (rowreq_ctx-> + column_set_flags & + ~COLUMN_INETNETTOMEDIAROWSTATUS_FLAG) { + DEBUGMSGTL(("inetNetToMediaTable", + "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(("inetNetToMediaTable", + "must use RowStatus to create rows\n")); + return MFD_CANNOT_CREATE_NOW; + } + } /* row status not set */ + + if (MFD_SUCCESS != rc) + return rc; + + return rc; +} /* inetNetToMediaTable_check_dependencies */ + +/** @} */ +/** @{ */ diff --git a/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable.h b/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable.h new file mode 100644 index 0000000..aad8ad9 --- /dev/null +++ b/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable.h @@ -0,0 +1,413 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.48 $ of : mfd-top.m2c,v $ + * + * $Id: inetNetToMediaTable.h 14169 2006-01-25 16:28:12Z dts12 $ + */ +#ifndef INETNETTOMEDIATABLE_H +#define INETNETTOMEDIATABLE_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/** @addtogroup misc misc: Miscellaneous routines + * + * @{ + */ +#include <net-snmp/library/asn1.h> +#include <net-snmp/data_access/arp.h> + + /* + * other required module components + */ + /* *INDENT-OFF* */ +config_require(ip-mib/data_access/arp) +config_require(ip-mib/inetNetToMediaTable/inetNetToMediaTable_interface) +config_require(ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access) + /* *INDENT-ON* */ + + /* + * OID, column number and enum definions for inetNetToMediaTable + */ +#include "inetNetToMediaTable_constants.h" + + /* + ********************************************************************* + * function declarations + */ + void init_inetNetToMediaTable(void); + void shutdown_inetNetToMediaTable(void); + + /* + ********************************************************************* + * Table declarations + */ +/********************************************************************** + ********************************************************************** + *** + *** Table inetNetToMediaTable + *** + ********************************************************************** + **********************************************************************/ + /* + * IP-MIB::inetNetToMediaTable is subid 35 of ip. + * Its status is Current. + * OID: .1.3.6.1.2.1.4.35, length: 8 + */ + /* + ********************************************************************* + * 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 inetNetToMediaTable registration context. + */ + typedef netsnmp_data_list inetNetToMediaTable_registration; + +/**********************************************************************/ + /* + * TODO:110:r: |-> Review inetNetToMediaTable data context structure. + * This structure is used to represent the data for inetNetToMediaTable. + */ + typedef netsnmp_arp_entry inetNetToMediaTable_data; + + + /* + ********************************************************************* + * TODO:115:o: |-> Review inetNetToMediaTable 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 inetNetToMediaTable_data inetNetToMediaTable_undo_data; + + /* + * TODO:120:r: |-> Review inetNetToMediaTable mib index. + * This structure is used to represent the index for inetNetToMediaTable. + */ + typedef struct inetNetToMediaTable_mib_index_s { + + /* + * inetNetToMediaIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H + */ + long inetNetToMediaIfIndex; + + /* + * inetNetToMediaNetAddressType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h + */ + u_long inetNetToMediaNetAddressType; + + /* + * inetNetToMediaNetAddress(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h + */ + /** 128 - 2(other indexes) - oid length(10) = 115 */ + char inetNetToMediaNetAddress[115]; + size_t inetNetToMediaNetAddress_len; + + + } inetNetToMediaTable_mib_index; + + /* + * TODO:121:r: | |-> Review inetNetToMediaTable 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(8) + */ +#define MAX_inetNetToMediaTable_IDX_LEN 118 + + + /* + ********************************************************************* + * TODO:130:o: |-> Review inetNetToMediaTable Row request (rowreq) context. + * When your functions are called, you will be passed a + * inetNetToMediaTable_rowreq_ctx pointer. + */ + typedef struct inetNetToMediaTable_rowreq_ctx_s { + + /** this must be first for container compare to work */ + netsnmp_index oid_idx; + oid oid_tmp[MAX_inetNetToMediaTable_IDX_LEN]; + + inetNetToMediaTable_mib_index tbl_idx; + + inetNetToMediaTable_data *data; + inetNetToMediaTable_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 inetNetToMediaTable rowreq context. + */ + int inetNetToMediaRowStatus, + inetNetToMediaRowStatus_undo; + + /* + * storage for future expansion + */ + netsnmp_data_list *inetNetToMediaTable_data_list; + + } inetNetToMediaTable_rowreq_ctx; + + typedef struct inetNetToMediaTable_ref_rowreq_ctx_s { + inetNetToMediaTable_rowreq_ctx *rowreq_ctx; + } inetNetToMediaTable_ref_rowreq_ctx; + + /* + ********************************************************************* + * function prototypes + */ + int + inetNetToMediaTable_pre_request(inetNetToMediaTable_registration * + user_context); + int + inetNetToMediaTable_post_request(inetNetToMediaTable_registration * + user_context, int rc); + + int + inetNetToMediaTable_rowreq_ctx_init(inetNetToMediaTable_rowreq_ctx + * rowreq_ctx, + void *user_init_ctx); + void + inetNetToMediaTable_rowreq_ctx_cleanup + (inetNetToMediaTable_rowreq_ctx * rowreq_ctx); + + inetNetToMediaTable_data *inetNetToMediaTable_allocate_data(void); + void + inetNetToMediaTable_release_data(inetNetToMediaTable_data * data); + + int + inetNetToMediaTable_check_dependencies + (inetNetToMediaTable_rowreq_ctx * rowreq_ctx); + int + inetNetToMediaTable_commit(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx); + + inetNetToMediaTable_rowreq_ctx + * inetNetToMediaTable_row_find_by_mib_index + (inetNetToMediaTable_mib_index * mib_idx); + + extern oid inetNetToMediaTable_oid[]; + extern int inetNetToMediaTable_oid_size; + + +#include "inetNetToMediaTable_interface.h" +#include "inetNetToMediaTable_data_access.h" + /* + ********************************************************************* + * GET function declarations + */ + + /* + ********************************************************************* + * GET Table declarations + */ +/********************************************************************** + ********************************************************************** + *** + *** Table inetNetToMediaTable + *** + ********************************************************************** + **********************************************************************/ + /* + * IP-MIB::inetNetToMediaTable is subid 35 of ip. + * Its status is Current. + * OID: .1.3.6.1.2.1.4.35, length: 8 + */ + /* + * indexes + */ + + int + inetNetToMediaPhysAddress_get(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx, char + **inetNetToMediaPhysAddress_val_ptr_ptr, + size_t * + inetNetToMediaPhysAddress_val_ptr_len_ptr); + int + inetNetToMediaLastUpdated_get(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx, + u_long * + inetNetToMediaLastUpdated_val_ptr); + int inetNetToMediaType_get(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx, + u_long * + inetNetToMediaType_val_ptr); + int inetNetToMediaState_get(inetNetToMediaTable_rowreq_ctx + * rowreq_ctx, + u_long * + inetNetToMediaState_val_ptr); + int + inetNetToMediaRowStatus_get(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx, + u_long * + inetNetToMediaRowStatus_val_ptr); + + + int + inetNetToMediaTable_indexes_set_tbl_idx + (inetNetToMediaTable_mib_index * tbl_idx, + long inetNetToMediaIfIndex_val, + u_long inetNetToMediaNetAddressType_val, + char *inetNetToMediaNetAddress_val_ptr, + size_t inetNetToMediaNetAddress_val_ptr_len); + int + inetNetToMediaTable_indexes_set(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx, + long inetNetToMediaIfIndex_val, + u_long + inetNetToMediaNetAddressType_val, + char + *inetNetToMediaNetAddress_val_ptr, + size_t + inetNetToMediaNetAddress_val_ptr_len); + + + + /* + ********************************************************************* + * SET function declarations + */ + + /* + ********************************************************************* + * SET Table declarations + */ +/********************************************************************** + ********************************************************************** + *** + *** Table inetNetToMediaTable + *** + ********************************************************************** + **********************************************************************/ + /* + * IP-MIB::inetNetToMediaTable is subid 35 of ip. + * Its status is Current. + * OID: .1.3.6.1.2.1.4.35, length: 8 + */ + + + int + inetNetToMediaTable_undo_setup(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx); + int + inetNetToMediaTable_undo_cleanup(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx); + int inetNetToMediaTable_undo(inetNetToMediaTable_rowreq_ctx + * rowreq_ctx); + int + inetNetToMediaTable_commit(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx); + int + inetNetToMediaTable_undo_commit(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx); + + + int + inetNetToMediaPhysAddress_check_value + (inetNetToMediaTable_rowreq_ctx * rowreq_ctx, + char *inetNetToMediaPhysAddress_val_ptr, + size_t inetNetToMediaPhysAddress_val_ptr_len); + int + inetNetToMediaPhysAddress_undo_setup(inetNetToMediaTable_rowreq_ctx + * rowreq_ctx); + int + inetNetToMediaPhysAddress_set(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx, char + *inetNetToMediaPhysAddress_val_ptr, + size_t + inetNetToMediaPhysAddress_val_ptr_len); + int + inetNetToMediaPhysAddress_undo(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx); + + int + inetNetToMediaLastUpdated_check_value + (inetNetToMediaTable_rowreq_ctx * rowreq_ctx, + u_long inetNetToMediaLastUpdated_val); + int + inetNetToMediaLastUpdated_undo_setup(inetNetToMediaTable_rowreq_ctx + * rowreq_ctx); + int + inetNetToMediaLastUpdated_set(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx, + u_long + inetNetToMediaLastUpdated_val); + int + inetNetToMediaLastUpdated_undo(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx); + + int + inetNetToMediaType_check_value(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx, + u_long inetNetToMediaType_val); + int + inetNetToMediaType_undo_setup(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx); + int inetNetToMediaType_set(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx, + u_long inetNetToMediaType_val); + int inetNetToMediaType_undo(inetNetToMediaTable_rowreq_ctx + * rowreq_ctx); + + int + inetNetToMediaState_check_value(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx, + u_long inetNetToMediaState_val); + int + inetNetToMediaState_undo_setup(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx); + int inetNetToMediaState_set(inetNetToMediaTable_rowreq_ctx + * rowreq_ctx, + u_long + inetNetToMediaState_val); + int inetNetToMediaState_undo(inetNetToMediaTable_rowreq_ctx + * rowreq_ctx); + + int + inetNetToMediaRowStatus_check_value(inetNetToMediaTable_rowreq_ctx + * rowreq_ctx, + u_long + inetNetToMediaRowStatus_val); + int + inetNetToMediaRowStatus_undo_setup(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx); + int + inetNetToMediaRowStatus_undo(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx); + + + int + inetNetToMediaTable_check_dependencies + (inetNetToMediaTable_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 /* INETNETTOMEDIATABLE_H */ +/** @} */ + diff --git a/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_constants.h b/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_constants.h new file mode 100644 index 0000000..8197395 --- /dev/null +++ b/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_constants.h @@ -0,0 +1,161 @@ +/* + * 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: inetNetToMediaTable_constants.h 13759 2005-12-01 00:45:50Z rstory $ + */ +#ifndef INETNETTOMEDIATABLE_CONSTANTS_H +#define INETNETTOMEDIATABLE_CONSTANTS_H + +#ifdef __cplusplus +extern "C" { +#endif + + + /* + * column number definitions for table inetNetToMediaTable + */ +#define INETNETTOMEDIATABLE_OID 1,3,6,1,2,1,4,35 + +#define COLUMN_INETNETTOMEDIAIFINDEX 1 + +#define COLUMN_INETNETTOMEDIANETADDRESSTYPE 2 + +#define COLUMN_INETNETTOMEDIANETADDRESS 3 + +#define COLUMN_INETNETTOMEDIAPHYSADDRESS 4 +#define COLUMN_INETNETTOMEDIAPHYSADDRESS_FLAG (0x1 << 3) + +#define COLUMN_INETNETTOMEDIALASTUPDATED 5 + +#define COLUMN_INETNETTOMEDIATYPE 6 +#define COLUMN_INETNETTOMEDIATYPE_FLAG (0x1 << 5) + +#define COLUMN_INETNETTOMEDIASTATE 7 + +#define COLUMN_INETNETTOMEDIAROWSTATUS 8 +#define COLUMN_INETNETTOMEDIAROWSTATUS_FLAG (0x1 << 7) + + +#define INETNETTOMEDIATABLE_MIN_COL COLUMN_INETNETTOMEDIAPHYSADDRESS +#define INETNETTOMEDIATABLE_MAX_COL COLUMN_INETNETTOMEDIAROWSTATUS + + + /* + * TODO:405:r: Review INETNETTOMEDIATABLE_SETTABLE_COLS macro. + * OR together all the writable cols. + */ +#define INETNETTOMEDIATABLE_SETTABLE_COLS (COLUMN_INETNETTOMEDIAPHYSADDRESS_FLAG | COLUMN_INETNETTOMEDIATYPE_FLAG | COLUMN_INETNETTOMEDIAROWSTATUS_FLAG) + /* + * TODO:405:r: Review INETNETTOMEDIATABLE_REQUIRED_COLS macro. + * OR together all the required rows for row creation. + * default is writable cols w/out defaults. + */ +#define INETNETTOMEDIATABLE_REQUIRED_COLS (COLUMN_INETNETTOMEDIAPHYSADDRESS_FLAG | COLUMN_INETNETTOMEDIAROWSTATUS_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 inetNetToMediaTable + * + ************************************************************************* + *************************************************************************/ + +/************************************************************* + * constants for enums for the MIB node + * inetNetToMediaNetAddressType (InetAddressType / ASN_INTEGER) + * + * since a Textual Convention may be referenced more than once in a + * MIB, protect againt redefinitions of the enum values. + */ +#ifndef INETADDRESSTYPE_ENUMS +#define INETADDRESSTYPE_ENUMS + +#define INETADDRESSTYPE_UNKNOWN 0 +#define INETADDRESSTYPE_IPV4 1 +#define INETADDRESSTYPE_IPV6 2 +#define INETADDRESSTYPE_IPV4Z 3 +#define INETADDRESSTYPE_IPV6Z 4 +#define INETADDRESSTYPE_DNS 16 + +#endif /* INETADDRESSTYPE_ENUMS */ + + +/************************************************************* + * constants for enums for the MIB node + * inetNetToMediaType (INTEGER / ASN_INTEGER) + * + * since a Textual Convention may be referenced more than once in a + * MIB, protect againt redefinitions of the enum values. + */ +#ifndef INETNETTOMEDIATYPE_ENUMS +#define INETNETTOMEDIATYPE_ENUMS + +#define INETNETTOMEDIATYPE_OTHER 1 +#define INETNETTOMEDIATYPE_INVALID 2 +#define INETNETTOMEDIATYPE_DYNAMIC 3 +#define INETNETTOMEDIATYPE_STATIC 4 +#define INETNETTOMEDIATYPE_LOCAL 5 + +#endif /* INETNETTOMEDIATYPE_ENUMS */ + + +/************************************************************* + * constants for enums for the MIB node + * inetNetToMediaState (INTEGER / ASN_INTEGER) + * + * since a Textual Convention may be referenced more than once in a + * MIB, protect againt redefinitions of the enum values. + */ +#ifndef INETNETTOMEDIASTATE_ENUMS +#define INETNETTOMEDIASTATE_ENUMS + +#define INETNETTOMEDIASTATE_REACHABLE 1 +#define INETNETTOMEDIASTATE_STALE 2 +#define INETNETTOMEDIASTATE_DELAY 3 +#define INETNETTOMEDIASTATE_PROBE 4 +#define INETNETTOMEDIASTATE_INVALID 5 +#define INETNETTOMEDIASTATE_UNKNOWN 6 +#define INETNETTOMEDIASTATE_INCOMPLETE 7 + +#endif /* INETNETTOMEDIASTATE_ENUMS */ + + +/************************************************************* + * constants for enums for the MIB node + * inetNetToMediaRowStatus (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 /* INETNETTOMEDIATABLE_OIDS_H */ diff --git a/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access.c b/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access.c new file mode 100644 index 0000000..cad942c --- /dev/null +++ b/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access.c @@ -0,0 +1,619 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.17 $ of : mfd-data-access.m2c,v $ + * + * $Id: inetNetToMediaTable_data_access.c 14169 2006-01-25 16:28:12Z dts12 $ + */ +/* + * standard Net-SNMP includes + */ +#include <net-snmp/net-snmp-config.h> +#include <net-snmp/net-snmp-includes.h> +#include <net-snmp/agent/net-snmp-agent-includes.h> + +/* + * include our parent header + */ +#include "inetNetToMediaTable.h" + + +#include "inetNetToMediaTable_data_access.h" + +/** @ingroup interface + * @addtogroup data_access data_access: Routines to access data + * + * These routines are used to locate the data used to satisfy + * requests. + * + * @{ + */ +/********************************************************************** + ********************************************************************** + *** + *** Table inetNetToMediaTable + *** + ********************************************************************** + **********************************************************************/ +/* + * IP-MIB::inetNetToMediaTable is subid 35 of ip. + * Its status is Current. + * OID: .1.3.6.1.2.1.4.35, length: 8 + */ + +/** + * initialization for inetNetToMediaTable data access + * + * This function is called during startup to allow you to + * allocate any resources you need for the data table. + * + * @param inetNetToMediaTable_reg + * Pointer to inetNetToMediaTable_registration + * + * @retval MFD_SUCCESS : success. + * @retval MFD_ERROR : unrecoverable error. + */ +int +inetNetToMediaTable_init_data(inetNetToMediaTable_registration * + inetNetToMediaTable_reg) +{ + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_init_data", "called\n")); + + /* + * TODO:303:o: Initialize inetNetToMediaTable data. + */ + + return MFD_SUCCESS; +} /* inetNetToMediaTable_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. + * @param cache A pointer to a cache structure. You can set the timeout + * and other cache flags using this pointer. + * + * 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. + * + * This is also the place to set up cache behavior. The default, to + * simply set the cache timeout, will work well with the default + * container. If you are using a custom container, you may want to + * look at the cache helper documentation to see if there are any + * flags you want to set. + * + * @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 +inetNetToMediaTable_container_init(netsnmp_container **container_ptr_ptr, + netsnmp_cache * cache) +{ + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_container_init", "called\n")); + + if (NULL == container_ptr_ptr) { + snmp_log(LOG_ERR, + "bad container param to inetNetToMediaTable_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; + + if (NULL == cache) { + snmp_log(LOG_ERR, + "bad cache param to inetNetToMediaTable_container_init\n"); + return; + } + + /* + * TODO:345:A: Set up inetNetToMediaTable cache properties. + * + * Also for advanced users, you can set parameters for the + * cache. Do not change the magic pointer, as it is used + * by the MFD helper. To completely disable caching, set + * cache->enabled to 0. + */ + cache->timeout = INETNETTOMEDIATABLE_CACHE_TIMEOUT; /* seconds */ +} /* inetNetToMediaTable_container_init */ + +/** + * check entry for update + * + */ +static void +_snarf_arp_entry(netsnmp_arp_entry *arp_entry, + netsnmp_container *container) +{ + inetNetToMediaTable_rowreq_ctx *rowreq_ctx; + int inetAddressType; + + DEBUGTRACE; + + netsnmp_assert(NULL != arp_entry); + netsnmp_assert(NULL != container); + + /* + * convert the addr len to an inetAddressType + */ + switch (arp_entry->arp_ipaddress_len) { + case 4: + inetAddressType = INETADDRESSTYPE_IPV4; + break; + + case 6: + inetAddressType = INETADDRESSTYPE_IPV6; + break; + + default: + netsnmp_access_arp_entry_free(arp_entry); + snmp_log(LOG_ERR, "unsupported address type\n"); + return; + } + + /* + * allocate an row context and set the index(es), then add it to + * the container + */ + rowreq_ctx = inetNetToMediaTable_allocate_rowreq_ctx(arp_entry, NULL); + if ((NULL != rowreq_ctx) && + (MFD_SUCCESS == inetNetToMediaTable_indexes_set + (rowreq_ctx, rowreq_ctx->data->if_index, inetAddressType, + rowreq_ctx->data->arp_ipaddress, + rowreq_ctx->data->arp_ipaddress_len))) { + rowreq_ctx->inetNetToMediaRowStatus = ROWSTATUS_ACTIVE; + CONTAINER_INSERT(container, rowreq_ctx); + } else { + if (rowreq_ctx) { + snmp_log(LOG_ERR, "error setting index while loading " + "inetNetToMediaTable cache.\n"); + inetNetToMediaTable_release_rowreq_ctx(rowreq_ctx); + } else + netsnmp_access_arp_entry_free(arp_entry); + } +} + +/** + * 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 inetNetToMediaTable_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 +inetNetToMediaTable_container_shutdown(netsnmp_container *container_ptr) +{ + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_container_shutdown", "called\n")); + + if (NULL == container_ptr) { + snmp_log(LOG_ERR, + "bad params to inetNetToMediaTable_container_shutdown\n"); + return; + } + +} /* inetNetToMediaTable_container_shutdown */ + +/** + * load initial data + * + * TODO:350:M: Implement inetNetToMediaTable data load + * This function will also be called by the cache helper to load + * the container again (after the container free function has been + * called to free the previous contents). + * + * @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 + * inetNetToMediaTable_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 +inetNetToMediaTable_container_load(netsnmp_container *container) +{ + netsnmp_container *arp_container; + + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_cache_load", "called\n")); + + /* + * TODO:351:M: |-> Load/update data in the inetNetToMediaTable container. + * loop over your inetNetToMediaTable data, allocate a rowreq context, + * set the index(es) [and data, optionally] and insert into + * the container. + */ + arp_container = + netsnmp_access_arp_container_load(NULL, + NETSNMP_ACCESS_ARP_LOAD_NOFLAGS); + if (NULL == arp_container) + return MFD_RESOURCE_UNAVAILABLE; /* msg already logged */ + + /* + * we just got a fresh copy of data. snarf data + */ + CONTAINER_FOR_EACH(arp_container, + (netsnmp_container_obj_func *) _snarf_arp_entry, + container); + + /* + * free the container. we've either claimed each entry, or released it, + * so the access function doesn't need to clear the container. + */ + netsnmp_access_arp_container_free(arp_container, + NETSNMP_ACCESS_ARP_FREE_DONT_CLEAR); + + DEBUGMSGT(("verbose:inetNetToMediaTable:inetNetToMediaTable_cache_load", "%d records\n", CONTAINER_SIZE(container))); + + return MFD_SUCCESS; +} /* inetNetToMediaTable_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 +inetNetToMediaTable_container_free(netsnmp_container *container) +{ + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_container_free", "called\n")); + + /* + * TODO:380:M: Free inetNetToMediaTable container data. + */ +} /* inetNetToMediaTable_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 +inetNetToMediaTable_row_prep(inetNetToMediaTable_rowreq_ctx * rowreq_ctx) +{ + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_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; +} /* inetNetToMediaTable_row_prep */ + +/* + * TODO:420:r: Implement inetNetToMediaTable index validation. + */ +/*--------------------------------------------------------------------- + * IP-MIB::inetNetToMediaEntry.inetNetToMediaIfIndex + * inetNetToMediaIfIndex is subid 1 of inetNetToMediaEntry. + * Its status is Current, and its access level is NoAccess. + * OID: .1.3.6.1.2.1.4.35.1.1 + * Description: +The index value which uniquely identifies the interface to + which this entry is applicable. The interface identified by + a particular value of this index is the same interface as + identified by the same value of the IF-MIB's ifIndex. + * + * Attributes: + * accessible 0 isscalar 0 enums 0 hasdefval 0 + * readable 0 iscolumn 1 ranges 1 hashint 1 + * settable 0 + * hint: d + * + * Ranges: 1 - 2147483647; + * + * Its syntax is InterfaceIndex (based on perltype INTEGER32) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + * + * + * + * NOTE: NODE inetNetToMediaIfIndex IS NOT ACCESSIBLE + * + * + */ +/** + * check validity of inetNetToMediaIfIndex 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 + * inetNetToMediaTable_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: + * The value is in (one of) the range set(s): 1 - 2147483647 + * + * If there a no other checks you need to do, simply return MFD_SUCCESS. + */ +int +inetNetToMediaIfIndex_check_index(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx) +{ + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaIfIndex_check_index", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:426:M: |-> Check inetNetToMediaTable index inetNetToMediaIfIndex. + * check that index value in the table context is legal. + * (rowreq_ctx->tbl_index.inetNetToMediaIfIndex) + */ + + return MFD_SUCCESS; /* inetNetToMediaIfIndex index ok */ +} /* inetNetToMediaIfIndex_check_index */ + +/*--------------------------------------------------------------------- + * IP-MIB::inetNetToMediaEntry.inetNetToMediaNetAddressType + * inetNetToMediaNetAddressType is subid 2 of inetNetToMediaEntry. + * Its status is Current, and its access level is NoAccess. + * OID: .1.3.6.1.2.1.4.35.1.2 + * Description: +The type of inetNetToMediaNetAddress. + * + * Attributes: + * accessible 0 isscalar 0 enums 1 hasdefval 0 + * readable 0 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * Enum range: 5/8. Values: unknown(0), ipv4(1), ipv6(2), ipv4z(3), ipv6z(4), dns(16) + * + * Its syntax is InetAddressType (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) + * + * + * + * NOTE: NODE inetNetToMediaNetAddressType IS NOT ACCESSIBLE + * + * + */ +/** + * check validity of inetNetToMediaNetAddressType 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 + * inetNetToMediaTable_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: + * The value is one of unknown(0), ipv4(1), ipv6(2), ipv4z(3), ipv6z(4), dns(16) + * + * If there a no other checks you need to do, simply return MFD_SUCCESS. + */ +int +inetNetToMediaNetAddressType_check_index(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx) +{ + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaNetAddressType_check_index", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:426:M: |-> Check inetNetToMediaTable index inetNetToMediaNetAddressType. + * check that index value in the table context is legal. + * (rowreq_ctx->tbl_index.inetNetToMediaNetAddressType) + */ + + return MFD_SUCCESS; /* inetNetToMediaNetAddressType index ok */ +} /* inetNetToMediaNetAddressType_check_index */ + +/*--------------------------------------------------------------------- + * IP-MIB::inetNetToMediaEntry.inetNetToMediaNetAddress + * inetNetToMediaNetAddress is subid 3 of inetNetToMediaEntry. + * Its status is Current, and its access level is NoAccess. + * OID: .1.3.6.1.2.1.4.35.1.3 + * Description: +The IP Address corresponding to the media-dependent + `physical' address. The address type of this object is + specified in inetNetToMediaAddressType. + + + Implementors need to be aware that if the size of + inetNetToMediaNetAddress exceeds 115 octets then OIDS of + instances of columns in this row will have more than 128 + sub-identifiers and cannot be accessed using SNMPv1, SNMPv2c + or SNMPv3. + * + * Attributes: + * accessible 0 isscalar 0 enums 0 hasdefval 0 + * readable 0 iscolumn 1 ranges 1 hashint 0 + * settable 0 + * + * Ranges: 0 - 255; + * + * Its syntax is InetAddress (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 255) + * + * + * + * NOTE: NODE inetNetToMediaNetAddress IS NOT ACCESSIBLE + * + * + */ +/** + * check validity of inetNetToMediaNetAddress 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 + * inetNetToMediaTable_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: + * The length is in (one of) the range set(s): 0 - 255 + * + * If there a no other checks you need to do, simply return MFD_SUCCESS. + */ +int +inetNetToMediaNetAddress_check_index(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx) +{ + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaNetAddress_check_index", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:426:M: |-> Check inetNetToMediaTable index inetNetToMediaNetAddress. + * check that index value in the table context is legal. + * (rowreq_ctx->tbl_index.inetNetToMediaNetAddress) + */ + + return MFD_SUCCESS; /* inetNetToMediaNetAddress index ok */ +} /* inetNetToMediaNetAddress_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 inetNetToMediaTable_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 +inetNetToMediaTable_validate_index(inetNetToMediaTable_registration * + inetNetToMediaTable_reg, + inetNetToMediaTable_rowreq_ctx * + rowreq_ctx) +{ + int rc = MFD_SUCCESS; + + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_validate_index", "called\n")); + + /** we should have a non-NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:430:M: |-> Validate potential inetNetToMediaTable index. + */ + if (1) { + snmp_log(LOG_WARNING, "invalid index for a new row in the " + "inetNetToMediaTable table.\n"); + /* + * determine failure type. + * + * If the index could not ever be created, return MFD_NOT_EVER + * If the index can not be created under the present circumstances + * (even though it could be created under other circumstances), + * return MFD_NOT_NOW. + */ + if (0) { + return MFD_CANNOT_CREATE_EVER; + } else { + return MFD_CANNOT_CREATE_NOW; + } + } + + return rc; +} /* inetNetToMediaTable_validate_index */ + +/** @} */ diff --git a/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access.h b/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access.h new file mode 100644 index 0000000..d1638cf --- /dev/null +++ b/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access.h @@ -0,0 +1,84 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.17 $ of : mfd-data-access.m2c,v $ + * + * $Id: inetNetToMediaTable_data_access.h 13759 2005-12-01 00:45:50Z rstory $ + */ +#ifndef INETNETTOMEDIATABLE_DATA_ACCESS_H +#define INETNETTOMEDIATABLE_DATA_ACCESS_H + +#ifdef __cplusplus +extern "C" { +#endif + + + /* + ********************************************************************* + * function declarations + */ + + /* + ********************************************************************* + * Table declarations + */ +/********************************************************************** + ********************************************************************** + *** + *** Table inetNetToMediaTable + *** + ********************************************************************** + **********************************************************************/ + /* + * IP-MIB::inetNetToMediaTable is subid 35 of ip. + * Its status is Current. + * OID: .1.3.6.1.2.1.4.35, length: 8 + */ + + + int + inetNetToMediaTable_init_data(inetNetToMediaTable_registration * + inetNetToMediaTable_reg); + + + /* + * TODO:180:o: Review inetNetToMediaTable cache timeout. + * The number of seconds before the cache times out + */ +#define INETNETTOMEDIATABLE_CACHE_TIMEOUT 60 + + void inetNetToMediaTable_container_init(netsnmp_container + **container_ptr_ptr, + netsnmp_cache * + cache); + void + inetNetToMediaTable_container_shutdown(netsnmp_container + *container_ptr); + + int inetNetToMediaTable_container_load(netsnmp_container + *container); + void inetNetToMediaTable_container_free(netsnmp_container + *container); + + int inetNetToMediaTable_cache_load(netsnmp_container + *container); + void inetNetToMediaTable_cache_free(netsnmp_container + *container); + + int + inetNetToMediaTable_row_prep(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx); + + int + inetNetToMediaTable_validate_index(inetNetToMediaTable_registration + * inetNetToMediaTable_reg, + inetNetToMediaTable_rowreq_ctx * + rowreq_ctx); + int inetNetToMediaIfIndex_check_index(inetNetToMediaTable_rowreq_ctx * rowreq_ctx); /* internal */ + int inetNetToMediaNetAddressType_check_index(inetNetToMediaTable_rowreq_ctx * rowreq_ctx); /* internal */ + int inetNetToMediaNetAddress_check_index(inetNetToMediaTable_rowreq_ctx * rowreq_ctx); /* internal */ + + +#ifdef __cplusplus +} +#endif +#endif /* INETNETTOMEDIATABLE_DATA_ACCESS_H */ diff --git a/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_interface.c b/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_interface.c new file mode 100644 index 0000000..3339309 --- /dev/null +++ b/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_interface.c @@ -0,0 +1,1994 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.67 $ of : mfd-interface.m2c,v $ + * + * $Id: inetNetToMediaTable_interface.c 15781 2007-01-23 22:55:06Z rstory $ + */ +/* + * ********************************************************************* + * ********************************************************************* + * ********************************************************************* + * *** *** + * *** 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-includes.h> +#include <net-snmp/agent/net-snmp-agent-includes.h> + +/* + * include our parent header + */ +#include "inetNetToMediaTable.h" + + +#include <net-snmp/agent/table_container.h> +#include <net-snmp/library/container.h> + +#include "inetNetToMediaTable_interface.h" + +#include <ctype.h> + +/********************************************************************** + ********************************************************************** + *** + *** Table inetNetToMediaTable + *** + ********************************************************************** + **********************************************************************/ +/* + * IP-MIB::inetNetToMediaTable is subid 35 of ip. + * Its status is Current. + * OID: .1.3.6.1.2.1.4.35, length: 8 + */ +typedef struct inetNetToMediaTable_interface_ctx_s { + + netsnmp_container *container; + netsnmp_cache *cache; + + inetNetToMediaTable_registration *user_ctx; + + netsnmp_table_registration_info tbl_info; + + netsnmp_baby_steps_access_methods access_multiplexer; + + u_int table_dirty; + +} inetNetToMediaTable_interface_ctx; + +static inetNetToMediaTable_interface_ctx inetNetToMediaTable_if_ctx; + +static void + _inetNetToMediaTable_container_init(inetNetToMediaTable_interface_ctx * + if_ctx); +static void + _inetNetToMediaTable_container_shutdown(inetNetToMediaTable_interface_ctx * + if_ctx); + + +netsnmp_container * +inetNetToMediaTable_container_get(void) +{ + return inetNetToMediaTable_if_ctx.container; +} + +inetNetToMediaTable_registration * +inetNetToMediaTable_registration_get(void) +{ + return inetNetToMediaTable_if_ctx.user_ctx; +} + +inetNetToMediaTable_registration * +inetNetToMediaTable_registration_set(inetNetToMediaTable_registration * + newreg) +{ + inetNetToMediaTable_registration *old = + inetNetToMediaTable_if_ctx.user_ctx; + inetNetToMediaTable_if_ctx.user_ctx = newreg; + return old; +} + +int +inetNetToMediaTable_container_size(void) +{ + return CONTAINER_SIZE(inetNetToMediaTable_if_ctx.container); +} + +u_int +inetNetToMediaTable_dirty_get(void) +{ + return inetNetToMediaTable_if_ctx.table_dirty; +} + +void +inetNetToMediaTable_dirty_set(u_int status) +{ + DEBUGMSGTL(("inetNetToMediaTable:inetNetToMediaTable_dirty_set", + "called. was %d, now %d\n", + inetNetToMediaTable_if_ctx.table_dirty, status)); + inetNetToMediaTable_if_ctx.table_dirty = status; +} + +/* + * mfd multiplexer modes + */ +static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_pre_request; +static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_post_request; +static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_object_lookup; +static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_get_values; +static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_check_objects; +static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_undo_setup; +static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_set_values; +static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_undo_cleanup; +static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_undo_values; +static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_commit; +static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_undo_commit; +static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_irreversible_commit; +static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_check_dependencies; + +NETSNMP_STATIC_INLINE int + _inetNetToMediaTable_undo_column(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx, + netsnmp_variable_list * + var, int column); + +NETSNMP_STATIC_INLINE int + _inetNetToMediaTable_check_indexes(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx); + +/** + * @internal + * Initialize the table inetNetToMediaTable + * (Define its contents and how it's structured) + */ +void +_inetNetToMediaTable_initialize_interface(inetNetToMediaTable_registration + * reg_ptr, u_long flags) +{ + netsnmp_baby_steps_access_methods *access_multiplexer = + &inetNetToMediaTable_if_ctx.access_multiplexer; + netsnmp_table_registration_info *tbl_info = + &inetNetToMediaTable_if_ctx.tbl_info; + netsnmp_handler_registration *reginfo; + netsnmp_mib_handler *handler; + int mfd_modes = 0; + + DEBUGMSGTL(("internal:inetNetToMediaTable:_inetNetToMediaTable_initialize_interface", "called\n")); + + + /************************************************* + * + * save interface context for inetNetToMediaTable + */ + /* + * Setting up the table's definition + */ + netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER, + /** index: inetNetToMediaIfIndex */ + ASN_INTEGER, + /** index: inetNetToMediaNetAddressType */ + ASN_OCTET_STR, + /** index: inetNetToMediaNetAddress */ + 0); + + /* + * Define the minimum and maximum accessible columns. This + * optimizes retrival. + */ + tbl_info->min_column = INETNETTOMEDIATABLE_MIN_COL; + tbl_info->max_column = INETNETTOMEDIATABLE_MAX_COL; + + /* + * save users context + */ + inetNetToMediaTable_if_ctx.user_ctx = reg_ptr; + + /* + * call data access initialization code + */ + inetNetToMediaTable_init_data(reg_ptr); + + /* + * set up the container + */ + _inetNetToMediaTable_container_init(&inetNetToMediaTable_if_ctx); + if (NULL == inetNetToMediaTable_if_ctx.container) { + snmp_log(LOG_ERR, + "could not initialize container for inetNetToMediaTable\n"); + return; + } + + /* + * access_multiplexer: REQUIRED wrapper for get request handling + */ + access_multiplexer->object_lookup = + _mfd_inetNetToMediaTable_object_lookup; + access_multiplexer->get_values = _mfd_inetNetToMediaTable_get_values; + + /* + * no wrappers yet + */ + access_multiplexer->pre_request = _mfd_inetNetToMediaTable_pre_request; + access_multiplexer->post_request = + _mfd_inetNetToMediaTable_post_request; + + + /* + * REQUIRED wrappers for set request handling + */ + access_multiplexer->object_syntax_checks = + _mfd_inetNetToMediaTable_check_objects; + access_multiplexer->undo_setup = _mfd_inetNetToMediaTable_undo_setup; + access_multiplexer->undo_cleanup = + _mfd_inetNetToMediaTable_undo_cleanup; + access_multiplexer->set_values = _mfd_inetNetToMediaTable_set_values; + access_multiplexer->undo_sets = _mfd_inetNetToMediaTable_undo_values; + + /* + * no wrappers yet + */ + access_multiplexer->commit = _mfd_inetNetToMediaTable_commit; + access_multiplexer->undo_commit = _mfd_inetNetToMediaTable_undo_commit; + access_multiplexer->irreversible_commit = + _mfd_inetNetToMediaTable_irreversible_commit; + + /* + * REQUIRED for tables with dependencies + */ + access_multiplexer->consistency_checks = + _mfd_inetNetToMediaTable_check_dependencies; + + /************************************************* + * + * Create a registration, save our reg data, register table. + */ + DEBUGMSGTL(("inetNetToMediaTable:init_inetNetToMediaTable", + "Registering inetNetToMediaTable as a mibs-for-dummies table.\n")); + handler = + netsnmp_baby_steps_access_multiplexer_get(access_multiplexer); + reginfo = + netsnmp_handler_registration_create("inetNetToMediaTable", handler, + inetNetToMediaTable_oid, + inetNetToMediaTable_oid_size, + HANDLER_CAN_BABY_STEP | + HANDLER_CAN_RWRITE); + if (NULL == reginfo) { + snmp_log(LOG_ERR, "error registering table inetNetToMediaTable\n"); + return; + } + reginfo->my_reg_void = &inetNetToMediaTable_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->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->pre_request) + mfd_modes |= BABY_STEP_PRE_REQUEST; + if (access_multiplexer->post_request) + mfd_modes |= BABY_STEP_POST_REQUEST; + + 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; + + 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, + inetNetToMediaTable_if_ctx. + container, + TABLE_CONTAINER_KEY_NETSNMP_INDEX); + netsnmp_inject_handler(reginfo, handler); + + /************************************************* + * + * inject cache helper + */ + if (NULL != inetNetToMediaTable_if_ctx.cache) { + handler = + netsnmp_cache_handler_get(inetNetToMediaTable_if_ctx.cache); + netsnmp_inject_handler(reginfo, handler); + } + + /* + * register table + */ + netsnmp_register_table(reginfo, tbl_info); + +} /* _inetNetToMediaTable_initialize_interface */ + +/** + * @internal + * Shutdown the table inetNetToMediaTable + */ +void +_inetNetToMediaTable_shutdown_interface(inetNetToMediaTable_registration * + reg_ptr) +{ + /* + * shutdown the container + */ + _inetNetToMediaTable_container_shutdown(&inetNetToMediaTable_if_ctx); +} + +void +inetNetToMediaTable_valid_columns_set(netsnmp_column_info *vc) +{ + inetNetToMediaTable_if_ctx.tbl_info.valid_columns = vc; +} /* inetNetToMediaTable_valid_columns_set */ + +/** + * @internal + * convert the index component stored in the context to an oid + */ +int +inetNetToMediaTable_index_to_oid(netsnmp_index * oid_idx, + inetNetToMediaTable_mib_index * mib_idx) +{ + int err = SNMP_ERR_NOERROR; + + /* + * temp storage for parsing indexes + */ + /* + * inetNetToMediaIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H + */ + netsnmp_variable_list var_inetNetToMediaIfIndex; + /* + * inetNetToMediaNetAddressType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h + */ + netsnmp_variable_list var_inetNetToMediaNetAddressType; + /* + * inetNetToMediaNetAddress(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h + */ + netsnmp_variable_list var_inetNetToMediaNetAddress; + + /* + * set up varbinds + */ + memset(&var_inetNetToMediaIfIndex, 0x00, + sizeof(var_inetNetToMediaIfIndex)); + var_inetNetToMediaIfIndex.type = ASN_INTEGER; + memset(&var_inetNetToMediaNetAddressType, 0x00, + sizeof(var_inetNetToMediaNetAddressType)); + var_inetNetToMediaNetAddressType.type = ASN_INTEGER; + memset(&var_inetNetToMediaNetAddress, 0x00, + sizeof(var_inetNetToMediaNetAddress)); + var_inetNetToMediaNetAddress.type = ASN_OCTET_STR; + + /* + * chain temp index varbinds together + */ + var_inetNetToMediaIfIndex.next_variable = + &var_inetNetToMediaNetAddressType; + var_inetNetToMediaNetAddressType.next_variable = + &var_inetNetToMediaNetAddress; + var_inetNetToMediaNetAddress.next_variable = NULL; + + + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_index_to_oid", "called\n")); + + /* + * inetNetToMediaIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H + */ + snmp_set_var_value(&var_inetNetToMediaIfIndex, + (u_char *) & mib_idx->inetNetToMediaIfIndex, + sizeof(mib_idx->inetNetToMediaIfIndex)); + + /* + * inetNetToMediaNetAddressType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h + */ + snmp_set_var_value(&var_inetNetToMediaNetAddressType, + (u_char *) & mib_idx->inetNetToMediaNetAddressType, + sizeof(mib_idx->inetNetToMediaNetAddressType)); + + /* + * inetNetToMediaNetAddress(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h + */ + snmp_set_var_value(&var_inetNetToMediaNetAddress, + (u_char *) & mib_idx->inetNetToMediaNetAddress, + mib_idx->inetNetToMediaNetAddress_len * + sizeof(mib_idx->inetNetToMediaNetAddress[0])); + + + err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len, + NULL, 0, &var_inetNetToMediaIfIndex); + 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_inetNetToMediaIfIndex); + + return err; +} /* inetNetToMediaTable_index_to_oid */ + +/** + * extract inetNetToMediaTable indexes from a netsnmp_index + * + * @retval SNMP_ERR_NOERROR : no error + * @retval SNMP_ERR_GENERR : error + */ +int +inetNetToMediaTable_index_from_oid(netsnmp_index * oid_idx, + inetNetToMediaTable_mib_index * mib_idx) +{ + int err = SNMP_ERR_NOERROR; + + /* + * temp storage for parsing indexes + */ + /* + * inetNetToMediaIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H + */ + netsnmp_variable_list var_inetNetToMediaIfIndex; + /* + * inetNetToMediaNetAddressType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h + */ + netsnmp_variable_list var_inetNetToMediaNetAddressType; + /* + * inetNetToMediaNetAddress(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h + */ + netsnmp_variable_list var_inetNetToMediaNetAddress; + + /* + * set up varbinds + */ + memset(&var_inetNetToMediaIfIndex, 0x00, + sizeof(var_inetNetToMediaIfIndex)); + var_inetNetToMediaIfIndex.type = ASN_INTEGER; + memset(&var_inetNetToMediaNetAddressType, 0x00, + sizeof(var_inetNetToMediaNetAddressType)); + var_inetNetToMediaNetAddressType.type = ASN_INTEGER; + memset(&var_inetNetToMediaNetAddress, 0x00, + sizeof(var_inetNetToMediaNetAddress)); + var_inetNetToMediaNetAddress.type = ASN_OCTET_STR; + + /* + * chain temp index varbinds together + */ + var_inetNetToMediaIfIndex.next_variable = + &var_inetNetToMediaNetAddressType; + var_inetNetToMediaNetAddressType.next_variable = + &var_inetNetToMediaNetAddress; + var_inetNetToMediaNetAddress.next_variable = NULL; + + + DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_index_from_oid", "called\n")); + + /* + * parse the oid into the individual index components + */ + err = parse_oid_indexes(oid_idx->oids, oid_idx->len, + &var_inetNetToMediaIfIndex); + if (err == SNMP_ERR_NOERROR) { + /* + * copy out values + */ + mib_idx->inetNetToMediaIfIndex = + *((long *) var_inetNetToMediaIfIndex.val.string); + mib_idx->inetNetToMediaNetAddressType = + *((u_long *) var_inetNetToMediaNetAddressType.val.string); + /* + * NOTE: val_len is in bytes, inetNetToMediaNetAddress_len might not be + */ + if (var_inetNetToMediaNetAddress.val_len > + sizeof(mib_idx->inetNetToMediaNetAddress)) + err = SNMP_ERR_GENERR; + else { + memcpy(mib_idx->inetNetToMediaNetAddress, + var_inetNetToMediaNetAddress.val.string, + var_inetNetToMediaNetAddress.val_len); + mib_idx->inetNetToMediaNetAddress_len = + var_inetNetToMediaNetAddress.val_len / + sizeof(mib_idx->inetNetToMediaNetAddress[0]); + } + + + } + + /* + * parsing may have allocated memory. free it. + */ + snmp_reset_var_buffers(&var_inetNetToMediaIfIndex); + + return err; +} /* inetNetToMediaTable_index_from_oid */ + + +/* + ********************************************************************* + * @internal + * allocate resources for a inetNetToMediaTable_rowreq_ctx + */ +inetNetToMediaTable_rowreq_ctx * +inetNetToMediaTable_allocate_rowreq_ctx(inetNetToMediaTable_data * data, + void *user_init_ctx) +{ + inetNetToMediaTable_rowreq_ctx *rowreq_ctx = + SNMP_MALLOC_TYPEDEF(inetNetToMediaTable_rowreq_ctx); + + DEBUGMSGTL(("internal:inetNetToMediaTable:inetNetToMediaTable_allocate_rowreq_ctx", "called\n")); + + if (NULL == rowreq_ctx) { + snmp_log(LOG_ERR, "Couldn't allocate memory for a " + "inetNetToMediaTable_rowreq_ctx.\n"); + return NULL; + } else { + if (NULL != data) { + /* + * track if we got data from user + */ + rowreq_ctx->rowreq_flags |= MFD_ROW_DATA_FROM_USER; + rowreq_ctx->data = data; + } else if (NULL == + (rowreq_ctx->data = + inetNetToMediaTable_allocate_data())) { + SNMP_FREE(rowreq_ctx); + return NULL; + } + } + + /* + * undo context will be allocated when needed (in *_undo_setup) + */ + + rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp; + + rowreq_ctx->inetNetToMediaTable_data_list = NULL; + + /* + * if we allocated data, call init routine + */ + if (!(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) { + if (SNMPERR_SUCCESS != + inetNetToMediaTable_rowreq_ctx_init(rowreq_ctx, + user_init_ctx)) { + inetNetToMediaTable_release_rowreq_ctx(rowreq_ctx); + rowreq_ctx = NULL; + } + } + + return rowreq_ctx; +} /* inetNetToMediaTable_allocate_rowreq_ctx */ + +/* + * @internal + * release resources for a inetNetToMediaTable_rowreq_ctx + */ +void +inetNetToMediaTable_release_rowreq_ctx(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx) +{ + DEBUGMSGTL(("internal:inetNetToMediaTable:inetNetToMediaTable_release_rowreq_ctx", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + inetNetToMediaTable_rowreq_ctx_cleanup(rowreq_ctx); + + /* + * for non-transient data, don't free data we got from the user + */ + if ((rowreq_ctx->data) && + !(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) + inetNetToMediaTable_release_data(rowreq_ctx->data); + + if (rowreq_ctx->undo) + inetNetToMediaTable_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); +} /* inetNetToMediaTable_release_rowreq_ctx */ + +/** + * @internal + * wrapper + */ +static int +_mfd_inetNetToMediaTable_pre_request(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + int rc; + + DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_pre_request", "called\n")); + + if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) { + DEBUGMSGTL(("internal:inetNetToMediaTable", + "skipping additional pre_request\n")); + return SNMP_ERR_NOERROR; + } + + rc = inetNetToMediaTable_pre_request(inetNetToMediaTable_if_ctx. + user_ctx); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("inetNetToMediaTable", "error %d from " + "inetNetToMediaTable_pre_request\n", rc)); + netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); + } + + return SNMP_ERR_NOERROR; +} /* _mfd_inetNetToMediaTable_pre_request */ + +/** + * @internal + * wrapper + */ +static int +_mfd_inetNetToMediaTable_post_request(netsnmp_mib_handler *handler, netsnmp_handler_registration + *reginfo, netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + inetNetToMediaTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + int rc, packet_rc; + + DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_post_request", "called\n")); + + /* + * release row context, if deleted + */ + if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED)) + inetNetToMediaTable_release_rowreq_ctx(rowreq_ctx); + + /* + * wait for last call before calling user + */ + if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) { + DEBUGMSGTL(("internal:inetNetToMediaTable", + "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) && inetNetToMediaTable_dirty_get()) { + /* + * we shouldn't get here. the undo steps should also clear + * the dirty flags. + */ + snmp_log(LOG_WARNING, + "inetNetToMediaTable dirty flag set in post_request " + "but status != SUCCESS.\n"); + } + + rc = inetNetToMediaTable_post_request(inetNetToMediaTable_if_ctx. + user_ctx, packet_rc); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("inetNetToMediaTable", "error %d from " + "inetNetToMediaTable_post_request\n", rc)); + } + + return SNMP_ERR_NOERROR; +} /* _mfd_inetNetToMediaTable_post_request */ + +/** + * @internal + * wrapper + */ +static inetNetToMediaTable_rowreq_ctx * +_mfd_inetNetToMediaTable_rowreq_from_index(netsnmp_index * oid_idx, + int *rc_ptr) +{ + inetNetToMediaTable_rowreq_ctx *rowreq_ctx; + inetNetToMediaTable_mib_index mib_idx; + int rc; + + DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_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 = inetNetToMediaTable_index_from_oid(oid_idx, &mib_idx); + if (MFD_SUCCESS != *rc_ptr) { + DEBUGMSGT(("inetNetToMediaTable", "error parsing index\n")); + return NULL; + } + + /* + * allocate new context + */ + rowreq_ctx = inetNetToMediaTable_allocate_rowreq_ctx(NULL, 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 = _inetNetToMediaTable_check_indexes(rowreq_ctx); + if (MFD_SUCCESS != *rc_ptr) { + netsnmp_assert((*rc_ptr == SNMP_ERR_NOCREATION) || + (*rc_ptr == SNMP_ERR_INCONSISTENTNAME)); + inetNetToMediaTable_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_inetNetToMediaTable_rowreq_from_index */ + + +/** + * @internal + * wrapper + */ +static int +_mfd_inetNetToMediaTable_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; + inetNetToMediaTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + + DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_object_lookup", "called\n")); + + /* + * get our context from mfd + * inetNetToMediaTable_interface_ctx *if_ctx = + * (inetNetToMediaTable_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_inetNetToMediaTable_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 + inetNetToMediaTable_row_prep(rowreq_ctx); + + return SNMP_VALIDATE_ERR(rc); +} /* _mfd_inetNetToMediaTable_object_lookup */ + +/*********************************************************************** + * + * GET processing + * + ***********************************************************************/ +/* + * @internal + * Retrieve the value for a particular column + */ +NETSNMP_STATIC_INLINE int +_inetNetToMediaTable_get_column(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx, netsnmp_variable_list * var, + int column) +{ + int rc = SNMPERR_SUCCESS; + + DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_get_column", "called for %d\n", column)); + + + netsnmp_assert(NULL != rowreq_ctx); + + switch (column) { + + /* + * inetNetToMediaPhysAddress(4)/PhysAddress/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H + */ + case COLUMN_INETNETTOMEDIAPHYSADDRESS: + var->type = ASN_OCTET_STR; + rc = inetNetToMediaPhysAddress_get(rowreq_ctx, + (char **) &var->val.string, + &var->val_len); + break; + + /* + * inetNetToMediaLastUpdated(5)/TimeStamp/ASN_TIMETICKS/u_long(u_long)//l/A/w/e/r/d/h + */ + case COLUMN_INETNETTOMEDIALASTUPDATED: + var->val_len = sizeof(u_long); + var->type = ASN_TIMETICKS; + rc = inetNetToMediaLastUpdated_get(rowreq_ctx, + (u_long *) var->val.string); + break; + + /* + * inetNetToMediaType(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h + */ + case COLUMN_INETNETTOMEDIATYPE: + var->val_len = sizeof(u_long); + var->type = ASN_INTEGER; + rc = inetNetToMediaType_get(rowreq_ctx, + (u_long *) var->val.string); + break; + + /* + * inetNetToMediaState(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h + */ + case COLUMN_INETNETTOMEDIASTATE: + var->val_len = sizeof(u_long); + var->type = ASN_INTEGER; + rc = inetNetToMediaState_get(rowreq_ctx, + (u_long *) var->val.string); + break; + + /* + * inetNetToMediaRowStatus(8)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h + */ + case COLUMN_INETNETTOMEDIAROWSTATUS: + var->val_len = sizeof(u_long); + var->type = ASN_INTEGER; + rc = inetNetToMediaRowStatus_get(rowreq_ctx, + (u_long *) var->val.string); + break; + + default: + snmp_log(LOG_ERR, + "unknown column %d in _inetNetToMediaTable_get_column\n", + column); + break; + } + + return rc; +} /* _inetNetToMediaTable_get_column */ + +int +_mfd_inetNetToMediaTable_get_values(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + inetNetToMediaTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + netsnmp_table_request_info *tri; + u_char *old_string; + void (*dataFreeHook) (void *); + int rc; + + DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_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 = _inetNetToMediaTable_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_inetNetToMediaTable_get_values */ + +NETSNMP_STATIC_INLINE int +_inetNetToMediaTable_check_indexes(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx) +{ + int rc = SNMPERR_SUCCESS; + + DEBUGMSGTL(("internal:inetNetToMediaTable:_inetNetToMediaTable_check_indexes", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + + /* + * (INDEX) inetNetToMediaIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H + */ + /* + * check defined range(s). + */ + if ((SNMPERR_SUCCESS == rc) + && ((rowreq_ctx->tbl_idx.inetNetToMediaIfIndex < 1) + || (rowreq_ctx->tbl_idx.inetNetToMediaIfIndex > 2147483647)) + ) { + rc = SNMP_ERR_WRONGVALUE; + } + if (MFD_SUCCESS != rc) + return rc; + rc = inetNetToMediaIfIndex_check_index(rowreq_ctx); + if (MFD_SUCCESS != rc) + return SNMP_ERR_NOCREATION; + + /* + * (INDEX) inetNetToMediaNetAddressType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h + */ + /* + * check that the value is one of defined enums + */ + if ((SNMPERR_SUCCESS == rc) + && (rowreq_ctx->tbl_idx.inetNetToMediaNetAddressType != + INETADDRESSTYPE_UNKNOWN) + && (rowreq_ctx->tbl_idx.inetNetToMediaNetAddressType != + INETADDRESSTYPE_IPV4) + && (rowreq_ctx->tbl_idx.inetNetToMediaNetAddressType != + INETADDRESSTYPE_IPV6) + && (rowreq_ctx->tbl_idx.inetNetToMediaNetAddressType != + INETADDRESSTYPE_IPV4Z) + && (rowreq_ctx->tbl_idx.inetNetToMediaNetAddressType != + INETADDRESSTYPE_IPV6Z) + && (rowreq_ctx->tbl_idx.inetNetToMediaNetAddressType != + INETADDRESSTYPE_DNS) + ) { + rc = SNMP_ERR_WRONGVALUE; + } + if (MFD_SUCCESS != rc) + return rc; + rc = inetNetToMediaNetAddressType_check_index(rowreq_ctx); + if (MFD_SUCCESS != rc) + return SNMP_ERR_NOCREATION; + + /* + * (INDEX) inetNetToMediaNetAddress(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h + */ + /* + * check defined range(s). + */ + if ((SNMPERR_SUCCESS == rc) + && ((rowreq_ctx->tbl_idx.inetNetToMediaNetAddress_len < 0) + || (rowreq_ctx->tbl_idx.inetNetToMediaNetAddress_len > 255)) + ) { + rc = SNMP_ERR_WRONGLENGTH; + } + if (MFD_SUCCESS != rc) + return rc; + rc = inetNetToMediaNetAddress_check_index(rowreq_ctx); + if (MFD_SUCCESS != rc) + return SNMP_ERR_NOCREATION; + + /* + * if individual parts look ok, check them as a whole + */ + return inetNetToMediaTable_validate_index(inetNetToMediaTable_if_ctx. + user_ctx, rowreq_ctx); +} /* _inetNetToMediaTable_check_indexes */ + +/*********************************************************************** + * + * SET processing + * + ***********************************************************************/ + +/*---------------------------------------------------------------------- + * + * SET: Syntax checks + * + *---------------------------------------------------------------------*/ +/* + * @internal + * Check the syntax for a particular column + */ +NETSNMP_STATIC_INLINE int +_inetNetToMediaTable_check_column(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx, netsnmp_variable_list * var, + int column) +{ + int rc = SNMPERR_SUCCESS; + + DEBUGMSGTL(("internal:inetNetToMediaTable:_inetNetToMediaTable_check_column", "called for %d\n", column)); + + netsnmp_assert(NULL != rowreq_ctx); + + switch (column) { + /* + * (INDEX) inetNetToMediaIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H + */ + case COLUMN_INETNETTOMEDIAIFINDEX: + rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */ + break; + /* + * (INDEX) inetNetToMediaNetAddressType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h + */ + case COLUMN_INETNETTOMEDIANETADDRESSTYPE: + rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */ + break; + /* + * (INDEX) inetNetToMediaNetAddress(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h + */ + case COLUMN_INETNETTOMEDIANETADDRESS: + rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */ + break; + + /* + * inetNetToMediaPhysAddress(4)/PhysAddress/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H + */ + case COLUMN_INETNETTOMEDIAPHYSADDRESS: + rc = netsnmp_check_vb_type(var, ASN_OCTET_STR); + /* + * check defined range(s). + */ + if ((SNMPERR_SUCCESS == rc) + && ((var->val_len < 0) || (var->val_len > 65535)) + ) { + rc = SNMP_ERR_WRONGLENGTH; + } + if (SNMPERR_SUCCESS != rc) { + DEBUGMSGTL(("inetNetToMediaTable:_inetNetToMediaTable_check_column:inetNetToMediaPhysAddress", "varbind validation failed (eg bad type or size)\n")); + } else { + rc = inetNetToMediaPhysAddress_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 inetNetToMediaPhysAddress_check_value\n", + rc); + rc = SNMP_ERR_GENERR; + } + } + break; + + /* + * inetNetToMediaLastUpdated(5)/TimeStamp/ASN_TIMETICKS/u_long(u_long)//l/A/w/e/r/d/h + */ + case COLUMN_INETNETTOMEDIALASTUPDATED: + rc = SNMP_ERR_NOTWRITABLE; + break; + + /* + * inetNetToMediaType(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h + */ + case COLUMN_INETNETTOMEDIATYPE: + rc = netsnmp_check_vb_type(var, ASN_INTEGER); + /* + * check that the value is one of defined enums + */ + if ((SNMPERR_SUCCESS == rc) + && (*var->val.integer != INETNETTOMEDIATYPE_OTHER) + && (*var->val.integer != INETNETTOMEDIATYPE_INVALID) + && (*var->val.integer != INETNETTOMEDIATYPE_DYNAMIC) + && (*var->val.integer != INETNETTOMEDIATYPE_STATIC) + && (*var->val.integer != INETNETTOMEDIATYPE_LOCAL) + ) { + rc = SNMP_ERR_WRONGVALUE; + } + if (SNMPERR_SUCCESS != rc) { + DEBUGMSGTL(("inetNetToMediaTable:_inetNetToMediaTable_check_column:inetNetToMediaType", "varbind validation failed (eg bad type or size)\n")); + } else { + rc = inetNetToMediaType_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 inetNetToMediaType_check_value\n", + rc); + rc = SNMP_ERR_GENERR; + } + } + break; + + /* + * inetNetToMediaState(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h + */ + case COLUMN_INETNETTOMEDIASTATE: + rc = SNMP_ERR_NOTWRITABLE; + break; + + /* + * inetNetToMediaRowStatus(8)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h + */ + case COLUMN_INETNETTOMEDIAROWSTATUS: + rc = netsnmp_check_vb_rowstatus_value(var); + if (SNMPERR_SUCCESS != rc) { + DEBUGMSGTL(("inetNetToMediaTable:_inetNetToMediaTable_check_column:inetNetToMediaRowStatus", "varbind validation failed (eg bad type or size)\n")); + } else { + rc = inetNetToMediaRowStatus_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 inetNetToMediaRowStatus_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 _inetNetToMediaTable_check_column\n", + column); + } + + return rc; +} /* _inetNetToMediaTable_check_column */ + +int +_mfd_inetNetToMediaTable_check_objects(netsnmp_mib_handler *handler, netsnmp_handler_registration + *reginfo, netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + inetNetToMediaTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + netsnmp_table_request_info *tri; + int rc; + + DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_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 = _inetNetToMediaTable_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_inetNetToMediaTable_check_objects */ + + +/*---------------------------------------------------------------------- + * + * SET: check dependencies + * + *---------------------------------------------------------------------*/ +/* + * @internal + * Check dependencies wrapper + */ +static int +_mfd_inetNetToMediaTable_check_dependencies(netsnmp_mib_handler *handler, netsnmp_handler_registration + *reginfo, netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + int rc; + inetNetToMediaTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_check_dependencies", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + rc = inetNetToMediaTable_check_dependencies(rowreq_ctx); + if (rc) { + DEBUGMSGTL(("inetNetToMediaTable:mfd", "error %d from " + "inetNetToMediaTable_check_dependencies\n", rc)); + netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); + } + + return SNMP_ERR_NOERROR; +} /* _mfd_inetNetToMediaTable_check_dependencies */ + +/*---------------------------------------------------------------------- + * + * SET: Undo setup + * + *---------------------------------------------------------------------*/ +/* + * @internal + * Set the value for a particular column + */ +NETSNMP_STATIC_INLINE int +_inetNetToMediaTable_undo_setup_column(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx, int column) +{ + int rc = SNMPERR_SUCCESS; + + DEBUGMSGTL(("internal:inetNetToMediaTable:_inetNetToMediaTable_undo_setup_column", "called for %d\n", column)); + + netsnmp_assert(NULL != rowreq_ctx); + + switch (column) { + + /* + * inetNetToMediaPhysAddress(4)/PhysAddress/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H + */ + case COLUMN_INETNETTOMEDIAPHYSADDRESS: + rowreq_ctx->column_set_flags |= + COLUMN_INETNETTOMEDIAPHYSADDRESS_FLAG; + rc = inetNetToMediaPhysAddress_undo_setup(rowreq_ctx); + break; + + /* + * inetNetToMediaType(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h + */ + case COLUMN_INETNETTOMEDIATYPE: + rowreq_ctx->column_set_flags |= COLUMN_INETNETTOMEDIATYPE_FLAG; + rc = inetNetToMediaType_undo_setup(rowreq_ctx); + break; + + /* + * inetNetToMediaRowStatus(8)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h + */ + case COLUMN_INETNETTOMEDIAROWSTATUS: + rowreq_ctx->column_set_flags |= + COLUMN_INETNETTOMEDIAROWSTATUS_FLAG; + rc = inetNetToMediaRowStatus_undo_setup(rowreq_ctx); + break; + + default: + snmp_log(LOG_ERR, + "unknown column %d in _inetNetToMediaTable_undo_setup_column\n", + column); + break; + } + + return rc; +} /* _inetNetToMediaTable_undo_setup_column */ + + +/** + * @internal + * undo setup + */ +int +_mfd_inetNetToMediaTable_undo_setup(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + int rc; + inetNetToMediaTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + + DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_undo_setup", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * allocate undo context + */ + rowreq_ctx->undo = inetNetToMediaTable_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 = inetNetToMediaTable_undo_setup(rowreq_ctx); + if (MFD_SUCCESS != rc) { + DEBUGMSGTL(("inetNetToMediaTable:mfd", "error %d from " + "inetNetToMediaTable_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 = _inetNetToMediaTable_undo_setup_column(rowreq_ctx, + tri->colnum); + if (MFD_SUCCESS != rc) { + DEBUGMSGTL(("inetNetToMediaTable:mfd", "error %d from " + "inetNetToMediaTable_undo_setup_column\n", + rc)); + netsnmp_set_request_error(agtreq_info, requests, + SNMP_VALIDATE_ERR(rc)); + } + } /* for results */ + } + + return SNMP_ERR_NOERROR; +} /* _mfd_inetNetToMediaTable_undo_setup */ + +/** + * @internal + * undo setup + */ +int +_mfd_inetNetToMediaTable_undo_cleanup(netsnmp_mib_handler *handler, netsnmp_handler_registration + *reginfo, netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + inetNetToMediaTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + int rc; + + DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_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 = inetNetToMediaTable_undo_cleanup(rowreq_ctx); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("inetNetToMediaTable:mfd", "error %d from " + "inetNetToMediaTable_undo_cleanup\n", rc)); + } + + /* + * release undo context, if needed + */ + if (rowreq_ctx->undo) { + inetNetToMediaTable_release_data(rowreq_ctx->undo); + rowreq_ctx->undo = NULL; + } + + + return SNMP_ERR_NOERROR; +} /* _mfd_inetNetToMediaTable_undo_cleanup */ + +/*---------------------------------------------------------------------- + * + * SET: Set values + * + *---------------------------------------------------------------------*/ +/* + * @internal + * Set the value for a particular column + */ +NETSNMP_STATIC_INLINE int +_inetNetToMediaTable_set_column(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx, netsnmp_variable_list * var, + int column) +{ + int rc = SNMPERR_SUCCESS; + + DEBUGMSGTL(("internal:inetNetToMediaTable:_inetNetToMediaTable_set_column", "called for %d\n", column)); + + netsnmp_assert(NULL != rowreq_ctx); + + switch (column) { + + /* + * inetNetToMediaPhysAddress(4)/PhysAddress/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H + */ + case COLUMN_INETNETTOMEDIAPHYSADDRESS: + rowreq_ctx->column_set_flags |= + COLUMN_INETNETTOMEDIAPHYSADDRESS_FLAG; + rc = inetNetToMediaPhysAddress_set(rowreq_ctx, + (char *) var->val.string, + var->val_len); + break; + + /* + * inetNetToMediaType(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h + */ + case COLUMN_INETNETTOMEDIATYPE: + rowreq_ctx->column_set_flags |= COLUMN_INETNETTOMEDIATYPE_FLAG; + rc = inetNetToMediaType_set(rowreq_ctx, + *((u_long *) var->val.string)); + break; + + /* + * inetNetToMediaRowStatus(8)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h + */ + case COLUMN_INETNETTOMEDIAROWSTATUS: + rowreq_ctx->column_set_flags |= + COLUMN_INETNETTOMEDIAROWSTATUS_FLAG; + rc = inetNetToMediaRowStatus_set(rowreq_ctx, + *((u_long *) var->val.string)); + break; + + default: + snmp_log(LOG_ERR, + "unknown column %d in _inetNetToMediaTable_set_column\n", + column); + rc = SNMP_ERR_GENERR; + break; + } + + return rc; +} /* _inetNetToMediaTable_set_column */ + +int +_mfd_inetNetToMediaTable_set_values(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + inetNetToMediaTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + netsnmp_table_request_info *tri; + int rc = SNMP_ERR_NOERROR; + + DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_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 = _inetNetToMediaTable_set_column(rowreq_ctx, + requests->requestvb, + tri->colnum); + if (MFD_SUCCESS != rc) { + DEBUGMSGTL(("inetNetToMediaTable:mfd", "error %d from " + "inetNetToMediaTable_set_column\n", rc)); + netsnmp_set_request_error(agtreq_info, requests, + SNMP_VALIDATE_ERR(rc)); + } + } /* for results */ + + return SNMP_ERR_NOERROR; +} /* _mfd_inetNetToMediaTable_set_values */ + +/*---------------------------------------------------------------------- + * + * SET: commit + * + *---------------------------------------------------------------------*/ +/** + * @internal + * commit the values + */ +int +_mfd_inetNetToMediaTable_commit(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *agtreq_info, + netsnmp_request_info *requests) +{ + int rc; + inetNetToMediaTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + + DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_commit", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + rc = inetNetToMediaTable_commit(rowreq_ctx); + if (MFD_SUCCESS != rc) { + DEBUGMSGTL(("inetNetToMediaTable:mfd", "error %d from " + "inetNetToMediaTable_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... + */ + inetNetToMediaTable_dirty_set(inetNetToMediaTable_dirty_get() + 1); /* set table dirty flag */ + } + + return SNMP_ERR_NOERROR; +} + +int +_mfd_inetNetToMediaTable_undo_commit(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + int rc; + inetNetToMediaTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + + DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_undo_commit", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) { + u_int d = inetNetToMediaTable_dirty_get(); + + netsnmp_assert(d != 0); + if (d) + inetNetToMediaTable_dirty_set(d - 1); + } + + rc = inetNetToMediaTable_undo_commit(rowreq_ctx); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("inetNetToMediaTable:mfd", "error %d from " + "inetNetToMediaTable_undo_commit\n", rc)); + } + + if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) { + snmp_log(LOG_WARNING, + "inetNetToMediaTable row dirty flag still set after undo_commit\n"); + rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY; + } + + return SNMP_ERR_NOERROR; +} /* _mfd_inetNetToMediaTable_commit */ + +/*---------------------------------------------------------------------- + * + * SET: Undo + * + *---------------------------------------------------------------------*/ +/** + * @internal + * undo the value for a particular column + */ +NETSNMP_STATIC_INLINE int +_inetNetToMediaTable_undo_column(inetNetToMediaTable_rowreq_ctx * + rowreq_ctx, netsnmp_variable_list * var, + int column) +{ + int rc = SNMPERR_SUCCESS; + + DEBUGMSGTL(("internal:inetNetToMediaTable:_inetNetToMediaTable_undo_column", "called for %d\n", column)); + + netsnmp_assert(NULL != rowreq_ctx); + + switch (column) { + + /* + * inetNetToMediaPhysAddress(4)/PhysAddress/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H + */ + case COLUMN_INETNETTOMEDIAPHYSADDRESS: + rc = inetNetToMediaPhysAddress_undo(rowreq_ctx); + break; + + /* + * inetNetToMediaType(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h + */ + case COLUMN_INETNETTOMEDIATYPE: + rc = inetNetToMediaType_undo(rowreq_ctx); + break; + + /* + * inetNetToMediaRowStatus(8)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h + */ + case COLUMN_INETNETTOMEDIAROWSTATUS: + rc = inetNetToMediaRowStatus_undo(rowreq_ctx); + break; + + default: + snmp_log(LOG_ERR, + "unknown column %d in _inetNetToMediaTable_undo_column\n", + column); + break; + } + + return rc; +} /* _inetNetToMediaTable_undo_column */ + +int +_mfd_inetNetToMediaTable_undo_values(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + int rc; + inetNetToMediaTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + netsnmp_table_request_info *tri; + + DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_undo_values", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + rc = inetNetToMediaTable_undo(rowreq_ctx); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("inetNetToMediaTable:mfd", "error %d from " + "inetNetToMediaTable_undo\n", rc)); + } + + for (; requests; requests = requests->next) { + /* + * set column data + */ + tri = netsnmp_extract_table_info(requests); + if (NULL == tri) + continue; + + rc = _inetNetToMediaTable_undo_column(rowreq_ctx, + requests->requestvb, + tri->colnum); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("inetNetToMediaTable:mfd", "error %d from " + "inetNetToMediaTable_undo_column\n", rc)); + } + } /* for results */ + + return SNMP_ERR_NOERROR; +} /* _mfd_inetNetToMediaTable_undo_values */ + +/*---------------------------------------------------------------------- + * + * SET: irreversible commit + * + *---------------------------------------------------------------------*/ +/** + * @internal + * commit irreversible actions + */ +int +_mfd_inetNetToMediaTable_irreversible_commit(netsnmp_mib_handler *handler, netsnmp_handler_registration + *reginfo, netsnmp_agent_request_info + *agtreq_info, netsnmp_request_info + *requests) +{ + inetNetToMediaTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + + DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_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(inetNetToMediaTable_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(inetNetToMediaTable_if_ctx.container, + rowreq_ctx); + } + } + + return SNMP_ERR_NOERROR; +} /* _mfd_inetNetToMediaTable_irreversible_commit */ + +/*********************************************************************** + * + * DATA ACCESS + * + ***********************************************************************/ +static void _container_free(netsnmp_container *container); + +/** + * @internal + */ +static int +_cache_load(netsnmp_cache * cache, void *vmagic) +{ + DEBUGTRACE; + + if ((NULL == cache) || (NULL == cache->magic)) { + snmp_log(LOG_ERR, + "invalid cache for inetNetToMediaTable_cache_load\n"); + return -1; + } + DEBUGMSGTL(("inetNetToMediaTable/cache", "inetNetToMedia_load %p/%p\n", + cache, cache->magic)); + + netsnmp_assert((0 == cache->valid) || (1 == cache->expired)); + + /* + * call user code + */ + return inetNetToMediaTable_container_load((netsnmp_container *) cache-> + magic); +} /* _cache_load */ + +/** + * @internal + */ +static void +_cache_free(netsnmp_cache * cache, void *magic) +{ + netsnmp_container *container; + + DEBUGMSGTL(("internal:inetNetToMediaTable:_cache_free", "called\n")); + + if ((NULL == cache) || (NULL == cache->magic)) { + snmp_log(LOG_ERR, + "invalid cache in inetNetToMediaTable_cache_free\n"); + return; + } + + container = (netsnmp_container *) cache->magic; + + _container_free(container); +} /* _cache_free */ + +/** + * @internal + */ +static void +_container_item_free(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, + void *context) +{ + DEBUGMSGTL(("internal:inetNetToMediaTable:_container_item_free", + "called\n")); + + if (NULL == rowreq_ctx) + return; + + inetNetToMediaTable_release_rowreq_ctx(rowreq_ctx); +} /* _container_item_free */ + +/** + * @internal + */ +static void +_container_free(netsnmp_container *container) +{ + DEBUGMSGTL(("internal:inetNetToMediaTable:_container_free", + "called\n")); + + if (NULL == container) { + snmp_log(LOG_ERR, + "invalid container in inetNetToMediaTable_container_free\n"); + return; + } + + /* + * call user code + */ + inetNetToMediaTable_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 +_inetNetToMediaTable_container_init(inetNetToMediaTable_interface_ctx * + if_ctx) +{ + DEBUGMSGTL(("internal:inetNetToMediaTable:_inetNetToMediaTable_container_init", "called\n")); + + /* + * cache init + */ + if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */ + _cache_load, _cache_free, + inetNetToMediaTable_oid, + inetNetToMediaTable_oid_size); + + if (NULL == if_ctx->cache) { + snmp_log(LOG_ERR, + "error creating cache for inetNetToMediaTable\n"); + return; + } + + if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET; + + inetNetToMediaTable_container_init(&if_ctx->container, if_ctx->cache); + if (NULL == if_ctx->container) + if_ctx->container = + netsnmp_container_find("inetNetToMediaTable:table_container"); + if (NULL == if_ctx->container) { + snmp_log(LOG_ERR, "error creating container in " + "inetNetToMediaTable_container_init\n"); + return; + } + + if (NULL != if_ctx->cache) + if_ctx->cache->magic = (void *) if_ctx->container; +} /* _inetNetToMediaTable_container_init */ + +/** + * @internal + * shutdown the container with functions or wrappers + */ +void +_inetNetToMediaTable_container_shutdown(inetNetToMediaTable_interface_ctx * + if_ctx) +{ + DEBUGMSGTL(("internal:inetNetToMediaTable:_inetNetToMediaTable_container_shutdown", "called\n")); + + inetNetToMediaTable_container_shutdown(if_ctx->container); + + _container_free(if_ctx->container); + +} /* _inetNetToMediaTable_container_shutdown */ + + +inetNetToMediaTable_rowreq_ctx * +inetNetToMediaTable_row_find_by_mib_index(inetNetToMediaTable_mib_index * + mib_idx) +{ + inetNetToMediaTable_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 = inetNetToMediaTable_index_to_oid(&oid_idx, mib_idx); + if (MFD_SUCCESS != rc) + return NULL; + + rowreq_ctx = + CONTAINER_FIND(inetNetToMediaTable_if_ctx.container, &oid_idx); + + return rowreq_ctx; +} diff --git a/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_interface.h b/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_interface.h new file mode 100644 index 0000000..a111a23 --- /dev/null +++ b/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_interface.h @@ -0,0 +1,103 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.67 $ of : mfd-interface.m2c,v $ + * + * $Id: inetNetToMediaTable_interface.h 14169 2006-01-25 16:28:12Z dts12 $ + */ +/** @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 INETNETTOMEDIATABLE_INTERFACE_H +#define INETNETTOMEDIATABLE_INTERFACE_H + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "inetNetToMediaTable.h" + + + /* + ******************************************************************** + * Table declarations + */ + + /* + * PUBLIC interface initialization routine + */ + void + _inetNetToMediaTable_initialize_interface + (inetNetToMediaTable_registration * user_ctx, u_long flags); + void + _inetNetToMediaTable_shutdown_interface + (inetNetToMediaTable_registration * user_ctx); + + inetNetToMediaTable_registration + * inetNetToMediaTable_registration_get(void); + + inetNetToMediaTable_registration + * inetNetToMediaTable_registration_set + (inetNetToMediaTable_registration * newreg); + + netsnmp_container *inetNetToMediaTable_container_get(void); + int inetNetToMediaTable_container_size(void); + + u_int inetNetToMediaTable_dirty_get(void); + void inetNetToMediaTable_dirty_set(u_int status); + + inetNetToMediaTable_rowreq_ctx + * inetNetToMediaTable_allocate_rowreq_ctx(inetNetToMediaTable_data + *, void *); + void + inetNetToMediaTable_release_rowreq_ctx + (inetNetToMediaTable_rowreq_ctx * rowreq_ctx); + + int inetNetToMediaTable_index_to_oid(netsnmp_index * + oid_idx, + inetNetToMediaTable_mib_index + * mib_idx); + int inetNetToMediaTable_index_from_oid(netsnmp_index * + oid_idx, + inetNetToMediaTable_mib_index + * mib_idx); + + /* + * access to certain internals. use with caution! + */ + void + inetNetToMediaTable_valid_columns_set(netsnmp_column_info *vc); + + +#ifdef __cplusplus +} +#endif +#endif /* INETNETTOMEDIATABLE_INTERFACE_H */ +/** @} */ + |