From cccfb554a1884b3ddca424170f79d7f0046c8cb226ff116eb502775ec993e5d3 Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Fri, 12 Sep 2008 23:13:09 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/net-snmp?expand=0&rev=9 --- net-snmp-5.4.1.2-etherlike-mib-revised.patch | 4612 ++++++++++++ net-snmp-5.4.1.2-rmon-mib.patch | 6935 ++++++++++++++++++ net-snmp-5.4.2_fix_dell_patches.patch | 24 + net-snmp.changes | 9 + net-snmp.spec | 14 +- 5 files changed, 11593 insertions(+), 1 deletion(-) create mode 100644 net-snmp-5.4.1.2-etherlike-mib-revised.patch create mode 100644 net-snmp-5.4.1.2-rmon-mib.patch create mode 100644 net-snmp-5.4.2_fix_dell_patches.patch diff --git a/net-snmp-5.4.1.2-etherlike-mib-revised.patch b/net-snmp-5.4.1.2-etherlike-mib-revised.patch new file mode 100644 index 0000000..326f065 --- /dev/null +++ b/net-snmp-5.4.1.2-etherlike-mib-revised.patch @@ -0,0 +1,4612 @@ +Index: agent/mibgroup/etherlike-mib/dot3StatsTable.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/etherlike-mib/dot3StatsTable.c 2008-09-11 22:27:50.795794559 +0200 +@@ -0,0 +1,212 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 14170 $ of $ ++ * ++ * $Id:$ ++ */ ++/** \page MFD helper for dot3StatsTable ++ * ++ * \section intro Introduction ++ * Introductory text. ++ * ++ */ ++/* ++ * standard Net-SNMP includes ++ */ ++#include ++#include ++#include ++ ++/* ++ * include our parent header ++ */ ++#include "dot3StatsTable.h" ++ ++#include ++ ++#include "dot3StatsTable_interface.h" ++ ++oid dot3StatsTable_oid[] = { DOT3STATSTABLE_OID }; ++int dot3StatsTable_oid_size = OID_LENGTH(dot3StatsTable_oid); ++ ++dot3StatsTable_registration dot3StatsTable_user_context; ++ ++void initialize_table_dot3StatsTable(void); ++void shutdown_table_dot3StatsTable(void); ++ ++ ++/** ++ * Initializes the dot3StatsTable module ++ */ ++void ++init_dot3StatsTable(void) ++{ ++ DEBUGMSGTL(("verbose:dot3StatsTable:init_dot3StatsTable", "called\n")); ++ ++ /* ++ * TODO:300:o: Perform dot3StatsTable one-time module initialization. ++ */ ++ ++ /* ++ * here we initialize all the tables we're planning on supporting ++ */ ++ if (should_init("dot3StatsTable")) ++ initialize_table_dot3StatsTable(); ++ ++} /* init_dot3StatsTable */ ++ ++/** ++ * Shut-down the dot3StatsTable module (agent is exiting) ++ */ ++void ++shutdown_dot3StatsTable(void) ++{ ++ if (should_init("dot3StatsTable")) ++ shutdown_table_dot3StatsTable(); ++ ++} ++ ++/** ++ * Initialize the table dot3StatsTable ++ * (Define its contents and how it's structured) ++ */ ++void ++initialize_table_dot3StatsTable(void) ++{ ++ dot3StatsTable_registration *user_context; ++ u_long flags; ++ ++ DEBUGMSGTL(("verbose:dot3StatsTable:initialize_table_dot3StatsTable", ++ "called\n")); ++ ++ /* ++ * TODO:301:o: Perform dot3StatsTable one-time table initialization. ++ */ ++ ++ /* ++ * TODO:302:o: |->Initialize dot3StatsTable 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("dot3StatsTable", NULL, NULL); ++ ++ /* ++ * No support for any flags yet, but in the future you would ++ * set any flags here. ++ */ ++ flags = 0; ++ ++ /* ++ * call interface initialization code ++ */ ++ _dot3StatsTable_initialize_interface(user_context, flags); ++} /* initialize_table_dot3StatsTable */ ++ ++/** ++ * Shutdown the table dot3StatsTable ++ */ ++void ++shutdown_table_dot3StatsTable(void) ++{ ++ /* ++ * call interface shutdown code ++ */ ++ _dot3StatsTable_shutdown_interface(&dot3StatsTable_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 ++dot3StatsTable_rowreq_ctx_init(dot3StatsTable_rowreq_ctx * rowreq_ctx, ++ void *user_init_ctx) ++{ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsTable_rowreq_ctx_init", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:210:o: |-> Perform extra dot3StatsTable rowreq initialization. (eg DEFVALS) ++ */ ++ ++ return MFD_SUCCESS; ++} /* dot3StatsTable_rowreq_ctx_init */ ++ ++/** ++ * extra context cleanup ++ * ++ */ ++void ++dot3StatsTable_rowreq_ctx_cleanup(dot3StatsTable_rowreq_ctx * rowreq_ctx) ++{ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsTable_rowreq_ctx_cleanup", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:211:o: |-> Perform extra dot3StatsTable rowreq cleanup. ++ */ ++} /* dot3StatsTable_rowreq_ctx_cleanup */ ++ ++/** ++ * pre-request callback ++ * ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_ERROR : other error ++ */ ++int ++dot3StatsTable_pre_request(dot3StatsTable_registration * user_context) ++{ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsTable_pre_request", ++ "called\n")); ++ ++ /* ++ * TODO:510:o: Perform dot3StatsTable pre-request actions. ++ */ ++ ++ return MFD_SUCCESS; ++} /* dot3StatsTable_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 ++dot3StatsTable_post_request(dot3StatsTable_registration * user_context, ++ int rc) ++{ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsTable_post_request", ++ "called\n")); ++ ++ /* ++ * TODO:511:o: Perform dot3StatsTable post-request actions. ++ */ ++ ++ return MFD_SUCCESS; ++} /* dot3StatsTable_post_request */ ++ ++ ++/** @{ */ +Index: agent/mibgroup/etherlike-mib/dot3StatsTable_data_access.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/etherlike-mib/dot3StatsTable_data_access.c 2008-09-11 22:27:50.807792263 +0200 +@@ -0,0 +1,803 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 14170 $ of $ ++ * ++ * $Id:$ ++ */ ++/* ++ * standard Net-SNMP includes ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++/* ++ * include our parent header ++ */ ++#include "dot3StatsTable.h" ++ ++ ++#include "dot3StatsTable_data_access.h" ++#include "ioctl_imp_common.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 dot3StatsTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++/* ++ * EtherLike-MIB::dot3StatsTable is subid 2 of dot3. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.10.7.2, length: 9 ++ */ ++ ++/** ++ * initialization for dot3StatsTable data access ++ * ++ * This function is called during startup to allow you to ++ * allocate any resources you need for the data table. ++ * ++ * @param dot3StatsTable_reg ++ * Pointer to dot3StatsTable_registration ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_ERROR : unrecoverable error. ++ */ ++int ++dot3StatsTable_init_data(dot3StatsTable_registration * dot3StatsTable_reg) ++{ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsTable_init_data", ++ "called\n")); ++ ++ /* ++ * TODO:303:o: Initialize dot3StatsTable data. ++ */ ++ ++ return MFD_SUCCESS; ++} /* dot3StatsTable_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 ++dot3StatsTable_container_init(netsnmp_container ** container_ptr_ptr, ++ netsnmp_cache * cache) ++{ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsTable_container_init", ++ "called\n")); ++ ++ if (NULL == container_ptr_ptr) { ++ snmp_log(LOG_ERR, ++ "bad container param to dot3StatsTable_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 dot3StatsTable_container_init\n"); ++ return; ++ } ++ ++ /* ++ * TODO:345:A: Set up dot3StatsTable 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 = DOT3STATSTABLE_CACHE_TIMEOUT; /* seconds */ ++} /* dot3StatsTable_container_init */ ++ ++/** ++ * container shutdown ++ * ++ * @param container_ptr A pointer to the container. ++ * ++ * This function is called at shutdown to allow you to customize certain ++ * aspects of the access method. For the most part, it is for advanced ++ * users. The default code should suffice for most cases. ++ * ++ * This function is called before dot3StatsTable_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 ++dot3StatsTable_container_shutdown(netsnmp_container * container_ptr) ++{ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsTable_container_shutdown", ++ "called\n")); ++ ++ if (NULL == container_ptr) { ++ snmp_log(LOG_ERR, ++ "bad params to dot3StatsTable_container_shutdown\n"); ++ return; ++ } ++ ++} /* dot3StatsTable_container_shutdown */ ++ ++/** ++ * load initial data ++ * ++ * TODO:350:M: Implement dot3StatsTable 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 ++ * dot3StatsTable_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. ++ * ++ */ ++ ++/* ++ * ++ * @retval MFD_SUCCESS success ++ * @retval MFD_ERROR could not get the interface names ++ * @retval MFD_RESOURCE_UNAVAILABLE failed to allocate memory ++ * @retval -2 could not open a socket ++ */ ++ ++ ++int ++dot3StatsTable_container_load(netsnmp_container * container) ++{ ++ dot3StatsTable_rowreq_ctx *rowreq_ctx; ++ size_t count = 0; ++ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsTable_container_load", ++ "called\n")); ++ ++ /* ++ * TODO:352:M: | |-> set indexes in new dot3StatsTable rowreq context. ++ * data context will be set from the param (unless NULL, ++ * in which case a new data context will be allocated) ++ */ ++ ++ /* ++ * temporary storage for index values ++ */ ++ ++ /* ++ * dot3StatsIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/w/e/R/d/H ++ */ ++ ++ long dot3StatsIndex; ++ int fd; ++ int rc = 0, retval = 0; ++ struct ifname *list_head = NULL, *p = NULL; ++ ++ ++ /* ++ * create socket for ioctls ++ */ ++ ++ fd = socket(AF_INET, SOCK_DGRAM, 0); ++ if(fd < 0) { ++ snmp_log(LOG_ERR, "could not create socket\n"); ++ return -2; ++ } ++ ++ /* ++ * get the interface names of the devices present in the system, in case of failure retval suggests the reson for failure ++ * and list_head contains null ++ */ ++ ++ list_head = interface_name_list_get (list_head, &retval); ++ ++ if (!list_head) { ++ snmp_log (LOG_ERR, "access:dot3StatsTable, error getting the interface names present in the system\n"); ++ DEBUGMSGTL(("access:dot3StatsTable", "error getting the interface names present in the system")); ++ return MFD_ERROR; ++ } ++ ++ /* ++ * Walk over the list of interface names present in the system and retreive the statistics ++ */ ++ ++ for (p = list_head; p; p = p->ifn_next) { ++ u_int flags; ++ ++ flags = 0; ++ ++ DEBUGMSGTL(("access:dot3StatsTable", "processing '%s'\n", p->name)); ++ ++ /* ++ * get index via ioctl. ++ */ ++ ++ dot3StatsIndex = interface_ioctl_ifindex_get(-1, p->name); ++ ++ /* ++ * get the dot3stats contents populated, if the device is not an ethernet device ++ * the operation will not be supported and an error message will be logged ++ */ ++ ++ rowreq_ctx = dot3StatsTable_allocate_rowreq_ctx(NULL); ++ if (NULL == rowreq_ctx) { ++ snmp_log(LOG_ERR, "memory allocation for dot3StatsTable failed\n"); ++ return MFD_RESOURCE_UNAVAILABLE; ++ } ++ ++ if (MFD_SUCCESS != ++ dot3StatsTable_indexes_set(rowreq_ctx, dot3StatsIndex)) { ++ snmp_log(LOG_ERR, ++ "error setting index while loading " ++ "dot3StatsTable data.\n"); ++ dot3StatsTable_release_rowreq_ctx(rowreq_ctx); ++ continue; ++ } ++ ++ /* ++ * TODO:352:r: | |-> populate dot3StatsTable data context. ++ * Populate data context here. (optionally, delay until row prep) ++ */ ++ /* ++ * non-TRANSIENT data: no need to copy. set pointer to data ++ */ ++ ++ memset (&rowreq_ctx->data, 0, sizeof (rowreq_ctx->data)); ++ rc = interface_ioctl_dot3stats_get (rowreq_ctx, fd, p->name); ++ ++ if (rc < 0) { ++ snmp_log(LOG_ERR, ++ "error getting the statistics for interface |%s| " ++ "dot3StatsTable data, operation might not be supported\n", p->name); ++ DEBUGMSGTL(("access:dot3StatsTable", "error getting the statistics for interface |%s| " ++ "dot3StatsTable data, operation might not be supported\n", p->name)); ++ dot3StatsTable_release_rowreq_ctx(rowreq_ctx); ++ continue; ++ } ++ ++ rc = interface_ioctl_dot3stats_duplex_get(rowreq_ctx, fd, p->name); ++ if (rc < 0) { ++ snmp_log(LOG_ERR, ++ "error getting the duplex status for |%s| " ++ "dot3StatsTable data, operation might not be supported\n", p->name); ++ DEBUGMSGTL(("access:dot3StatsTable", "error getting the duplex status for |%s| " ++ "dot3StatsTable data, operation might not be supported\n", p->name)); ++ dot3StatsTable_release_rowreq_ctx(rowreq_ctx); ++ continue; ++ } ++ ++ /* ++ * insert into table container ++ */ ++ CONTAINER_INSERT(container, rowreq_ctx); ++ ++count; ++ } ++ ++ ++ /* ++ * free the interface names list ++ */ ++ ++ if ( (interface_name_list_free(list_head)) < 0) { ++ snmp_log(LOG_ERR, "access:dot3StatsTable, error freeing the interface name list \n"); ++ DEBUGMSGTL(("access:dot3StatsTable", "error freeing the interface name list\n")); ++ return MFD_ERROR; ++ } ++ ++ ++ DEBUGMSGT(("verbose:dot3StatsTable:dot3StatsTable_container_load", ++ "inserted %d records\n", count)); ++ ++ return MFD_SUCCESS; ++} ++ ++/* ++ * @retval 0 success ++ * @retval -1 getifaddrs failed ++ * @retval -2 memory allocation failed ++ */ ++ ++static struct ifname * ++interface_name_list_get (struct ifname *list_head, int *retval) ++{ ++ struct ifaddrs *addrs = NULL, *p = NULL; ++ struct ifname *nameptr1=NULL, *nameptr2 = NULL; ++ ++ DEBUGMSGTL(("access:dot3StatsTable:interface_name_list_get", ++ "called\n")); ++ ++ if ((getifaddrs(&addrs)) < 0) { ++ DEBUGMSGTL(("access:dot3StatsTable:interface_name_list_get", ++ "getifaddrs failed\n")); ++ snmp_log (LOG_ERR, "access:dot3StatsTable,interface_name_list_get, getifaddrs failed\n"); ++ *retval = -1; ++ return NULL; ++ } ++ ++ for (p = addrs; p; p = p->ifa_next) { ++ ++ if (!list_head) { ++ if ( (list_head = (struct ifname *) malloc (sizeof(struct ifname))) < 0) { ++ DEBUGMSGTL(("access:dot3StatsTable:interface_name_list_get", ++ "memory allocation failed\n")); ++ snmp_log (LOG_ERR, "access:dot3StatsTable,interface_name_list_get, memory allocation failed\n"); ++ freeifaddrs(addrs); ++ *retval = -2; ++ return NULL; ++ } ++ memset (list_head, 0, sizeof (struct ifname)); ++ strncpy (list_head->name, p->ifa_name, IF_NAMESIZE); ++ continue; ++ } ++ ++ for (nameptr1 = list_head; nameptr1; nameptr2 = nameptr1, nameptr1 = nameptr1->ifn_next) ++ if (!strncmp(p->ifa_name, nameptr1->name, IF_NAMESIZE)) ++ break; ++ ++ if (nameptr1) ++ continue; ++ ++ if ( (nameptr2->ifn_next = (struct ifname *) malloc (sizeof(struct ifname))) < 0) { ++ DEBUGMSGTL(("access:dot3StatsTable:interface_name_list_get", ++ "memory allocation failed\n")); ++ snmp_log (LOG_ERR, "access:dot3StatsTable,interface_name_list_get, memory allocation failed\n"); ++ interface_name_list_free (list_head); ++ freeifaddrs(addrs); ++ *retval = -2; ++ return NULL; ++ } ++ nameptr2 = nameptr2->ifn_next; ++ memset (nameptr2, 0, sizeof (struct ifname)); ++ strncpy (nameptr2->name, p->ifa_name, IF_NAMESIZE); ++ continue; ++ ++ } ++ ++ freeifaddrs(addrs); ++ return list_head; ++} ++ ++/* ++ * @retval 0 success ++ * @retval -1 invalid pointer ++ */ ++ ++static int ++interface_name_list_free (struct ifname *list_head) ++{ ++ struct ifname *nameptr1 = NULL, *nameptr2 = NULL; ++ ++ DEBUGMSGTL(("access:dot3StatsTable:interface_name_list_free", ++ "called\n")); ++ ++ if (!list_head) { ++ snmp_log (LOG_ERR, "access:dot3StatsTable:interface_name_list_free: invalid pointer list_head"); ++ DEBUGMSGTL(("access:dot3StatsTable:interface_name_list_free", ++ "invalid pointer list_head\n")); ++ return -1; ++ } ++ ++ for (nameptr1 = list_head; nameptr1; nameptr1 = nameptr2) { ++ nameptr2 = nameptr1->ifn_next; ++ free (nameptr1); ++ } ++ ++ return 0; ++} ++ ++/* ++ * @retval 0 : not found ++ * @retval !0 : ifIndex ++ */ ++ ++static u_long ++interface_ioctl_ifindex_get (int fd, const char *name) { ++#ifndef SIOCGIFINDEX ++ return 0; ++#else ++ struct ifreq ifrq; ++ int rc = 0; ++ ++ DEBUGMSGTL(("access:dot3StatsTable:interface_ioctl_ifindex_get", "called\n")); ++ ++ rc = _dot3Stats_ioctl_get(fd, SIOCGIFINDEX, &ifrq, name); ++ if (rc < 0) { ++ DEBUGMSGTL(("access:dot3StatsTable:interface_ioctl_ifindex_get", ++ "error on interface '%s'\n", name)); ++ snmp_log (LOG_ERR, "access:dot3StatsTable:interface_ioctl_ifindex_get, error on interface '%s'\n", name); ++ return 0; ++ ++ } ++ ++ return ifrq.ifr_ifindex; ++#endif /* SIOCGIFINDEX */ ++} ++ ++/* ++ * @retval 0 success ++ * @retval -1 cannot get ETHTOOL_DRVINFO failed ++ * @retval -2 nstats zero - no statistcs available ++ * @retval -3 memory allocation for holding the statistics failed ++ * @retval -4 cannot get ETHTOOL_GSTRINGS information ++ * @retval -5 cannot get ETHTOOL_GSTATS information ++ * @retval -6 function not supported if HAVE_LINUX_ETHTOOL_H not defined ++ */ ++ ++ ++int ++interface_ioctl_dot3stats_get (dot3StatsTable_rowreq_ctx *rowreq_ctx, int fd, const char *name) { ++ ++#ifdef HAVE_LINUX_ETHTOOL_H ++ dot3StatsTable_data *data = &rowreq_ctx->data; ++ struct ethtool_drvinfo driver_info; ++ struct ethtool_gstrings *eth_strings; ++ struct ethtool_stats *eth_stats; ++ struct ifreq ifr; ++ unsigned int nstats, size_str, size_stats, i; ++ int err; ++ ++ DEBUGMSGTL(("access:dot3StatsTable:interface_ioctl_dot3Stats_get", ++ "called\n")); ++ ++ memset(&ifr, 0, sizeof(ifr)); ++ strcpy(ifr.ifr_name, name); ++ ++ memset(&driver_info, 0, sizeof (driver_info)); ++ driver_info.cmd = ETHTOOL_GDRVINFO; ++ ifr.ifr_data = (char *)&driver_info; ++ ++ err = _dot3Stats_ioctl_get(fd, SIOCETHTOOL, &ifr, name); ++ if (err < 0) { ++ DEBUGMSGTL(("access:dot3StatsTable:interface_ioctl_dot3Stats_get", ++ "ETHTOOL_GETDRVINFO failed for interface |%s| \n", name)); ++ snmp_log (LOG_ERR, "access:dot3StatsTable,interface_ioctl_dot3Stats_get, ETHTOOL_GETDRVINFO failed for interface |%s| \n", name); ++ ++ return -1; ++ } ++ ++ nstats = driver_info.n_stats; ++ if (nstats < 1) { ++ DEBUGMSGTL(("access:dot3StatsTable:interface_ioctl_dot3Stats_get", ++ "no stats available for interface |%s| \n", name)); ++ snmp_log (LOG_ERR, "access:dot3StatsTable,interface_ioctl_dot3Stats_get, no stats available for interface |%s| \n", name); ++ return -2; ++ } ++ ++ size_str = nstats * ETH_GSTRING_LEN; ++ size_stats = nstats * sizeof(u64); ++ ++ eth_strings = malloc(size_str + sizeof (struct ethtool_gstrings)); ++ if (!eth_strings) { ++ DEBUGMSGTL(("access:dot3StatsTable:interface_ioctl_dot3Stats_get", ++ "no memory available\n")); ++ snmp_log (LOG_ERR, "access:dot3StatsTable,interface_ioctl_dot3Stats_get, no memory available\n"); ++ ++ return -3; ++ } ++ memset (eth_strings, 0, (size_str + sizeof (struct ethtool_gstrings))); ++ ++ eth_stats = malloc (size_str + sizeof (struct ethtool_stats)); ++ if (!eth_stats) { ++ free (eth_strings); ++ DEBUGMSGTL(("access:dot3StatsTable:interface_ioctl_dot3Stats_get", ++ "no memory available\n")); ++ snmp_log (LOG_ERR, "access:dot3StatsTable,interface_ioctl_dot3Stats_get, no memory available\n"); ++ ++ return -3; ++ } ++ memset (eth_stats, 0, (size_str + sizeof (struct ethtool_stats))); ++ ++ eth_strings->cmd = ETHTOOL_GSTRINGS; ++ eth_strings->string_set = ETH_SS_STATS; ++ eth_strings->len = nstats; ++ ifr.ifr_data = (char *) eth_strings; ++ err = _dot3Stats_ioctl_get(fd, SIOCETHTOOL, &ifr, name); ++ if (err < 0) { ++ DEBUGMSGTL(("access:dot3StatsTable:interface_ioctl_dot3Stats_get", ++ "cannot get stats strings information for interface |%s| \n", name)); ++ snmp_log (LOG_ERR, "access:dot3StatsTable,interface_ioctl_dot3Stats_get, cannot get stats strings information for interface |%s| \n", name); ++ ++ free(eth_strings); ++ free(eth_stats); ++ return -4; ++ } ++ ++ eth_stats->cmd = ETHTOOL_GSTATS; ++ eth_stats->n_stats = nstats; ++ ifr.ifr_data = (char *) eth_stats; ++ err = _dot3Stats_ioctl_get(fd, SIOCETHTOOL, &ifr, name); ++ if (err < 0) { ++ DEBUGMSGTL(("access:dot3StatsTable:interface_ioctl_dot3Stats_get", ++ "cannot get stats strings information for interface |%s| \n", name)); ++ snmp_log (LOG_ERR, "access:dot3StatsTable,interface_ioctl_dot3Stats_get, cannot get stats information for interface |%s| \n", name); ++ ++ free(eth_strings); ++ free(eth_stats); ++ return -5; ++ } ++ ++ for (i = 0; i < nstats; i++) { ++ char s[ETH_GSTRING_LEN]; ++ ++ strncpy(s, (const char *) ð_strings->data[i * ETH_GSTRING_LEN], ++ ETH_GSTRING_LEN); ++ ++ if (DOT3STATSALIGNMENTERRORS(s)) { ++ data->dot3StatsAlignmentErrors = (u_long)eth_stats->data[i]; ++ rowreq_ctx->column_exists_flags |= COLUMN_DOT3STATSALIGNMENTERRORS_FLAG; ++ } ++ ++ if (DOT3STATSMULTIPLECOLLISIONFRAMES(s)) { ++ data->dot3StatsMultipleCollisionFrames = (u_long)eth_stats->data[i]; ++ rowreq_ctx->column_exists_flags |= COLUMN_DOT3STATSMULTIPLECOLLISIONFRAMES_FLAG; ++ } ++ ++ if (DOT3STATSLATECOLLISIONS(s)) { ++ data->dot3StatsLateCollisions = (u_long)eth_stats->data[i]; ++ rowreq_ctx->column_exists_flags |= COLUMN_DOT3STATSLATECOLLISIONS_FLAG; ++ } ++ ++ if (DOT3STATSSINGLECOLLISIONFRAMES(s)) { ++ data->dot3StatsSingleCollisionFrames = (u_long)eth_stats->data[i]; ++ rowreq_ctx->column_exists_flags |= COLUMN_DOT3STATSSINGLECOLLISIONFRAMES_FLAG; ++ } ++ ++ if (DOT3STATSEXCESSIVECOLLISIONS(s)) { ++ data->dot3StatsExcessiveCollisions = (u_long)eth_stats->data[i]; ++ rowreq_ctx->column_exists_flags |= COLUMN_DOT3STATSEXCESSIVECOLLISIONS_FLAG; ++ } ++ } ++ ++ free(eth_strings); ++ free(eth_stats); ++ ++ return 0; ++#else ++ return -6; ++#endif ++} ++ ++ ++/* ++ * @retval 0 success ++ * @retval -1 ETHTOOL_GSET failed ++ * @retval -2 function not supported if HAVE_LINUX_ETHTOOL_H not defined ++ */ ++ ++int ++interface_ioctl_dot3stats_duplex_get(dot3StatsTable_rowreq_ctx *rowreq_ctx, int fd, const char* name) { ++ ++#ifdef HAVE_LINUX_ETHTOOL_H ++ dot3StatsTable_data *data = &rowreq_ctx->data; ++ struct ethtool_cmd edata; ++ struct ifreq ifr; ++ int err; ++ ++ DEBUGMSGTL(("access:dot3StatsTable:interface_ioctl_dot3Stats_duplex_get", ++ "called\n")); ++ ++ memset(&edata, 0, sizeof (edata)); ++ memset(&ifr, 0, sizeof (ifr)); ++ edata.cmd = ETHTOOL_GSET; ++ ifr.ifr_data = (char *)&edata; ++ ++ err = _dot3Stats_ioctl_get (fd, SIOCETHTOOL, &ifr, name); ++ if (err < 0) { ++ DEBUGMSGTL(("access:dot3StatsTable:interface_ioctl_dot3Stats_duplex_get", ++ "ETHTOOL_GSET failed\n")); ++ snmp_log (LOG_ERR, "access:dot3StatsTable,interface_ioctl_dot3Stats_duplex_get, ETHTOOL_GSET failed\n"); ++ ++ return -1; ++ } ++ ++ if (err == 0) { ++ rowreq_ctx->column_exists_flags |= COLUMN_DOT3STATSDUPLEXSTATUS_FLAG; ++ switch (edata.duplex) { ++ case DUPLEX_HALF: ++ data->dot3StatsDuplexStatus = (u_long) DOT3STATSDUPLEXSTATUS_HALFDUPLEX; ++ break; ++ case DUPLEX_FULL: ++ data->dot3StatsDuplexStatus = (u_long) DOT3STATSDUPLEXSTATUS_FULLDUPLEX; ++ break; ++ default: ++ data->dot3StatsDuplexStatus = (u_long) DOT3STATSDUPLEXSTATUS_UNKNOWN; ++ break; ++ }; ++ } ++ ++ DEBUGMSGTL(("access:dot3StatsTable:interface_ioctl_dot3Stats_duplex_get", ++ "ETHTOOL_GSET processed\n")); ++ return err; ++#else ++ return -2; ++#endif ++} ++ ++ ++ ++/* ioctl wrapper ++ * ++ * @param fd : socket fd to use w/ioctl, or -1 to open/close one ++ * @param which ++ * @param ifrq ++ * param ifentry : ifentry to update ++ * @param name ++ * ++ * @retval 0 : success ++ * @retval -1 : invalid parameters ++ * @retval -2 : couldn't create socket ++ * @retval -3 : ioctl call failed ++ */ ++static int ++_dot3Stats_ioctl_get(int fd, int which, struct ifreq *ifrq, const char* name) ++{ ++ int ourfd = -1, rc = 0; ++ ++ DEBUGMSGTL(("access:dot3StatsTable:ioctl", "_dot3Stats_ioctl_get\n")); ++ ++ /* ++ * sanity checks ++ */ ++ if(NULL == name) { ++ DEBUGMSGTL(("access:dot3StatsTable:ioctl", ++ "_dot3Stats_ioctl_get invalid ifname '%s'\n", name)); ++ snmp_log (LOG_ERR, "access:dot3StatsTable:ioctl, _dot3Stats_ioctl_get error on interface '%s'\n", name); ++ return -1; ++ } ++ ++ /* ++ * create socket for ioctls ++ */ ++ if(fd < 0) { ++ fd = ourfd = socket(AF_INET, SOCK_DGRAM, 0); ++ if(ourfd < 0) { ++ DEBUGMSGTL(("access:dot3StatsTable:ioctl", ++ "dot3Stats_ioctl_get couldn't create a socket\n", name)); ++ snmp_log (LOG_ERR, "access:dot3StatsTable:ioctl, _dot3Stats_ioctl_get error on interface '%s'\n", name); ++ ++ return -2; ++ } ++ } ++ ++ strncpy(ifrq->ifr_name, name, sizeof(ifrq->ifr_name)); ++ ifrq->ifr_name[ sizeof(ifrq->ifr_name)-1 ] = 0; ++ rc = ioctl(fd, which, ifrq); ++ if (rc < 0) { ++ DEBUGMSGTL(("access:dot3StatsTable:ioctl", ++ "dot3Stats_ioctl_get ioctl %d returned %d\n", which, rc)); ++ snmp_log (LOG_ERR, "access:dot3StatsTable:ioctl, _dot3Stats_ioctl_get error on interface '%s'\n", name); ++ ++ rc = -3; ++ } ++ ++ if(ourfd >= 0) ++ close(ourfd); ++ ++ return rc; ++} ++ /* dot3StatsTable_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 ++dot3StatsTable_container_free(netsnmp_container * container) ++{ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsTable_container_free", ++ "called\n")); ++ ++ /* ++ * TODO:380:M: Free dot3StatsTable container data. ++ */ ++} /* dot3StatsTable_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 ++dot3StatsTable_row_prep(dot3StatsTable_rowreq_ctx * rowreq_ctx) ++{ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsTable_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; ++} /* dot3StatsTable_row_prep */ ++ ++/** @} */ +Index: agent/mibgroup/etherlike-mib/dot3StatsTable_data_access.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/etherlike-mib/dot3StatsTable_data_access.h 2008-09-11 22:27:50.839791747 +0200 +@@ -0,0 +1,74 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 14170 $ of $ ++ * ++ * $Id:$ ++ */ ++#ifndef DOT3STATSTABLE_DATA_ACCESS_H ++#define DOT3STATSTABLE_DATA_ACCESS_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++ /* ++ ********************************************************************* ++ * function declarations ++ */ ++ ++ /* ++ ********************************************************************* ++ * Table declarations ++ */ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table dot3StatsTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++ /* ++ * EtherLike-MIB::dot3StatsTable is subid 2 of dot3. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.10.7.2, length: 9 ++ */ ++ ++ ++ int dot3StatsTable_init_data(dot3StatsTable_registration * ++ dot3StatsTable_reg); ++ ++ ++ /* ++ * TODO:180:o: Review dot3StatsTable cache timeout. ++ * The number of seconds before the cache times out ++ */ ++#define DOT3STATSTABLE_CACHE_TIMEOUT 60 ++ ++ void dot3StatsTable_container_init(netsnmp_container ** ++ container_ptr_ptr, ++ netsnmp_cache * cache); ++ void dot3StatsTable_container_shutdown(netsnmp_container * ++ container_ptr); ++ ++ int dot3StatsTable_container_load(netsnmp_container * ++ container); ++ void dot3StatsTable_container_free(netsnmp_container * ++ container); ++ ++ int dot3StatsTable_cache_load(netsnmp_container * ++ container); ++ void dot3StatsTable_cache_free(netsnmp_container * ++ container); ++ ++#define MAX_LINE_SIZE 256 ++ ++ int dot3StatsTable_row_prep(dot3StatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* DOT3STATSTABLE_DATA_ACCESS_H */ +Index: agent/mibgroup/etherlike-mib/dot3StatsTable_data_get.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/etherlike-mib/dot3StatsTable_data_get.c 2008-09-11 22:27:50.867791851 +0200 +@@ -0,0 +1,1450 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 12088 $ of $ ++ * ++ * $Id:$ ++ */ ++/* ++ * standard Net-SNMP includes ++ */ ++#include ++#include ++#include ++ ++/* ++ * include our parent header ++ */ ++#include "dot3StatsTable.h" ++ ++ ++/** @defgroup data_get data_get: Routines to get data ++ * ++ * TODO:230:M: Implement dot3StatsTable get routines. ++ * TODO:240:M: Implement dot3StatsTable mapping routines (if any). ++ * ++ * These routine are used to get the value for individual objects. The ++ * row context is passed, along with a pointer to the memory where the ++ * value should be copied. ++ * ++ * @{ ++ */ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table dot3StatsTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++/* ++ * EtherLike-MIB::dot3StatsTable is subid 2 of dot3. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.10.7.2, length: 9 ++ */ ++ ++/* ++ * --------------------------------------------------------------------- ++ * * TODO:200:r: Implement dot3StatsTable data context functions. ++ */ ++ ++ ++/** ++ * set mib index(es) ++ * ++ * @param tbl_idx mib index structure ++ * @param dot3StatsIndex_val ++ * ++ * @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 ++dot3StatsTable_indexes_set_tbl_idx(dot3StatsTable_mib_index * tbl_idx, ++ long dot3StatsIndex_val) ++{ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsTable_indexes_set_tbl_idx", "called\n")); ++ ++ /* ++ * dot3StatsIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/w/e/R/d/H ++ */ ++ tbl_idx->dot3StatsIndex = dot3StatsIndex_val; ++ ++ ++ return MFD_SUCCESS; ++} /* dot3StatsTable_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 ++dot3StatsTable_indexes_set(dot3StatsTable_rowreq_ctx * rowreq_ctx, ++ long dot3StatsIndex_val) ++{ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsTable_indexes_set", ++ "called\n")); ++ ++ if (MFD_SUCCESS != ++ dot3StatsTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx, ++ dot3StatsIndex_val)) ++ return MFD_ERROR; ++ ++ /* ++ * convert mib index to oid index ++ */ ++ rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid); ++ if (0 != dot3StatsTable_index_to_oid(&rowreq_ctx->oid_idx, ++ &rowreq_ctx->tbl_idx)) { ++ return MFD_ERROR; ++ } ++ ++ return MFD_SUCCESS; ++} /* dot3StatsTable_indexes_set */ ++ ++ ++/*--------------------------------------------------------------------- ++ * EtherLike-MIB::dot3StatsEntry.dot3StatsAlignmentErrors ++ * dot3StatsAlignmentErrors is subid 2 of dot3StatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.10.7.2.1.2 ++ * Description: ++A count of frames received on a particular ++ interface that are not an integral number of ++ octets in length and do not pass the FCS check. ++ ++ The count represented by an instance of this ++ object is incremented when the alignmentError ++ status is returned by the MAC service to the ++ LLC (or other MAC user). Received frames for ++ which multiple error conditions pertain are, ++ according to the conventions of IEEE 802.3 ++ Layer Management, counted exclusively according ++ ++ to the error status presented to the LLC. ++ ++ This counter does not increment for group ++ encoding schemes greater than 4 bits per group. ++ ++ For interfaces operating at 10 Gb/s, this ++ counter can roll over in less than 5 minutes if ++ it is incrementing at its maximum rate. Since ++ that amount of time could be less than a ++ management station's poll cycle time, in order ++ to avoid a loss of information, a management ++ station is advised to poll the ++ dot3HCStatsAlignmentErrors object for 10 Gb/s ++ or faster interfaces. ++ ++ Discontinuities in the value of this counter can ++ occur at re-initialization of the management ++ system, and at other times as indicated by the ++ value of ifCounterDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the dot3StatsAlignmentErrors data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param dot3StatsAlignmentErrors_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 ++dot3StatsAlignmentErrors_get(dot3StatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * dot3StatsAlignmentErrors_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != dot3StatsAlignmentErrors_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsAlignmentErrors_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the dot3StatsAlignmentErrors data. ++ * copy (* dot3StatsAlignmentErrors_val_ptr ) from rowreq_ctx->data ++ */ ++ (*dot3StatsAlignmentErrors_val_ptr) = ++ rowreq_ctx->data.dot3StatsAlignmentErrors; ++ ++ return MFD_SUCCESS; ++} /* dot3StatsAlignmentErrors_get */ ++ ++/*--------------------------------------------------------------------- ++ * EtherLike-MIB::dot3StatsEntry.dot3StatsFCSErrors ++ * dot3StatsFCSErrors is subid 3 of dot3StatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.10.7.2.1.3 ++ * Description: ++A count of frames received on a particular ++ interface that are an integral number of octets ++ in length but do not pass the FCS check. This ++ count does not include frames received with ++ frame-too-long or frame-too-short error. ++ ++ The count represented by an instance of this ++ object is incremented when the frameCheckError ++ status is returned by the MAC service to the ++ LLC (or other MAC user). Received frames for ++ which multiple error conditions pertain are, ++ according to the conventions of IEEE 802.3 ++ Layer Management, counted exclusively according ++ to the error status presented to the LLC. ++ ++ Note: Coding errors detected by the physical ++ layer for speeds above 10 Mb/s will cause the ++ frame to fail the FCS check. ++ ++ For interfaces operating at 10 Gb/s, this ++ counter can roll over in less than 5 minutes if ++ ++ it is incrementing at its maximum rate. Since ++ that amount of time could be less than a ++ management station's poll cycle time, in order ++ to avoid a loss of information, a management ++ station is advised to poll the ++ dot3HCStatsFCSErrors object for 10 Gb/s or ++ faster interfaces. ++ ++ Discontinuities in the value of this counter can ++ occur at re-initialization of the management ++ system, and at other times as indicated by the ++ value of ifCounterDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the dot3StatsFCSErrors data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param dot3StatsFCSErrors_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 ++dot3StatsFCSErrors_get(dot3StatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * dot3StatsFCSErrors_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != dot3StatsFCSErrors_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsFCSErrors_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the dot3StatsFCSErrors data. ++ * copy (* dot3StatsFCSErrors_val_ptr ) from rowreq_ctx->data ++ */ ++ (*dot3StatsFCSErrors_val_ptr) = rowreq_ctx->data.dot3StatsFCSErrors; ++ ++ return MFD_SUCCESS; ++} /* dot3StatsFCSErrors_get */ ++ ++/*--------------------------------------------------------------------- ++ * EtherLike-MIB::dot3StatsEntry.dot3StatsSingleCollisionFrames ++ * dot3StatsSingleCollisionFrames is subid 4 of dot3StatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.10.7.2.1.4 ++ * Description: ++A count of frames that are involved in a single ++ collision, and are subsequently transmitted ++ successfully. ++ ++ A frame that is counted by an instance of this ++ object is also counted by the corresponding ++ instance of either the ifOutUcastPkts, ++ ifOutMulticastPkts, or ifOutBroadcastPkts, ++ and is not counted by the corresponding ++ instance of the dot3StatsMultipleCollisionFrames ++ object. ++ ++ This counter does not increment when the ++ interface is operating in full-duplex mode. ++ ++ Discontinuities in the value of this counter can ++ occur at re-initialization of the management ++ system, and at other times as indicated by the ++ value of ifCounterDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the dot3StatsSingleCollisionFrames data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param dot3StatsSingleCollisionFrames_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 ++dot3StatsSingleCollisionFrames_get(dot3StatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ++ dot3StatsSingleCollisionFrames_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != dot3StatsSingleCollisionFrames_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsSingleCollisionFrames_get", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the dot3StatsSingleCollisionFrames data. ++ * copy (* dot3StatsSingleCollisionFrames_val_ptr ) from rowreq_ctx->data ++ */ ++ (*dot3StatsSingleCollisionFrames_val_ptr) = ++ rowreq_ctx->data.dot3StatsSingleCollisionFrames; ++ ++ return MFD_SUCCESS; ++} /* dot3StatsSingleCollisionFrames_get */ ++ ++/*--------------------------------------------------------------------- ++ * EtherLike-MIB::dot3StatsEntry.dot3StatsMultipleCollisionFrames ++ * dot3StatsMultipleCollisionFrames is subid 5 of dot3StatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.10.7.2.1.5 ++ * Description: ++A count of frames that are involved in more ++ ++ than one collision and are subsequently ++ transmitted successfully. ++ ++ A frame that is counted by an instance of this ++ object is also counted by the corresponding ++ instance of either the ifOutUcastPkts, ++ ifOutMulticastPkts, or ifOutBroadcastPkts, ++ and is not counted by the corresponding ++ instance of the dot3StatsSingleCollisionFrames ++ object. ++ ++ This counter does not increment when the ++ interface is operating in full-duplex mode. ++ ++ Discontinuities in the value of this counter can ++ occur at re-initialization of the management ++ system, and at other times as indicated by the ++ value of ifCounterDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the dot3StatsMultipleCollisionFrames data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param dot3StatsMultipleCollisionFrames_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 ++dot3StatsMultipleCollisionFrames_get(dot3StatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ dot3StatsMultipleCollisionFrames_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != dot3StatsMultipleCollisionFrames_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsMultipleCollisionFrames_get", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the dot3StatsMultipleCollisionFrames data. ++ * copy (* dot3StatsMultipleCollisionFrames_val_ptr ) from rowreq_ctx->data ++ */ ++ (*dot3StatsMultipleCollisionFrames_val_ptr) = ++ rowreq_ctx->data.dot3StatsMultipleCollisionFrames; ++ ++ return MFD_SUCCESS; ++} /* dot3StatsMultipleCollisionFrames_get */ ++ ++/*--------------------------------------------------------------------- ++ * EtherLike-MIB::dot3StatsEntry.dot3StatsSQETestErrors ++ * dot3StatsSQETestErrors is subid 6 of dot3StatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.10.7.2.1.6 ++ * Description: ++A count of times that the SQE TEST ERROR ++ is received on a particular interface. The ++ SQE TEST ERROR is set in accordance with the ++ rules for verification of the SQE detection ++ mechanism in the PLS Carrier Sense Function as ++ described in IEEE Std. 802.3, 2000 Edition, ++ section 7.2.4.6. ++ ++ This counter does not increment on interfaces ++ operating at speeds greater than 10 Mb/s, or on ++ interfaces operating in full-duplex mode. ++ ++ Discontinuities in the value of this counter can ++ occur at re-initialization of the management ++ system, and at other times as indicated by the ++ value of ifCounterDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the dot3StatsSQETestErrors data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param dot3StatsSQETestErrors_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 ++dot3StatsSQETestErrors_get(dot3StatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * dot3StatsSQETestErrors_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != dot3StatsSQETestErrors_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsSQETestErrors_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the dot3StatsSQETestErrors data. ++ * copy (* dot3StatsSQETestErrors_val_ptr ) from rowreq_ctx->data ++ */ ++ (*dot3StatsSQETestErrors_val_ptr) = ++ rowreq_ctx->data.dot3StatsSQETestErrors; ++ ++ return MFD_SUCCESS; ++} /* dot3StatsSQETestErrors_get */ ++ ++/*--------------------------------------------------------------------- ++ * EtherLike-MIB::dot3StatsEntry.dot3StatsDeferredTransmissions ++ * dot3StatsDeferredTransmissions is subid 7 of dot3StatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.10.7.2.1.7 ++ * Description: ++A count of frames for which the first ++ transmission attempt on a particular interface ++ is delayed because the medium is busy. ++ ++ The count represented by an instance of this ++ object does not include frames involved in ++ collisions. ++ ++ This counter does not increment when the ++ interface is operating in full-duplex mode. ++ ++ Discontinuities in the value of this counter can ++ occur at re-initialization of the management ++ system, and at other times as indicated by the ++ value of ifCounterDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the dot3StatsDeferredTransmissions data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param dot3StatsDeferredTransmissions_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 ++dot3StatsDeferredTransmissions_get(dot3StatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ++ dot3StatsDeferredTransmissions_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != dot3StatsDeferredTransmissions_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsDeferredTransmissions_get", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the dot3StatsDeferredTransmissions data. ++ * copy (* dot3StatsDeferredTransmissions_val_ptr ) from rowreq_ctx->data ++ */ ++ (*dot3StatsDeferredTransmissions_val_ptr) = ++ rowreq_ctx->data.dot3StatsDeferredTransmissions; ++ ++ return MFD_SUCCESS; ++} /* dot3StatsDeferredTransmissions_get */ ++ ++/*--------------------------------------------------------------------- ++ * EtherLike-MIB::dot3StatsEntry.dot3StatsLateCollisions ++ * dot3StatsLateCollisions is subid 8 of dot3StatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.10.7.2.1.8 ++ * Description: ++The number of times that a collision is ++ detected on a particular interface later than ++ one slotTime into the transmission of a packet. ++ ++ A (late) collision included in a count ++ represented by an instance of this object is ++ also considered as a (generic) collision for ++ purposes of other collision-related ++ statistics. ++ ++ This counter does not increment when the ++ interface is operating in full-duplex mode. ++ ++ Discontinuities in the value of this counter can ++ occur at re-initialization of the management ++ system, and at other times as indicated by the ++ value of ifCounterDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the dot3StatsLateCollisions data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param dot3StatsLateCollisions_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 ++dot3StatsLateCollisions_get(dot3StatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * dot3StatsLateCollisions_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != dot3StatsLateCollisions_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsLateCollisions_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the dot3StatsLateCollisions data. ++ * copy (* dot3StatsLateCollisions_val_ptr ) from rowreq_ctx->data ++ */ ++ (*dot3StatsLateCollisions_val_ptr) = ++ rowreq_ctx->data.dot3StatsLateCollisions; ++ ++ return MFD_SUCCESS; ++} /* dot3StatsLateCollisions_get */ ++ ++/*--------------------------------------------------------------------- ++ * EtherLike-MIB::dot3StatsEntry.dot3StatsExcessiveCollisions ++ * dot3StatsExcessiveCollisions is subid 9 of dot3StatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.10.7.2.1.9 ++ * Description: ++A count of frames for which transmission on a ++ particular interface fails due to excessive ++ collisions. ++ ++ This counter does not increment when the ++ interface is operating in full-duplex mode. ++ ++ Discontinuities in the value of this counter can ++ occur at re-initialization of the management ++ system, and at other times as indicated by the ++ value of ifCounterDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the dot3StatsExcessiveCollisions data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param dot3StatsExcessiveCollisions_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 ++dot3StatsExcessiveCollisions_get(dot3StatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ++ dot3StatsExcessiveCollisions_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != dot3StatsExcessiveCollisions_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsExcessiveCollisions_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the dot3StatsExcessiveCollisions data. ++ * copy (* dot3StatsExcessiveCollisions_val_ptr ) from rowreq_ctx->data ++ */ ++ (*dot3StatsExcessiveCollisions_val_ptr) = ++ rowreq_ctx->data.dot3StatsExcessiveCollisions; ++ ++ return MFD_SUCCESS; ++} /* dot3StatsExcessiveCollisions_get */ ++ ++/*--------------------------------------------------------------------- ++ * EtherLike-MIB::dot3StatsEntry.dot3StatsInternalMacTransmitErrors ++ * dot3StatsInternalMacTransmitErrors is subid 10 of dot3StatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.10.7.2.1.10 ++ * Description: ++A count of frames for which transmission on a ++ particular interface fails due to an internal ++ MAC sublayer transmit error. A frame is only ++ counted by an instance of this object if it is ++ not counted by the corresponding instance of ++ either the dot3StatsLateCollisions object, the ++ dot3StatsExcessiveCollisions object, or the ++ dot3StatsCarrierSenseErrors object. ++ ++ The precise meaning of the count represented by ++ an instance of this object is implementation- ++ specific. In particular, an instance of this ++ object may represent a count of transmission ++ errors on a particular interface that are not ++ otherwise counted. ++ ++ For interfaces operating at 10 Gb/s, this ++ counter can roll over in less than 5 minutes if ++ it is incrementing at its maximum rate. Since ++ that amount of time could be less than a ++ management station's poll cycle time, in order ++ to avoid a loss of information, a management ++ station is advised to poll the ++ dot3HCStatsInternalMacTransmitErrors object for ++ 10 Gb/s or faster interfaces. ++ ++ Discontinuities in the value of this counter can ++ ++ occur at re-initialization of the management ++ system, and at other times as indicated by the ++ value of ifCounterDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the dot3StatsInternalMacTransmitErrors data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param dot3StatsInternalMacTransmitErrors_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 ++dot3StatsInternalMacTransmitErrors_get(dot3StatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ dot3StatsInternalMacTransmitErrors_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != dot3StatsInternalMacTransmitErrors_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsInternalMacTransmitErrors_get", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the dot3StatsInternalMacTransmitErrors data. ++ * copy (* dot3StatsInternalMacTransmitErrors_val_ptr ) from rowreq_ctx->data ++ */ ++ (*dot3StatsInternalMacTransmitErrors_val_ptr) = ++ rowreq_ctx->data.dot3StatsInternalMacTransmitErrors; ++ ++ return MFD_SUCCESS; ++} /* dot3StatsInternalMacTransmitErrors_get */ ++ ++/*--------------------------------------------------------------------- ++ * EtherLike-MIB::dot3StatsEntry.dot3StatsCarrierSenseErrors ++ * dot3StatsCarrierSenseErrors is subid 11 of dot3StatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.10.7.2.1.11 ++ * Description: ++The number of times that the carrier sense ++ condition was lost or never asserted when ++ attempting to transmit a frame on a particular ++ interface. ++ ++ The count represented by an instance of this ++ object is incremented at most once per ++ transmission attempt, even if the carrier sense ++ condition fluctuates during a transmission ++ attempt. ++ ++ This counter does not increment when the ++ interface is operating in full-duplex mode. ++ ++ Discontinuities in the value of this counter can ++ occur at re-initialization of the management ++ system, and at other times as indicated by the ++ value of ifCounterDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the dot3StatsCarrierSenseErrors data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param dot3StatsCarrierSenseErrors_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 ++dot3StatsCarrierSenseErrors_get(dot3StatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ++ dot3StatsCarrierSenseErrors_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != dot3StatsCarrierSenseErrors_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsCarrierSenseErrors_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the dot3StatsCarrierSenseErrors data. ++ * copy (* dot3StatsCarrierSenseErrors_val_ptr ) from rowreq_ctx->data ++ */ ++ (*dot3StatsCarrierSenseErrors_val_ptr) = ++ rowreq_ctx->data.dot3StatsCarrierSenseErrors; ++ ++ return MFD_SUCCESS; ++} /* dot3StatsCarrierSenseErrors_get */ ++ ++/*--------------------------------------------------------------------- ++ * EtherLike-MIB::dot3StatsEntry.dot3StatsFrameTooLongs ++ * dot3StatsFrameTooLongs is subid 13 of dot3StatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.10.7.2.1.13 ++ * Description: ++A count of frames received on a particular ++ interface that exceed the maximum permitted ++ frame size. ++ ++ The count represented by an instance of this ++ object is incremented when the frameTooLong ++ status is returned by the MAC service to the ++ LLC (or other MAC user). Received frames for ++ which multiple error conditions pertain are, ++ according to the conventions of IEEE 802.3 ++ Layer Management, counted exclusively according ++ to the error status presented to the LLC. ++ ++ For interfaces operating at 10 Gb/s, this ++ counter can roll over in less than 80 minutes if ++ it is incrementing at its maximum rate. Since ++ that amount of time could be less than a ++ management station's poll cycle time, in order ++ to avoid a loss of information, a management ++ station is advised to poll the ++ dot3HCStatsFrameTooLongs object for 10 Gb/s ++ or faster interfaces. ++ ++ Discontinuities in the value of this counter can ++ occur at re-initialization of the management ++ system, and at other times as indicated by the ++ value of ifCounterDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the dot3StatsFrameTooLongs data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param dot3StatsFrameTooLongs_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 ++dot3StatsFrameTooLongs_get(dot3StatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * dot3StatsFrameTooLongs_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != dot3StatsFrameTooLongs_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsFrameTooLongs_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the dot3StatsFrameTooLongs data. ++ * copy (* dot3StatsFrameTooLongs_val_ptr ) from rowreq_ctx->data ++ */ ++ (*dot3StatsFrameTooLongs_val_ptr) = ++ rowreq_ctx->data.dot3StatsFrameTooLongs; ++ ++ return MFD_SUCCESS; ++} /* dot3StatsFrameTooLongs_get */ ++ ++/*--------------------------------------------------------------------- ++ * EtherLike-MIB::dot3StatsEntry.dot3StatsInternalMacReceiveErrors ++ * dot3StatsInternalMacReceiveErrors is subid 16 of dot3StatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.10.7.2.1.16 ++ * Description: ++A count of frames for which reception on a ++ particular interface fails due to an internal ++ MAC sublayer receive error. A frame is only ++ counted by an instance of this object if it is ++ not counted by the corresponding instance of ++ either the dot3StatsFrameTooLongs object, the ++ dot3StatsAlignmentErrors object, or the ++ dot3StatsFCSErrors object. ++ ++ The precise meaning of the count represented by ++ an instance of this object is implementation- ++ specific. In particular, an instance of this ++ object may represent a count of receive errors ++ on a particular interface that are not ++ otherwise counted. ++ ++ For interfaces operating at 10 Gb/s, this ++ counter can roll over in less than 5 minutes if ++ ++ it is incrementing at its maximum rate. Since ++ that amount of time could be less than a ++ management station's poll cycle time, in order ++ to avoid a loss of information, a management ++ station is advised to poll the ++ dot3HCStatsInternalMacReceiveErrors object for ++ 10 Gb/s or faster interfaces. ++ ++ Discontinuities in the value of this counter can ++ occur at re-initialization of the management ++ system, and at other times as indicated by the ++ value of ifCounterDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the dot3StatsInternalMacReceiveErrors data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param dot3StatsInternalMacReceiveErrors_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 ++dot3StatsInternalMacReceiveErrors_get(dot3StatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ dot3StatsInternalMacReceiveErrors_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != dot3StatsInternalMacReceiveErrors_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsInternalMacReceiveErrors_get", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the dot3StatsInternalMacReceiveErrors data. ++ * copy (* dot3StatsInternalMacReceiveErrors_val_ptr ) from rowreq_ctx->data ++ */ ++ (*dot3StatsInternalMacReceiveErrors_val_ptr) = ++ rowreq_ctx->data.dot3StatsInternalMacReceiveErrors; ++ ++ return MFD_SUCCESS; ++} /* dot3StatsInternalMacReceiveErrors_get */ ++ ++/*--------------------------------------------------------------------- ++ * EtherLike-MIB::dot3StatsEntry.dot3StatsEtherChipSet ++ * dot3StatsEtherChipSet is subid 17 of dot3StatsEntry. ++ * Its status is Deprecated, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.10.7.2.1.17 ++ * Description: ++******** THIS OBJECT IS DEPRECATED ******** ++ ++ This object contains an OBJECT IDENTIFIER ++ which identifies the chipset used to ++ realize the interface. Ethernet-like ++ interfaces are typically built out of ++ several different chips. The MIB implementor ++ is presented with a decision of which chip ++ to identify via this object. The implementor ++ should identify the chip which is usually ++ called the Medium Access Control chip. ++ If no such chip is easily identifiable, ++ the implementor should identify the chip ++ which actually gathers the transmit ++ and receive statistics and error ++ indications. This would allow a ++ manager station to correlate the ++ statistics and the chip generating ++ them, giving it the ability to take ++ into account any known anomalies ++ in the chip. ++ ++ This object has been deprecated. Implementation ++ feedback indicates that it is of limited use for ++ debugging network problems in the field, and ++ the administrative overhead involved in ++ maintaining a registry of chipset OIDs is not ++ justified. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is OBJECTID (based on perltype OBJECTID) ++ * The net-snmp type is ASN_OBJECT_ID. The C type decl is oid (oid) ++ * This data type requires a length. ++ */ ++/** ++ * Extract the current value of the dot3StatsEtherChipSet data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param dot3StatsEtherChipSet_val_ptr_ptr ++ * Pointer to storage for a oid variable ++ * @param dot3StatsEtherChipSet_val_ptr_len_ptr ++ * Pointer to a size_t. On entry, it will contain the size (in bytes) ++ * pointed to by dot3StatsEtherChipSet. ++ * 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 (*dot3StatsEtherChipSet_val_ptr_len_ptr) bytes of memory, ++ * allocate it using malloc() and update dot3StatsEtherChipSet_val_ptr_ptr. ++ * DO NOT 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 ++dot3StatsEtherChipSet_get(dot3StatsTable_rowreq_ctx * rowreq_ctx, ++ oid ** dot3StatsEtherChipSet_val_ptr_ptr, ++ size_t *dot3StatsEtherChipSet_val_ptr_len_ptr) ++{ ++ /** we should have a non-NULL pointer and enough storage */ ++ netsnmp_assert((NULL != dot3StatsEtherChipSet_val_ptr_ptr) ++ && (NULL != *dot3StatsEtherChipSet_val_ptr_ptr)); ++ netsnmp_assert(NULL != dot3StatsEtherChipSet_val_ptr_len_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsEtherChipSet_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the dot3StatsEtherChipSet data. ++ * copy (* dot3StatsEtherChipSet_val_ptr_ptr ) data and (* dot3StatsEtherChipSet_val_ptr_len_ptr ) from rowreq_ctx->data ++ */ ++ /* ++ * make sure there is enough space for dot3StatsEtherChipSet data ++ */ ++ if ((NULL == (*dot3StatsEtherChipSet_val_ptr_ptr)) || ++ ((*dot3StatsEtherChipSet_val_ptr_len_ptr) < ++ (rowreq_ctx->data.dot3StatsEtherChipSet_len * ++ sizeof(rowreq_ctx->data.dot3StatsEtherChipSet[0])))) { ++ /* ++ * allocate space for dot3StatsEtherChipSet data ++ */ ++ (*dot3StatsEtherChipSet_val_ptr_ptr) = ++ malloc(rowreq_ctx->data.dot3StatsEtherChipSet_len * ++ sizeof(rowreq_ctx->data.dot3StatsEtherChipSet[0])); ++ if (NULL == (*dot3StatsEtherChipSet_val_ptr_ptr)) { ++ snmp_log(LOG_ERR, "could not allocate memory\n"); ++ return MFD_ERROR; ++ } ++ } ++ (*dot3StatsEtherChipSet_val_ptr_len_ptr) = ++ rowreq_ctx->data.dot3StatsEtherChipSet_len * ++ sizeof(rowreq_ctx->data.dot3StatsEtherChipSet[0]); ++ memcpy((*dot3StatsEtherChipSet_val_ptr_ptr), ++ rowreq_ctx->data.dot3StatsEtherChipSet, ++ rowreq_ctx->data.dot3StatsEtherChipSet_len * ++ sizeof(rowreq_ctx->data.dot3StatsEtherChipSet[0])); ++ ++ return MFD_SUCCESS; ++} /* dot3StatsEtherChipSet_get */ ++ ++/*--------------------------------------------------------------------- ++ * EtherLike-MIB::dot3StatsEntry.dot3StatsSymbolErrors ++ * dot3StatsSymbolErrors is subid 18 of dot3StatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.10.7.2.1.18 ++ * Description: ++For an interface operating at 100 Mb/s, the ++ number of times there was an invalid data symbol ++ when a valid carrier was present. ++ ++ For an interface operating in half-duplex mode ++ at 1000 Mb/s, the number of times the receiving ++ media is non-idle (a carrier event) for a period ++ of time equal to or greater than slotTime, and ++ during which there was at least one occurrence ++ of an event that causes the PHY to indicate ++ 'Data reception error' or 'carrier extend error' ++ on the GMII. ++ ++ For an interface operating in full-duplex mode ++ at 1000 Mb/s, the number of times the receiving ++ media is non-idle (a carrier event) for a period ++ of time equal to or greater than minFrameSize, ++ and during which there was at least one ++ occurrence of an event that causes the PHY to ++ indicate 'Data reception error' on the GMII. ++ ++ For an interface operating at 10 Gb/s, the ++ number of times the receiving media is non-idle ++ (a carrier event) for a period of time equal to ++ or greater than minFrameSize, and during which ++ there was at least one occurrence of an event ++ that causes the PHY to indicate 'Receive Error' ++ on the XGMII. ++ ++ The count represented by an instance of this ++ object is incremented at most once per carrier ++ event, even if multiple symbol errors occur ++ during the carrier event. This count does ++ not increment if a collision is present. ++ ++ This counter does not increment when the ++ interface is operating at 10 Mb/s. ++ ++ For interfaces operating at 10 Gb/s, this ++ counter can roll over in less than 5 minutes if ++ it is incrementing at its maximum rate. Since ++ that amount of time could be less than a ++ ++ management station's poll cycle time, in order ++ to avoid a loss of information, a management ++ station is advised to poll the ++ dot3HCStatsSymbolErrors object for 10 Gb/s ++ or faster interfaces. ++ ++ Discontinuities in the value of this counter can ++ occur at re-initialization of the management ++ system, and at other times as indicated by the ++ value of ifCounterDiscontinuityTime. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the dot3StatsSymbolErrors data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param dot3StatsSymbolErrors_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 ++dot3StatsSymbolErrors_get(dot3StatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * dot3StatsSymbolErrors_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != dot3StatsSymbolErrors_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsSymbolErrors_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the dot3StatsSymbolErrors data. ++ * copy (* dot3StatsSymbolErrors_val_ptr ) from rowreq_ctx->data ++ */ ++ (*dot3StatsSymbolErrors_val_ptr) = ++ rowreq_ctx->data.dot3StatsSymbolErrors; ++ ++ return MFD_SUCCESS; ++} /* dot3StatsSymbolErrors_get */ ++ ++/*--------------------------------------------------------------------- ++ * EtherLike-MIB::dot3StatsEntry.dot3StatsDuplexStatus ++ * dot3StatsDuplexStatus is subid 19 of dot3StatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.10.7.2.1.19 ++ * Description: ++The current mode of operation of the MAC ++ entity. 'unknown' indicates that the current ++ duplex mode could not be determined. ++ ++ Management control of the duplex mode is ++ accomplished through the MAU MIB. When ++ an interface does not support autonegotiation, ++ or when autonegotiation is not enabled, the ++ duplex mode is controlled using ++ ifMauDefaultType. When autonegotiation is ++ supported and enabled, duplex mode is controlled ++ using ifMauAutoNegAdvertisedBits. In either ++ case, the currently operating duplex mode is ++ reflected both in this object and in ifMauType. ++ ++ Note that this object provides redundant ++ information with ifMauType. Normally, redundant ++ objects are discouraged. However, in this ++ instance, it allows a management application to ++ determine the duplex status of an interface ++ without having to know every possible value of ++ ifMauType. This was felt to be sufficiently ++ valuable to justify the redundancy. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 1 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * Enum range: 3/8. Values: unknown(1), halfDuplex(2), fullDuplex(3) ++ * ++ * 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 dot3StatsDuplexStatus data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param dot3StatsDuplexStatus_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 ++dot3StatsDuplexStatus_get(dot3StatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * dot3StatsDuplexStatus_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != dot3StatsDuplexStatus_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsDuplexStatus_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the dot3StatsDuplexStatus data. ++ * copy (* dot3StatsDuplexStatus_val_ptr ) from rowreq_ctx->data ++ */ ++ (*dot3StatsDuplexStatus_val_ptr) = ++ rowreq_ctx->data.dot3StatsDuplexStatus; ++ ++ return MFD_SUCCESS; ++} /* dot3StatsDuplexStatus_get */ ++ ++/*--------------------------------------------------------------------- ++ * EtherLike-MIB::dot3StatsEntry.dot3StatsRateControlAbility ++ * dot3StatsRateControlAbility is subid 20 of dot3StatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.10.7.2.1.20 ++ * Description: ++'true' for interfaces operating at speeds above ++ 1000 Mb/s that support Rate Control through ++ lowering the average data rate of the MAC ++ sublayer, with frame granularity, and 'false' ++ otherwise. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 1 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * Enum range: 2/8. Values: true(1), false(2) ++ * ++ * Its syntax is TruthValue (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 dot3StatsRateControlAbility data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param dot3StatsRateControlAbility_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 ++dot3StatsRateControlAbility_get(dot3StatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ++ dot3StatsRateControlAbility_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != dot3StatsRateControlAbility_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsRateControlAbility_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the dot3StatsRateControlAbility data. ++ * copy (* dot3StatsRateControlAbility_val_ptr ) from rowreq_ctx->data ++ */ ++ (*dot3StatsRateControlAbility_val_ptr) = ++ rowreq_ctx->data.dot3StatsRateControlAbility; ++ ++ return MFD_SUCCESS; ++} /* dot3StatsRateControlAbility_get */ ++ ++/*--------------------------------------------------------------------- ++ * EtherLike-MIB::dot3StatsEntry.dot3StatsRateControlStatus ++ * dot3StatsRateControlStatus is subid 21 of dot3StatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.10.7.2.1.21 ++ * Description: ++The current Rate Control mode of operation of ++ the MAC sublayer of this interface. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 1 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * Enum range: 3/8. Values: rateControlOff(1), rateControlOn(2), unknown(3) ++ * ++ * 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 dot3StatsRateControlStatus data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param dot3StatsRateControlStatus_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 ++dot3StatsRateControlStatus_get(dot3StatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * dot3StatsRateControlStatus_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != dot3StatsRateControlStatus_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsRateControlStatus_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the dot3StatsRateControlStatus data. ++ * copy (* dot3StatsRateControlStatus_val_ptr ) from rowreq_ctx->data ++ */ ++ (*dot3StatsRateControlStatus_val_ptr) = ++ rowreq_ctx->data.dot3StatsRateControlStatus; ++ ++ return MFD_SUCCESS; ++} /* dot3StatsRateControlStatus_get */ ++ ++ ++ ++/** @} */ +Index: agent/mibgroup/etherlike-mib/dot3StatsTable_data_get.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/etherlike-mib/dot3StatsTable_data_get.h 2008-09-11 22:27:50.911791927 +0200 +@@ -0,0 +1,143 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 12088 $ of $ ++ * ++ * $Id:$ ++ * ++ * @file dot3StatsTable_data_get.h ++ * ++ * @addtogroup get ++ * ++ * Prototypes for get functions ++ * ++ * @{ ++ */ ++#ifndef DOT3STATSTABLE_DATA_GET_H ++#define DOT3STATSTABLE_DATA_GET_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ /* ++ ********************************************************************* ++ * GET function declarations ++ */ ++ ++ /* ++ ********************************************************************* ++ * GET Table declarations ++ */ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table dot3StatsTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++ /* ++ * EtherLike-MIB::dot3StatsTable is subid 2 of dot3. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.10.7.2, length: 9 ++ */ ++ /* ++ * indexes ++ */ ++ ++ int dot3StatsAlignmentErrors_get(dot3StatsTable_rowreq_ctx ++ * rowreq_ctx, ++ u_long * ++ dot3StatsAlignmentErrors_val_ptr); ++ int dot3StatsFCSErrors_get(dot3StatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ dot3StatsFCSErrors_val_ptr); ++ int ++ dot3StatsSingleCollisionFrames_get(dot3StatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ dot3StatsSingleCollisionFrames_val_ptr); ++ int ++ dot3StatsMultipleCollisionFrames_get(dot3StatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ dot3StatsMultipleCollisionFrames_val_ptr); ++ int dot3StatsSQETestErrors_get(dot3StatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ dot3StatsSQETestErrors_val_ptr); ++ int ++ dot3StatsDeferredTransmissions_get(dot3StatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ dot3StatsDeferredTransmissions_val_ptr); ++ int dot3StatsLateCollisions_get(dot3StatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ dot3StatsLateCollisions_val_ptr); ++ int ++ dot3StatsExcessiveCollisions_get(dot3StatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ dot3StatsExcessiveCollisions_val_ptr); ++ int ++ dot3StatsInternalMacTransmitErrors_get(dot3StatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ dot3StatsInternalMacTransmitErrors_val_ptr); ++ int ++ dot3StatsCarrierSenseErrors_get(dot3StatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ dot3StatsCarrierSenseErrors_val_ptr); ++ int dot3StatsFrameTooLongs_get(dot3StatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ dot3StatsFrameTooLongs_val_ptr); ++ int ++ dot3StatsInternalMacReceiveErrors_get(dot3StatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ dot3StatsInternalMacReceiveErrors_val_ptr); ++ int dot3StatsEtherChipSet_get(dot3StatsTable_rowreq_ctx * ++ rowreq_ctx, ++ oid ** ++ dot3StatsEtherChipSet_val_ptr_ptr, ++ size_t ++ *dot3StatsEtherChipSet_val_ptr_len_ptr); ++ int dot3StatsSymbolErrors_get(dot3StatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ dot3StatsSymbolErrors_val_ptr); ++ int dot3StatsDuplexStatus_get(dot3StatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ dot3StatsDuplexStatus_val_ptr); ++ int ++ dot3StatsRateControlAbility_get(dot3StatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ dot3StatsRateControlAbility_val_ptr); ++ int ++ dot3StatsRateControlStatus_get(dot3StatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ dot3StatsRateControlStatus_val_ptr); ++ ++ ++ int ++ dot3StatsTable_indexes_set_tbl_idx(dot3StatsTable_mib_index * ++ tbl_idx, ++ long dot3StatsIndex_val); ++ int dot3StatsTable_indexes_set(dot3StatsTable_rowreq_ctx * ++ rowreq_ctx, ++ long dot3StatsIndex_val); ++ ++ ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* DOT3STATSTABLE_DATA_GET_H */ ++/** @} */ +Index: agent/mibgroup/etherlike-mib/dot3StatsTable_data_set.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/etherlike-mib/dot3StatsTable_data_set.c 2008-09-11 22:27:51.199791195 +0200 +@@ -0,0 +1,28 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 12077 $ of $ ++ * ++ * $Id:$ ++ * ++ */ ++/* ++ * standard Net-SNMP includes ++ */ ++#include ++#include ++#include ++ ++/* ++ * include our parent header ++ */ ++#include "dot3StatsTable.h" ++ ++ ++/** @defgroup data_set data_set: Routines to set data ++ * ++ * These routines are used to set the value for individual objects. The ++ * row context is passed, along with the new value. ++ * ++ * @{ ++ */ ++/** @} */ +Index: agent/mibgroup/etherlike-mib/dot3StatsTable_data_set.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/etherlike-mib/dot3StatsTable_data_set.h 2008-09-11 22:27:51.499791582 +0200 +@@ -0,0 +1,28 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 12077 $ of $ ++ * ++ * $Id:$ ++ */ ++#ifndef DOT3STATSTABLE_DATA_SET_H ++#define DOT3STATSTABLE_DATA_SET_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ /* ++ ********************************************************************* ++ * SET function declarations ++ */ ++ ++ /* ++ ********************************************************************* ++ * SET Table declarations ++ */ ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* DOT3STATSTABLE_DATA_SET_H */ +Index: agent/mibgroup/etherlike-mib/dot3StatsTable_enums.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/etherlike-mib/dot3StatsTable_enums.h 2008-09-11 22:27:51.523792041 +0200 +@@ -0,0 +1,89 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * : generic-table-enums.m2c 12526 2005-07-15 22:41:16Z rstory $ ++ * ++ * $Id:$ ++ */ ++#ifndef DOT3STATSTABLE_ENUMS_H ++#define DOT3STATSTABLE_ENUMS_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ /* ++ * 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 dot3StatsTable ++ * ++ ************************************************************************* ++ *************************************************************************/ ++ ++/************************************************************* ++ * constants for enums for the MIB node ++ * dot3StatsDuplexStatus (INTEGER / ASN_INTEGER) ++ * ++ * since a Textual Convention may be referenced more than once in a ++ * MIB, protect againt redefinitions of the enum values. ++ */ ++#ifndef DOT3STATSDUPLEXSTATUS_ENUMS ++#define DOT3STATSDUPLEXSTATUS_ENUMS ++ ++#define DOT3STATSDUPLEXSTATUS_UNKNOWN 1 ++#define DOT3STATSDUPLEXSTATUS_HALFDUPLEX 2 ++#define DOT3STATSDUPLEXSTATUS_FULLDUPLEX 3 ++ ++#endif /* DOT3STATSDUPLEXSTATUS_ENUMS */ ++ ++ ++/************************************************************* ++ * constants for enums for the MIB node ++ * dot3StatsRateControlAbility (TruthValue / ASN_INTEGER) ++ * ++ * since a Textual Convention may be referenced more than once in a ++ * MIB, protect againt redefinitions of the enum values. ++ */ ++#ifndef TRUTHVALUE_ENUMS ++#define TRUTHVALUE_ENUMS ++ ++#define TRUTHVALUE_TRUE 1 ++#define TRUTHVALUE_FALSE 2 ++ ++#endif /* TRUTHVALUE_ENUMS */ ++ ++ ++/************************************************************* ++ * constants for enums for the MIB node ++ * dot3StatsRateControlStatus (INTEGER / ASN_INTEGER) ++ * ++ * since a Textual Convention may be referenced more than once in a ++ * MIB, protect againt redefinitions of the enum values. ++ */ ++#ifndef DOT3STATSRATECONTROLSTATUS_ENUMS ++#define DOT3STATSRATECONTROLSTATUS_ENUMS ++ ++#define DOT3STATSRATECONTROLSTATUS_RATECONTROLOFF 1 ++#define DOT3STATSRATECONTROLSTATUS_RATECONTROLON 2 ++#define DOT3STATSRATECONTROLSTATUS_UNKNOWN 3 ++ ++#endif /* DOT3STATSRATECONTROLSTATUS_ENUMS */ ++ ++ ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* DOT3STATSTABLE_ENUMS_H */ +Index: agent/mibgroup/etherlike-mib/dot3StatsTable.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/etherlike-mib/dot3StatsTable.h 2008-09-11 22:27:51.547791530 +0200 +@@ -0,0 +1,271 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 14170 $ of $ ++ * ++ * $Id:$ ++ */ ++#ifndef DOT3STATSTABLE_H ++#define DOT3STATSTABLE_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++/** @addtogroup misc misc: Miscellaneous routines ++ * ++ * @{ ++ */ ++#include ++ ++ /* ++ * OID and column number definitions for dot3StatsTable ++ */ ++#include "dot3StatsTable_oids.h" ++ ++ /* ++ * enum definions ++ */ ++#include "dot3StatsTable_enums.h" ++ ++ /* ++ ********************************************************************* ++ * function declarations ++ */ ++ void init_dot3StatsTable(void); ++ void shutdown_dot3StatsTable(void); ++ ++ /* ++ ********************************************************************* ++ * Table declarations ++ */ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table dot3StatsTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++ /* ++ * EtherLike-MIB::dot3StatsTable is subid 2 of dot3. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.10.7.2, length: 9 ++ */ ++ /* ++ ********************************************************************* ++ * When you register your mib, you get to provide a generic ++ * pointer that will be passed back to you for most of the ++ * functions calls. ++ * ++ * TODO:100:r: Review all context structures ++ */ ++ /* ++ * TODO:101:o: |-> Review dot3StatsTable registration context. ++ */ ++ typedef netsnmp_data_list dot3StatsTable_registration; ++ ++/**********************************************************************/ ++ /* ++ * TODO:110:r: |-> Review dot3StatsTable data context structure. ++ * This structure is used to represent the data for dot3StatsTable. ++ */ ++ /* ++ * This structure contains storage for all the columns defined in the ++ * dot3StatsTable. ++ */ ++ typedef struct dot3StatsTable_data_s { ++ ++ /* ++ * dot3StatsAlignmentErrors(2)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long dot3StatsAlignmentErrors; ++ ++ /* ++ * dot3StatsFCSErrors(3)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long dot3StatsFCSErrors; ++ ++ /* ++ * dot3StatsSingleCollisionFrames(4)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long dot3StatsSingleCollisionFrames; ++ ++ /* ++ * dot3StatsMultipleCollisionFrames(5)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long dot3StatsMultipleCollisionFrames; ++ ++ /* ++ * dot3StatsSQETestErrors(6)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long dot3StatsSQETestErrors; ++ ++ /* ++ * dot3StatsDeferredTransmissions(7)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long dot3StatsDeferredTransmissions; ++ ++ /* ++ * dot3StatsLateCollisions(8)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long dot3StatsLateCollisions; ++ ++ /* ++ * dot3StatsExcessiveCollisions(9)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long dot3StatsExcessiveCollisions; ++ ++ /* ++ * dot3StatsInternalMacTransmitErrors(10)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long dot3StatsInternalMacTransmitErrors; ++ ++ /* ++ * dot3StatsCarrierSenseErrors(11)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long dot3StatsCarrierSenseErrors; ++ ++ /* ++ * dot3StatsFrameTooLongs(13)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long dot3StatsFrameTooLongs; ++ ++ /* ++ * dot3StatsInternalMacReceiveErrors(16)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long dot3StatsInternalMacReceiveErrors; ++ ++ /* ++ * dot3StatsEtherChipSet(17)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/A/w/e/r/d/h ++ */ ++ oid dot3StatsEtherChipSet[128]; ++ size_t dot3StatsEtherChipSet_len; /* # of oid elements, not bytes */ ++ ++ /* ++ * dot3StatsSymbolErrors(18)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long dot3StatsSymbolErrors; ++ ++ /* ++ * dot3StatsDuplexStatus(19)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h ++ */ ++ u_long dot3StatsDuplexStatus; ++ ++ /* ++ * dot3StatsRateControlAbility(20)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h ++ */ ++ u_long dot3StatsRateControlAbility; ++ ++ /* ++ * dot3StatsRateControlStatus(21)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h ++ */ ++ u_long dot3StatsRateControlStatus; ++ ++ } dot3StatsTable_data; ++ ++ ++ /* ++ * TODO:120:r: |-> Review dot3StatsTable mib index. ++ * This structure is used to represent the index for dot3StatsTable. ++ */ ++ typedef struct dot3StatsTable_mib_index_s { ++ ++ /* ++ * dot3StatsIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/w/e/R/d/H ++ */ ++ long dot3StatsIndex; ++ ++ ++ } dot3StatsTable_mib_index; ++ ++ /* ++ * TODO:121:r: | |-> Review dot3StatsTable max index length. ++ * If you KNOW that your indexes will never exceed a certain ++ * length, update this macro to that length. ++ */ ++#define MAX_dot3StatsTable_IDX_LEN 255 ++ ++ ++ /* ++ ********************************************************************* ++ * TODO:130:o: |-> Review dot3StatsTable Row request (rowreq) context. ++ * When your functions are called, you will be passed a ++ * dot3StatsTable_rowreq_ctx pointer. ++ */ ++ typedef struct dot3StatsTable_rowreq_ctx_s { ++ ++ /** this must be first for container compare to work */ ++ netsnmp_index oid_idx; ++ oid oid_tmp[MAX_dot3StatsTable_IDX_LEN]; ++ ++ dot3StatsTable_mib_index tbl_idx; ++ ++ dot3StatsTable_data data; ++ unsigned int column_exists_flags; /* flags for existence */ ++ ++ /* ++ * 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 dot3StatsTable rowreq context. ++ */ ++ ++ /* ++ * storage for future expansion ++ */ ++ netsnmp_data_list *dot3StatsTable_data_list; ++ ++ } dot3StatsTable_rowreq_ctx; ++ ++ typedef struct dot3StatsTable_ref_rowreq_ctx_s { ++ dot3StatsTable_rowreq_ctx *rowreq_ctx; ++ } dot3StatsTable_ref_rowreq_ctx; ++ ++ /* ++ ********************************************************************* ++ * function prototypes ++ */ ++ int dot3StatsTable_pre_request(dot3StatsTable_registration ++ * user_context); ++ int dot3StatsTable_post_request(dot3StatsTable_registration ++ * user_context, int rc); ++ ++ int ++ dot3StatsTable_rowreq_ctx_init(dot3StatsTable_rowreq_ctx * ++ rowreq_ctx, void *user_init_ctx); ++ void ++ dot3StatsTable_rowreq_ctx_cleanup(dot3StatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ ++ dot3StatsTable_rowreq_ctx ++ *dot3StatsTable_row_find_by_mib_index(dot3StatsTable_mib_index * ++ mib_idx); ++ ++ extern oid dot3StatsTable_oid[]; ++ extern int dot3StatsTable_oid_size; ++ ++ ++#include "dot3StatsTable_interface.h" ++#include "dot3StatsTable_data_access.h" ++#include "dot3StatsTable_data_get.h" ++#include "dot3StatsTable_data_set.h" ++ ++ /* ++ * DUMMY markers, ignore ++ * ++ * TODO:099:x: ************************************************************* ++ * TODO:199:x: ************************************************************* ++ * TODO:299:x: ************************************************************* ++ * TODO:399:x: ************************************************************* ++ * TODO:499:x: ************************************************************* ++ */ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* DOT3STATSTABLE_H */ ++/** @} */ +Index: agent/mibgroup/etherlike-mib/dot3StatsTable_interface.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/etherlike-mib/dot3StatsTable_interface.c 2008-09-11 22:27:51.575791972 +0200 +@@ -0,0 +1,1188 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 15899 $ of $ ++ * ++ * $Id:$ ++ */ ++/* ++ * ********************************************************************* ++ * ********************************************************************* ++ * ********************************************************************* ++ * *** *** ++ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE *** ++ * *** *** ++ * *** *** ++ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. *** ++ * *** *** ++ * *** *** ++ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND *** ++ * *** *** ++ * *** *** ++ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. *** ++ * *** *** ++ * *** *** ++ * ********************************************************************* ++ * ********************************************************************* ++ * ********************************************************************* ++ */ ++ ++/* ++ * standard Net-SNMP includes ++ */ ++#include ++#include ++#include ++ ++/* ++ * include our parent header ++ */ ++#include "dot3StatsTable.h" ++ ++ ++#include ++#include ++ ++#include "dot3StatsTable_interface.h" ++ ++#include ++ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table dot3StatsTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++/* ++ * EtherLike-MIB::dot3StatsTable is subid 2 of dot3. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.10.7.2, length: 9 ++ */ ++typedef struct dot3StatsTable_interface_ctx_s { ++ ++ netsnmp_container *container; ++ netsnmp_cache *cache; ++ ++ dot3StatsTable_registration *user_ctx; ++ ++ netsnmp_table_registration_info tbl_info; ++ ++ netsnmp_baby_steps_access_methods access_multiplexer; ++ ++} dot3StatsTable_interface_ctx; ++ ++static dot3StatsTable_interface_ctx dot3StatsTable_if_ctx; ++ ++static void _dot3StatsTable_container_init(dot3StatsTable_interface_ctx ++ * if_ctx); ++static void ++_dot3StatsTable_container_shutdown(dot3StatsTable_interface_ctx * if_ctx); ++ ++ ++netsnmp_container * ++dot3StatsTable_container_get(void) ++{ ++ return dot3StatsTable_if_ctx.container; ++} ++ ++dot3StatsTable_registration * ++dot3StatsTable_registration_get(void) ++{ ++ return dot3StatsTable_if_ctx.user_ctx; ++} ++ ++dot3StatsTable_registration * ++dot3StatsTable_registration_set(dot3StatsTable_registration * newreg) ++{ ++ dot3StatsTable_registration *old = dot3StatsTable_if_ctx.user_ctx; ++ dot3StatsTable_if_ctx.user_ctx = newreg; ++ return old; ++} ++ ++int ++dot3StatsTable_container_size(void) ++{ ++ return CONTAINER_SIZE(dot3StatsTable_if_ctx.container); ++} ++ ++/* ++ * mfd multiplexer modes ++ */ ++static Netsnmp_Node_Handler _mfd_dot3StatsTable_pre_request; ++static Netsnmp_Node_Handler _mfd_dot3StatsTable_post_request; ++static Netsnmp_Node_Handler _mfd_dot3StatsTable_object_lookup; ++static Netsnmp_Node_Handler _mfd_dot3StatsTable_get_values; ++/** ++ * @internal ++ * Initialize the table dot3StatsTable ++ * (Define its contents and how it's structured) ++ */ ++void ++_dot3StatsTable_initialize_interface(dot3StatsTable_registration * reg_ptr, ++ u_long flags) ++{ ++ netsnmp_baby_steps_access_methods *access_multiplexer = ++ &dot3StatsTable_if_ctx.access_multiplexer; ++ netsnmp_table_registration_info *tbl_info = ++ &dot3StatsTable_if_ctx.tbl_info; ++ netsnmp_handler_registration *reginfo; ++ netsnmp_mib_handler *handler; ++ int mfd_modes = 0; ++ ++ DEBUGMSGTL(("internal:dot3StatsTable:_dot3StatsTable_initialize_interface", "called\n")); ++ ++ ++ /************************************************* ++ * ++ * save interface context for dot3StatsTable ++ */ ++ /* ++ * Setting up the table's definition ++ */ ++ netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER, ++ /** index: dot3StatsIndex */ ++ 0); ++ ++ /* ++ * Define the minimum and maximum accessible columns. This ++ * optimizes retrival. ++ */ ++ tbl_info->min_column = DOT3STATSTABLE_MIN_COL; ++ tbl_info->max_column = DOT3STATSTABLE_MAX_COL; ++ ++ /* ++ * save users context ++ */ ++ dot3StatsTable_if_ctx.user_ctx = reg_ptr; ++ ++ /* ++ * call data access initialization code ++ */ ++ dot3StatsTable_init_data(reg_ptr); ++ ++ /* ++ * set up the container ++ */ ++ _dot3StatsTable_container_init(&dot3StatsTable_if_ctx); ++ if (NULL == dot3StatsTable_if_ctx.container) { ++ snmp_log(LOG_ERR, ++ "could not initialize container for dot3StatsTable\n"); ++ return; ++ } ++ ++ /* ++ * access_multiplexer: REQUIRED wrapper for get request handling ++ */ ++ access_multiplexer->object_lookup = _mfd_dot3StatsTable_object_lookup; ++ access_multiplexer->get_values = _mfd_dot3StatsTable_get_values; ++ ++ /* ++ * no wrappers yet ++ */ ++ access_multiplexer->pre_request = _mfd_dot3StatsTable_pre_request; ++ access_multiplexer->post_request = _mfd_dot3StatsTable_post_request; ++ ++ ++ /************************************************* ++ * ++ * Create a registration, save our reg data, register table. ++ */ ++ DEBUGMSGTL(("dot3StatsTable:init_dot3StatsTable", ++ "Registering dot3StatsTable as a mibs-for-dummies table.\n")); ++ handler = ++ netsnmp_baby_steps_access_multiplexer_get(access_multiplexer); ++ reginfo = ++ netsnmp_handler_registration_create("dot3StatsTable", handler, ++ dot3StatsTable_oid, ++ dot3StatsTable_oid_size, ++ HANDLER_CAN_BABY_STEP | ++ HANDLER_CAN_RONLY); ++ if (NULL == reginfo) { ++ snmp_log(LOG_ERR, "error registering table dot3StatsTable\n"); ++ return; ++ } ++ reginfo->my_reg_void = &dot3StatsTable_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, ++ dot3StatsTable_if_ctx. ++ container, ++ TABLE_CONTAINER_KEY_NETSNMP_INDEX); ++ netsnmp_inject_handler(reginfo, handler); ++ ++ /************************************************* ++ * ++ * inject cache helper ++ */ ++ if (NULL != dot3StatsTable_if_ctx.cache) { ++ handler = netsnmp_cache_handler_get(dot3StatsTable_if_ctx.cache); ++ netsnmp_inject_handler(reginfo, handler); ++ } ++ ++ /* ++ * register table ++ */ ++ netsnmp_register_table(reginfo, tbl_info); ++ ++} /* _dot3StatsTable_initialize_interface */ ++ ++/** ++ * @internal ++ * Shutdown the table dot3StatsTable ++ */ ++void ++_dot3StatsTable_shutdown_interface(dot3StatsTable_registration * reg_ptr) ++{ ++ /* ++ * shutdown the container ++ */ ++ _dot3StatsTable_container_shutdown(&dot3StatsTable_if_ctx); ++} ++ ++void ++dot3StatsTable_valid_columns_set(netsnmp_column_info *vc) ++{ ++ dot3StatsTable_if_ctx.tbl_info.valid_columns = vc; ++} /* dot3StatsTable_valid_columns_set */ ++ ++/** ++ * @internal ++ * convert the index component stored in the context to an oid ++ */ ++int ++dot3StatsTable_index_to_oid(netsnmp_index * oid_idx, ++ dot3StatsTable_mib_index * mib_idx) ++{ ++ int err = SNMP_ERR_NOERROR; ++ ++ /* ++ * temp storage for parsing indexes ++ */ ++ /* ++ * dot3StatsIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/w/e/R/d/H ++ */ ++ netsnmp_variable_list var_dot3StatsIndex; ++ ++ /* ++ * set up varbinds ++ */ ++ memset(&var_dot3StatsIndex, 0x00, sizeof(var_dot3StatsIndex)); ++ var_dot3StatsIndex.type = ASN_INTEGER; ++ ++ /* ++ * chain temp index varbinds together ++ */ ++ var_dot3StatsIndex.next_variable = NULL; ++ ++ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsTable_index_to_oid", ++ "called\n")); ++ ++ /* ++ * dot3StatsIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/w/e/R/d/H ++ */ ++ snmp_set_var_value(&var_dot3StatsIndex, ++ (u_char *) & mib_idx->dot3StatsIndex, ++ sizeof(mib_idx->dot3StatsIndex)); ++ ++ ++ err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len, ++ NULL, 0, &var_dot3StatsIndex); ++ 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_dot3StatsIndex); ++ ++ return err; ++} /* dot3StatsTable_index_to_oid */ ++ ++/** ++ * extract dot3StatsTable indexes from a netsnmp_index ++ * ++ * @retval SNMP_ERR_NOERROR : no error ++ * @retval SNMP_ERR_GENERR : error ++ */ ++int ++dot3StatsTable_index_from_oid(netsnmp_index * oid_idx, ++ dot3StatsTable_mib_index * mib_idx) ++{ ++ int err = SNMP_ERR_NOERROR; ++ ++ /* ++ * temp storage for parsing indexes ++ */ ++ /* ++ * dot3StatsIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/w/e/R/d/H ++ */ ++ netsnmp_variable_list var_dot3StatsIndex; ++ ++ /* ++ * set up varbinds ++ */ ++ memset(&var_dot3StatsIndex, 0x00, sizeof(var_dot3StatsIndex)); ++ var_dot3StatsIndex.type = ASN_INTEGER; ++ ++ /* ++ * chain temp index varbinds together ++ */ ++ var_dot3StatsIndex.next_variable = NULL; ++ ++ ++ DEBUGMSGTL(("verbose:dot3StatsTable:dot3StatsTable_index_from_oid", ++ "called\n")); ++ ++ /* ++ * parse the oid into the individual index components ++ */ ++ err = parse_oid_indexes(oid_idx->oids, oid_idx->len, ++ &var_dot3StatsIndex); ++ if (err == SNMP_ERR_NOERROR) { ++ /* ++ * copy out values ++ */ ++ mib_idx->dot3StatsIndex = ++ *((long *) var_dot3StatsIndex.val.string); ++ ++ ++ } ++ ++ /* ++ * parsing may have allocated memory. free it. ++ */ ++ snmp_reset_var_buffers(&var_dot3StatsIndex); ++ ++ return err; ++} /* dot3StatsTable_index_from_oid */ ++ ++ ++/* ++ ********************************************************************* ++ * @internal ++ * allocate resources for a dot3StatsTable_rowreq_ctx ++ */ ++dot3StatsTable_rowreq_ctx * ++dot3StatsTable_allocate_rowreq_ctx(void *user_init_ctx) ++{ ++ dot3StatsTable_rowreq_ctx *rowreq_ctx = ++ SNMP_MALLOC_TYPEDEF(dot3StatsTable_rowreq_ctx); ++ ++ DEBUGMSGTL(("internal:dot3StatsTable:dot3StatsTable_allocate_rowreq_ctx", "called\n")); ++ ++ if (NULL == rowreq_ctx) { ++ snmp_log(LOG_ERR, "Couldn't allocate memory for a " ++ "dot3StatsTable_rowreq_ctx.\n"); ++ return NULL; ++ } ++ ++ rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp; ++ ++ rowreq_ctx->dot3StatsTable_data_list = NULL; ++ ++ /* ++ * if we allocated data, call init routine ++ */ ++ if (!(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) { ++ if (SNMPERR_SUCCESS != ++ dot3StatsTable_rowreq_ctx_init(rowreq_ctx, user_init_ctx)) { ++ dot3StatsTable_release_rowreq_ctx(rowreq_ctx); ++ rowreq_ctx = NULL; ++ } ++ } ++ ++ return rowreq_ctx; ++} /* dot3StatsTable_allocate_rowreq_ctx */ ++ ++/* ++ * @internal ++ * release resources for a dot3StatsTable_rowreq_ctx ++ */ ++void ++dot3StatsTable_release_rowreq_ctx(dot3StatsTable_rowreq_ctx * rowreq_ctx) ++{ ++ DEBUGMSGTL(("internal:dot3StatsTable:dot3StatsTable_release_rowreq_ctx", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ dot3StatsTable_rowreq_ctx_cleanup(rowreq_ctx); ++ ++ /* ++ * free index oid pointer ++ */ ++ if (rowreq_ctx->oid_idx.oids != rowreq_ctx->oid_tmp) ++ free(rowreq_ctx->oid_idx.oids); ++ ++ SNMP_FREE(rowreq_ctx); ++} /* dot3StatsTable_release_rowreq_ctx */ ++ ++/** ++ * @internal ++ * wrapper ++ */ ++static int ++_mfd_dot3StatsTable_pre_request(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration *reginfo, ++ netsnmp_agent_request_info *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ int rc; ++ ++ DEBUGMSGTL(("internal:dot3StatsTable:_mfd_dot3StatsTable_pre_request", ++ "called\n")); ++ ++ if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) { ++ DEBUGMSGTL(("internal:dot3StatsTable", ++ "skipping additional pre_request\n")); ++ return SNMP_ERR_NOERROR; ++ } ++ ++ rc = dot3StatsTable_pre_request(dot3StatsTable_if_ctx.user_ctx); ++ if (MFD_SUCCESS != rc) { ++ /* ++ * nothing we can do about it but log it ++ */ ++ DEBUGMSGTL(("dot3StatsTable", "error %d from " ++ "dot3StatsTable_pre_request\n", rc)); ++ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); ++ } ++ ++ return SNMP_ERR_NOERROR; ++} /* _mfd_dot3StatsTable_pre_request */ ++ ++/** ++ * @internal ++ * wrapper ++ */ ++static int ++_mfd_dot3StatsTable_post_request(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration *reginfo, ++ netsnmp_agent_request_info *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ dot3StatsTable_rowreq_ctx *rowreq_ctx = ++ netsnmp_container_table_row_extract(requests); ++ int rc, packet_rc; ++ ++ DEBUGMSGTL(("internal:dot3StatsTable:_mfd_dot3StatsTable_post_request", ++ "called\n")); ++ ++ /* ++ * release row context, if deleted ++ */ ++ if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED)) ++ dot3StatsTable_release_rowreq_ctx(rowreq_ctx); ++ ++ /* ++ * wait for last call before calling user ++ */ ++ if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) { ++ DEBUGMSGTL(("internal:dot3StatsTable", ++ "waiting for last post_request\n")); ++ return SNMP_ERR_NOERROR; ++ } ++ ++ packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0); ++ rc = dot3StatsTable_post_request(dot3StatsTable_if_ctx.user_ctx, ++ packet_rc); ++ if (MFD_SUCCESS != rc) { ++ /* ++ * nothing we can do about it but log it ++ */ ++ DEBUGMSGTL(("dot3StatsTable", "error %d from " ++ "dot3StatsTable_post_request\n", rc)); ++ } ++ ++ return SNMP_ERR_NOERROR; ++} /* _mfd_dot3StatsTable_post_request */ ++ ++/** ++ * @internal ++ * wrapper ++ */ ++static int ++_mfd_dot3StatsTable_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; ++ dot3StatsTable_rowreq_ctx *rowreq_ctx = ++ netsnmp_container_table_row_extract(requests); ++ ++ DEBUGMSGTL(("internal:dot3StatsTable:_mfd_dot3StatsTable_object_lookup", "called\n")); ++ ++ /* ++ * get our context from mfd ++ * dot3StatsTable_interface_ctx *if_ctx = ++ * (dot3StatsTable_interface_ctx *)reginfo->my_reg_void; ++ */ ++ ++ if (NULL == rowreq_ctx) { ++ rc = SNMP_ERR_NOCREATION; ++ } ++ ++ if (MFD_SUCCESS != rc) ++ netsnmp_request_set_error_all(requests, rc); ++ else ++ dot3StatsTable_row_prep(rowreq_ctx); ++ ++ return SNMP_VALIDATE_ERR(rc); ++} /* _mfd_dot3StatsTable_object_lookup */ ++ ++/*********************************************************************** ++ * ++ * GET processing ++ * ++ ***********************************************************************/ ++/* ++ * @internal ++ * Retrieve the value for a particular column ++ */ ++NETSNMP_STATIC_INLINE int ++_dot3StatsTable_get_column(dot3StatsTable_rowreq_ctx * rowreq_ctx, ++ netsnmp_variable_list * var, int column) ++{ ++ int rc = SNMPERR_SUCCESS; ++ ++ DEBUGMSGTL(("internal:dot3StatsTable:_mfd_dot3StatsTable_get_column", ++ "called for %d\n", column)); ++ ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ switch (column) { ++ ++ /* ++ * (INDEX) dot3StatsIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/w/e/R/d/H ++ */ ++ case COLUMN_DOT3STATSINDEX: ++ var->type = ASN_INTEGER; ++ var->val_len = sizeof(long); ++ (*var->val.integer) = rowreq_ctx->tbl_idx.dot3StatsIndex; ++ break; ++ ++ /* ++ * dot3StatsAlignmentErrors(2)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_DOT3STATSALIGNMENTERRORS: ++ if (! ++ (COLUMN_DOT3STATSALIGNMENTERRORS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ snmp_log (LOG_ERR, "internal:dot3StatsTable:_mfd_dot3StatsTable_get_column, column %d (dot3StatsAlignmentErrors) doesn't exist for interface with index %u\n", column, rowreq_ctx->tbl_idx.dot3StatsIndex); ++ DEBUGMSGTL(("internal:dot3StatsTable:_mfd_dot3StatsTable_get_column", "column %d (dot3StatsAlignmentErrors) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = dot3StatsAlignmentErrors_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * dot3StatsFCSErrors(3)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_DOT3STATSFCSERRORS: ++ if (! ++ (COLUMN_DOT3STATSFCSERRORS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:dot3StatsTable:_mfd_dot3StatsTable_get_column", "column %d (dot3StatsFCSErrors) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = dot3StatsFCSErrors_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * dot3StatsSingleCollisionFrames(4)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_DOT3STATSSINGLECOLLISIONFRAMES: ++ if (! ++ (COLUMN_DOT3STATSSINGLECOLLISIONFRAMES_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ snmp_log (LOG_ERR, "internal:dot3StatsTable:_mfd_dot3StatsTable_get_column, column %d (dot3StatsSingleCollisionFrames) doesn't exist for the interface with index %u\n", column, rowreq_ctx->tbl_idx.dot3StatsIndex); ++ DEBUGMSGTL(("internal:dot3StatsTable:_mfd_dot3StatsTable_get_column", "column %d (dot3StatsSingleCollisionFrames) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = dot3StatsSingleCollisionFrames_get(rowreq_ctx, ++ (u_long *) var->val. ++ string); ++ break; ++ ++ /* ++ * dot3StatsMultipleCollisionFrames(5)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_DOT3STATSMULTIPLECOLLISIONFRAMES: ++ if (! ++ (COLUMN_DOT3STATSMULTIPLECOLLISIONFRAMES_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ snmp_log (LOG_ERR, "internal:dot3StatsTable:_mfd_dot3StatsTable_get_column, column %d (dot3StatsMultipleCollisionFrames) doesn't exist for the interface with index %u\n", column, rowreq_ctx->tbl_idx.dot3StatsIndex); ++ DEBUGMSGTL(("internal:dot3StatsTable:_mfd_dot3StatsTable_get_column", "column %d (dot3StatsMultipleCollisionFrames) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = dot3StatsMultipleCollisionFrames_get(rowreq_ctx, ++ (u_long *) var->val. ++ string); ++ break; ++ ++ /* ++ * dot3StatsSQETestErrors(6)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_DOT3STATSSQETESTERRORS: ++ if (! ++ (COLUMN_DOT3STATSSQETESTERRORS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:dot3StatsTable:_mfd_dot3StatsTable_get_column", "column %d (dot3StatsSQETestErrors) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = dot3StatsSQETestErrors_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * dot3StatsDeferredTransmissions(7)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_DOT3STATSDEFERREDTRANSMISSIONS: ++ if (! ++ (COLUMN_DOT3STATSDEFERREDTRANSMISSIONS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:dot3StatsTable:_mfd_dot3StatsTable_get_column", "column %d (dot3StatsDeferredTransmissions) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = dot3StatsDeferredTransmissions_get(rowreq_ctx, ++ (u_long *) var->val. ++ string); ++ break; ++ ++ /* ++ * dot3StatsLateCollisions(8)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_DOT3STATSLATECOLLISIONS: ++ if (! ++ (COLUMN_DOT3STATSLATECOLLISIONS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ snmp_log (LOG_ERR, "internal:dot3StatsTable:_mfd_dot3StatsTable_get_column, column %d (dot3StatsLateCollisions) doesn't exist for the interface with index %u\n", column, rowreq_ctx->tbl_idx.dot3StatsIndex); ++ DEBUGMSGTL(("internal:dot3StatsTable:_mfd_dot3StatsTable_get_column", "column %d (dot3StatsLateCollisions) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = dot3StatsLateCollisions_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * dot3StatsExcessiveCollisions(9)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_DOT3STATSEXCESSIVECOLLISIONS: ++ if (! ++ (COLUMN_DOT3STATSEXCESSIVECOLLISIONS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ snmp_log (LOG_ERR, "internal:dot3StatsTable:_mfd_dot3StatsTable_get_column, column %d (dot3StatsExcessiveCollisions) doesn't exist for the interface with index %u\n", column, rowreq_ctx->tbl_idx.dot3StatsIndex); ++ DEBUGMSGTL(("internal:dot3StatsTable:_mfd_dot3StatsTable_get_column", "column %d (dot3StatsExcessiveCollisions) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = dot3StatsExcessiveCollisions_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * dot3StatsInternalMacTransmitErrors(10)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_DOT3STATSINTERNALMACTRANSMITERRORS: ++ if (! ++ (COLUMN_DOT3STATSINTERNALMACTRANSMITERRORS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:dot3StatsTable:_mfd_dot3StatsTable_get_column", "column %d (dot3StatsInternalMacTransmitErrors) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = dot3StatsInternalMacTransmitErrors_get(rowreq_ctx, ++ (u_long *) var->val. ++ string); ++ break; ++ ++ /* ++ * dot3StatsCarrierSenseErrors(11)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_DOT3STATSCARRIERSENSEERRORS: ++ if (! ++ (COLUMN_DOT3STATSCARRIERSENSEERRORS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:dot3StatsTable:_mfd_dot3StatsTable_get_column", "column %d (dot3StatsCarrierSenseErrors) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = dot3StatsCarrierSenseErrors_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * dot3StatsFrameTooLongs(13)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_DOT3STATSFRAMETOOLONGS: ++ if (! ++ (COLUMN_DOT3STATSFRAMETOOLONGS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:dot3StatsTable:_mfd_dot3StatsTable_get_column", "column %d (dot3StatsFrameTooLongs) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = dot3StatsFrameTooLongs_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * dot3StatsInternalMacReceiveErrors(16)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_DOT3STATSINTERNALMACRECEIVEERRORS: ++ if (! ++ (COLUMN_DOT3STATSINTERNALMACRECEIVEERRORS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:dot3StatsTable:_mfd_dot3StatsTable_get_column", "column %d (dot3StatsInternalMacReceiveErrors) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = dot3StatsInternalMacReceiveErrors_get(rowreq_ctx, ++ (u_long *) var->val. ++ string); ++ break; ++ ++ /* ++ * dot3StatsEtherChipSet(17)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/A/w/e/r/d/h ++ */ ++ case COLUMN_DOT3STATSETHERCHIPSET: ++ if (! ++ (COLUMN_DOT3STATSETHERCHIPSET_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:dot3StatsTable:_mfd_dot3StatsTable_get_column", "column %d (dot3StatsEtherChipSet) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->type = ASN_OBJECT_ID; ++ rc = dot3StatsEtherChipSet_get(rowreq_ctx, ++ (oid **) & var->val.string, ++ &var->val_len); ++ break; ++ ++ /* ++ * dot3StatsSymbolErrors(18)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_DOT3STATSSYMBOLERRORS: ++ if (! ++ (COLUMN_DOT3STATSSYMBOLERRORS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:dot3StatsTable:_mfd_dot3StatsTable_get_column", "column %d (dot3StatsSymbolErrors) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = dot3StatsSymbolErrors_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * dot3StatsDuplexStatus(19)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h ++ */ ++ case COLUMN_DOT3STATSDUPLEXSTATUS: ++ if (! ++ (COLUMN_DOT3STATSDUPLEXSTATUS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ snmp_log (LOG_ERR, "internal:dot3StatsTable:_mfd_dot3StatsTable_get_column, column %d (dot3StatsDuplexStatus) doesn't exist for the interface with index %u\n", column, rowreq_ctx->tbl_idx.dot3StatsIndex); ++ DEBUGMSGTL(("internal:dot3StatsTable:_mfd_dot3StatsTable_get_column", "column %d (dot3StatsDuplexStatus) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_INTEGER; ++ rc = dot3StatsDuplexStatus_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * dot3StatsRateControlAbility(20)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h ++ */ ++ case COLUMN_DOT3STATSRATECONTROLABILITY: ++ if (! ++ (COLUMN_DOT3STATSRATECONTROLABILITY_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:dot3StatsTable:_mfd_dot3StatsTable_get_column", "column %d (dot3StatsRateControlAbility) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_INTEGER; ++ rc = dot3StatsRateControlAbility_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * dot3StatsRateControlStatus(21)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h ++ */ ++ case COLUMN_DOT3STATSRATECONTROLSTATUS: ++ if (! ++ (COLUMN_DOT3STATSRATECONTROLSTATUS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:dot3StatsTable:_mfd_dot3StatsTable_get_column", "column %d (dot3StatsRateControlStatus) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_INTEGER; ++ rc = dot3StatsRateControlStatus_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ default: ++ if (DOT3STATSTABLE_MIN_COL <= column ++ && column <= DOT3STATSTABLE_MAX_COL) { ++ DEBUGMSGTL(("internal:dot3StatsTable:_mfd_dot3StatsTable_get_column", "assume column %d is reserved\n", column)); ++ rc = MFD_SKIP; ++ } else { ++ snmp_log(LOG_ERR, ++ "unknown column %d in _dot3StatsTable_get_column\n", ++ column); ++ } ++ break; ++ } ++ ++ return rc; ++} /* _dot3StatsTable_get_column */ ++ ++int ++_mfd_dot3StatsTable_get_values(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration *reginfo, ++ netsnmp_agent_request_info *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ dot3StatsTable_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:dot3StatsTable:_mfd_dot3StatsTable_get_values", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ DEBUGMSGTL(("9:dot3StatsTable:_mfd_dot3StatsTable_get_values", ++ "exists %p\n", (void *) rowreq_ctx->column_exists_flags)); ++ ++ 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 = _dot3StatsTable_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_dot3StatsTable_get_values */ ++ ++ ++/*********************************************************************** ++ * ++ * SET processing ++ * ++ ***********************************************************************/ ++ ++/* ++ * SET PROCESSING NOT APPLICABLE (per MIB or user setting) ++ */ ++/*********************************************************************** ++ * ++ * DATA ACCESS ++ * ++ ***********************************************************************/ ++static void _container_free(netsnmp_container * container); ++ ++/** ++ * @internal ++ */ ++static int ++_cache_load(netsnmp_cache * cache, void *vmagic) ++{ ++ DEBUGMSGTL(("internal:dot3StatsTable:_cache_load", "called\n")); ++ ++ if ((NULL == cache) || (NULL == cache->magic)) { ++ snmp_log(LOG_ERR, "invalid cache for dot3StatsTable_cache_load\n"); ++ return -1; ++ } ++ ++ /** should only be called for an invalid or expired cache */ ++ netsnmp_assert((0 == cache->valid) || (1 == cache->expired)); ++ ++ /* ++ * call user code ++ */ ++ return dot3StatsTable_container_load((netsnmp_container *) cache-> ++ magic); ++} /* _cache_load */ ++ ++/** ++ * @internal ++ */ ++static void ++_cache_free(netsnmp_cache * cache, void *magic) ++{ ++ netsnmp_container *container; ++ ++ DEBUGMSGTL(("internal:dot3StatsTable:_cache_free", "called\n")); ++ ++ if ((NULL == cache) || (NULL == cache->magic)) { ++ snmp_log(LOG_ERR, "invalid cache in dot3StatsTable_cache_free\n"); ++ return; ++ } ++ ++ container = (netsnmp_container *) cache->magic; ++ ++ _container_free(container); ++} /* _cache_free */ ++ ++/** ++ * @internal ++ */ ++static void ++_container_item_free(dot3StatsTable_rowreq_ctx * rowreq_ctx, void *context) ++{ ++ DEBUGMSGTL(("internal:dot3StatsTable:_container_item_free", ++ "called\n")); ++ ++ if (NULL == rowreq_ctx) ++ return; ++ ++ dot3StatsTable_release_rowreq_ctx(rowreq_ctx); ++} /* _container_item_free */ ++ ++/** ++ * @internal ++ */ ++static void ++_container_free(netsnmp_container * container) ++{ ++ DEBUGMSGTL(("internal:dot3StatsTable:_container_free", "called\n")); ++ ++ if (NULL == container) { ++ snmp_log(LOG_ERR, ++ "invalid container in dot3StatsTable_container_free\n"); ++ return; ++ } ++ ++ /* ++ * call user code ++ */ ++ dot3StatsTable_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 ++_dot3StatsTable_container_init(dot3StatsTable_interface_ctx * if_ctx) ++{ ++ DEBUGMSGTL(("internal:dot3StatsTable:_dot3StatsTable_container_init", ++ "called\n")); ++ ++ /* ++ * cache init ++ */ ++ if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */ ++ _cache_load, _cache_free, ++ dot3StatsTable_oid, ++ dot3StatsTable_oid_size); ++ ++ if (NULL == if_ctx->cache) { ++ snmp_log(LOG_ERR, "error creating cache for dot3StatsTable\n"); ++ return; ++ } ++ ++ if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET; ++ ++ dot3StatsTable_container_init(&if_ctx->container, if_ctx->cache); ++ if (NULL == if_ctx->container) ++ if_ctx->container = ++ netsnmp_container_find("dot3StatsTable:table_container"); ++ if (NULL == if_ctx->container) { ++ snmp_log(LOG_ERR, "error creating container in " ++ "dot3StatsTable_container_init\n"); ++ return; ++ } ++ ++ if (NULL != if_ctx->cache) ++ if_ctx->cache->magic = (void *) if_ctx->container; ++} /* _dot3StatsTable_container_init */ ++ ++/** ++ * @internal ++ * shutdown the container with functions or wrappers ++ */ ++void ++_dot3StatsTable_container_shutdown(dot3StatsTable_interface_ctx * if_ctx) ++{ ++ DEBUGMSGTL(("internal:dot3StatsTable:_dot3StatsTable_container_shutdown", "called\n")); ++ ++ dot3StatsTable_container_shutdown(if_ctx->container); ++ ++ _container_free(if_ctx->container); ++ ++} /* _dot3StatsTable_container_shutdown */ ++ ++ ++dot3StatsTable_rowreq_ctx * ++dot3StatsTable_row_find_by_mib_index(dot3StatsTable_mib_index * mib_idx) ++{ ++ dot3StatsTable_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 = dot3StatsTable_index_to_oid(&oid_idx, mib_idx); ++ if (MFD_SUCCESS != rc) ++ return NULL; ++ ++ rowreq_ctx = CONTAINER_FIND(dot3StatsTable_if_ctx.container, &oid_idx); ++ ++ return rowreq_ctx; ++} +Index: agent/mibgroup/etherlike-mib/dot3StatsTable_interface.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/etherlike-mib/dot3StatsTable_interface.h 2008-09-11 22:27:51.599791862 +0200 +@@ -0,0 +1,94 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 15899 $ of $ ++ * ++ * $Id:$ ++ */ ++/** @ingroup interface: Routines to interface to Net-SNMP ++ * ++ * \warning This code should not be modified, called directly, ++ * or used to interpret functionality. It is subject to ++ * change at any time. ++ * ++ * @{ ++ */ ++/* ++ * ********************************************************************* ++ * ********************************************************************* ++ * ********************************************************************* ++ * *** *** ++ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE *** ++ * *** *** ++ * *** *** ++ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. *** ++ * *** *** ++ * *** *** ++ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND *** ++ * *** *** ++ * *** *** ++ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. *** ++ * *** *** ++ * *** *** ++ * ********************************************************************* ++ * ********************************************************************* ++ * ********************************************************************* ++ */ ++#ifndef DOT3STATSTABLE_INTERFACE_H ++#define DOT3STATSTABLE_INTERFACE_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++#include "dot3StatsTable.h" ++ ++ ++ /* ++ ******************************************************************** ++ * Table declarations ++ */ ++ ++ /* ++ * PUBLIC interface initialization routine ++ */ ++ void ++ _dot3StatsTable_initialize_interface(dot3StatsTable_registration * ++ user_ctx, u_long flags); ++ void ++ _dot3StatsTable_shutdown_interface(dot3StatsTable_registration * ++ user_ctx); ++ ++ dot3StatsTable_registration *dot3StatsTable_registration_get(void); ++ ++ dot3StatsTable_registration ++ *dot3StatsTable_registration_set(dot3StatsTable_registration * ++ newreg); ++ ++ netsnmp_container *dot3StatsTable_container_get(void); ++ int dot3StatsTable_container_size(void); ++ ++ dot3StatsTable_rowreq_ctx *dot3StatsTable_allocate_rowreq_ctx(void *); ++ void ++ dot3StatsTable_release_rowreq_ctx(dot3StatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ int dot3StatsTable_index_to_oid(netsnmp_index * oid_idx, ++ dot3StatsTable_mib_index * ++ mib_idx); ++ int dot3StatsTable_index_from_oid(netsnmp_index * oid_idx, ++ dot3StatsTable_mib_index ++ * mib_idx); ++ ++ /* ++ * access to certain internals. use with caution! ++ */ ++ void dot3StatsTable_valid_columns_set(netsnmp_column_info ++ *vc); ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* DOT3STATSTABLE_INTERFACE_H */ ++/** @} */ +Index: agent/mibgroup/etherlike-mib/dot3StatsTable_oids.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/etherlike-mib/dot3StatsTable_oids.h 2008-09-11 22:27:51.639791663 +0200 +@@ -0,0 +1,82 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * : generic-table-oids.m2c 12855 2005-09-27 15:56:08Z rstory $ ++ * ++ * $Id:$ ++ */ ++#ifndef DOT3STATSTABLE_OIDS_H ++#define DOT3STATSTABLE_OIDS_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++ /* ++ * column number definitions for table dot3StatsTable ++ */ ++#define DOT3STATSTABLE_OID 1,3,6,1,2,1,10,7,2 ++ ++#define COLUMN_DOT3STATSINDEX 1 ++#define COLUMN_DOT3STATSINDEX_FLAG (0x1 << 0) ++ ++#define COLUMN_DOT3STATSALIGNMENTERRORS 2 ++#define COLUMN_DOT3STATSALIGNMENTERRORS_FLAG (0x1 << 1) ++ ++#define COLUMN_DOT3STATSFCSERRORS 3 ++#define COLUMN_DOT3STATSFCSERRORS_FLAG (0x1 << 2) ++ ++#define COLUMN_DOT3STATSSINGLECOLLISIONFRAMES 4 ++#define COLUMN_DOT3STATSSINGLECOLLISIONFRAMES_FLAG (0x1 << 3) ++ ++#define COLUMN_DOT3STATSMULTIPLECOLLISIONFRAMES 5 ++#define COLUMN_DOT3STATSMULTIPLECOLLISIONFRAMES_FLAG (0x1 << 4) ++ ++#define COLUMN_DOT3STATSSQETESTERRORS 6 ++#define COLUMN_DOT3STATSSQETESTERRORS_FLAG (0x1 << 5) ++ ++#define COLUMN_DOT3STATSDEFERREDTRANSMISSIONS 7 ++#define COLUMN_DOT3STATSDEFERREDTRANSMISSIONS_FLAG (0x1 << 6) ++ ++#define COLUMN_DOT3STATSLATECOLLISIONS 8 ++#define COLUMN_DOT3STATSLATECOLLISIONS_FLAG (0x1 << 7) ++ ++#define COLUMN_DOT3STATSEXCESSIVECOLLISIONS 9 ++#define COLUMN_DOT3STATSEXCESSIVECOLLISIONS_FLAG (0x1 << 8) ++ ++#define COLUMN_DOT3STATSINTERNALMACTRANSMITERRORS 10 ++#define COLUMN_DOT3STATSINTERNALMACTRANSMITERRORS_FLAG (0x1 << 9) ++ ++#define COLUMN_DOT3STATSCARRIERSENSEERRORS 11 ++#define COLUMN_DOT3STATSCARRIERSENSEERRORS_FLAG (0x1 << 10) ++ ++#define COLUMN_DOT3STATSFRAMETOOLONGS 13 ++#define COLUMN_DOT3STATSFRAMETOOLONGS_FLAG (0x1 << 12) ++ ++#define COLUMN_DOT3STATSINTERNALMACRECEIVEERRORS 16 ++#define COLUMN_DOT3STATSINTERNALMACRECEIVEERRORS_FLAG (0x1 << 15) ++ ++#define COLUMN_DOT3STATSETHERCHIPSET 17 ++#define COLUMN_DOT3STATSETHERCHIPSET_FLAG (0x1 << 16) ++ ++#define COLUMN_DOT3STATSSYMBOLERRORS 18 ++#define COLUMN_DOT3STATSSYMBOLERRORS_FLAG (0x1 << 17) ++ ++#define COLUMN_DOT3STATSDUPLEXSTATUS 19 ++#define COLUMN_DOT3STATSDUPLEXSTATUS_FLAG (0x1 << 18) ++ ++#define COLUMN_DOT3STATSRATECONTROLABILITY 20 ++#define COLUMN_DOT3STATSRATECONTROLABILITY_FLAG (0x1 << 19) ++ ++#define COLUMN_DOT3STATSRATECONTROLSTATUS 21 ++#define COLUMN_DOT3STATSRATECONTROLSTATUS_FLAG (0x1 << 20) ++ ++ ++#define DOT3STATSTABLE_MIN_COL COLUMN_DOT3STATSINDEX ++#define DOT3STATSTABLE_MAX_COL COLUMN_DOT3STATSRATECONTROLSTATUS ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* DOT3STATSTABLE_OIDS_H */ +Index: agent/mibgroup/etherlike-mib/ioctl_imp_common.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/etherlike-mib/ioctl_imp_common.h 2008-09-11 22:27:51.667791737 +0200 +@@ -0,0 +1,70 @@ ++#include ++#include ++#include ++#include ++#include ++ ++/* use kernel's ethtool.h */ ++ ++#include ++typedef __u64 u64; ++typedef __u32 u32; ++typedef __u16 u16; ++typedef __u8 u8; ++#include ++ ++/* structure for storing the interface names in the system */ ++ ++static struct ifname { ++ struct ifname *ifn_next; ++ char name [IF_NAMESIZE]; ++}; ++ ++static struct ifname *interface_name_list_get (struct ifname *, int *); ++static int interface_name_list_free (struct ifname *list_head); ++static u_long interface_ioctl_ifindex_get (int fd, const char *name); ++static int _dot3Stats_ioctl_get(int fd, int which, struct ifreq *ifrq, const char* name); ++int interface_ioctl_dot3stats_get(dot3StatsTable_rowreq_ctx *rowreq_ctx, int fd, const char* name); ++int interface_ioctl_dot3stats_duplex_get(dot3StatsTable_rowreq_ctx *rowreq_ctx, int fd, const char* name); ++ ++ ++/* for maintainability */ ++ ++#define INTEL_RECEIVE_ALIGN_ERRORS "rx_align_errors" ++#define BROADCOM_RECEIVE_ALIGN_ERRORS INTEL_RECEIVE_ALIGN_ERRORS ++ ++#define INTEL_TRANSMIT_MULTIPLE_COLLISIONS "tx_multi_coll_ok" ++#define BROADCOM_TRANSMIT_MULTIPLE_COLLISIONS "tx_multi_collisions" ++ ++#define INTEL_TRANSMIT_LATE_COLLISIONS "tx_abort_late_coll" ++#define BROADCOM_TRANSMIT_LATE_COLLISIONS "tx_late_collisions" ++ ++#define INTEL_TRANSMIT_SINGLE_COLLISIONS "tx_single_coll_ok" ++#define BROADCOM_TRANSMIT_SINGLE_COLLISIONS "tx_single_collisions" ++ ++#define BROADCOM_TRANSMIT_EXCESS_COLLISIONS "tx_excess_collisions" ++ ++ ++#define DOT3STATSALIGNMENTERRORS(x) strstr(x, INTEL_RECEIVE_ALIGN_ERRORS) ++ ++#define DOT3STATSMULTIPLECOLLISIONFRAMES(x) (strstr(x, INTEL_TRANSMIT_MULTIPLE_COLLISIONS)) || \ ++ (strstr(x, BROADCOM_TRANSMIT_MULTIPLE_COLLISIONS)) ++ ++#define DOT3STATSLATECOLLISIONS(x) (strstr(x, INTEL_TRANSMIT_LATE_COLLISIONS)) || \ ++ (strstr(x, BROADCOM_TRANSMIT_LATE_COLLISIONS)) ++ ++#define DOT3STATSSINGLECOLLISIONFRAMES(x) (strstr(x, INTEL_TRANSMIT_SINGLE_COLLISIONS)) || \ ++ (strstr(x, BROADCOM_TRANSMIT_SINGLE_COLLISIONS)) ++ ++#define DOT3STATSEXCESSIVECOLLISIONS(x) strstr(x, BROADCOM_TRANSMIT_EXCESS_COLLISIONS) ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +Index: agent/mibgroup/etherlike-mib.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/etherlike-mib.h 2008-09-11 22:27:51.709180832 +0200 +@@ -0,0 +1,10 @@ ++/* ++ * module to include the modules ++ */ ++ ++config_require(etherlike-mib/dot3StatsTable) ++config_require(etherlike-mib/dot3StatsTable_interface) ++config_require(etherlike-mib/dot3StatsTable_data_get) ++config_require(etherlike-mib/dot3StatsTable_data_set) ++config_require(etherlike-mib/dot3StatsTable_data_access) ++config_add_mib(ETHERLIKE-MIB) diff --git a/net-snmp-5.4.1.2-rmon-mib.patch b/net-snmp-5.4.1.2-rmon-mib.patch new file mode 100644 index 0000000..becbeff --- /dev/null +++ b/net-snmp-5.4.1.2-rmon-mib.patch @@ -0,0 +1,6935 @@ +Index: agent/mibgroup/rmon-mib/etherStatsTable.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/rmon-mib/etherStatsTable.c 2008-09-11 22:27:51.743792380 +0200 +@@ -0,0 +1,229 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 14170 $ of $ ++ * ++ * $Id:$ ++ */ ++/** \page MFD helper for etherStatsTable ++ * ++ * \section intro Introduction ++ * Introductory text. ++ * ++ */ ++/* ++ * standard Net-SNMP includes ++ */ ++#include ++#include ++#include ++ ++/* ++ * include our parent header ++ */ ++#include "etherStatsTable.h" ++ ++#include ++ ++#include "etherStatsTable_interface.h" ++ ++oid etherStatsTable_oid[] = { ETHERSTATSTABLE_OID }; ++int etherStatsTable_oid_size = OID_LENGTH(etherStatsTable_oid); ++ ++etherStatsTable_registration etherStatsTable_user_context; ++ ++void initialize_table_etherStatsTable(void); ++void shutdown_table_etherStatsTable(void); ++ ++ ++/** ++ * Initializes the etherStatsTable module ++ */ ++void ++init_etherStatsTable(void) ++{ ++ DEBUGMSGTL(("verbose:etherStatsTable:init_etherStatsTable", ++ "called\n")); ++ ++ /* ++ * TODO:300:o: Perform etherStatsTable one-time module initialization. ++ */ ++ ++ /* ++ * here we initialize all the tables we're planning on supporting ++ */ ++ if (should_init("etherStatsTable")) ++ initialize_table_etherStatsTable(); ++ ++} /* init_etherStatsTable */ ++ ++/** ++ * Shut-down the etherStatsTable module (agent is exiting) ++ */ ++void ++shutdown_etherStatsTable(void) ++{ ++ if (should_init("etherStatsTable")) ++ shutdown_table_etherStatsTable(); ++ ++} ++ ++/** ++ * Initialize the table etherStatsTable ++ * (Define its contents and how it's structured) ++ */ ++void ++initialize_table_etherStatsTable(void) ++{ ++ etherStatsTable_registration *user_context; ++ u_long flags; ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:initialize_table_etherStatsTable", ++ "called\n")); ++ ++ /* ++ * TODO:301:o: Perform etherStatsTable one-time table initialization. ++ */ ++ ++ /* ++ * TODO:302:o: |->Initialize etherStatsTable 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("etherStatsTable", NULL, NULL); ++ ++ /* ++ * No support for any flags yet, but in the future you would ++ * set any flags here. ++ */ ++ flags = 0; ++ ++ /* ++ * call interface initialization code ++ */ ++ _etherStatsTable_initialize_interface(user_context, flags); ++} /* initialize_table_etherStatsTable */ ++ ++/** ++ * Shutdown the table etherStatsTable ++ */ ++void ++shutdown_table_etherStatsTable(void) ++{ ++ /* ++ * call interface shutdown code ++ */ ++ _etherStatsTable_shutdown_interface(ðerStatsTable_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 ++etherStatsTable_rowreq_ctx_init(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ void *user_init_ctx) ++{ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_rowreq_ctx_init", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:210:o: |-> Perform extra etherStatsTable rowreq initialization. (eg DEFVALS) ++ */ ++ ++ return MFD_SUCCESS; ++} /* etherStatsTable_rowreq_ctx_init */ ++ ++/** ++ * extra context cleanup ++ * ++ */ ++void ++etherStatsTable_rowreq_ctx_cleanup(etherStatsTable_rowreq_ctx * rowreq_ctx) ++{ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_rowreq_ctx_cleanup", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:211:o: |-> Perform extra etherStatsTable rowreq cleanup. ++ */ ++} /* etherStatsTable_rowreq_ctx_cleanup */ ++ ++/** ++ * pre-request callback ++ * ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_ERROR : other error ++ */ ++int ++etherStatsTable_pre_request(etherStatsTable_registration * user_context) ++{ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_pre_request", ++ "called\n")); ++ ++ /* ++ * TODO:510:o: Perform etherStatsTable pre-request actions. ++ */ ++ ++ return MFD_SUCCESS; ++} /* etherStatsTable_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 ++etherStatsTable_post_request(etherStatsTable_registration * user_context, ++ int rc) ++{ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_post_request", ++ "called\n")); ++ ++ /* ++ * TODO:511:o: Perform etherStatsTable post-request actions. ++ */ ++ ++ /* ++ * check to set if any rows were changed. ++ */ ++ if (etherStatsTable_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 ++ */ ++ } ++ ++ etherStatsTable_dirty_set(0); /* clear table dirty flag */ ++ } ++ ++ return MFD_SUCCESS; ++} /* etherStatsTable_post_request */ ++ ++ ++/** @{ */ +Index: agent/mibgroup/rmon-mib/etherStatsTable_data_access.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/rmon-mib/etherStatsTable_data_access.c 2008-09-11 22:27:51.759791777 +0200 +@@ -0,0 +1,825 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 14170 $ of $ ++ * ++ * $Id:$ ++ */ ++/* ++ * standard Net-SNMP includes ++ */ ++#include ++#include ++#include ++ ++/* ++ * include our parent header ++ */ ++#include "etherStatsTable.h" ++ ++ ++#include "etherStatsTable_data_access.h" ++#include "ioctl_imp_common.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 etherStatsTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++/* ++ * RMON-MIB::etherStatsTable is subid 1 of statistics. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.16.1.1, length: 9 ++ */ ++ ++/** ++ * initialization for etherStatsTable data access ++ * ++ * This function is called during startup to allow you to ++ * allocate any resources you need for the data table. ++ * ++ * @param etherStatsTable_reg ++ * Pointer to etherStatsTable_registration ++ * ++ * @retval MFD_SUCCESS : success. ++ * @retval MFD_ERROR : unrecoverable error. ++ */ ++int ++etherStatsTable_init_data(etherStatsTable_registration * ++ etherStatsTable_reg) ++{ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_init_data", ++ "called\n")); ++ ++ /* ++ * TODO:303:o: Initialize etherStatsTable data. ++ */ ++ ++ return MFD_SUCCESS; ++} /* etherStatsTable_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 ++etherStatsTable_container_init(netsnmp_container ** container_ptr_ptr, ++ netsnmp_cache * cache) ++{ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_container_init", ++ "called\n")); ++ ++ if (NULL == container_ptr_ptr) { ++ snmp_log(LOG_ERR, ++ "bad container param to etherStatsTable_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 etherStatsTable_container_init\n"); ++ return; ++ } ++ ++ /* ++ * TODO:345:A: Set up etherStatsTable 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 = ETHERSTATSTABLE_CACHE_TIMEOUT; /* seconds */ ++} /* etherStatsTable_container_init */ ++ ++/** ++ * container shutdown ++ * ++ * @param container_ptr A pointer to the container. ++ * ++ * This function is called at shutdown to allow you to customize certain ++ * aspects of the access method. For the most part, it is for advanced ++ * users. The default code should suffice for most cases. ++ * ++ * This function is called before etherStatsTable_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 ++etherStatsTable_container_shutdown(netsnmp_container * container_ptr) ++{ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_container_shutdown", "called\n")); ++ ++ if (NULL == container_ptr) { ++ snmp_log(LOG_ERR, ++ "bad params to etherStatsTable_container_shutdown\n"); ++ return; ++ } ++ ++} /* etherStatsTable_container_shutdown */ ++ ++/** ++ * load initial data ++ * ++ * TODO:350:M: Implement etherStatsTable 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 ++ * etherStatsTable_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 ++etherStatsTable_container_load(netsnmp_container * container) ++{ ++ etherStatsTable_rowreq_ctx *rowreq_ctx; ++ size_t count = 0; ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_container_load", ++ "called\n")); ++ ++ /* ++ * TODO:352:M: | |-> set indexes in new etherStatsTable rowreq context. ++ * data context will be set from the param (unless NULL, ++ * in which case a new data context will be allocated) ++ */ ++ ++ /* ++ * temporary storage for index values ++ */ ++ ++ /* ++ * etherStatsIndex(1)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h ++ */ ++ ++ ++ long etherStatsIndex; ++ int fd; ++ int rc = 0, retval = 0; ++ struct ifname *list_head = NULL, *p = NULL; ++ ++ /* ++ * create socket for ioctls ++ */ ++ ++ fd = socket(AF_INET, SOCK_DGRAM, 0); ++ if(fd < 0) { ++ snmp_log(LOG_ERR, "could not create socket\n"); ++ return -2; ++ } ++ ++ /* ++ * get the interface names of the devices present in the system, in case of failure retval suggests the reson for failure ++ * and list_head contains null ++ */ ++ ++ list_head = interface_name_list_get (list_head, &retval); ++ ++ if (!list_head) { ++ snmp_log (LOG_ERR, "access:etherStatsTable, error getting the interface names present in the system\n"); ++ DEBUGMSGTL(("access:etherStatsTable", "error getting the interface names present in the system")); ++ return MFD_ERROR; ++ } ++ ++ /* ++ * Walk over the list of interface names present in the system and retreive the statistics ++ */ ++ ++ for (p = list_head; p; p = p->ifn_next) { ++ u_int flags; ++ ++ flags = 0; ++ ++ DEBUGMSGTL(("access:etherStatsTable", "processing '%s'\n", p->name)); ++ ++ /* ++ * get index via ioctl. ++ */ ++ ++ etherStatsIndex = interface_ioctl_ifindex_get(-1, p->name); ++ ++ /* ++ * get the etherstats contents populated, if the device is not an ethernet device ++ * the operation will not be supported and an error message will be logged ++ */ ++ ++ rowreq_ctx = etherStatsTable_allocate_rowreq_ctx(NULL); ++ if (NULL == rowreq_ctx) { ++ snmp_log(LOG_ERR, "memory allocation failed\n"); ++ return MFD_RESOURCE_UNAVAILABLE; ++ } ++ ++ if (MFD_SUCCESS != ++ etherStatsTable_indexes_set(rowreq_ctx, etherStatsIndex)) { ++ snmp_log(LOG_ERR, ++ "error setting index while loading " ++ "etherStatsTable data.\n"); ++ etherStatsTable_release_rowreq_ctx(rowreq_ctx); ++ continue; ++ } ++ ++ /* ++ * TODO:352:r: | |-> populate etherStatsTable data context. ++ * Populate data context here. (optionally, delay until row prep) ++ */ ++ /* ++ * non-TRANSIENT data: no need to copy. set pointer to data ++ */ ++ ++ memset (&rowreq_ctx->data, 0, sizeof (rowreq_ctx->data)); ++ rc = interface_ioctl_etherstats_get (rowreq_ctx, fd, p->name); ++ ++ if (rc < 0) { ++ snmp_log(LOG_ERR, ++ "error getting the statistics for interface |%s| " ++ "etherStatsTable data, operation might not be supported \n", p->name); ++ DEBUGMSGTL(("access:etherStatsTable", "error getting the statistics for interface |%s| " ++ "etherStatsTable data, operation might not be supported\n", p->name)); ++ etherStatsTable_release_rowreq_ctx(rowreq_ctx); ++ continue; ++ } ++ ++ /* ++ * insert into table container ++ */ ++ CONTAINER_INSERT(container, rowreq_ctx); ++ ++count; ++ } ++ ++ /* ++ * free the interface names list ++ */ ++ ++ if ( (interface_name_list_free(list_head)) < 0) { ++ snmp_log(LOG_ERR, "access:etherStatsTable, error freeing the interface name list \n"); ++ DEBUGMSGTL(("access:etherStatsTable", "error freeing the interface name list\n")); ++ return MFD_ERROR; ++ } ++ ++ ++ DEBUGMSGT(("verbose:etherStatsTable:etherStatsTable_container_load", ++ "inserted %d records\n", count)); ++ ++ return MFD_SUCCESS; ++} ++ /* etherStatsTable_container_load */ ++ ++/* ++ * @retval 0 success ++ * @retval -1 getifaddrs failed ++ * @retval -2 memory allocation failed ++ */ ++ ++static struct ifname * ++interface_name_list_get (struct ifname *list_head, int *retval) ++{ ++ struct ifaddrs *addrs = NULL, *p = NULL; ++ struct ifname *nameptr1=NULL, *nameptr2 = NULL; ++ ++ DEBUGMSGTL(("access:etherStatsTable:interface_name_list_get", ++ "called\n")); ++ ++ if ((getifaddrs(&addrs)) < 0) { ++ DEBUGMSGTL(("access:etherStatsTable:interface_name_list_get", ++ "getifaddrs failed\n")); ++ snmp_log (LOG_ERR, "access:etherStatsTable,interface_name_list_get, getifaddrs failed\n"); ++ *retval = -1; ++ return NULL; ++ } ++ ++ for (p = addrs; p; p = p->ifa_next) { ++ ++ if (!list_head) { ++ if ( (list_head = (struct ifname *) malloc (sizeof(struct ifname))) < 0) { ++ DEBUGMSGTL(("access:etherStatsTable:interface_name_list_get", ++ "memory allocation failed\n")); ++ snmp_log (LOG_ERR, "access:etherStatsTable,interface_name_list_get, memory allocation failed\n"); ++ freeifaddrs(addrs); ++ *retval = -2; ++ return NULL; ++ } ++ memset (list_head, 0, sizeof (struct ifname)); ++ strncpy (list_head->name, p->ifa_name, IF_NAMESIZE); ++ continue; ++ } ++ for (nameptr1 = list_head; nameptr1; nameptr2 = nameptr1, nameptr1 = nameptr1->ifn_next) ++ if (!strncmp(p->ifa_name, nameptr1->name, IF_NAMESIZE)) ++ break; ++ ++ if (nameptr1) ++ continue; ++ ++ if ( (nameptr2->ifn_next = (struct ifname *) malloc (sizeof(struct ifname))) < 0) { ++ DEBUGMSGTL(("access:etherStatsTable:interface_name_list_get", ++ "memory allocation failed\n")); ++ snmp_log (LOG_ERR, "access:etherStatsTable,interface_name_list_get, memory allocation failed\n"); ++ interface_name_list_free (list_head); ++ freeifaddrs(addrs); ++ *retval = -2; ++ return NULL; ++ } ++ nameptr2 = nameptr2->ifn_next; ++ memset (nameptr2, 0, sizeof (struct ifname)); ++ strncpy (nameptr2->name, p->ifa_name, IF_NAMESIZE); ++ continue; ++ ++ } ++ ++ freeifaddrs(addrs); ++ *retval = 0; ++ return list_head; ++} ++ ++ ++/* ++ * @retval 0 success ++ * @retval -1 invalid pointer ++ */ ++ ++static int ++interface_name_list_free (struct ifname *list_head) ++{ ++ struct ifname *nameptr1 = NULL, *nameptr2 = NULL; ++ ++ DEBUGMSGTL(("access:etherStatsTable:interface_name_list_free", ++ "called\n")); ++ ++ if (!list_head) { ++ snmp_log (LOG_ERR, "access:etherStatsTable:interface_name_list_free: invalid pointer list_head"); ++ DEBUGMSGTL(("access:etherStatsTable:interface_name_list_free", ++ "invalid pointer list_head\n")); ++ return -1; ++ } ++ ++ for (nameptr1 = list_head; nameptr1; nameptr1 = nameptr2) { ++ nameptr2 = nameptr1->ifn_next; ++ free (nameptr1); ++ } ++ ++ return 0; ++} ++ ++/* ++ * @retval 0 : not found ++ * @retval !0 : ifIndex ++ */ ++ ++static u_long ++interface_ioctl_ifindex_get (int fd, const char *name) { ++#ifndef SIOCGIFINDEX ++ return 0; ++#else ++ struct ifreq ifrq; ++ int rc = 0; ++ ++ DEBUGMSGTL(("access:etherStatsTable:ioctl", "ifindex_get\n")); ++ ++ rc = _etherStats_ioctl_get(fd, SIOCGIFINDEX, &ifrq, name); ++ if (rc < 0) { ++ DEBUGMSGTL(("access:etherStats:ioctl", ++ "ifindex_get error on inerface '%s'\n", name)); ++ snmp_log (LOG_ERR, "access:etherStatsTable:ioctl, ifindex_get error on inerface '%s'\n", name); ++ return 0; ++ ++ } ++ ++ return ifrq.ifr_ifindex; ++#endif /* SIOCGIFINDEX */ ++} ++ ++/* ++ * @retval 0 success ++ * @retval -1 cannot get ETHTOOL_DRVINFO failed ++ * @retval -2 n_stats zero - no statistcs available ++ * @retval -3 memory allocation for holding the statistics failed ++ * @retval -4 cannot get ETHTOOL_GSTRINGS information ++ * @retval -5 cannot get ETHTOOL_GSTATS information ++ * @retval -6 function not supported if HAVE_LINUX_ETHTOOL_H not defined ++ */ ++ ++int ++interface_ioctl_etherstats_get (etherStatsTable_rowreq_ctx *rowreq_ctx , int fd, const char *name) { ++ ++#ifdef HAVE_LINUX_ETHTOOL_H ++ ++ etherStatsTable_data *data = &rowreq_ctx->data; ++ struct ethtool_drvinfo driver_info; ++ struct ethtool_gstrings *eth_strings; ++ struct ethtool_stats *eth_stats; ++ struct ifreq ifr; ++ unsigned int nstats, size_str, size_stats, i; ++ int err; ++ ++ DEBUGMSGTL(("access:etherStatsTable:interface_ioctl_etherstats_get", ++ "called\n")); ++ ++ memset(&ifr, 0, sizeof(ifr)); ++ strcpy(ifr.ifr_name, name); ++ ++ memset(&driver_info, 0, sizeof(driver_info)); ++ driver_info.cmd = ETHTOOL_GDRVINFO; ++ ifr.ifr_data = (char *)&driver_info; ++ ++ err = _etherStats_ioctl_get(fd, SIOCETHTOOL, &ifr, name); ++ if (err < 0) { ++ DEBUGMSGTL(("access:etherStatsTable:interface_ioctl_etherstats_get", ++ "ETHTOOL_GETDRVINFO failed on interface |%s| \n", name)); ++ snmp_log (LOG_ERR, "access:etherStatsTable,interface_ioctl_etherstats_get, ETHTOOL_GETDRVINFO failed on interface |%s| \n", name); ++ return -1; ++ } ++ ++ nstats = driver_info.n_stats; ++ if (nstats < 1) { ++ DEBUGMSGTL(("access:etherStatsTable:interface_ioctl_etherstats_get", ++ "no stats available for interface |%s| \n", name)); ++ snmp_log (LOG_ERR, "access:etherStatsTable,interface_ioctl_etherstats_get, no stats availablei for interface |%s| \n", name); ++ return -2; ++ } ++ ++ size_str = nstats * ETH_GSTRING_LEN; ++ size_stats = nstats * sizeof(u64); ++ ++ eth_strings = malloc(size_str + sizeof (struct ethtool_gstrings)); ++ if (!eth_strings) { ++ DEBUGMSGTL(("access:etherStatsTable:interface_ioctl_etherstats_get", ++ "no memory available\n")); ++ snmp_log (LOG_ERR, "access:etherStatsTable,interface_ioctl_etherstats_get, no memory available\n"); ++ ++ return -3; ++ } ++ memset (eth_strings, 0, (size_str + sizeof (struct ethtool_gstrings))); ++ ++ eth_stats = malloc (size_str + sizeof (struct ethtool_stats)); ++ if (!eth_stats) { ++ free (eth_strings); ++ DEBUGMSGTL(("access:etherStatsTable:interface_ioctl_etherstats_get", ++ "no memory available\n")); ++ snmp_log (LOG_ERR, "access:etherStatsTable,interface_ioctl_etherstats_get, no memory available\n"); ++ ++ return -3; ++ } ++ memset (eth_stats, 0, (size_str + sizeof (struct ethtool_stats))); ++ ++ eth_strings->cmd = ETHTOOL_GSTRINGS; ++ eth_strings->string_set = ETH_SS_STATS; ++ eth_strings->len = nstats; ++ ifr.ifr_data = (char *) eth_strings; ++ ++ err = _etherStats_ioctl_get(fd, SIOCETHTOOL, &ifr, name); ++ if (err < 0) { ++ DEBUGMSGTL(("access:etherStatsTable:interface_ioctl_etherstats_get", ++ "cannot get stats strings information for interface |%s| \n", name)); ++ snmp_log (LOG_ERR, "access:etherStatsTable,interface_ioctl_etherstats_get, cannot get stats strings information for interface |%s| \n", name); ++ ++ free(eth_strings); ++ free(eth_stats); ++ return -4; ++ } ++ ++ eth_stats->cmd = ETHTOOL_GSTATS; ++ eth_stats->n_stats = nstats; ++ ifr.ifr_data = (char *) eth_stats; ++ err = _etherStats_ioctl_get(fd, SIOCETHTOOL, &ifr, name); ++ if (err < 0) { ++ DEBUGMSGTL(("access:etherStatsTable:interface_ioctl_etherstats_get", ++ "cannot get stats strings information for interface |%s| \n", name)); ++ snmp_log (LOG_ERR, "access:etherStatsTable,interface_ioctl_etherstats_get, cannot get stats information for interface |%s| \n", name); ++ ++ free(eth_strings); ++ free(eth_stats); ++ return -5; ++ } ++ ++ for (i = 0; i < nstats; i++) { ++ char s[ETH_GSTRING_LEN]; ++ ++ strncpy(s, (const char *) ð_strings->data[i * ETH_GSTRING_LEN], ++ ETH_GSTRING_LEN); ++ ++ if (ETHERSTATSJABBERS(s)) { ++ data->etherStatsJabbers = (u_long)eth_stats->data[i]; ++ rowreq_ctx->column_exists_flags |= COLUMN_ETHERSTATSJABBERS_FLAG; ++ } ++ } ++ free(eth_strings); ++ free(eth_stats); ++ ++ return 0; ++#else ++ return -6; ++#endif ++ ++} ++ ++ ++/* ioctl wrapper ++ * ++ * @param fd : socket fd to use w/ioctl, or -1 to open/close one ++ * @param which ++ * @param ifrq ++ * param ifentry : ifentry to update ++ * @param name ++ * ++ * @retval 0 : success ++ * @retval -1 : invalid parameters ++ * @retval -2 : couldn't create socket ++ * @retval -3 : ioctl call failed ++ */ ++static int ++_etherStats_ioctl_get(int fd, int which, struct ifreq *ifrq, const char* name) ++{ ++ int ourfd = -1, rc = 0; ++ ++ DEBUGMSGTL(("access:etherStatsTable:ioctl", "_etherStats_ioctl_get\n")); ++ /* ++ * sanity checks ++ */ ++ if(NULL == name) { ++ DEBUGMSGTL(("access:etherStatsTable:ioctl", ++ "_etherStats_ioctl_get invalid ifname '%s'\n", name)); ++ snmp_log (LOG_ERR, "access:etherStatsTable:ioctl, _etherStats_ioctl_get error on inerface '%s'\n", name); ++ return -1; ++ } ++ ++ /* ++ * create socket for ioctls ++ */ ++ if(fd < 0) { ++ fd = ourfd = socket(AF_INET, SOCK_DGRAM, 0); ++ if(ourfd < 0) { ++ DEBUGMSGTL(("access:etherStatsTable:ioctl", ++ "_etherStats_ioctl_get couldn't create a socket\n", name)); ++ snmp_log (LOG_ERR, "access:etherStatsTable:ioctl, _etherStats_ioctl_get error on inerface '%s'\n", name); ++ ++ return -2; ++ } ++ } ++ ++ strncpy(ifrq->ifr_name, name, sizeof(ifrq->ifr_name)); ++ ifrq->ifr_name[ sizeof(ifrq->ifr_name)-1 ] = 0; ++ rc = ioctl(fd, which, ifrq); ++ if (rc < 0) { ++ DEBUGMSGTL(("access:etherStatsTable:ioctl", ++ "_etherStats_ioctl_get ioctl %d returned %d\n", which, rc)); ++ snmp_log (LOG_ERR, "access:etherStatsTable:ioctl, _etherStats_ioctl_get error on inerface '%s'\n", name); ++ ++ rc = -3; ++ } ++ ++ if(ourfd >= 0) ++ close(ourfd); ++ ++ return rc; ++} ++ ++/** ++ * 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 ++etherStatsTable_container_free(netsnmp_container * container) ++{ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_container_free", ++ "called\n")); ++ ++ /* ++ * TODO:380:M: Free etherStatsTable container data. ++ */ ++} /* etherStatsTable_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 ++etherStatsTable_row_prep(etherStatsTable_rowreq_ctx * rowreq_ctx) ++{ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_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; ++} /* etherStatsTable_row_prep */ ++ ++/* ++ * TODO:420:r: Implement etherStatsTable index validation. ++ */ ++/*--------------------------------------------------------------------- ++ * RMON-MIB::etherStatsEntry.etherStatsIndex ++ * etherStatsIndex is subid 1 of etherStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.16.1.1.1.1 ++ * Description: ++The value of this object uniquely identifies this ++ etherStats entry. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 1 hashint 0 ++ * settable 0 ++ * ++ * Ranges: 1 - 65535; ++ * ++ * Its syntax is INTEGER32 (based on perltype INTEGER32) ++ * The net-snmp type is ASN_INTEGER. The C type decl is long (long) ++ */ ++/** ++ * check validity of etherStatsIndex 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 ++ * etherStatsTable_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 - 65535 ++ * ++ * If there a no other checks you need to do, simply return MFD_SUCCESS. ++ */ ++int ++etherStatsIndex_check_index(etherStatsTable_rowreq_ctx * rowreq_ctx) ++{ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsIndex_check_index", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:426:M: |-> Check etherStatsTable index etherStatsIndex. ++ * check that index value in the table context is legal. ++ * (rowreq_ctx->tbl_index.etherStatsIndex) ++ */ ++ ++ return MFD_SUCCESS; /* etherStatsIndex index ok */ ++} /* etherStatsIndex_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 etherStatsTable_reg ++ * Pointer to the user registration data ++ * @param etherStatsTable_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 ++etherStatsTable_validate_index(etherStatsTable_registration * ++ etherStatsTable_reg, ++ etherStatsTable_rowreq_ctx * rowreq_ctx) ++{ ++ int rc = MFD_SUCCESS; ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_validate_index", ++ "called\n")); ++ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:430:M: |-> Validate potential etherStatsTable index. ++ */ ++ if (1) { ++ snmp_log(LOG_WARNING, "invalid index for a new row in the " ++ "etherStatsTable 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; ++} /* etherStatsTable_validate_index */ ++ ++/** @} */ +Index: agent/mibgroup/rmon-mib/etherStatsTable_data_access.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/rmon-mib/etherStatsTable_data_access.h 2008-09-11 22:27:51.775791616 +0200 +@@ -0,0 +1,80 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 14170 $ of $ ++ * ++ * $Id:$ ++ */ ++#ifndef ETHERSTATSTABLE_DATA_ACCESS_H ++#define ETHERSTATSTABLE_DATA_ACCESS_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++ /* ++ ********************************************************************* ++ * function declarations ++ */ ++ ++ /* ++ ********************************************************************* ++ * Table declarations ++ */ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table etherStatsTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++ /* ++ * RMON-MIB::etherStatsTable is subid 1 of statistics. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.16.1.1, length: 9 ++ */ ++ ++ ++ int etherStatsTable_init_data(etherStatsTable_registration ++ * etherStatsTable_reg); ++ ++ ++ /* ++ * TODO:180:o: Review etherStatsTable cache timeout. ++ * The number of seconds before the cache times out ++ */ ++#define ETHERSTATSTABLE_CACHE_TIMEOUT 60 ++ ++ void etherStatsTable_container_init(netsnmp_container ** ++ container_ptr_ptr, ++ netsnmp_cache * cache); ++ void etherStatsTable_container_shutdown(netsnmp_container * ++ container_ptr); ++ ++ int etherStatsTable_container_load(netsnmp_container * ++ container); ++ void etherStatsTable_container_free(netsnmp_container * ++ container); ++ ++ int etherStatsTable_cache_load(netsnmp_container * ++ container); ++ void etherStatsTable_cache_free(netsnmp_container * ++ container); ++ ++#define MAX_LINE_SIZE 256 ++ ++ int etherStatsTable_row_prep(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ int ++ etherStatsTable_validate_index(etherStatsTable_registration * ++ etherStatsTable_reg, ++ etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ int etherStatsIndex_check_index(etherStatsTable_rowreq_ctx * rowreq_ctx); /* internal */ ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* ETHERSTATSTABLE_DATA_ACCESS_H */ +Index: agent/mibgroup/rmon-mib/etherStatsTable_data_get.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/rmon-mib/etherStatsTable_data_get.c 2008-09-11 22:27:51.794514885 +0200 +@@ -0,0 +1,1411 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 12088 $ of $ ++ * ++ * $Id:$ ++ */ ++/* ++ * standard Net-SNMP includes ++ */ ++#include ++#include ++#include ++ ++/* ++ * include our parent header ++ */ ++#include "etherStatsTable.h" ++ ++ ++/** @defgroup data_get data_get: Routines to get data ++ * ++ * TODO:230:M: Implement etherStatsTable get routines. ++ * TODO:240:M: Implement etherStatsTable mapping routines (if any). ++ * ++ * These routine are used to get the value for individual objects. The ++ * row context is passed, along with a pointer to the memory where the ++ * value should be copied. ++ * ++ * @{ ++ */ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table etherStatsTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++/* ++ * RMON-MIB::etherStatsTable is subid 1 of statistics. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.16.1.1, length: 9 ++ */ ++ ++/* ++ * --------------------------------------------------------------------- ++ * * TODO:200:r: Implement etherStatsTable data context functions. ++ */ ++ ++ ++/** ++ * set mib index(es) ++ * ++ * @param tbl_idx mib index structure ++ * @param etherStatsIndex_val ++ * ++ * @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 ++etherStatsTable_indexes_set_tbl_idx(etherStatsTable_mib_index * tbl_idx, ++ long etherStatsIndex_val) ++{ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_indexes_set_tbl_idx", "called\n")); ++ ++ /* ++ * etherStatsIndex(1)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h ++ */ ++ tbl_idx->etherStatsIndex = etherStatsIndex_val; ++ ++ ++ return MFD_SUCCESS; ++} /* etherStatsTable_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 ++etherStatsTable_indexes_set(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ long etherStatsIndex_val) ++{ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_indexes_set", ++ "called\n")); ++ ++ if (MFD_SUCCESS != ++ etherStatsTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx, ++ etherStatsIndex_val)) ++ return MFD_ERROR; ++ ++ /* ++ * convert mib index to oid index ++ */ ++ rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid); ++ if (0 != etherStatsTable_index_to_oid(&rowreq_ctx->oid_idx, ++ &rowreq_ctx->tbl_idx)) { ++ return MFD_ERROR; ++ } ++ ++ return MFD_SUCCESS; ++} /* etherStatsTable_indexes_set */ ++ ++ ++/*--------------------------------------------------------------------- ++ * RMON-MIB::etherStatsEntry.etherStatsDataSource ++ * etherStatsDataSource is subid 2 of etherStatsEntry. ++ * Its status is Current, and its access level is Create. ++ * OID: .1.3.6.1.2.1.16.1.1.1.2 ++ * Description: ++This object identifies the source of the data that ++ this etherStats entry is configured to analyze. This ++ source can be any ethernet interface on this device. ++ In order to identify a particular interface, this object ++ shall identify the instance of the ifIndex object, ++ defined in RFC 2233 [17], for the desired interface. ++ For example, if an entry were to receive data from ++ interface #1, this object would be set to ifIndex.1. ++ ++ The statistics in this group reflect all packets ++ on the local network segment attached to the identified ++ interface. ++ ++ An agent may or may not be able to tell if fundamental ++ changes to the media of the interface have occurred and ++ necessitate an invalidation of this entry. For example, a ++ hot-pluggable ethernet card could be pulled out and replaced ++ by a token-ring card. In such a case, if the agent has such ++ knowledge of the change, it is recommended that it ++ invalidate this entry. ++ ++ This object may not be modified if the associated ++ etherStatsStatus object is equal to valid(1). ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 1 ++ * ++ * ++ * Its syntax is OBJECTID (based on perltype OBJECTID) ++ * The net-snmp type is ASN_OBJECT_ID. The C type decl is oid (oid) ++ * This data type requires a length. ++ */ ++/** ++ * Extract the current value of the etherStatsDataSource data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param etherStatsDataSource_val_ptr_ptr ++ * Pointer to storage for a oid variable ++ * @param etherStatsDataSource_val_ptr_len_ptr ++ * Pointer to a size_t. On entry, it will contain the size (in bytes) ++ * pointed to by etherStatsDataSource. ++ * 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 (*etherStatsDataSource_val_ptr_len_ptr) bytes of memory, ++ * allocate it using malloc() and update etherStatsDataSource_val_ptr_ptr. ++ * DO NOT 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 ++etherStatsDataSource_get(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ oid ** etherStatsDataSource_val_ptr_ptr, ++ size_t *etherStatsDataSource_val_ptr_len_ptr) ++{ ++ /** we should have a non-NULL pointer and enough storage */ ++ netsnmp_assert((NULL != etherStatsDataSource_val_ptr_ptr) ++ && (NULL != *etherStatsDataSource_val_ptr_ptr)); ++ netsnmp_assert(NULL != etherStatsDataSource_val_ptr_len_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsDataSource_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the etherStatsDataSource data. ++ * copy (* etherStatsDataSource_val_ptr_ptr ) data and (* etherStatsDataSource_val_ptr_len_ptr ) from rowreq_ctx->data ++ */ ++ /* ++ * make sure there is enough space for etherStatsDataSource data ++ */ ++ if ((NULL == (*etherStatsDataSource_val_ptr_ptr)) || ++ ((*etherStatsDataSource_val_ptr_len_ptr) < ++ (rowreq_ctx->data.etherStatsDataSource_len * ++ sizeof(rowreq_ctx->data.etherStatsDataSource[0])))) { ++ /* ++ * allocate space for etherStatsDataSource data ++ */ ++ (*etherStatsDataSource_val_ptr_ptr) = ++ malloc(rowreq_ctx->data.etherStatsDataSource_len * ++ sizeof(rowreq_ctx->data.etherStatsDataSource[0])); ++ if (NULL == (*etherStatsDataSource_val_ptr_ptr)) { ++ snmp_log(LOG_ERR, "could not allocate memory\n"); ++ return MFD_ERROR; ++ } ++ } ++ (*etherStatsDataSource_val_ptr_len_ptr) = ++ rowreq_ctx->data.etherStatsDataSource_len * ++ sizeof(rowreq_ctx->data.etherStatsDataSource[0]); ++ memcpy((*etherStatsDataSource_val_ptr_ptr), ++ rowreq_ctx->data.etherStatsDataSource, ++ rowreq_ctx->data.etherStatsDataSource_len * ++ sizeof(rowreq_ctx->data.etherStatsDataSource[0])); ++ ++ return MFD_SUCCESS; ++} /* etherStatsDataSource_get */ ++ ++/*--------------------------------------------------------------------- ++ * RMON-MIB::etherStatsEntry.etherStatsDropEvents ++ * etherStatsDropEvents is subid 3 of etherStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.16.1.1.1.3 ++ * Description: ++The total number of events in which packets ++ were dropped by the probe due to lack of resources. ++ Note that this number is not necessarily the number of ++ packets dropped; it is just the number of times this ++ condition has been detected. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the etherStatsDropEvents data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param etherStatsDropEvents_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 ++etherStatsDropEvents_get(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * etherStatsDropEvents_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != etherStatsDropEvents_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsDropEvents_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the etherStatsDropEvents data. ++ * copy (* etherStatsDropEvents_val_ptr ) from rowreq_ctx->data ++ */ ++ (*etherStatsDropEvents_val_ptr) = ++ rowreq_ctx->data.etherStatsDropEvents; ++ ++ return MFD_SUCCESS; ++} /* etherStatsDropEvents_get */ ++ ++/*--------------------------------------------------------------------- ++ * RMON-MIB::etherStatsEntry.etherStatsOctets ++ * etherStatsOctets is subid 4 of etherStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.16.1.1.1.4 ++ * Description: ++The total number of octets of data (including ++ those in bad packets) received on the ++ network (excluding framing bits but including ++ FCS octets). ++ ++ This object can be used as a reasonable estimate of ++ 10-Megabit ethernet utilization. If greater precision is ++ desired, the etherStatsPkts and etherStatsOctets objects ++ should be sampled before and after a common interval. The ++ differences in the sampled values are Pkts and Octets, ++ respectively, and the number of seconds in the interval is ++ Interval. These values are used to calculate the Utilization ++ as follows: ++ ++ Pkts * (9.6 + 6.4) + (Octets * .8) ++ Utilization = ------------------------------------- ++ Interval * 10,000 ++ ++ The result of this equation is the value Utilization which ++ is the percent utilization of the ethernet segment on a ++ scale of 0 to 100 percent. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the etherStatsOctets data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param etherStatsOctets_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 ++etherStatsOctets_get(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * etherStatsOctets_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != etherStatsOctets_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsOctets_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the etherStatsOctets data. ++ * copy (* etherStatsOctets_val_ptr ) from rowreq_ctx->data ++ */ ++ (*etherStatsOctets_val_ptr) = rowreq_ctx->data.etherStatsOctets; ++ ++ return MFD_SUCCESS; ++} /* etherStatsOctets_get */ ++ ++/*--------------------------------------------------------------------- ++ * RMON-MIB::etherStatsEntry.etherStatsPkts ++ * etherStatsPkts is subid 5 of etherStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.16.1.1.1.5 ++ * Description: ++The total number of packets (including bad packets, ++ broadcast packets, and multicast packets) received. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the etherStatsPkts data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param etherStatsPkts_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 ++etherStatsPkts_get(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * etherStatsPkts_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != etherStatsPkts_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsPkts_get", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the etherStatsPkts data. ++ * copy (* etherStatsPkts_val_ptr ) from rowreq_ctx->data ++ */ ++ (*etherStatsPkts_val_ptr) = rowreq_ctx->data.etherStatsPkts; ++ ++ return MFD_SUCCESS; ++} /* etherStatsPkts_get */ ++ ++/*--------------------------------------------------------------------- ++ * RMON-MIB::etherStatsEntry.etherStatsBroadcastPkts ++ * etherStatsBroadcastPkts is subid 6 of etherStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.16.1.1.1.6 ++ * Description: ++The total number of good packets received that were ++ directed to the broadcast address. Note that this ++ does not include multicast packets. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the etherStatsBroadcastPkts data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param etherStatsBroadcastPkts_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 ++etherStatsBroadcastPkts_get(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * etherStatsBroadcastPkts_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != etherStatsBroadcastPkts_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsBroadcastPkts_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the etherStatsBroadcastPkts data. ++ * copy (* etherStatsBroadcastPkts_val_ptr ) from rowreq_ctx->data ++ */ ++ (*etherStatsBroadcastPkts_val_ptr) = ++ rowreq_ctx->data.etherStatsBroadcastPkts; ++ ++ return MFD_SUCCESS; ++} /* etherStatsBroadcastPkts_get */ ++ ++/*--------------------------------------------------------------------- ++ * RMON-MIB::etherStatsEntry.etherStatsMulticastPkts ++ * etherStatsMulticastPkts is subid 7 of etherStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.16.1.1.1.7 ++ * Description: ++The total number of good packets received that were ++ directed to a multicast address. Note that this number ++ does not include packets directed to the broadcast ++ ++ address. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the etherStatsMulticastPkts data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param etherStatsMulticastPkts_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 ++etherStatsMulticastPkts_get(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * etherStatsMulticastPkts_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != etherStatsMulticastPkts_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsMulticastPkts_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the etherStatsMulticastPkts data. ++ * copy (* etherStatsMulticastPkts_val_ptr ) from rowreq_ctx->data ++ */ ++ (*etherStatsMulticastPkts_val_ptr) = ++ rowreq_ctx->data.etherStatsMulticastPkts; ++ ++ return MFD_SUCCESS; ++} /* etherStatsMulticastPkts_get */ ++ ++/*--------------------------------------------------------------------- ++ * RMON-MIB::etherStatsEntry.etherStatsCRCAlignErrors ++ * etherStatsCRCAlignErrors is subid 8 of etherStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.16.1.1.1.8 ++ * Description: ++The total number of packets received that ++ had a length (excluding framing bits, but ++ including FCS octets) of between 64 and 1518 ++ octets, inclusive, but had either a bad ++ Frame Check Sequence (FCS) with an integral ++ number of octets (FCS Error) or a bad FCS with ++ a non-integral number of octets (Alignment Error). ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the etherStatsCRCAlignErrors data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param etherStatsCRCAlignErrors_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 ++etherStatsCRCAlignErrors_get(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * etherStatsCRCAlignErrors_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != etherStatsCRCAlignErrors_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsCRCAlignErrors_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the etherStatsCRCAlignErrors data. ++ * copy (* etherStatsCRCAlignErrors_val_ptr ) from rowreq_ctx->data ++ */ ++ (*etherStatsCRCAlignErrors_val_ptr) = ++ rowreq_ctx->data.etherStatsCRCAlignErrors; ++ ++ return MFD_SUCCESS; ++} /* etherStatsCRCAlignErrors_get */ ++ ++/*--------------------------------------------------------------------- ++ * RMON-MIB::etherStatsEntry.etherStatsUndersizePkts ++ * etherStatsUndersizePkts is subid 9 of etherStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.16.1.1.1.9 ++ * Description: ++The total number of packets received that were ++ less than 64 octets long (excluding framing bits, ++ but including FCS octets) and were otherwise well ++ formed. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the etherStatsUndersizePkts data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param etherStatsUndersizePkts_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 ++etherStatsUndersizePkts_get(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * etherStatsUndersizePkts_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != etherStatsUndersizePkts_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsUndersizePkts_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the etherStatsUndersizePkts data. ++ * copy (* etherStatsUndersizePkts_val_ptr ) from rowreq_ctx->data ++ */ ++ (*etherStatsUndersizePkts_val_ptr) = ++ rowreq_ctx->data.etherStatsUndersizePkts; ++ ++ return MFD_SUCCESS; ++} /* etherStatsUndersizePkts_get */ ++ ++/*--------------------------------------------------------------------- ++ * RMON-MIB::etherStatsEntry.etherStatsOversizePkts ++ * etherStatsOversizePkts is subid 10 of etherStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.16.1.1.1.10 ++ * Description: ++The total number of packets received that were ++ longer than 1518 octets (excluding framing bits, ++ but including FCS octets) and were otherwise ++ well formed. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the etherStatsOversizePkts data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param etherStatsOversizePkts_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 ++etherStatsOversizePkts_get(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * etherStatsOversizePkts_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != etherStatsOversizePkts_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsOversizePkts_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the etherStatsOversizePkts data. ++ * copy (* etherStatsOversizePkts_val_ptr ) from rowreq_ctx->data ++ */ ++ (*etherStatsOversizePkts_val_ptr) = ++ rowreq_ctx->data.etherStatsOversizePkts; ++ ++ return MFD_SUCCESS; ++} /* etherStatsOversizePkts_get */ ++ ++/*--------------------------------------------------------------------- ++ * RMON-MIB::etherStatsEntry.etherStatsFragments ++ * etherStatsFragments is subid 11 of etherStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.16.1.1.1.11 ++ * Description: ++The total number of packets received that were less than ++ 64 octets in length (excluding framing bits but including ++ FCS octets) and had either a bad Frame Check Sequence ++ (FCS) with an integral number of octets (FCS Error) or a ++ bad FCS with a non-integral number of octets (Alignment ++ Error). ++ ++ Note that it is entirely normal for etherStatsFragments to ++ increment. This is because it counts both runts (which are ++ normal occurrences due to collisions) and noise hits. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the etherStatsFragments data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param etherStatsFragments_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 ++etherStatsFragments_get(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * etherStatsFragments_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != etherStatsFragments_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsFragments_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the etherStatsFragments data. ++ * copy (* etherStatsFragments_val_ptr ) from rowreq_ctx->data ++ */ ++ (*etherStatsFragments_val_ptr) = rowreq_ctx->data.etherStatsFragments; ++ ++ return MFD_SUCCESS; ++} /* etherStatsFragments_get */ ++ ++/*--------------------------------------------------------------------- ++ * RMON-MIB::etherStatsEntry.etherStatsJabbers ++ * etherStatsJabbers is subid 12 of etherStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.16.1.1.1.12 ++ * Description: ++The total number of packets received that were ++ longer than 1518 octets (excluding framing bits, ++ but including FCS octets), and had either a bad ++ Frame Check Sequence (FCS) with an integral number ++ of octets (FCS Error) or a bad FCS with a non-integral ++ number of octets (Alignment Error). ++ ++ Note that this definition of jabber is different ++ than the definition in IEEE-802.3 section 8.2.1.5 ++ (10BASE5) and section 10.3.1.4 (10BASE2). These ++ documents define jabber as the condition where any ++ packet exceeds 20 ms. The allowed range to detect ++ jabber is between 20 ms and 150 ms. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the etherStatsJabbers data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param etherStatsJabbers_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 ++etherStatsJabbers_get(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * etherStatsJabbers_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != etherStatsJabbers_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsJabbers_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ /* ++ * TODO:231:o: |-> Extract the current value of the etherStatsJabbers data. ++ * copy (* etherStatsJabbers_val_ptr ) from rowreq_ctx->data ++ */ ++ (*etherStatsJabbers_val_ptr) = rowreq_ctx->data.etherStatsJabbers; ++ ++ return MFD_SUCCESS; ++} /* etherStatsJabbers_get */ ++ ++/*--------------------------------------------------------------------- ++ * RMON-MIB::etherStatsEntry.etherStatsCollisions ++ * etherStatsCollisions is subid 13 of etherStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.16.1.1.1.13 ++ * Description: ++The best estimate of the total number of collisions ++ on this Ethernet segment. ++ ++ The value returned will depend on the location of the ++ RMON probe. Section 8.2.1.3 (10BASE-5) and section ++ 10.3.1.3 (10BASE-2) of IEEE standard 802.3 states that a ++ station must detect a collision, in the receive mode, if ++ three or more stations are transmitting simultaneously. A ++ repeater port must detect a collision when two or more ++ ++ stations are transmitting simultaneously. Thus a probe ++ placed on a repeater port could record more collisions ++ than a probe connected to a station on the same segment ++ would. ++ ++ Probe location plays a much smaller role when considering ++ 10BASE-T. 14.2.1.4 (10BASE-T) of IEEE standard 802.3 ++ defines a collision as the simultaneous presence of signals ++ on the DO and RD circuits (transmitting and receiving ++ at the same time). A 10BASE-T station can only detect ++ collisions when it is transmitting. Thus probes placed on ++ a station and a repeater, should report the same number of ++ collisions. ++ ++ Note also that an RMON probe inside a repeater should ++ ideally report collisions between the repeater and one or ++ more other hosts (transmit collisions as defined by IEEE ++ 802.3k) plus receiver collisions observed on any coax ++ segments to which the repeater is connected. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the etherStatsCollisions data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param etherStatsCollisions_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 ++etherStatsCollisions_get(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * etherStatsCollisions_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != etherStatsCollisions_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsCollisions_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the etherStatsCollisions data. ++ * copy (* etherStatsCollisions_val_ptr ) from rowreq_ctx->data ++ */ ++ (*etherStatsCollisions_val_ptr) = ++ rowreq_ctx->data.etherStatsCollisions; ++ ++ return MFD_SUCCESS; ++} /* etherStatsCollisions_get */ ++ ++/*--------------------------------------------------------------------- ++ * RMON-MIB::etherStatsEntry.etherStatsPkts64Octets ++ * etherStatsPkts64Octets is subid 14 of etherStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.16.1.1.1.14 ++ * Description: ++The total number of packets (including bad ++ packets) received that were 64 octets in length ++ (excluding framing bits but including FCS octets). ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the etherStatsPkts64Octets data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param etherStatsPkts64Octets_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 ++etherStatsPkts64Octets_get(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * etherStatsPkts64Octets_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != etherStatsPkts64Octets_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsPkts64Octets_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the etherStatsPkts64Octets data. ++ * copy (* etherStatsPkts64Octets_val_ptr ) from rowreq_ctx->data ++ */ ++ (*etherStatsPkts64Octets_val_ptr) = ++ rowreq_ctx->data.etherStatsPkts64Octets; ++ ++ return MFD_SUCCESS; ++} /* etherStatsPkts64Octets_get */ ++ ++/*--------------------------------------------------------------------- ++ * RMON-MIB::etherStatsEntry.etherStatsPkts65to127Octets ++ * etherStatsPkts65to127Octets is subid 15 of etherStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.16.1.1.1.15 ++ * Description: ++The total number of packets (including bad ++ packets) received that were between ++ 65 and 127 octets in length inclusive ++ (excluding framing bits but including FCS octets). ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the etherStatsPkts65to127Octets data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param etherStatsPkts65to127Octets_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 ++etherStatsPkts65to127Octets_get(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ++ etherStatsPkts65to127Octets_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != etherStatsPkts65to127Octets_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsPkts65to127Octets_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the etherStatsPkts65to127Octets data. ++ * copy (* etherStatsPkts65to127Octets_val_ptr ) from rowreq_ctx->data ++ */ ++ (*etherStatsPkts65to127Octets_val_ptr) = ++ rowreq_ctx->data.etherStatsPkts65to127Octets; ++ ++ return MFD_SUCCESS; ++} /* etherStatsPkts65to127Octets_get */ ++ ++/*--------------------------------------------------------------------- ++ * RMON-MIB::etherStatsEntry.etherStatsPkts128to255Octets ++ * etherStatsPkts128to255Octets is subid 16 of etherStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.16.1.1.1.16 ++ * Description: ++The total number of packets (including bad ++ packets) received that were between ++ 128 and 255 octets in length inclusive ++ (excluding framing bits but including FCS octets). ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the etherStatsPkts128to255Octets data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param etherStatsPkts128to255Octets_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 ++etherStatsPkts128to255Octets_get(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ++ etherStatsPkts128to255Octets_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != etherStatsPkts128to255Octets_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsPkts128to255Octets_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the etherStatsPkts128to255Octets data. ++ * copy (* etherStatsPkts128to255Octets_val_ptr ) from rowreq_ctx->data ++ */ ++ (*etherStatsPkts128to255Octets_val_ptr) = ++ rowreq_ctx->data.etherStatsPkts128to255Octets; ++ ++ return MFD_SUCCESS; ++} /* etherStatsPkts128to255Octets_get */ ++ ++/*--------------------------------------------------------------------- ++ * RMON-MIB::etherStatsEntry.etherStatsPkts256to511Octets ++ * etherStatsPkts256to511Octets is subid 17 of etherStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.16.1.1.1.17 ++ * Description: ++The total number of packets (including bad ++ packets) received that were between ++ 256 and 511 octets in length inclusive ++ (excluding framing bits but including FCS octets). ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the etherStatsPkts256to511Octets data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param etherStatsPkts256to511Octets_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 ++etherStatsPkts256to511Octets_get(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ++ etherStatsPkts256to511Octets_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != etherStatsPkts256to511Octets_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsPkts256to511Octets_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the etherStatsPkts256to511Octets data. ++ * copy (* etherStatsPkts256to511Octets_val_ptr ) from rowreq_ctx->data ++ */ ++ (*etherStatsPkts256to511Octets_val_ptr) = ++ rowreq_ctx->data.etherStatsPkts256to511Octets; ++ ++ return MFD_SUCCESS; ++} /* etherStatsPkts256to511Octets_get */ ++ ++/*--------------------------------------------------------------------- ++ * RMON-MIB::etherStatsEntry.etherStatsPkts512to1023Octets ++ * etherStatsPkts512to1023Octets is subid 18 of etherStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.16.1.1.1.18 ++ * Description: ++The total number of packets (including bad ++ packets) received that were between ++ 512 and 1023 octets in length inclusive ++ (excluding framing bits but including FCS octets). ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the etherStatsPkts512to1023Octets data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param etherStatsPkts512to1023Octets_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 ++etherStatsPkts512to1023Octets_get(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ++ etherStatsPkts512to1023Octets_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != etherStatsPkts512to1023Octets_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsPkts512to1023Octets_get", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the etherStatsPkts512to1023Octets data. ++ * copy (* etherStatsPkts512to1023Octets_val_ptr ) from rowreq_ctx->data ++ */ ++ (*etherStatsPkts512to1023Octets_val_ptr) = ++ rowreq_ctx->data.etherStatsPkts512to1023Octets; ++ ++ return MFD_SUCCESS; ++} /* etherStatsPkts512to1023Octets_get */ ++ ++/*--------------------------------------------------------------------- ++ * RMON-MIB::etherStatsEntry.etherStatsPkts1024to1518Octets ++ * etherStatsPkts1024to1518Octets is subid 19 of etherStatsEntry. ++ * Its status is Current, and its access level is ReadOnly. ++ * OID: .1.3.6.1.2.1.16.1.1.1.19 ++ * Description: ++The total number of packets (including bad ++ packets) received that were between ++ 1024 and 1518 octets in length inclusive ++ (excluding framing bits but including FCS octets). ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 0 ++ * ++ * ++ * Its syntax is COUNTER (based on perltype COUNTER) ++ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) ++ */ ++/** ++ * Extract the current value of the etherStatsPkts1024to1518Octets data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param etherStatsPkts1024to1518Octets_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 ++etherStatsPkts1024to1518Octets_get(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * ++ etherStatsPkts1024to1518Octets_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != etherStatsPkts1024to1518Octets_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsPkts1024to1518Octets_get", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the etherStatsPkts1024to1518Octets data. ++ * copy (* etherStatsPkts1024to1518Octets_val_ptr ) from rowreq_ctx->data ++ */ ++ (*etherStatsPkts1024to1518Octets_val_ptr) = ++ rowreq_ctx->data.etherStatsPkts1024to1518Octets; ++ ++ return MFD_SUCCESS; ++} /* etherStatsPkts1024to1518Octets_get */ ++ ++/*--------------------------------------------------------------------- ++ * RMON-MIB::etherStatsEntry.etherStatsOwner ++ * etherStatsOwner is subid 20 of etherStatsEntry. ++ * Its status is Current, and its access level is Create. ++ * OID: .1.3.6.1.2.1.16.1.1.1.20 ++ * Description: ++The entity that configured this entry and is therefore ++ using the resources assigned to it. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 1 hashint 0 ++ * settable 1 ++ * ++ * Ranges: 0 - 127; ++ * ++ * Its syntax is OwnerString (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 127) ++ */ ++/** ++ * Extract the current value of the etherStatsOwner data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param etherStatsOwner_val_ptr_ptr ++ * Pointer to storage for a char variable ++ * @param etherStatsOwner_val_ptr_len_ptr ++ * Pointer to a size_t. On entry, it will contain the size (in bytes) ++ * pointed to by etherStatsOwner. ++ * 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 (*etherStatsOwner_val_ptr_len_ptr) bytes of memory, ++ * allocate it using malloc() and update etherStatsOwner_val_ptr_ptr. ++ * DO NOT 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 ++etherStatsOwner_get(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ char **etherStatsOwner_val_ptr_ptr, ++ size_t *etherStatsOwner_val_ptr_len_ptr) ++{ ++ /** we should have a non-NULL pointer and enough storage */ ++ netsnmp_assert((NULL != etherStatsOwner_val_ptr_ptr) ++ && (NULL != *etherStatsOwner_val_ptr_ptr)); ++ netsnmp_assert(NULL != etherStatsOwner_val_ptr_len_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsOwner_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the etherStatsOwner data. ++ * copy (* etherStatsOwner_val_ptr_ptr ) data and (* etherStatsOwner_val_ptr_len_ptr ) from rowreq_ctx->data ++ */ ++ /* ++ * make sure there is enough space for etherStatsOwner data ++ */ ++ if ((NULL == (*etherStatsOwner_val_ptr_ptr)) || ++ ((*etherStatsOwner_val_ptr_len_ptr) < ++ (rowreq_ctx->data.etherStatsOwner_len * ++ sizeof(rowreq_ctx->data.etherStatsOwner[0])))) { ++ /* ++ * allocate space for etherStatsOwner data ++ */ ++ (*etherStatsOwner_val_ptr_ptr) = ++ malloc(rowreq_ctx->data.etherStatsOwner_len * ++ sizeof(rowreq_ctx->data.etherStatsOwner[0])); ++ if (NULL == (*etherStatsOwner_val_ptr_ptr)) { ++ snmp_log(LOG_ERR, "could not allocate memory\n"); ++ return MFD_ERROR; ++ } ++ } ++ (*etherStatsOwner_val_ptr_len_ptr) = ++ rowreq_ctx->data.etherStatsOwner_len * ++ sizeof(rowreq_ctx->data.etherStatsOwner[0]); ++ memcpy((*etherStatsOwner_val_ptr_ptr), ++ rowreq_ctx->data.etherStatsOwner, ++ rowreq_ctx->data.etherStatsOwner_len * ++ sizeof(rowreq_ctx->data.etherStatsOwner[0])); ++ ++ return MFD_SUCCESS; ++} /* etherStatsOwner_get */ ++ ++/*--------------------------------------------------------------------- ++ * RMON-MIB::etherStatsEntry.etherStatsStatus ++ * etherStatsStatus is subid 21 of etherStatsEntry. ++ * Its status is Current, and its access level is Create. ++ * OID: .1.3.6.1.2.1.16.1.1.1.21 ++ * Description: ++The status of this etherStats entry. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 1 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 1 ++ * ++ * Enum range: 2/8. Values: valid(1), createRequest(2), underCreation(3), invalid(4) ++ * ++ * Its syntax is EntryStatus (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 etherStatsStatus data. ++ * ++ * Set a value using the data context for the row. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param etherStatsStatus_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 ++etherStatsStatus_get(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long * etherStatsStatus_val_ptr) ++{ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != etherStatsStatus_val_ptr); ++ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsStatus_get", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:231:o: |-> Extract the current value of the etherStatsStatus data. ++ * copy (* etherStatsStatus_val_ptr ) from rowreq_ctx->data ++ */ ++ (*etherStatsStatus_val_ptr) = rowreq_ctx->data.etherStatsStatus; ++ ++ return MFD_SUCCESS; ++} /* etherStatsStatus_get */ ++ ++ ++ ++/** @} */ +Index: agent/mibgroup/rmon-mib/etherStatsTable_data_get.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/rmon-mib/etherStatsTable_data_get.h 2008-09-11 22:27:51.811792945 +0200 +@@ -0,0 +1,151 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 12088 $ of $ ++ * ++ * $Id:$ ++ * ++ * @file etherStatsTable_data_get.h ++ * ++ * @addtogroup get ++ * ++ * Prototypes for get functions ++ * ++ * @{ ++ */ ++#ifndef ETHERSTATSTABLE_DATA_GET_H ++#define ETHERSTATSTABLE_DATA_GET_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ /* ++ ********************************************************************* ++ * GET function declarations ++ */ ++ ++ /* ++ ********************************************************************* ++ * GET Table declarations ++ */ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table etherStatsTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++ /* ++ * RMON-MIB::etherStatsTable is subid 1 of statistics. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.16.1.1, length: 9 ++ */ ++ /* ++ * indexes ++ */ ++ ++ int etherStatsDataSource_get(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ oid ** ++ etherStatsDataSource_val_ptr_ptr, ++ size_t ++ *etherStatsDataSource_val_ptr_len_ptr); ++ int etherStatsDropEvents_get(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ etherStatsDropEvents_val_ptr); ++ int etherStatsOctets_get(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ etherStatsOctets_val_ptr); ++ int etherStatsPkts_get(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * etherStatsPkts_val_ptr); ++ int etherStatsBroadcastPkts_get(etherStatsTable_rowreq_ctx ++ * rowreq_ctx, ++ u_long * ++ etherStatsBroadcastPkts_val_ptr); ++ int etherStatsMulticastPkts_get(etherStatsTable_rowreq_ctx ++ * rowreq_ctx, ++ u_long * ++ etherStatsMulticastPkts_val_ptr); ++ int etherStatsCRCAlignErrors_get(etherStatsTable_rowreq_ctx ++ * rowreq_ctx, ++ u_long * ++ etherStatsCRCAlignErrors_val_ptr); ++ int etherStatsUndersizePkts_get(etherStatsTable_rowreq_ctx ++ * rowreq_ctx, ++ u_long * ++ etherStatsUndersizePkts_val_ptr); ++ int etherStatsOversizePkts_get(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ etherStatsOversizePkts_val_ptr); ++ int etherStatsFragments_get(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ etherStatsFragments_val_ptr); ++ int etherStatsJabbers_get(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ etherStatsJabbers_val_ptr); ++ int etherStatsCollisions_get(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ etherStatsCollisions_val_ptr); ++ int etherStatsPkts64Octets_get(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ etherStatsPkts64Octets_val_ptr); ++ int ++ etherStatsPkts65to127Octets_get(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ etherStatsPkts65to127Octets_val_ptr); ++ int ++ etherStatsPkts128to255Octets_get(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ etherStatsPkts128to255Octets_val_ptr); ++ int ++ etherStatsPkts256to511Octets_get(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ etherStatsPkts256to511Octets_val_ptr); ++ int ++ etherStatsPkts512to1023Octets_get(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ etherStatsPkts512to1023Octets_val_ptr); ++ int ++ etherStatsPkts1024to1518Octets_get(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ etherStatsPkts1024to1518Octets_val_ptr); ++ int etherStatsOwner_get(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ char **etherStatsOwner_val_ptr_ptr, ++ size_t ++ *etherStatsOwner_val_ptr_len_ptr); ++ int etherStatsStatus_get(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long * ++ etherStatsStatus_val_ptr); ++ ++ ++ int ++ etherStatsTable_indexes_set_tbl_idx(etherStatsTable_mib_index * ++ tbl_idx, ++ long etherStatsIndex_val); ++ int etherStatsTable_indexes_set(etherStatsTable_rowreq_ctx ++ * rowreq_ctx, ++ long etherStatsIndex_val); ++ ++ ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* ETHERSTATSTABLE_DATA_GET_H */ ++/** @} */ +Index: agent/mibgroup/rmon-mib/etherStatsTable_data_set.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/rmon-mib/etherStatsTable_data_set.c 2008-09-11 22:27:51.851791158 +0200 +@@ -0,0 +1,977 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 12077 $ of $ ++ * ++ * $Id:$ ++ * ++ */ ++/* ++ * standard Net-SNMP includes ++ */ ++#include ++#include ++#include ++ ++/* ++ * include our parent header ++ */ ++#include "etherStatsTable.h" ++ ++ ++/** @defgroup data_set data_set: Routines to set data ++ * ++ * These routines are used to set the value for individual objects. The ++ * row context is passed, along with the new value. ++ * ++ * @{ ++ */ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table etherStatsTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++/* ++ * RMON-MIB::etherStatsTable is subid 1 of statistics. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.16.1.1, length: 9 ++ */ ++ /* ++ * NOTE: if you update this chart, please update the versions in ++ * local/mib2c-conf.d/parent-set.m2i ++ * agent/mibgroup/helpers/baby_steps.c ++ * while you're at it. ++ */ ++ /* ++ *********************************************************************** ++ * Baby Steps Flow Chart (2004.06.05) * ++ * * ++ * +--------------+ +================+ U = unconditional path * ++ * |optional state| ||required state|| S = path for success * ++ * +--------------+ +================+ E = path for error * ++ *********************************************************************** ++ * ++ * +--------------+ ++ * | pre | ++ * | request | ++ * +--------------+ ++ * | U ++ * +-------------+ +==============+ ++ * | row |f|<-------|| object || ++ * | create |1| E || lookup || ++ * +-------------+ +==============+ ++ * E | | S | S ++ * | +------------------>| ++ * | +==============+ ++ * | E || check || ++ * |<---------------|| values || ++ * | +==============+ ++ * | | S ++ * | +==============+ ++ * | +<-------|| undo || ++ * | | E || setup || ++ * | | +==============+ ++ * | | | S ++ * | | +==============+ ++ * | | || set ||-------------------------->+ ++ * | | || value || E | ++ * | | +==============+ | ++ * | | | S | ++ * | | +--------------+ | ++ * | | | check |-------------------------->| ++ * | | | consistency | E | ++ * | | +--------------+ | ++ * | | | S | ++ * | | +==============+ +==============+ | ++ * | | || commit ||-------->|| undo || | ++ * | | || || E || commit || | ++ * | | +==============+ +==============+ | ++ * | | | S U |<--------+ ++ * | | +--------------+ +==============+ ++ * | | | irreversible | || undo || ++ * | | | commit | || set || ++ * | | +--------------+ +==============+ ++ * | | | U U | ++ * | +-------------->|<------------------------+ ++ * | +==============+ ++ * | || undo || ++ * | || cleanup || ++ * | +==============+ ++ * +---------------------->| U ++ * | ++ * (err && f1)------------------->+ ++ * | | ++ * +--------------+ +--------------+ ++ * | post |<--------| row | ++ * | request | U | release | ++ * +--------------+ +--------------+ ++ * ++ */ ++ ++/** ++ * Setup up context with information needed to undo a set request. ++ * ++ * This function will be called before the individual node undo setup ++ * functions are called. If you need to do any undo setup that is not ++ * related to a specific column, you can do it here. ++ * ++ * Note that the undo context has been allocated with ++ * etherStatsTable_allocate_data(), but may need extra ++ * initialization similar to what you may have done in ++ * etherStatsTable_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 (etherStatsTable_rowreq_ctx) ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_ERROR : error. set will fail. ++ */ ++int ++etherStatsTable_undo_setup(etherStatsTable_rowreq_ctx * rowreq_ctx) ++{ ++ int rc = MFD_SUCCESS; ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_undo_setup", ++ "called\n")); ++ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:451:M: |-> Setup etherStatsTable undo. ++ * set up etherStatsTable undo information, in preparation for a set. ++ * Undo storage is in (* etherStatsStatus_val_ptr )* ++ */ ++ ++ return rc; ++} /* etherStatsTable_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 (etherStatsTable_rowreq_ctx) ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_ERROR : error. set will fail. ++ */ ++int ++etherStatsTable_undo(etherStatsTable_rowreq_ctx * rowreq_ctx) ++{ ++ int rc = MFD_SUCCESS; ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_undo", ++ "called\n")); ++ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:451:M: |-> etherStatsTable undo. ++ * etherStatsTable undo information, in response to a failed set. ++ * Undo storage is in (* etherStatsStatus_val_ptr )* ++ */ ++ ++ return rc; ++} /* etherStatsTable_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 (etherStatsTable_rowreq_ctx) ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_ERROR : error ++ */ ++int ++etherStatsTable_undo_cleanup(etherStatsTable_rowreq_ctx * rowreq_ctx) ++{ ++ int rc = MFD_SUCCESS; ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_undo_cleanup", ++ "called\n")); ++ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:452:M: |-> Cleanup etherStatsTable undo. ++ * Undo storage is in (* etherStatsStatus_val_ptr )* ++ */ ++ ++ return rc; ++} /* etherStatsTable_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 ++ * etherStatsTable_oids.h. ++ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. ++ * ++ * @param etherStatsTable_rowreq_ctx ++ * Pointer to the users context. ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_ERROR : error ++ */ ++int ++etherStatsTable_commit(etherStatsTable_rowreq_ctx * rowreq_ctx) ++{ ++ int rc = MFD_SUCCESS; ++ int save_flags; ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_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 etherStatsTable 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 (save_flags & COLUMN_ETHERSTATSDATASOURCE_FLAG) { ++ save_flags &= ~COLUMN_ETHERSTATSDATASOURCE_FLAG; /* clear etherStatsDataSource */ ++ /* ++ * TODO:482:o: |-> commit column etherStatsDataSource. ++ */ ++ rc = -1; ++ if (-1 == rc) { ++ snmp_log(LOG_ERR, ++ "etherStatsTable column etherStatsDataSource commit failed\n"); ++ } else { ++ /* ++ * set flag, in case we need to undo etherStatsDataSource ++ */ ++ rowreq_ctx->column_set_flags |= ++ COLUMN_ETHERSTATSDATASOURCE_FLAG; ++ } ++ } ++ ++ if (save_flags & COLUMN_ETHERSTATSOWNER_FLAG) { ++ save_flags &= ~COLUMN_ETHERSTATSOWNER_FLAG; /* clear etherStatsOwner */ ++ /* ++ * TODO:482:o: |-> commit column etherStatsOwner. ++ */ ++ rc = -1; ++ if (-1 == rc) { ++ snmp_log(LOG_ERR, ++ "etherStatsTable column etherStatsOwner commit failed\n"); ++ } else { ++ /* ++ * set flag, in case we need to undo etherStatsOwner ++ */ ++ rowreq_ctx->column_set_flags |= COLUMN_ETHERSTATSOWNER_FLAG; ++ } ++ } ++ ++ if (save_flags & COLUMN_ETHERSTATSSTATUS_FLAG) { ++ save_flags &= ~COLUMN_ETHERSTATSSTATUS_FLAG; /* clear etherStatsStatus */ ++ /* ++ * TODO:482:o: |-> commit column etherStatsStatus. ++ */ ++ rc = -1; ++ if (-1 == rc) { ++ snmp_log(LOG_ERR, ++ "etherStatsTable column etherStatsStatus commit failed\n"); ++ } else { ++ /* ++ * set flag, in case we need to undo etherStatsStatus ++ */ ++ rowreq_ctx->column_set_flags |= COLUMN_ETHERSTATSSTATUS_FLAG; ++ } ++ } ++ ++ /* ++ * if we successfully commited this row, set the dirty flag. ++ */ ++ if (MFD_SUCCESS == rc) { ++ rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY; ++ } ++ ++ if (save_flags) { ++ snmp_log(LOG_ERR, "unhandled columns (0x%x) in commit\n", ++ save_flags); ++ return MFD_ERROR; ++ } ++ ++ return rc; ++} /* etherStatsTable_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 ++ * etherStatsTable_oids.h. ++ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. ++ * ++ * @param etherStatsTable_rowreq_ctx ++ * Pointer to the users context. ++ * ++ * @retval MFD_SUCCESS : success ++ * @retval MFD_ERROR : error ++ */ ++int ++etherStatsTable_undo_commit(etherStatsTable_rowreq_ctx * rowreq_ctx) ++{ ++ int rc = MFD_SUCCESS; ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_undo_commit", ++ "called\n")); ++ ++ /** we should have a non-NULL pointer */ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:485:M: |-> Undo etherStatsTable 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; ++} /* etherStatsTable_undo_commit */ ++ ++/* ++ * TODO:440:M: Implement etherStatsTable node value checks. ++ * TODO:450:M: Implement etherStatsTable undo functions. ++ * TODO:460:M: Implement etherStatsTable set functions. ++ * TODO:480:M: Implement etherStatsTable commit functions. ++ */ ++/*--------------------------------------------------------------------- ++ * RMON-MIB::etherStatsEntry.etherStatsDataSource ++ * etherStatsDataSource is subid 2 of etherStatsEntry. ++ * Its status is Current, and its access level is Create. ++ * OID: .1.3.6.1.2.1.16.1.1.1.2 ++ * Description: ++This object identifies the source of the data that ++ this etherStats entry is configured to analyze. This ++ source can be any ethernet interface on this device. ++ In order to identify a particular interface, this object ++ shall identify the instance of the ifIndex object, ++ defined in RFC 2233 [17], for the desired interface. ++ For example, if an entry were to receive data from ++ interface #1, this object would be set to ifIndex.1. ++ ++ The statistics in this group reflect all packets ++ on the local network segment attached to the identified ++ interface. ++ ++ An agent may or may not be able to tell if fundamental ++ changes to the media of the interface have occurred and ++ necessitate an invalidation of this entry. For example, a ++ hot-pluggable ethernet card could be pulled out and replaced ++ by a token-ring card. In such a case, if the agent has such ++ knowledge of the change, it is recommended that it ++ invalidate this entry. ++ ++ This object may not be modified if the associated ++ etherStatsStatus object is equal to valid(1). ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 1 ++ * ++ * ++ * Its syntax is OBJECTID (based on perltype OBJECTID) ++ * The net-snmp type is ASN_OBJECT_ID. The C type decl is oid (oid) ++ * This data type requires a length. ++ */ ++/** ++ * Check that the proposed new value is potentially valid. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param etherStatsDataSource_val_ptr ++ * A oid containing the new value. ++ * @param etherStatsDataSource_val_ptr_len ++ * The size (in bytes) of the data pointed to by etherStatsDataSource_val_ptr ++ * ++ * @retval MFD_SUCCESS : incoming value is legal ++ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now ++ * @retval MFD_NOT_VALID_EVER : incoming value is never valid ++ * ++ * This is the place to check for requirements that are not ++ * expressed in the mib syntax (for example, a requirement that ++ * is detailed in the description for an object). ++ * ++ * You should check that the requested change between the undo value and the ++ * new value is legal (ie, the transistion from one value to another ++ * is legal). ++ * ++ *@note ++ * This check is only to determine if the new value ++ * is \b potentially valid. This is the first check of many, and ++ * is one of the simplest ones. ++ * ++ *@note ++ * this is not the place to do any checks for values ++ * which depend on some other value in the mib. Those ++ * types of checks should be done in the ++ * etherStatsTable_check_dependencies() function. ++ * ++ * The following checks have already been done for you: ++ * The syntax is ASN_OBJECT_ID ++ * The length is < sizeof(rowreq_ctx->data.etherStatsDataSource). ++ * ++ * If there a no other checks you need to do, simply return MFD_SUCCESS. ++ * ++ */ ++int ++etherStatsDataSource_check_value(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ oid * etherStatsDataSource_val_ptr, ++ size_t etherStatsDataSource_val_ptr_len) ++{ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsDataSource_check_value", ++ "called\n")); ++ ++ /** should never get a NULL pointer */ ++ netsnmp_assert(NULL != rowreq_ctx); ++ netsnmp_assert(NULL != etherStatsDataSource_val_ptr); ++ ++ /* ++ * TODO:441:o: |-> Check for valid etherStatsDataSource value. ++ */ ++ ++ return MFD_SUCCESS; /* etherStatsDataSource value not illegal */ ++} /* etherStatsDataSource_check_value */ ++ ++/** ++ * Save old value information ++ * ++ * @param rowreq_ctx ++ * Pointer to the table context (etherStatsTable_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 ++ * etherStatsTable_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 ++etherStatsDataSource_undo_setup(etherStatsTable_rowreq_ctx * rowreq_ctx) ++{ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsDataSource_undo_setup", ++ "called\n")); ++ ++ /** should never get a NULL pointer */ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:455:o: |-> Setup etherStatsDataSource undo. ++ */ ++ /* ++ * copy etherStatsDataSource and etherStatsDataSource_len data ++ * set rowreq_ctx->undo->etherStatsDataSource from rowreq_ctx->data.etherStatsDataSource ++ */ ++ memcpy(rowreq_ctx->undo->etherStatsDataSource, ++ rowreq_ctx->data.etherStatsDataSource, ++ (rowreq_ctx->data.etherStatsDataSource_len * ++ sizeof(rowreq_ctx->undo->etherStatsDataSource[0]))); ++ rowreq_ctx->undo->etherStatsDataSource_len = ++ rowreq_ctx->data.etherStatsDataSource_len; ++ ++ ++ return MFD_SUCCESS; ++} /* etherStatsDataSource_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 etherStatsDataSource_val_ptr ++ * A oid containing the new value. ++ * @param etherStatsDataSource_val_ptr_len ++ * The size (in bytes) of the data pointed to by etherStatsDataSource_val_ptr ++ */ ++int ++etherStatsDataSource_set(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ oid * etherStatsDataSource_val_ptr, ++ size_t etherStatsDataSource_val_ptr_len) ++{ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsDataSource_set", ++ "called\n")); ++ ++ /** should never get a NULL pointer */ ++ netsnmp_assert(NULL != rowreq_ctx); ++ netsnmp_assert(NULL != etherStatsDataSource_val_ptr); ++ ++ /* ++ * TODO:461:M: |-> Set etherStatsDataSource value. ++ * set etherStatsDataSource value in rowreq_ctx->data ++ */ ++ memcpy(rowreq_ctx->data.etherStatsDataSource, ++ etherStatsDataSource_val_ptr, etherStatsDataSource_val_ptr_len); ++ /** convert bytes to number of oid */ ++ rowreq_ctx->data.etherStatsDataSource_len = ++ etherStatsDataSource_val_ptr_len / ++ sizeof(etherStatsDataSource_val_ptr[0]); ++ ++ return MFD_SUCCESS; ++} /* etherStatsDataSource_set */ ++ ++/** ++ * undo the previous set. ++ * ++ * @param rowreq_ctx ++ * Pointer to the users context. ++ */ ++int ++etherStatsDataSource_undo(etherStatsTable_rowreq_ctx * rowreq_ctx) ++{ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsDataSource_undo", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:456:o: |-> Clean up etherStatsDataSource undo. ++ */ ++ /* ++ * copy etherStatsDataSource and etherStatsDataSource_len data ++ * set rowreq_ctx->data.etherStatsDataSource from rowreq_ctx->undo->etherStatsDataSource ++ */ ++ memcpy(rowreq_ctx->data.etherStatsDataSource, ++ rowreq_ctx->undo->etherStatsDataSource, ++ (rowreq_ctx->undo->etherStatsDataSource_len * ++ sizeof(rowreq_ctx->data.etherStatsDataSource[0]))); ++ rowreq_ctx->data.etherStatsDataSource_len = ++ rowreq_ctx->undo->etherStatsDataSource_len; ++ ++ ++ return MFD_SUCCESS; ++} /* etherStatsDataSource_undo */ ++ ++/*--------------------------------------------------------------------- ++ * RMON-MIB::etherStatsEntry.etherStatsOwner ++ * etherStatsOwner is subid 20 of etherStatsEntry. ++ * Its status is Current, and its access level is Create. ++ * OID: .1.3.6.1.2.1.16.1.1.1.20 ++ * Description: ++The entity that configured this entry and is therefore ++ using the resources assigned to it. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 0 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 1 hashint 0 ++ * settable 1 ++ * ++ * Ranges: 0 - 127; ++ * ++ * Its syntax is OwnerString (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 127) ++ */ ++/** ++ * Check that the proposed new value is potentially valid. ++ * ++ * @param rowreq_ctx ++ * Pointer to the row request context. ++ * @param etherStatsOwner_val_ptr ++ * A char containing the new value. ++ * @param etherStatsOwner_val_ptr_len ++ * The size (in bytes) of the data pointed to by etherStatsOwner_val_ptr ++ * ++ * @retval MFD_SUCCESS : incoming value is legal ++ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now ++ * @retval MFD_NOT_VALID_EVER : incoming value is never valid ++ * ++ * This is the place to check for requirements that are not ++ * expressed in the mib syntax (for example, a requirement that ++ * is detailed in the description for an object). ++ * ++ * You should check that the requested change between the undo value and the ++ * new value is legal (ie, the transistion from one value to another ++ * is legal). ++ * ++ *@note ++ * This check is only to determine if the new value ++ * is \b potentially valid. This is the first check of many, and ++ * is one of the simplest ones. ++ * ++ *@note ++ * this is not the place to do any checks for values ++ * which depend on some other value in the mib. Those ++ * types of checks should be done in the ++ * etherStatsTable_check_dependencies() function. ++ * ++ * The following checks have already been done for you: ++ * The syntax is ASN_OCTET_STR ++ * The length is < sizeof(rowreq_ctx->data.etherStatsOwner). ++ * The length is in (one of) the range set(s): 0 - 127 ++ * ++ * If there a no other checks you need to do, simply return MFD_SUCCESS. ++ * ++ */ ++int ++etherStatsOwner_check_value(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ char *etherStatsOwner_val_ptr, ++ size_t etherStatsOwner_val_ptr_len) ++{ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsOwner_check_value", ++ "called\n")); ++ ++ /** should never get a NULL pointer */ ++ netsnmp_assert(NULL != rowreq_ctx); ++ netsnmp_assert(NULL != etherStatsOwner_val_ptr); ++ ++ /* ++ * TODO:441:o: |-> Check for valid etherStatsOwner value. ++ */ ++ ++ return MFD_SUCCESS; /* etherStatsOwner value not illegal */ ++} /* etherStatsOwner_check_value */ ++ ++/** ++ * Save old value information ++ * ++ * @param rowreq_ctx ++ * Pointer to the table context (etherStatsTable_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 ++ * etherStatsTable_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 ++etherStatsOwner_undo_setup(etherStatsTable_rowreq_ctx * rowreq_ctx) ++{ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsOwner_undo_setup", ++ "called\n")); ++ ++ /** should never get a NULL pointer */ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:455:o: |-> Setup etherStatsOwner undo. ++ */ ++ /* ++ * copy etherStatsOwner and etherStatsOwner_len data ++ * set rowreq_ctx->undo->etherStatsOwner from rowreq_ctx->data.etherStatsOwner ++ */ ++ memcpy(rowreq_ctx->undo->etherStatsOwner, ++ rowreq_ctx->data.etherStatsOwner, ++ (rowreq_ctx->data.etherStatsOwner_len * ++ sizeof(rowreq_ctx->undo->etherStatsOwner[0]))); ++ rowreq_ctx->undo->etherStatsOwner_len = ++ rowreq_ctx->data.etherStatsOwner_len; ++ ++ ++ return MFD_SUCCESS; ++} /* etherStatsOwner_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 etherStatsOwner_val_ptr ++ * A char containing the new value. ++ * @param etherStatsOwner_val_ptr_len ++ * The size (in bytes) of the data pointed to by etherStatsOwner_val_ptr ++ */ ++int ++etherStatsOwner_set(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ char *etherStatsOwner_val_ptr, ++ size_t etherStatsOwner_val_ptr_len) ++{ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsOwner_set", ++ "called\n")); ++ ++ /** should never get a NULL pointer */ ++ netsnmp_assert(NULL != rowreq_ctx); ++ netsnmp_assert(NULL != etherStatsOwner_val_ptr); ++ ++ /* ++ * TODO:461:M: |-> Set etherStatsOwner value. ++ * set etherStatsOwner value in rowreq_ctx->data ++ */ ++ memcpy(rowreq_ctx->data.etherStatsOwner, etherStatsOwner_val_ptr, ++ etherStatsOwner_val_ptr_len); ++ /** convert bytes to number of char */ ++ rowreq_ctx->data.etherStatsOwner_len = ++ etherStatsOwner_val_ptr_len / sizeof(etherStatsOwner_val_ptr[0]); ++ ++ return MFD_SUCCESS; ++} /* etherStatsOwner_set */ ++ ++/** ++ * undo the previous set. ++ * ++ * @param rowreq_ctx ++ * Pointer to the users context. ++ */ ++int ++etherStatsOwner_undo(etherStatsTable_rowreq_ctx * rowreq_ctx) ++{ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsOwner_undo", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:456:o: |-> Clean up etherStatsOwner undo. ++ */ ++ /* ++ * copy etherStatsOwner and etherStatsOwner_len data ++ * set rowreq_ctx->data.etherStatsOwner from rowreq_ctx->undo->etherStatsOwner ++ */ ++ memcpy(rowreq_ctx->data.etherStatsOwner, ++ rowreq_ctx->undo->etherStatsOwner, ++ (rowreq_ctx->undo->etherStatsOwner_len * ++ sizeof(rowreq_ctx->data.etherStatsOwner[0]))); ++ rowreq_ctx->data.etherStatsOwner_len = ++ rowreq_ctx->undo->etherStatsOwner_len; ++ ++ ++ return MFD_SUCCESS; ++} /* etherStatsOwner_undo */ ++ ++/*--------------------------------------------------------------------- ++ * RMON-MIB::etherStatsEntry.etherStatsStatus ++ * etherStatsStatus is subid 21 of etherStatsEntry. ++ * Its status is Current, and its access level is Create. ++ * OID: .1.3.6.1.2.1.16.1.1.1.21 ++ * Description: ++The status of this etherStats entry. ++ * ++ * Attributes: ++ * accessible 1 isscalar 0 enums 1 hasdefval 0 ++ * readable 1 iscolumn 1 ranges 0 hashint 0 ++ * settable 1 ++ * ++ * Enum range: 2/8. Values: valid(1), createRequest(2), underCreation(3), invalid(4) ++ * ++ * Its syntax is EntryStatus (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 etherStatsStatus_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 ++ * etherStatsTable_check_dependencies() function. ++ * ++ * The following checks have already been done for you: ++ * The syntax is ASN_INTEGER ++ * The value is one of valid(1), createRequest(2), underCreation(3), invalid(4) ++ * ++ * If there a no other checks you need to do, simply return MFD_SUCCESS. ++ * ++ */ ++int ++etherStatsStatus_check_value(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long etherStatsStatus_val) ++{ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsStatus_check_value", ++ "called\n")); ++ ++ /** should never get a NULL pointer */ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:441:o: |-> Check for valid etherStatsStatus value. ++ */ ++ ++ return MFD_SUCCESS; /* etherStatsStatus value not illegal */ ++} /* etherStatsStatus_check_value */ ++ ++/** ++ * Save old value information ++ * ++ * @param rowreq_ctx ++ * Pointer to the table context (etherStatsTable_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 ++ * etherStatsTable_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 ++etherStatsStatus_undo_setup(etherStatsTable_rowreq_ctx * rowreq_ctx) ++{ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsStatus_undo_setup", ++ "called\n")); ++ ++ /** should never get a NULL pointer */ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:455:o: |-> Setup etherStatsStatus undo. ++ */ ++ /* ++ * copy etherStatsStatus data ++ * set rowreq_ctx->undo->etherStatsStatus from rowreq_ctx->data.etherStatsStatus ++ */ ++ rowreq_ctx->undo->etherStatsStatus = rowreq_ctx->data.etherStatsStatus; ++ ++ ++ return MFD_SUCCESS; ++} /* etherStatsStatus_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 etherStatsStatus_val ++ * A long containing the new value. ++ */ ++int ++etherStatsStatus_set(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long etherStatsStatus_val) ++{ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsStatus_set", ++ "called\n")); ++ ++ /** should never get a NULL pointer */ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:461:M: |-> Set etherStatsStatus value. ++ * set etherStatsStatus value in rowreq_ctx->data ++ */ ++ rowreq_ctx->data.etherStatsStatus = etherStatsStatus_val; ++ ++ return MFD_SUCCESS; ++} /* etherStatsStatus_set */ ++ ++/** ++ * undo the previous set. ++ * ++ * @param rowreq_ctx ++ * Pointer to the users context. ++ */ ++int ++etherStatsStatus_undo(etherStatsTable_rowreq_ctx * rowreq_ctx) ++{ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsStatus_undo", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * TODO:456:o: |-> Clean up etherStatsStatus undo. ++ */ ++ /* ++ * copy etherStatsStatus data ++ * set rowreq_ctx->data.etherStatsStatus from rowreq_ctx->undo->etherStatsStatus ++ */ ++ rowreq_ctx->data.etherStatsStatus = rowreq_ctx->undo->etherStatsStatus; ++ ++ ++ return MFD_SUCCESS; ++} /* etherStatsStatus_undo */ ++ ++/** @} */ +Index: agent/mibgroup/rmon-mib/etherStatsTable_data_set.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/rmon-mib/etherStatsTable_data_set.h 2008-09-11 22:27:51.867791955 +0200 +@@ -0,0 +1,356 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 12077 $ of $ ++ * ++ * $Id:$ ++ */ ++#ifndef ETHERSTATSTABLE_DATA_SET_H ++#define ETHERSTATSTABLE_DATA_SET_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ /* ++ ********************************************************************* ++ * SET function declarations ++ */ ++ ++ /* ++ ********************************************************************* ++ * SET Table declarations ++ */ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table etherStatsTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++ /* ++ * RMON-MIB::etherStatsTable is subid 1 of statistics. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.16.1.1, length: 9 ++ */ ++ ++ ++ int etherStatsTable_undo_setup(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ int etherStatsTable_undo_cleanup(etherStatsTable_rowreq_ctx ++ * rowreq_ctx); ++ int etherStatsTable_undo(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ int etherStatsTable_commit(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ int etherStatsTable_undo_commit(etherStatsTable_rowreq_ctx ++ * rowreq_ctx); ++ ++ ++ int ++ etherStatsDataSource_check_value(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ oid * ++ etherStatsDataSource_val_ptr, ++ size_t ++ etherStatsDataSource_val_ptr_len); ++ int ++ etherStatsDataSource_undo_setup(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ int etherStatsDataSource_set(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ oid * ++ etherStatsDataSource_val_ptr, ++ size_t ++ etherStatsDataSource_val_ptr_len); ++ int etherStatsDataSource_undo(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ int ++ etherStatsDropEvents_check_value(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long etherStatsDropEvents_val); ++ int ++ etherStatsDropEvents_undo_setup(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ int etherStatsDropEvents_set(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long ++ etherStatsDropEvents_val); ++ int etherStatsDropEvents_undo(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ int etherStatsOctets_check_value(etherStatsTable_rowreq_ctx ++ * rowreq_ctx, ++ u_long ++ etherStatsOctets_val); ++ int etherStatsOctets_undo_setup(etherStatsTable_rowreq_ctx ++ * rowreq_ctx); ++ int etherStatsOctets_set(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long etherStatsOctets_val); ++ int etherStatsOctets_undo(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ int etherStatsPkts_check_value(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long etherStatsPkts_val); ++ int etherStatsPkts_undo_setup(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ int etherStatsPkts_set(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long etherStatsPkts_val); ++ int etherStatsPkts_undo(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ int ++ etherStatsBroadcastPkts_check_value(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long ++ etherStatsBroadcastPkts_val); ++ int ++ etherStatsBroadcastPkts_undo_setup(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ int etherStatsBroadcastPkts_set(etherStatsTable_rowreq_ctx ++ * rowreq_ctx, ++ u_long ++ etherStatsBroadcastPkts_val); ++ int etherStatsBroadcastPkts_undo(etherStatsTable_rowreq_ctx ++ * rowreq_ctx); ++ ++ int ++ etherStatsMulticastPkts_check_value(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long ++ etherStatsMulticastPkts_val); ++ int ++ etherStatsMulticastPkts_undo_setup(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ int etherStatsMulticastPkts_set(etherStatsTable_rowreq_ctx ++ * rowreq_ctx, ++ u_long ++ etherStatsMulticastPkts_val); ++ int etherStatsMulticastPkts_undo(etherStatsTable_rowreq_ctx ++ * rowreq_ctx); ++ ++ int ++ etherStatsCRCAlignErrors_check_value(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long ++ etherStatsCRCAlignErrors_val); ++ int ++ etherStatsCRCAlignErrors_undo_setup(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ int etherStatsCRCAlignErrors_set(etherStatsTable_rowreq_ctx ++ * rowreq_ctx, ++ u_long ++ etherStatsCRCAlignErrors_val); ++ int ++ etherStatsCRCAlignErrors_undo(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ int ++ etherStatsUndersizePkts_check_value(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long ++ etherStatsUndersizePkts_val); ++ int ++ etherStatsUndersizePkts_undo_setup(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ int etherStatsUndersizePkts_set(etherStatsTable_rowreq_ctx ++ * rowreq_ctx, ++ u_long ++ etherStatsUndersizePkts_val); ++ int etherStatsUndersizePkts_undo(etherStatsTable_rowreq_ctx ++ * rowreq_ctx); ++ ++ int ++ etherStatsOversizePkts_check_value(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long ++ etherStatsOversizePkts_val); ++ int ++ etherStatsOversizePkts_undo_setup(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ int etherStatsOversizePkts_set(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long ++ etherStatsOversizePkts_val); ++ int etherStatsOversizePkts_undo(etherStatsTable_rowreq_ctx ++ * rowreq_ctx); ++ ++ int ++ etherStatsFragments_check_value(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long etherStatsFragments_val); ++ int ++ etherStatsFragments_undo_setup(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ int etherStatsFragments_set(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long ++ etherStatsFragments_val); ++ int etherStatsFragments_undo(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ int ++ etherStatsJabbers_check_value(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long etherStatsJabbers_val); ++ int etherStatsJabbers_undo_setup(etherStatsTable_rowreq_ctx ++ * rowreq_ctx); ++ int etherStatsJabbers_set(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long etherStatsJabbers_val); ++ int etherStatsJabbers_undo(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ int ++ etherStatsCollisions_check_value(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long etherStatsCollisions_val); ++ int ++ etherStatsCollisions_undo_setup(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ int etherStatsCollisions_set(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long ++ etherStatsCollisions_val); ++ int etherStatsCollisions_undo(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ int ++ etherStatsPkts64Octets_check_value(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long ++ etherStatsPkts64Octets_val); ++ int ++ etherStatsPkts64Octets_undo_setup(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ int etherStatsPkts64Octets_set(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long ++ etherStatsPkts64Octets_val); ++ int etherStatsPkts64Octets_undo(etherStatsTable_rowreq_ctx ++ * rowreq_ctx); ++ ++ int ++ etherStatsPkts65to127Octets_check_value(etherStatsTable_rowreq_ctx ++ * rowreq_ctx, ++ u_long ++ etherStatsPkts65to127Octets_val); ++ int ++ etherStatsPkts65to127Octets_undo_setup(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ int ++ etherStatsPkts65to127Octets_set(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long ++ etherStatsPkts65to127Octets_val); ++ int ++ etherStatsPkts65to127Octets_undo(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ int ++ etherStatsPkts128to255Octets_check_value(etherStatsTable_rowreq_ctx ++ * rowreq_ctx, ++ u_long ++ etherStatsPkts128to255Octets_val); ++ int ++ etherStatsPkts128to255Octets_undo_setup(etherStatsTable_rowreq_ctx ++ * rowreq_ctx); ++ int ++ etherStatsPkts128to255Octets_set(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long ++ etherStatsPkts128to255Octets_val); ++ int ++ etherStatsPkts128to255Octets_undo(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ int ++ etherStatsPkts256to511Octets_check_value(etherStatsTable_rowreq_ctx ++ * rowreq_ctx, ++ u_long ++ etherStatsPkts256to511Octets_val); ++ int ++ etherStatsPkts256to511Octets_undo_setup(etherStatsTable_rowreq_ctx ++ * rowreq_ctx); ++ int ++ etherStatsPkts256to511Octets_set(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long ++ etherStatsPkts256to511Octets_val); ++ int ++ etherStatsPkts256to511Octets_undo(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ int ++ etherStatsPkts512to1023Octets_check_value ++ (etherStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long etherStatsPkts512to1023Octets_val); ++ int ++ etherStatsPkts512to1023Octets_undo_setup(etherStatsTable_rowreq_ctx ++ * rowreq_ctx); ++ int ++ etherStatsPkts512to1023Octets_set(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long ++ etherStatsPkts512to1023Octets_val); ++ int ++ etherStatsPkts512to1023Octets_undo(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ int ++ etherStatsPkts1024to1518Octets_check_value ++ (etherStatsTable_rowreq_ctx * rowreq_ctx, ++ u_long etherStatsPkts1024to1518Octets_val); ++ int ++ etherStatsPkts1024to1518Octets_undo_setup ++ (etherStatsTable_rowreq_ctx * rowreq_ctx); ++ int ++ etherStatsPkts1024to1518Octets_set(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long ++ etherStatsPkts1024to1518Octets_val); ++ int ++ etherStatsPkts1024to1518Octets_undo(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ int etherStatsOwner_check_value(etherStatsTable_rowreq_ctx ++ * rowreq_ctx, ++ char ++ *etherStatsOwner_val_ptr, ++ size_t ++ etherStatsOwner_val_ptr_len); ++ int etherStatsOwner_undo_setup(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ int etherStatsOwner_set(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ char *etherStatsOwner_val_ptr, ++ size_t ++ etherStatsOwner_val_ptr_len); ++ int etherStatsOwner_undo(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ int etherStatsStatus_check_value(etherStatsTable_rowreq_ctx ++ * rowreq_ctx, ++ u_long ++ etherStatsStatus_val); ++ int etherStatsStatus_undo_setup(etherStatsTable_rowreq_ctx ++ * rowreq_ctx); ++ int etherStatsStatus_set(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, ++ u_long etherStatsStatus_val); ++ int etherStatsStatus_undo(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ ++ int ++ etherStatsTable_check_dependencies(etherStatsTable_rowreq_ctx * ++ ctx); ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* ETHERSTATSTABLE_DATA_SET_H */ +Index: agent/mibgroup/rmon-mib/etherStatsTable_enums.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/rmon-mib/etherStatsTable_enums.h 2008-09-11 22:27:51.883791406 +0200 +@@ -0,0 +1,57 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * : generic-table-enums.m2c 12526 2005-07-15 22:41:16Z rstory $ ++ * ++ * $Id:$ ++ */ ++#ifndef ETHERSTATSTABLE_ENUMS_H ++#define ETHERSTATSTABLE_ENUMS_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ /* ++ * 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 etherStatsTable ++ * ++ ************************************************************************* ++ *************************************************************************/ ++ ++/************************************************************* ++ * constants for enums for the MIB node ++ * etherStatsStatus (EntryStatus / ASN_INTEGER) ++ * ++ * since a Textual Convention may be referenced more than once in a ++ * MIB, protect againt redefinitions of the enum values. ++ */ ++#ifndef ENTRYSTATUS_ENUMS ++#define ENTRYSTATUS_ENUMS ++ ++#define ENTRYSTATUS_VALID 1 ++#define ENTRYSTATUS_CREATEREQUEST 2 ++#define ENTRYSTATUS_UNDERCREATION 3 ++#define ENTRYSTATUS_INVALID 4 ++ ++#endif /* ENTRYSTATUS_ENUMS */ ++ ++ ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* ETHERSTATSTABLE_ENUMS_H */ +Index: agent/mibgroup/rmon-mib/etherStatsTable.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/rmon-mib/etherStatsTable.h 2008-09-11 22:27:51.899791223 +0200 +@@ -0,0 +1,303 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 14170 $ of $ ++ * ++ * $Id:$ ++ */ ++#ifndef ETHERSTATSTABLE_H ++#define ETHERSTATSTABLE_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++/** @addtogroup misc misc: Miscellaneous routines ++ * ++ * @{ ++ */ ++#include ++ ++ /* ++ * OID and column number definitions for etherStatsTable ++ */ ++#include "etherStatsTable_oids.h" ++ ++ /* ++ * enum definions ++ */ ++#include "etherStatsTable_enums.h" ++ ++ /* ++ ********************************************************************* ++ * function declarations ++ */ ++ void init_etherStatsTable(void); ++ void shutdown_etherStatsTable(void); ++ ++ /* ++ ********************************************************************* ++ * Table declarations ++ */ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table etherStatsTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++ /* ++ * RMON-MIB::etherStatsTable is subid 1 of statistics. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.16.1.1, length: 9 ++ */ ++ /* ++ ********************************************************************* ++ * When you register your mib, you get to provide a generic ++ * pointer that will be passed back to you for most of the ++ * functions calls. ++ * ++ * TODO:100:r: Review all context structures ++ */ ++ /* ++ * TODO:101:o: |-> Review etherStatsTable registration context. ++ */ ++ typedef netsnmp_data_list etherStatsTable_registration; ++ ++/**********************************************************************/ ++ /* ++ * TODO:110:r: |-> Review etherStatsTable data context structure. ++ * This structure is used to represent the data for etherStatsTable. ++ */ ++ /* ++ * This structure contains storage for all the columns defined in the ++ * etherStatsTable. ++ */ ++ typedef struct etherStatsTable_data_s { ++ ++ /* ++ * etherStatsDataSource(2)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/A/W/e/r/d/h ++ */ ++ oid etherStatsDataSource[128]; ++ size_t etherStatsDataSource_len; /* # of oid elements, not bytes */ ++ ++ /* ++ * etherStatsDropEvents(3)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long etherStatsDropEvents; ++ ++ /* ++ * etherStatsOctets(4)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long etherStatsOctets; ++ ++ /* ++ * etherStatsPkts(5)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long etherStatsPkts; ++ ++ /* ++ * etherStatsBroadcastPkts(6)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long etherStatsBroadcastPkts; ++ ++ /* ++ * etherStatsMulticastPkts(7)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long etherStatsMulticastPkts; ++ ++ /* ++ * etherStatsCRCAlignErrors(8)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long etherStatsCRCAlignErrors; ++ ++ /* ++ * etherStatsUndersizePkts(9)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long etherStatsUndersizePkts; ++ ++ /* ++ * etherStatsOversizePkts(10)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long etherStatsOversizePkts; ++ ++ /* ++ * etherStatsFragments(11)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long etherStatsFragments; ++ ++ /* ++ * etherStatsJabbers(12)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long etherStatsJabbers; ++ ++ /* ++ * etherStatsCollisions(13)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long etherStatsCollisions; ++ ++ /* ++ * etherStatsPkts64Octets(14)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long etherStatsPkts64Octets; ++ ++ /* ++ * etherStatsPkts65to127Octets(15)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long etherStatsPkts65to127Octets; ++ ++ /* ++ * etherStatsPkts128to255Octets(16)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long etherStatsPkts128to255Octets; ++ ++ /* ++ * etherStatsPkts256to511Octets(17)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long etherStatsPkts256to511Octets; ++ ++ /* ++ * etherStatsPkts512to1023Octets(18)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long etherStatsPkts512to1023Octets; ++ ++ /* ++ * etherStatsPkts1024to1518Octets(19)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ u_long etherStatsPkts1024to1518Octets; ++ ++ /* ++ * etherStatsOwner(20)/OwnerString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/h ++ */ ++ char etherStatsOwner[127]; ++ size_t etherStatsOwner_len; /* # of char elements, not bytes */ ++ ++ /* ++ * etherStatsStatus(21)/EntryStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h ++ */ ++ u_long etherStatsStatus; ++ ++ } etherStatsTable_data; ++ ++ ++ /* ++ ********************************************************************* ++ * TODO:115:o: |-> Review etherStatsTable 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 etherStatsTable_data etherStatsTable_undo_data; ++ ++ /* ++ * TODO:120:r: |-> Review etherStatsTable mib index. ++ * This structure is used to represent the index for etherStatsTable. ++ */ ++ typedef struct etherStatsTable_mib_index_s { ++ ++ /* ++ * etherStatsIndex(1)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h ++ */ ++ long etherStatsIndex; ++ ++ ++ } etherStatsTable_mib_index; ++ ++ /* ++ * TODO:121:r: | |-> Review etherStatsTable max index length. ++ * If you KNOW that your indexes will never exceed a certain ++ * length, update this macro to that length. ++ */ ++#define MAX_etherStatsTable_IDX_LEN 1 ++ ++ ++ /* ++ ********************************************************************* ++ * TODO:130:o: |-> Review etherStatsTable Row request (rowreq) context. ++ * When your functions are called, you will be passed a ++ * etherStatsTable_rowreq_ctx pointer. ++ */ ++ typedef struct etherStatsTable_rowreq_ctx_s { ++ ++ /** this must be first for container compare to work */ ++ netsnmp_index oid_idx; ++ oid oid_tmp[MAX_etherStatsTable_IDX_LEN]; ++ ++ etherStatsTable_mib_index tbl_idx; ++ ++ etherStatsTable_data data; ++ unsigned int column_exists_flags; /* flags for existence */ ++ etherStatsTable_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 etherStatsTable rowreq context. ++ */ ++ ++ /* ++ * storage for future expansion ++ */ ++ netsnmp_data_list *etherStatsTable_data_list; ++ ++ } etherStatsTable_rowreq_ctx; ++ ++ typedef struct etherStatsTable_ref_rowreq_ctx_s { ++ etherStatsTable_rowreq_ctx *rowreq_ctx; ++ } etherStatsTable_ref_rowreq_ctx; ++ ++ /* ++ ********************************************************************* ++ * function prototypes ++ */ ++ int ++ etherStatsTable_pre_request(etherStatsTable_registration * ++ user_context); ++ int ++ etherStatsTable_post_request(etherStatsTable_registration * ++ user_context, int rc); ++ ++ int ++ etherStatsTable_rowreq_ctx_init(etherStatsTable_rowreq_ctx * ++ rowreq_ctx, void *user_init_ctx); ++ void ++ etherStatsTable_rowreq_ctx_cleanup(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ int etherStatsTable_commit(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ etherStatsTable_rowreq_ctx ++ *etherStatsTable_row_find_by_mib_index(etherStatsTable_mib_index * ++ mib_idx); ++ ++ extern oid etherStatsTable_oid[]; ++ extern int etherStatsTable_oid_size; ++ ++ ++#include "etherStatsTable_interface.h" ++#include "etherStatsTable_data_access.h" ++#include "etherStatsTable_data_get.h" ++#include "etherStatsTable_data_set.h" ++ ++ /* ++ * DUMMY markers, ignore ++ * ++ * TODO:099:x: ************************************************************* ++ * TODO:199:x: ************************************************************* ++ * TODO:299:x: ************************************************************* ++ * TODO:399:x: ************************************************************* ++ * TODO:499:x: ************************************************************* ++ */ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* ETHERSTATSTABLE_H */ ++/** @} */ +Index: agent/mibgroup/rmon-mib/etherStatsTable_interface.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/rmon-mib/etherStatsTable_interface.c 2008-09-11 22:27:51.919930192 +0200 +@@ -0,0 +1,2225 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 15899 $ of $ ++ * ++ * $Id:$ ++ */ ++/* ++ * ********************************************************************* ++ * ********************************************************************* ++ * ********************************************************************* ++ * *** *** ++ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE *** ++ * *** *** ++ * *** *** ++ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. *** ++ * *** *** ++ * *** *** ++ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND *** ++ * *** *** ++ * *** *** ++ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. *** ++ * *** *** ++ * *** *** ++ * ********************************************************************* ++ * ********************************************************************* ++ * ********************************************************************* ++ */ ++ ++/* ++ * standard Net-SNMP includes ++ */ ++#include ++#include ++#include ++ ++/* ++ * include our parent header ++ */ ++#include "etherStatsTable.h" ++ ++ ++#include ++#include ++ ++#include "etherStatsTable_interface.h" ++ ++#include ++ ++/********************************************************************** ++ ********************************************************************** ++ *** ++ *** Table etherStatsTable ++ *** ++ ********************************************************************** ++ **********************************************************************/ ++/* ++ * RMON-MIB::etherStatsTable is subid 1 of statistics. ++ * Its status is Current. ++ * OID: .1.3.6.1.2.1.16.1.1, length: 9 ++ */ ++typedef struct etherStatsTable_interface_ctx_s { ++ ++ netsnmp_container *container; ++ netsnmp_cache *cache; ++ ++ etherStatsTable_registration *user_ctx; ++ ++ netsnmp_table_registration_info tbl_info; ++ ++ netsnmp_baby_steps_access_methods access_multiplexer; ++ ++ u_int table_dirty; ++ ++} etherStatsTable_interface_ctx; ++ ++static etherStatsTable_interface_ctx etherStatsTable_if_ctx; ++ ++static void ++_etherStatsTable_container_init(etherStatsTable_interface_ctx * if_ctx); ++static void ++_etherStatsTable_container_shutdown(etherStatsTable_interface_ctx * ++ if_ctx); ++ ++ ++netsnmp_container * ++etherStatsTable_container_get(void) ++{ ++ return etherStatsTable_if_ctx.container; ++} ++ ++etherStatsTable_registration * ++etherStatsTable_registration_get(void) ++{ ++ return etherStatsTable_if_ctx.user_ctx; ++} ++ ++etherStatsTable_registration * ++etherStatsTable_registration_set(etherStatsTable_registration * newreg) ++{ ++ etherStatsTable_registration *old = etherStatsTable_if_ctx.user_ctx; ++ etherStatsTable_if_ctx.user_ctx = newreg; ++ return old; ++} ++ ++int ++etherStatsTable_container_size(void) ++{ ++ return CONTAINER_SIZE(etherStatsTable_if_ctx.container); ++} ++ ++u_int ++etherStatsTable_dirty_get(void) ++{ ++ return etherStatsTable_if_ctx.table_dirty; ++} ++ ++void ++etherStatsTable_dirty_set(u_int status) ++{ ++ DEBUGMSGTL(("etherStatsTable:etherStatsTable_dirty_set", ++ "called. was %d, now %d\n", ++ etherStatsTable_if_ctx.table_dirty, status)); ++ etherStatsTable_if_ctx.table_dirty = status; ++} ++ ++/* ++ * mfd multiplexer modes ++ */ ++static Netsnmp_Node_Handler _mfd_etherStatsTable_pre_request; ++static Netsnmp_Node_Handler _mfd_etherStatsTable_post_request; ++static Netsnmp_Node_Handler _mfd_etherStatsTable_object_lookup; ++static Netsnmp_Node_Handler _mfd_etherStatsTable_get_values; ++static Netsnmp_Node_Handler _mfd_etherStatsTable_check_objects; ++static Netsnmp_Node_Handler _mfd_etherStatsTable_undo_setup; ++static Netsnmp_Node_Handler _mfd_etherStatsTable_set_values; ++static Netsnmp_Node_Handler _mfd_etherStatsTable_undo_cleanup; ++static Netsnmp_Node_Handler _mfd_etherStatsTable_undo_values; ++static Netsnmp_Node_Handler _mfd_etherStatsTable_commit; ++static Netsnmp_Node_Handler _mfd_etherStatsTable_undo_commit; ++static Netsnmp_Node_Handler _mfd_etherStatsTable_irreversible_commit; ++ ++NETSNMP_STATIC_INLINE int ++_etherStatsTable_undo_column(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ netsnmp_variable_list * var, int column); ++ ++NETSNMP_STATIC_INLINE int ++_etherStatsTable_check_indexes(etherStatsTable_rowreq_ctx * rowreq_ctx); ++ ++etherStatsTable_data *etherStatsTable_allocate_data(void); ++ ++/** ++ * @internal ++ * Initialize the table etherStatsTable ++ * (Define its contents and how it's structured) ++ */ ++void ++_etherStatsTable_initialize_interface(etherStatsTable_registration * ++ reg_ptr, u_long flags) ++{ ++ netsnmp_baby_steps_access_methods *access_multiplexer = ++ ðerStatsTable_if_ctx.access_multiplexer; ++ netsnmp_table_registration_info *tbl_info = ++ ðerStatsTable_if_ctx.tbl_info; ++ netsnmp_handler_registration *reginfo; ++ netsnmp_mib_handler *handler; ++ int mfd_modes = 0; ++ ++ DEBUGMSGTL(("internal:etherStatsTable:_etherStatsTable_initialize_interface", "called\n")); ++ ++ ++ /************************************************* ++ * ++ * save interface context for etherStatsTable ++ */ ++ /* ++ * Setting up the table's definition ++ */ ++ netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER, ++ /** index: etherStatsIndex */ ++ 0); ++ ++ /* ++ * Define the minimum and maximum accessible columns. This ++ * optimizes retrival. ++ */ ++ tbl_info->min_column = ETHERSTATSTABLE_MIN_COL; ++ tbl_info->max_column = ETHERSTATSTABLE_MAX_COL; ++ ++ /* ++ * save users context ++ */ ++ etherStatsTable_if_ctx.user_ctx = reg_ptr; ++ ++ /* ++ * call data access initialization code ++ */ ++ etherStatsTable_init_data(reg_ptr); ++ ++ /* ++ * set up the container ++ */ ++ _etherStatsTable_container_init(ðerStatsTable_if_ctx); ++ if (NULL == etherStatsTable_if_ctx.container) { ++ snmp_log(LOG_ERR, ++ "could not initialize container for etherStatsTable\n"); ++ return; ++ } ++ ++ /* ++ * access_multiplexer: REQUIRED wrapper for get request handling ++ */ ++ access_multiplexer->object_lookup = _mfd_etherStatsTable_object_lookup; ++ access_multiplexer->get_values = _mfd_etherStatsTable_get_values; ++ ++ /* ++ * no wrappers yet ++ */ ++ access_multiplexer->pre_request = _mfd_etherStatsTable_pre_request; ++ access_multiplexer->post_request = _mfd_etherStatsTable_post_request; ++ ++ ++ /* ++ * REQUIRED wrappers for set request handling ++ */ ++ access_multiplexer->object_syntax_checks = ++ _mfd_etherStatsTable_check_objects; ++ access_multiplexer->undo_setup = _mfd_etherStatsTable_undo_setup; ++ access_multiplexer->undo_cleanup = _mfd_etherStatsTable_undo_cleanup; ++ access_multiplexer->set_values = _mfd_etherStatsTable_set_values; ++ access_multiplexer->undo_sets = _mfd_etherStatsTable_undo_values; ++ ++ /* ++ * no wrappers yet ++ */ ++ access_multiplexer->commit = _mfd_etherStatsTable_commit; ++ access_multiplexer->undo_commit = _mfd_etherStatsTable_undo_commit; ++ access_multiplexer->irreversible_commit = ++ _mfd_etherStatsTable_irreversible_commit; ++ ++ /************************************************* ++ * ++ * Create a registration, save our reg data, register table. ++ */ ++ DEBUGMSGTL(("etherStatsTable:init_etherStatsTable", ++ "Registering etherStatsTable as a mibs-for-dummies table.\n")); ++ handler = ++ netsnmp_baby_steps_access_multiplexer_get(access_multiplexer); ++ reginfo = ++ netsnmp_handler_registration_create("etherStatsTable", handler, ++ etherStatsTable_oid, ++ etherStatsTable_oid_size, ++ HANDLER_CAN_BABY_STEP | ++ HANDLER_CAN_RWRITE); ++ if (NULL == reginfo) { ++ snmp_log(LOG_ERR, "error registering table etherStatsTable\n"); ++ return; ++ } ++ reginfo->my_reg_void = ðerStatsTable_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, ++ etherStatsTable_if_ctx. ++ container, ++ TABLE_CONTAINER_KEY_NETSNMP_INDEX); ++ netsnmp_inject_handler(reginfo, handler); ++ ++ /************************************************* ++ * ++ * inject cache helper ++ */ ++ if (NULL != etherStatsTable_if_ctx.cache) { ++ handler = netsnmp_cache_handler_get(etherStatsTable_if_ctx.cache); ++ netsnmp_inject_handler(reginfo, handler); ++ } ++ ++ /* ++ * register table ++ */ ++ netsnmp_register_table(reginfo, tbl_info); ++ ++} /* _etherStatsTable_initialize_interface */ ++ ++/** ++ * @internal ++ * Shutdown the table etherStatsTable ++ */ ++void ++_etherStatsTable_shutdown_interface(etherStatsTable_registration * reg_ptr) ++{ ++ /* ++ * shutdown the container ++ */ ++ _etherStatsTable_container_shutdown(ðerStatsTable_if_ctx); ++} ++ ++void ++etherStatsTable_valid_columns_set(netsnmp_column_info *vc) ++{ ++ etherStatsTable_if_ctx.tbl_info.valid_columns = vc; ++} /* etherStatsTable_valid_columns_set */ ++ ++/** ++ * @internal ++ * convert the index component stored in the context to an oid ++ */ ++int ++etherStatsTable_index_to_oid(netsnmp_index * oid_idx, ++ etherStatsTable_mib_index * mib_idx) ++{ ++ int err = SNMP_ERR_NOERROR; ++ ++ /* ++ * temp storage for parsing indexes ++ */ ++ /* ++ * etherStatsIndex(1)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h ++ */ ++ netsnmp_variable_list var_etherStatsIndex; ++ ++ /* ++ * set up varbinds ++ */ ++ memset(&var_etherStatsIndex, 0x00, sizeof(var_etherStatsIndex)); ++ var_etherStatsIndex.type = ASN_INTEGER; ++ ++ /* ++ * chain temp index varbinds together ++ */ ++ var_etherStatsIndex.next_variable = NULL; ++ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_index_to_oid", ++ "called\n")); ++ ++ /* ++ * etherStatsIndex(1)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h ++ */ ++ snmp_set_var_value(&var_etherStatsIndex, ++ (u_char *) & mib_idx->etherStatsIndex, ++ sizeof(mib_idx->etherStatsIndex)); ++ ++ ++ err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len, ++ NULL, 0, &var_etherStatsIndex); ++ 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_etherStatsIndex); ++ ++ return err; ++} /* etherStatsTable_index_to_oid */ ++ ++/** ++ * extract etherStatsTable indexes from a netsnmp_index ++ * ++ * @retval SNMP_ERR_NOERROR : no error ++ * @retval SNMP_ERR_GENERR : error ++ */ ++int ++etherStatsTable_index_from_oid(netsnmp_index * oid_idx, ++ etherStatsTable_mib_index * mib_idx) ++{ ++ int err = SNMP_ERR_NOERROR; ++ ++ /* ++ * temp storage for parsing indexes ++ */ ++ /* ++ * etherStatsIndex(1)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h ++ */ ++ netsnmp_variable_list var_etherStatsIndex; ++ ++ /* ++ * set up varbinds ++ */ ++ memset(&var_etherStatsIndex, 0x00, sizeof(var_etherStatsIndex)); ++ var_etherStatsIndex.type = ASN_INTEGER; ++ ++ /* ++ * chain temp index varbinds together ++ */ ++ var_etherStatsIndex.next_variable = NULL; ++ ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_index_from_oid", ++ "called\n")); ++ ++ /* ++ * parse the oid into the individual index components ++ */ ++ err = parse_oid_indexes(oid_idx->oids, oid_idx->len, ++ &var_etherStatsIndex); ++ if (err == SNMP_ERR_NOERROR) { ++ /* ++ * copy out values ++ */ ++ mib_idx->etherStatsIndex = ++ *((long *) var_etherStatsIndex.val.string); ++ ++ ++ } ++ ++ /* ++ * parsing may have allocated memory. free it. ++ */ ++ snmp_reset_var_buffers(&var_etherStatsIndex); ++ ++ return err; ++} /* etherStatsTable_index_from_oid */ ++ ++ ++/* ++ * etherStatsTable_allocate_data ++ * ++ * Purpose: create new etherStatsTable_data. ++ */ ++etherStatsTable_data * ++etherStatsTable_allocate_data(void) ++{ ++ etherStatsTable_data *rtn = SNMP_MALLOC_TYPEDEF(etherStatsTable_data); ++ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_allocate_data", ++ "called\n")); ++ ++ if (NULL == rtn) { ++ snmp_log(LOG_ERR, "unable to malloc memory for new " ++ "etherStatsTable_data.\n"); ++ } ++ ++ return rtn; ++} /* etherStatsTable_allocate_data */ ++ ++/* ++ * etherStatsTable_release_data ++ * ++ * Purpose: release etherStatsTable data. ++ */ ++void ++etherStatsTable_release_data(etherStatsTable_data * data) ++{ ++ DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_release_data", ++ "called\n")); ++ ++ free(data); ++} /* etherStatsTable_release_data */ ++ ++/* ++ ********************************************************************* ++ * @internal ++ * allocate resources for a etherStatsTable_rowreq_ctx ++ */ ++etherStatsTable_rowreq_ctx * ++etherStatsTable_allocate_rowreq_ctx(void *user_init_ctx) ++{ ++ etherStatsTable_rowreq_ctx *rowreq_ctx = ++ SNMP_MALLOC_TYPEDEF(etherStatsTable_rowreq_ctx); ++ ++ DEBUGMSGTL(("internal:etherStatsTable:etherStatsTable_allocate_rowreq_ctx", "called\n")); ++ ++ if (NULL == rowreq_ctx) { ++ snmp_log(LOG_ERR, "Couldn't allocate memory for a " ++ "etherStatsTable_rowreq_ctx.\n"); ++ return NULL; ++ } ++ ++ rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp; ++ ++ rowreq_ctx->etherStatsTable_data_list = NULL; ++ ++ /* ++ * if we allocated data, call init routine ++ */ ++ if (!(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) { ++ if (SNMPERR_SUCCESS != ++ etherStatsTable_rowreq_ctx_init(rowreq_ctx, user_init_ctx)) { ++ etherStatsTable_release_rowreq_ctx(rowreq_ctx); ++ rowreq_ctx = NULL; ++ } ++ } ++ ++ return rowreq_ctx; ++} /* etherStatsTable_allocate_rowreq_ctx */ ++ ++/* ++ * @internal ++ * release resources for a etherStatsTable_rowreq_ctx ++ */ ++void ++etherStatsTable_release_rowreq_ctx(etherStatsTable_rowreq_ctx * rowreq_ctx) ++{ ++ DEBUGMSGTL(("internal:etherStatsTable:etherStatsTable_release_rowreq_ctx", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ etherStatsTable_rowreq_ctx_cleanup(rowreq_ctx); ++ ++ if (rowreq_ctx->undo) ++ etherStatsTable_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); ++} /* etherStatsTable_release_rowreq_ctx */ ++ ++/** ++ * @internal ++ * wrapper ++ */ ++static int ++_mfd_etherStatsTable_pre_request(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration *reginfo, ++ netsnmp_agent_request_info *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ int rc; ++ ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_pre_request", "called\n")); ++ ++ if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) { ++ DEBUGMSGTL(("internal:etherStatsTable", ++ "skipping additional pre_request\n")); ++ return SNMP_ERR_NOERROR; ++ } ++ ++ rc = etherStatsTable_pre_request(etherStatsTable_if_ctx.user_ctx); ++ if (MFD_SUCCESS != rc) { ++ /* ++ * nothing we can do about it but log it ++ */ ++ DEBUGMSGTL(("etherStatsTable", "error %d from " ++ "etherStatsTable_pre_request\n", rc)); ++ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); ++ } ++ ++ return SNMP_ERR_NOERROR; ++} /* _mfd_etherStatsTable_pre_request */ ++ ++/** ++ * @internal ++ * wrapper ++ */ ++static int ++_mfd_etherStatsTable_post_request(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration *reginfo, ++ netsnmp_agent_request_info *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ etherStatsTable_rowreq_ctx *rowreq_ctx = ++ netsnmp_container_table_row_extract(requests); ++ int rc, packet_rc; ++ ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_post_request", "called\n")); ++ ++ /* ++ * release row context, if deleted ++ */ ++ if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED)) ++ etherStatsTable_release_rowreq_ctx(rowreq_ctx); ++ ++ /* ++ * wait for last call before calling user ++ */ ++ if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) { ++ DEBUGMSGTL(("internal:etherStatsTable", ++ "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) && etherStatsTable_dirty_get()) { ++ /* ++ * we shouldn't get here. the undo steps should also clear ++ * the dirty flags. ++ */ ++ snmp_log(LOG_WARNING, ++ "etherStatsTable dirty flag set in post_request " ++ "but status != SUCCESS.\n"); ++ } ++ ++ rc = etherStatsTable_post_request(etherStatsTable_if_ctx.user_ctx, ++ packet_rc); ++ if (MFD_SUCCESS != rc) { ++ /* ++ * nothing we can do about it but log it ++ */ ++ DEBUGMSGTL(("etherStatsTable", "error %d from " ++ "etherStatsTable_post_request\n", rc)); ++ } ++ ++ return SNMP_ERR_NOERROR; ++} /* _mfd_etherStatsTable_post_request */ ++ ++/** ++ * @internal ++ * wrapper ++ */ ++static etherStatsTable_rowreq_ctx * ++_mfd_etherStatsTable_rowreq_from_index(netsnmp_index * oid_idx, ++ int *rc_ptr) ++{ ++ etherStatsTable_rowreq_ctx *rowreq_ctx; ++ etherStatsTable_mib_index mib_idx; ++ int rc; ++ ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_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 = etherStatsTable_index_from_oid(oid_idx, &mib_idx); ++ if (MFD_SUCCESS != *rc_ptr) { ++ DEBUGMSGT(("etherStatsTable", "error parsing index\n")); ++ return NULL; ++ } ++ ++ /* ++ * allocate new context ++ */ ++ rowreq_ctx = etherStatsTable_allocate_rowreq_ctx(NULL); ++ if (NULL == rowreq_ctx) { ++ *rc_ptr = MFD_ERROR; ++ return NULL; /* msg already logged */ ++ } ++ ++ memcpy(&rowreq_ctx->tbl_idx, &mib_idx, sizeof(mib_idx)); ++ ++ /* ++ * check indexes ++ */ ++ *rc_ptr = _etherStatsTable_check_indexes(rowreq_ctx); ++ if (MFD_SUCCESS != *rc_ptr) { ++ netsnmp_assert((*rc_ptr == SNMP_ERR_NOCREATION) || ++ (*rc_ptr == SNMP_ERR_INCONSISTENTNAME)); ++ etherStatsTable_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_etherStatsTable_rowreq_from_index */ ++ ++ ++/** ++ * @internal ++ * wrapper ++ */ ++static int ++_mfd_etherStatsTable_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; ++ etherStatsTable_rowreq_ctx *rowreq_ctx = ++ netsnmp_container_table_row_extract(requests); ++ ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_object_lookup", "called\n")); ++ ++ /* ++ * get our context from mfd ++ * etherStatsTable_interface_ctx *if_ctx = ++ * (etherStatsTable_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_etherStatsTable_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 ++ etherStatsTable_row_prep(rowreq_ctx); ++ ++ return SNMP_VALIDATE_ERR(rc); ++} /* _mfd_etherStatsTable_object_lookup */ ++ ++/*********************************************************************** ++ * ++ * GET processing ++ * ++ ***********************************************************************/ ++/* ++ * @internal ++ * Retrieve the value for a particular column ++ */ ++NETSNMP_STATIC_INLINE int ++_etherStatsTable_get_column(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ netsnmp_variable_list * var, int column) ++{ ++ int rc = SNMPERR_SUCCESS; ++ ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_get_column", ++ "called for %d\n", column)); ++ ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ switch (column) { ++ ++ /* ++ * (INDEX) etherStatsIndex(1)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h ++ */ ++ case COLUMN_ETHERSTATSINDEX: ++ var->type = ASN_INTEGER; ++ var->val_len = sizeof(long); ++ (*var->val.integer) = rowreq_ctx->tbl_idx.etherStatsIndex; ++ break; ++ ++ /* ++ * etherStatsDataSource(2)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/A/W/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSDATASOURCE: ++ if (! ++ (COLUMN_ETHERSTATSDATASOURCE_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_get_column", "column %d (etherStatsDataSource) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->type = ASN_OBJECT_ID; ++ rc = etherStatsDataSource_get(rowreq_ctx, ++ (oid **) & var->val.string, ++ &var->val_len); ++ break; ++ ++ /* ++ * etherStatsDropEvents(3)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSDROPEVENTS: ++ if (! ++ (COLUMN_ETHERSTATSDROPEVENTS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_get_column", "column %d (etherStatsDropEvents) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = etherStatsDropEvents_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * etherStatsOctets(4)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSOCTETS: ++ if (! ++ (COLUMN_ETHERSTATSOCTETS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_get_column", "column %d (etherStatsOctets) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = etherStatsOctets_get(rowreq_ctx, (u_long *) var->val.string); ++ break; ++ ++ /* ++ * etherStatsPkts(5)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSPKTS: ++ if (! ++ (COLUMN_ETHERSTATSPKTS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_get_column", "column %d (etherStatsPkts) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = etherStatsPkts_get(rowreq_ctx, (u_long *) var->val.string); ++ break; ++ ++ /* ++ * etherStatsBroadcastPkts(6)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSBROADCASTPKTS: ++ if (! ++ (COLUMN_ETHERSTATSBROADCASTPKTS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_get_column", "column %d (etherStatsBroadcastPkts) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = etherStatsBroadcastPkts_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * etherStatsMulticastPkts(7)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSMULTICASTPKTS: ++ if (! ++ (COLUMN_ETHERSTATSMULTICASTPKTS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_get_column", "column %d (etherStatsMulticastPkts) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = etherStatsMulticastPkts_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * etherStatsCRCAlignErrors(8)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSCRCALIGNERRORS: ++ if (! ++ (COLUMN_ETHERSTATSCRCALIGNERRORS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_get_column", "column %d (etherStatsCRCAlignErrors) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = etherStatsCRCAlignErrors_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * etherStatsUndersizePkts(9)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSUNDERSIZEPKTS: ++ if (! ++ (COLUMN_ETHERSTATSUNDERSIZEPKTS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_get_column", "column %d (etherStatsUndersizePkts) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = etherStatsUndersizePkts_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * etherStatsOversizePkts(10)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSOVERSIZEPKTS: ++ if (! ++ (COLUMN_ETHERSTATSOVERSIZEPKTS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_get_column", "column %d (etherStatsOversizePkts) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = etherStatsOversizePkts_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * etherStatsFragments(11)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSFRAGMENTS: ++ if (! ++ (COLUMN_ETHERSTATSFRAGMENTS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_get_column", "column %d (etherStatsFragments) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = etherStatsFragments_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * etherStatsJabbers(12)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSJABBERS: ++ if (! ++ (COLUMN_ETHERSTATSJABBERS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ snmp_log (LOG_ERR, "internal:etherStatsTable:_mfd_etherStatsTable_get_column, column %d (etherStatsJabbers) doesn't exist for the interface with index %u\n", column, rowreq_ctx->tbl_idx.etherStatsIndex); ++ ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_get_column", "column %d (etherStatsJabbers) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = etherStatsJabbers_get(rowreq_ctx, (u_long *) var->val.string); ++ break; ++ ++ /* ++ * etherStatsCollisions(13)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSCOLLISIONS: ++ if (! ++ (COLUMN_ETHERSTATSCOLLISIONS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_get_column", "column %d (etherStatsCollisions) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = etherStatsCollisions_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * etherStatsPkts64Octets(14)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSPKTS64OCTETS: ++ if (! ++ (COLUMN_ETHERSTATSPKTS64OCTETS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_get_column", "column %d (etherStatsPkts64Octets) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = etherStatsPkts64Octets_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * etherStatsPkts65to127Octets(15)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSPKTS65TO127OCTETS: ++ if (! ++ (COLUMN_ETHERSTATSPKTS65TO127OCTETS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_get_column", "column %d (etherStatsPkts65to127Octets) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = etherStatsPkts65to127Octets_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * etherStatsPkts128to255Octets(16)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSPKTS128TO255OCTETS: ++ if (! ++ (COLUMN_ETHERSTATSPKTS128TO255OCTETS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_get_column", "column %d (etherStatsPkts128to255Octets) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = etherStatsPkts128to255Octets_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * etherStatsPkts256to511Octets(17)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSPKTS256TO511OCTETS: ++ if (! ++ (COLUMN_ETHERSTATSPKTS256TO511OCTETS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_get_column", "column %d (etherStatsPkts256to511Octets) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = etherStatsPkts256to511Octets_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * etherStatsPkts512to1023Octets(18)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSPKTS512TO1023OCTETS: ++ if (! ++ (COLUMN_ETHERSTATSPKTS512TO1023OCTETS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_get_column", "column %d (etherStatsPkts512to1023Octets) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = etherStatsPkts512to1023Octets_get(rowreq_ctx, ++ (u_long *) var->val.string); ++ break; ++ ++ /* ++ * etherStatsPkts1024to1518Octets(19)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSPKTS1024TO1518OCTETS: ++ if (! ++ (COLUMN_ETHERSTATSPKTS1024TO1518OCTETS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_get_column", "column %d (etherStatsPkts1024to1518Octets) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_COUNTER; ++ rc = etherStatsPkts1024to1518Octets_get(rowreq_ctx, ++ (u_long *) var->val. ++ string); ++ break; ++ ++ /* ++ * etherStatsOwner(20)/OwnerString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/h ++ */ ++ case COLUMN_ETHERSTATSOWNER: ++ if (! ++ (COLUMN_ETHERSTATSOWNER_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_get_column", "column %d (etherStatsOwner) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->type = ASN_OCTET_STR; ++ rc = etherStatsOwner_get(rowreq_ctx, (char **) &var->val.string, ++ &var->val_len); ++ break; ++ ++ /* ++ * etherStatsStatus(21)/EntryStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h ++ */ ++ case COLUMN_ETHERSTATSSTATUS: ++ if (! ++ (COLUMN_ETHERSTATSSTATUS_FLAG & rowreq_ctx-> ++ column_exists_flags)) { ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_get_column", "column %d (etherStatsStatus) doesn't exist\n", column)); ++ return MFD_SKIP; ++ } ++ ++ var->val_len = sizeof(u_long); ++ var->type = ASN_INTEGER; ++ rc = etherStatsStatus_get(rowreq_ctx, (u_long *) var->val.string); ++ break; ++ ++ default: ++ if (ETHERSTATSTABLE_MIN_COL <= column ++ && column <= ETHERSTATSTABLE_MAX_COL) { ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_get_column", "assume column %d is reserved\n", column)); ++ rc = MFD_SKIP; ++ } else { ++ snmp_log(LOG_ERR, ++ "unknown column %d in _etherStatsTable_get_column.\n", ++ column); ++ } ++ break; ++ } ++ ++ return rc; ++} /* _etherStatsTable_get_column */ ++ ++int ++_mfd_etherStatsTable_get_values(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration *reginfo, ++ netsnmp_agent_request_info *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ etherStatsTable_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:etherStatsTable:_mfd_etherStatsTable_get_values", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ DEBUGMSGTL(("9:etherStatsTable:_mfd_etherStatsTable_get_values", ++ "exists %p\n", (void *) rowreq_ctx->column_exists_flags)); ++ ++ 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 = _etherStatsTable_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_etherStatsTable_get_values */ ++ ++NETSNMP_STATIC_INLINE int ++_etherStatsTable_check_indexes(etherStatsTable_rowreq_ctx * rowreq_ctx) ++{ ++ int rc = SNMPERR_SUCCESS; ++ ++ DEBUGMSGTL(("internal:etherStatsTable:_etherStatsTable_check_indexes", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ ++ /* ++ * (INDEX) etherStatsIndex(1)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h ++ */ ++ /* ++ * check defined range(s). ++ */ ++ if ((SNMPERR_SUCCESS == rc) ++ && ((rowreq_ctx->tbl_idx.etherStatsIndex < 1) ++ || (rowreq_ctx->tbl_idx.etherStatsIndex > 65535)) ++ ) { ++ rc = SNMP_ERR_WRONGVALUE; ++ } ++ if (MFD_SUCCESS != rc) ++ return rc; ++ rc = etherStatsIndex_check_index(rowreq_ctx); ++ if (MFD_SUCCESS != rc) ++ return SNMP_ERR_NOCREATION; ++ ++ /* ++ * if individual parts look ok, check them as a whole ++ */ ++ return etherStatsTable_validate_index(etherStatsTable_if_ctx.user_ctx, ++ rowreq_ctx); ++} /* _etherStatsTable_check_indexes */ ++ ++/*********************************************************************** ++ * ++ * SET processing ++ * ++ ***********************************************************************/ ++ ++/*---------------------------------------------------------------------- ++ * ++ * SET: Syntax checks ++ * ++ *---------------------------------------------------------------------*/ ++/* ++ * @internal ++ * Check the syntax for a particular column ++ */ ++NETSNMP_STATIC_INLINE int ++_etherStatsTable_check_column(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ netsnmp_variable_list * var, int column) ++{ ++ int rc = SNMPERR_SUCCESS; ++ ++ DEBUGMSGTL(("internal:etherStatsTable:_etherStatsTable_check_column", ++ "called for %d\n", column)); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ switch (column) { ++ /* ++ * (INDEX) etherStatsIndex(1)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h ++ */ ++ case COLUMN_ETHERSTATSINDEX: ++ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */ ++ break; ++ ++ /* ++ * etherStatsDataSource(2)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/A/W/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSDATASOURCE: ++ rc = netsnmp_check_vb_type_and_max_size(var, ASN_OBJECT_ID, ++ sizeof(rowreq_ctx->data. ++ etherStatsDataSource)); ++ if (SNMPERR_SUCCESS != rc) { ++ DEBUGMSGTL(("etherStatsTable:_etherStatsTable_check_column:etherStatsDataSource", "varbind validation failed (eg bad type or size)\n")); ++ } else { ++ rc = etherStatsDataSource_check_value(rowreq_ctx, ++ (oid *) 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 etherStatsDataSource_check_value\n", ++ rc); ++ rc = SNMP_ERR_GENERR; ++ } ++ } ++ break; ++ ++ /* ++ * etherStatsDropEvents(3)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSDROPEVENTS: ++ rc = SNMP_ERR_NOTWRITABLE; ++ break; ++ ++ /* ++ * etherStatsOctets(4)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSOCTETS: ++ rc = SNMP_ERR_NOTWRITABLE; ++ break; ++ ++ /* ++ * etherStatsPkts(5)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSPKTS: ++ rc = SNMP_ERR_NOTWRITABLE; ++ break; ++ ++ /* ++ * etherStatsBroadcastPkts(6)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSBROADCASTPKTS: ++ rc = SNMP_ERR_NOTWRITABLE; ++ break; ++ ++ /* ++ * etherStatsMulticastPkts(7)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSMULTICASTPKTS: ++ rc = SNMP_ERR_NOTWRITABLE; ++ break; ++ ++ /* ++ * etherStatsCRCAlignErrors(8)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSCRCALIGNERRORS: ++ rc = SNMP_ERR_NOTWRITABLE; ++ break; ++ ++ /* ++ * etherStatsUndersizePkts(9)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSUNDERSIZEPKTS: ++ rc = SNMP_ERR_NOTWRITABLE; ++ break; ++ ++ /* ++ * etherStatsOversizePkts(10)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSOVERSIZEPKTS: ++ rc = SNMP_ERR_NOTWRITABLE; ++ break; ++ ++ /* ++ * etherStatsFragments(11)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSFRAGMENTS: ++ rc = SNMP_ERR_NOTWRITABLE; ++ break; ++ ++ /* ++ * etherStatsJabbers(12)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSJABBERS: ++ rc = SNMP_ERR_NOTWRITABLE; ++ break; ++ ++ /* ++ * etherStatsCollisions(13)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSCOLLISIONS: ++ rc = SNMP_ERR_NOTWRITABLE; ++ break; ++ ++ /* ++ * etherStatsPkts64Octets(14)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSPKTS64OCTETS: ++ rc = SNMP_ERR_NOTWRITABLE; ++ break; ++ ++ /* ++ * etherStatsPkts65to127Octets(15)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSPKTS65TO127OCTETS: ++ rc = SNMP_ERR_NOTWRITABLE; ++ break; ++ ++ /* ++ * etherStatsPkts128to255Octets(16)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSPKTS128TO255OCTETS: ++ rc = SNMP_ERR_NOTWRITABLE; ++ break; ++ ++ /* ++ * etherStatsPkts256to511Octets(17)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSPKTS256TO511OCTETS: ++ rc = SNMP_ERR_NOTWRITABLE; ++ break; ++ ++ /* ++ * etherStatsPkts512to1023Octets(18)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSPKTS512TO1023OCTETS: ++ rc = SNMP_ERR_NOTWRITABLE; ++ break; ++ ++ /* ++ * etherStatsPkts1024to1518Octets(19)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSPKTS1024TO1518OCTETS: ++ rc = SNMP_ERR_NOTWRITABLE; ++ break; ++ ++ /* ++ * etherStatsOwner(20)/OwnerString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/h ++ */ ++ case COLUMN_ETHERSTATSOWNER: ++ rc = netsnmp_check_vb_type_and_max_size(var, ASN_OCTET_STR, ++ sizeof(rowreq_ctx->data. ++ etherStatsOwner)); ++ /* ++ * check defined range(s). ++ */ ++ if ((SNMPERR_SUCCESS == rc) ++ && ((var->val_len < 0) || (var->val_len > 127)) ++ ) { ++ rc = SNMP_ERR_WRONGLENGTH; ++ } ++ if (SNMPERR_SUCCESS != rc) { ++ DEBUGMSGTL(("etherStatsTable:_etherStatsTable_check_column:etherStatsOwner", "varbind validation failed (eg bad type or size)\n")); ++ } else { ++ rc = etherStatsOwner_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 etherStatsOwner_check_value\n", ++ rc); ++ rc = SNMP_ERR_GENERR; ++ } ++ } ++ break; ++ ++ /* ++ * etherStatsStatus(21)/EntryStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h ++ */ ++ case COLUMN_ETHERSTATSSTATUS: ++ rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER, ++ sizeof(rowreq_ctx->data. ++ etherStatsStatus)); ++ /* ++ * check that the value is one of defined enums ++ */ ++ if ((SNMPERR_SUCCESS == rc) ++ && (*var->val.integer != ENTRYSTATUS_VALID) ++ && (*var->val.integer != ENTRYSTATUS_CREATEREQUEST) ++ && (*var->val.integer != ENTRYSTATUS_UNDERCREATION) ++ && (*var->val.integer != ENTRYSTATUS_INVALID) ++ ) { ++ rc = SNMP_ERR_WRONGVALUE; ++ } ++ if (SNMPERR_SUCCESS != rc) { ++ DEBUGMSGTL(("etherStatsTable:_etherStatsTable_check_column:etherStatsStatus", "varbind validation failed (eg bad type or size)\n")); ++ } else { ++ rc = etherStatsStatus_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 etherStatsStatus_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 _etherStatsTable_check_column\n", ++ column); ++ } ++ ++ return rc; ++} /* _etherStatsTable_check_column */ ++ ++int ++_mfd_etherStatsTable_check_objects(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration *reginfo, ++ netsnmp_agent_request_info *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ etherStatsTable_rowreq_ctx *rowreq_ctx = ++ netsnmp_container_table_row_extract(requests); ++ netsnmp_table_request_info *tri; ++ int rc; ++ ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_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 = _etherStatsTable_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_etherStatsTable_check_objects */ ++ ++ ++/*---------------------------------------------------------------------- ++ * ++ * SET: Undo setup ++ * ++ *---------------------------------------------------------------------*/ ++/* ++ * @internal ++ * Set the value for a particular column ++ */ ++NETSNMP_STATIC_INLINE int ++_etherStatsTable_undo_setup_column(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ int column) ++{ ++ int rc = SNMPERR_SUCCESS; ++ ++ DEBUGMSGTL(("internal:etherStatsTable:_etherStatsTable_undo_setup_column", "called for %d\n", column)); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ switch (column) { ++ ++ /* ++ * etherStatsDataSource(2)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/A/W/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSDATASOURCE: ++ rowreq_ctx->column_set_flags |= COLUMN_ETHERSTATSDATASOURCE_FLAG; ++ rc = etherStatsDataSource_undo_setup(rowreq_ctx); ++ break; ++ ++ /* ++ * etherStatsOwner(20)/OwnerString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/h ++ */ ++ case COLUMN_ETHERSTATSOWNER: ++ rowreq_ctx->column_set_flags |= COLUMN_ETHERSTATSOWNER_FLAG; ++ rc = etherStatsOwner_undo_setup(rowreq_ctx); ++ break; ++ ++ /* ++ * etherStatsStatus(21)/EntryStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h ++ */ ++ case COLUMN_ETHERSTATSSTATUS: ++ rowreq_ctx->column_set_flags |= COLUMN_ETHERSTATSSTATUS_FLAG; ++ rc = etherStatsStatus_undo_setup(rowreq_ctx); ++ break; ++ ++ default: ++ snmp_log(LOG_ERR, ++ "unknown column %d in _etherStatsTable_undo_setup_column\n", ++ column); ++ break; ++ } ++ ++ return rc; ++} /* _etherStatsTable_undo_setup_column */ ++ ++ ++/** ++ * @internal ++ * undo setup ++ */ ++int ++_mfd_etherStatsTable_undo_setup(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration *reginfo, ++ netsnmp_agent_request_info *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ int rc; ++ etherStatsTable_rowreq_ctx *rowreq_ctx = ++ netsnmp_container_table_row_extract(requests); ++ ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_undo_setup", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ /* ++ * allocate undo context ++ */ ++ rowreq_ctx->undo = etherStatsTable_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 = etherStatsTable_undo_setup(rowreq_ctx); ++ if (MFD_SUCCESS != rc) { ++ DEBUGMSGTL(("etherStatsTable:mfd", "error %d from " ++ "etherStatsTable_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 = _etherStatsTable_undo_setup_column(rowreq_ctx, ++ tri->colnum); ++ if (MFD_SUCCESS != rc) { ++ DEBUGMSGTL(("etherStatsTable:mfd", "error %d from " ++ "etherStatsTable_undo_setup_column\n", rc)); ++ netsnmp_set_request_error(agtreq_info, requests, ++ SNMP_VALIDATE_ERR(rc)); ++ } ++ } /* for results */ ++ } ++ ++ return SNMP_ERR_NOERROR; ++} /* _mfd_etherStatsTable_undo_setup */ ++ ++/** ++ * @internal ++ * undo setup ++ */ ++int ++_mfd_etherStatsTable_undo_cleanup(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration *reginfo, ++ netsnmp_agent_request_info *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ etherStatsTable_rowreq_ctx *rowreq_ctx = ++ netsnmp_container_table_row_extract(requests); ++ int rc; ++ ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_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 = etherStatsTable_undo_cleanup(rowreq_ctx); ++ if (MFD_SUCCESS != rc) { ++ /* ++ * nothing we can do about it but log it ++ */ ++ DEBUGMSGTL(("etherStatsTable:mfd", "error %d from " ++ "etherStatsTable_undo_cleanup\n", rc)); ++ } ++ ++ /* ++ * release undo context, if needed ++ */ ++ if (rowreq_ctx->undo) { ++ etherStatsTable_release_data(rowreq_ctx->undo); ++ rowreq_ctx->undo = NULL; ++ } ++ ++ ++ return SNMP_ERR_NOERROR; ++} /* _mfd_etherStatsTable_undo_cleanup */ ++ ++/*---------------------------------------------------------------------- ++ * ++ * SET: Set values ++ * ++ *---------------------------------------------------------------------*/ ++/* ++ * @internal ++ * Set the value for a particular column ++ */ ++NETSNMP_STATIC_INLINE int ++_etherStatsTable_set_column(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ netsnmp_variable_list * var, int column) ++{ ++ int rc = SNMPERR_SUCCESS; ++ ++ DEBUGMSGTL(("internal:etherStatsTable:_etherStatsTable_set_column", ++ "called for %d\n", column)); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ switch (column) { ++ ++ /* ++ * etherStatsDataSource(2)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/A/W/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSDATASOURCE: ++ rowreq_ctx->column_set_flags |= COLUMN_ETHERSTATSDATASOURCE_FLAG; ++ rc = etherStatsDataSource_set(rowreq_ctx, (oid *) var->val.string, ++ var->val_len); ++ break; ++ ++ /* ++ * etherStatsOwner(20)/OwnerString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/h ++ */ ++ case COLUMN_ETHERSTATSOWNER: ++ rowreq_ctx->column_set_flags |= COLUMN_ETHERSTATSOWNER_FLAG; ++ rc = etherStatsOwner_set(rowreq_ctx, (char *) var->val.string, ++ var->val_len); ++ break; ++ ++ /* ++ * etherStatsStatus(21)/EntryStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h ++ */ ++ case COLUMN_ETHERSTATSSTATUS: ++ rowreq_ctx->column_set_flags |= COLUMN_ETHERSTATSSTATUS_FLAG; ++ rc = etherStatsStatus_set(rowreq_ctx, ++ *((u_long *) var->val.string)); ++ break; ++ ++ default: ++ snmp_log(LOG_ERR, ++ "unknown column %d in _etherStatsTable_set_column\n", ++ column); ++ rc = SNMP_ERR_GENERR; ++ break; ++ } ++ ++ return rc; ++} /* _etherStatsTable_set_column */ ++ ++int ++_mfd_etherStatsTable_set_values(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration *reginfo, ++ netsnmp_agent_request_info *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ etherStatsTable_rowreq_ctx *rowreq_ctx = ++ netsnmp_container_table_row_extract(requests); ++ netsnmp_table_request_info *tri; ++ int rc = SNMP_ERR_NOERROR; ++ ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_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 = _etherStatsTable_set_column(rowreq_ctx, ++ requests->requestvb, tri->colnum); ++ if (MFD_SUCCESS != rc) { ++ DEBUGMSGTL(("etherStatsTable:mfd", "error %d from " ++ "etherStatsTable_set_column\n", rc)); ++ netsnmp_set_request_error(agtreq_info, requests, ++ SNMP_VALIDATE_ERR(rc)); ++ } ++ } /* for results */ ++ ++ return SNMP_ERR_NOERROR; ++} /* _mfd_etherStatsTable_set_values */ ++ ++/*---------------------------------------------------------------------- ++ * ++ * SET: commit ++ * ++ *---------------------------------------------------------------------*/ ++/** ++ * @internal ++ * commit the values ++ */ ++int ++_mfd_etherStatsTable_commit(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration *reginfo, ++ netsnmp_agent_request_info *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ int rc; ++ etherStatsTable_rowreq_ctx *rowreq_ctx = ++ netsnmp_container_table_row_extract(requests); ++ ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_commit", ++ "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ rc = etherStatsTable_commit(rowreq_ctx); ++ if (MFD_SUCCESS != rc) { ++ DEBUGMSGTL(("etherStatsTable:mfd", "error %d from " ++ "etherStatsTable_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... ++ */ ++ etherStatsTable_dirty_set(etherStatsTable_dirty_get() + 1); /* set table dirty flag */ ++ } ++ ++ return SNMP_ERR_NOERROR; ++} ++ ++int ++_mfd_etherStatsTable_undo_commit(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration *reginfo, ++ netsnmp_agent_request_info *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ int rc; ++ etherStatsTable_rowreq_ctx *rowreq_ctx = ++ netsnmp_container_table_row_extract(requests); ++ ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_undo_commit", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) { ++ u_int d = etherStatsTable_dirty_get(); ++ ++ netsnmp_assert(d != 0); ++ if (d) ++ etherStatsTable_dirty_set(d - 1); ++ } ++ ++ rc = etherStatsTable_undo_commit(rowreq_ctx); ++ if (MFD_SUCCESS != rc) { ++ /* ++ * nothing we can do about it but log it ++ */ ++ DEBUGMSGTL(("etherStatsTable:mfd", "error %d from " ++ "etherStatsTable_undo_commit\n", rc)); ++ } ++ ++ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) { ++ snmp_log(LOG_WARNING, ++ "etherStatsTable row dirty flag still set after undo_commit\n"); ++ rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY; ++ } ++ ++ return SNMP_ERR_NOERROR; ++} /* _mfd_etherStatsTable_commit */ ++ ++/*---------------------------------------------------------------------- ++ * ++ * SET: Undo ++ * ++ *---------------------------------------------------------------------*/ ++/** ++ * @internal ++ * undo the value for a particular column ++ */ ++NETSNMP_STATIC_INLINE int ++_etherStatsTable_undo_column(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ netsnmp_variable_list * var, int column) ++{ ++ int rc = SNMPERR_SUCCESS; ++ ++ DEBUGMSGTL(("internal:etherStatsTable:_etherStatsTable_undo_column", ++ "called for %d\n", column)); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ switch (column) { ++ ++ /* ++ * etherStatsDataSource(2)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/A/W/e/r/d/h ++ */ ++ case COLUMN_ETHERSTATSDATASOURCE: ++ rc = etherStatsDataSource_undo(rowreq_ctx); ++ break; ++ ++ /* ++ * etherStatsOwner(20)/OwnerString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/h ++ */ ++ case COLUMN_ETHERSTATSOWNER: ++ rc = etherStatsOwner_undo(rowreq_ctx); ++ break; ++ ++ /* ++ * etherStatsStatus(21)/EntryStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h ++ */ ++ case COLUMN_ETHERSTATSSTATUS: ++ rc = etherStatsStatus_undo(rowreq_ctx); ++ break; ++ ++ default: ++ snmp_log(LOG_ERR, ++ "unknown column %d in _etherStatsTable_undo_column\n", ++ column); ++ break; ++ } ++ ++ return rc; ++} /* _etherStatsTable_undo_column */ ++ ++int ++_mfd_etherStatsTable_undo_values(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration *reginfo, ++ netsnmp_agent_request_info *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ int rc; ++ etherStatsTable_rowreq_ctx *rowreq_ctx = ++ netsnmp_container_table_row_extract(requests); ++ netsnmp_table_request_info *tri; ++ ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_undo_values", "called\n")); ++ ++ netsnmp_assert(NULL != rowreq_ctx); ++ ++ rc = etherStatsTable_undo(rowreq_ctx); ++ if (MFD_SUCCESS != rc) { ++ /* ++ * nothing we can do about it but log it ++ */ ++ DEBUGMSGTL(("etherStatsTable:mfd", "error %d from " ++ "etherStatsTable_undo\n", rc)); ++ } ++ ++ for (; requests; requests = requests->next) { ++ /* ++ * set column data ++ */ ++ tri = netsnmp_extract_table_info(requests); ++ if (NULL == tri) ++ continue; ++ ++ rc = _etherStatsTable_undo_column(rowreq_ctx, requests->requestvb, ++ tri->colnum); ++ if (MFD_SUCCESS != rc) { ++ /* ++ * nothing we can do about it but log it ++ */ ++ DEBUGMSGTL(("etherStatsTable:mfd", "error %d from " ++ "etherStatsTable_undo_column\n", rc)); ++ } ++ } /* for results */ ++ ++ return SNMP_ERR_NOERROR; ++} /* _mfd_etherStatsTable_undo_values */ ++ ++/*---------------------------------------------------------------------- ++ * ++ * SET: irreversible commit ++ * ++ *---------------------------------------------------------------------*/ ++/** ++ * @internal ++ * commit irreversible actions ++ */ ++int ++_mfd_etherStatsTable_irreversible_commit(netsnmp_mib_handler *handler, ++ netsnmp_handler_registration ++ *reginfo, ++ netsnmp_agent_request_info ++ *agtreq_info, ++ netsnmp_request_info *requests) ++{ ++ etherStatsTable_rowreq_ctx *rowreq_ctx = ++ netsnmp_container_table_row_extract(requests); ++ ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_etherStatsTable_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(etherStatsTable_if_ctx.container, rowreq_ctx); ++ } else { ++ if (rowreq_ctx->column_set_flags) { ++ DEBUGMSGTL(("internal:etherStatsTable:_mfd_irreversible_commit", "updating exists (%p) w/set (%p) = %p\n", rowreq_ctx->column_exists_flags, rowreq_ctx->column_set_flags, (rowreq_ctx->column_exists_flags | rowreq_ctx->column_set_flags))); ++ rowreq_ctx->column_exists_flags |= ++ 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(etherStatsTable_if_ctx.container, rowreq_ctx); ++ } ++ } ++ ++ return SNMP_ERR_NOERROR; ++} /* _mfd_etherStatsTable_irreversible_commit */ ++ ++/*********************************************************************** ++ * ++ * DATA ACCESS ++ * ++ ***********************************************************************/ ++static void _container_free(netsnmp_container * container); ++ ++/** ++ * @internal ++ */ ++static int ++_cache_load(netsnmp_cache * cache, void *vmagic) ++{ ++ DEBUGMSGTL(("internal:etherStatsTable:_cache_load", "called\n")); ++ ++ if ((NULL == cache) || (NULL == cache->magic)) { ++ snmp_log(LOG_ERR, ++ "invalid cache for etherStatsTable_cache_load\n"); ++ return -1; ++ } ++ ++ /** should only be called for an invalid or expired cache */ ++ netsnmp_assert((0 == cache->valid) || (1 == cache->expired)); ++ ++ /* ++ * call user code ++ */ ++ return etherStatsTable_container_load((netsnmp_container *) cache-> ++ magic); ++} /* _cache_load */ ++ ++/** ++ * @internal ++ */ ++static void ++_cache_free(netsnmp_cache * cache, void *magic) ++{ ++ netsnmp_container *container; ++ ++ DEBUGMSGTL(("internal:etherStatsTable:_cache_free", "called\n")); ++ ++ if ((NULL == cache) || (NULL == cache->magic)) { ++ snmp_log(LOG_ERR, "invalid cache in etherStatsTable_cache_free\n"); ++ return; ++ } ++ ++ container = (netsnmp_container *) cache->magic; ++ ++ _container_free(container); ++} /* _cache_free */ ++ ++/** ++ * @internal ++ */ ++static void ++_container_item_free(etherStatsTable_rowreq_ctx * rowreq_ctx, ++ void *context) ++{ ++ DEBUGMSGTL(("internal:etherStatsTable:_container_item_free", ++ "called\n")); ++ ++ if (NULL == rowreq_ctx) ++ return; ++ ++ etherStatsTable_release_rowreq_ctx(rowreq_ctx); ++} /* _container_item_free */ ++ ++/** ++ * @internal ++ */ ++static void ++_container_free(netsnmp_container * container) ++{ ++ DEBUGMSGTL(("internal:etherStatsTable:_container_free", "called\n")); ++ ++ if (NULL == container) { ++ snmp_log(LOG_ERR, ++ "invalid container in etherStatsTable_container_free\n"); ++ return; ++ } ++ ++ /* ++ * call user code ++ */ ++ etherStatsTable_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 ++_etherStatsTable_container_init(etherStatsTable_interface_ctx * if_ctx) ++{ ++ DEBUGMSGTL(("internal:etherStatsTable:_etherStatsTable_container_init", ++ "called\n")); ++ ++ /* ++ * cache init ++ */ ++ if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */ ++ _cache_load, _cache_free, ++ etherStatsTable_oid, ++ etherStatsTable_oid_size); ++ ++ if (NULL == if_ctx->cache) { ++ snmp_log(LOG_ERR, "error creating cache for etherStatsTable\n"); ++ return; ++ } ++ ++ if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET; ++ ++ etherStatsTable_container_init(&if_ctx->container, if_ctx->cache); ++ if (NULL == if_ctx->container) ++ if_ctx->container = ++ netsnmp_container_find("etherStatsTable:table_container"); ++ if (NULL == if_ctx->container) { ++ snmp_log(LOG_ERR, "error creating container in " ++ "etherStatsTable_container_init\n"); ++ return; ++ } ++ ++ if (NULL != if_ctx->cache) ++ if_ctx->cache->magic = (void *) if_ctx->container; ++} /* _etherStatsTable_container_init */ ++ ++/** ++ * @internal ++ * shutdown the container with functions or wrappers ++ */ ++void ++_etherStatsTable_container_shutdown(etherStatsTable_interface_ctx * if_ctx) ++{ ++ DEBUGMSGTL(("internal:etherStatsTable:_etherStatsTable_container_shutdown", "called\n")); ++ ++ etherStatsTable_container_shutdown(if_ctx->container); ++ ++ _container_free(if_ctx->container); ++ ++} /* _etherStatsTable_container_shutdown */ ++ ++ ++etherStatsTable_rowreq_ctx * ++etherStatsTable_row_find_by_mib_index(etherStatsTable_mib_index * mib_idx) ++{ ++ etherStatsTable_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 = etherStatsTable_index_to_oid(&oid_idx, mib_idx); ++ if (MFD_SUCCESS != rc) ++ return NULL; ++ ++ rowreq_ctx = ++ CONTAINER_FIND(etherStatsTable_if_ctx.container, &oid_idx); ++ ++ return rowreq_ctx; ++} +Index: agent/mibgroup/rmon-mib/etherStatsTable_interface.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/rmon-mib/etherStatsTable_interface.h 2008-09-11 22:27:51.935791457 +0200 +@@ -0,0 +1,98 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * version : 15899 $ of $ ++ * ++ * $Id:$ ++ */ ++/** @ingroup interface: Routines to interface to Net-SNMP ++ * ++ * \warning This code should not be modified, called directly, ++ * or used to interpret functionality. It is subject to ++ * change at any time. ++ * ++ * @{ ++ */ ++/* ++ * ********************************************************************* ++ * ********************************************************************* ++ * ********************************************************************* ++ * *** *** ++ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE *** ++ * *** *** ++ * *** *** ++ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. *** ++ * *** *** ++ * *** *** ++ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND *** ++ * *** *** ++ * *** *** ++ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. *** ++ * *** *** ++ * *** *** ++ * ********************************************************************* ++ * ********************************************************************* ++ * ********************************************************************* ++ */ ++#ifndef ETHERSTATSTABLE_INTERFACE_H ++#define ETHERSTATSTABLE_INTERFACE_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++#include "etherStatsTable.h" ++ ++ ++ /* ++ ******************************************************************** ++ * Table declarations ++ */ ++ ++ /* ++ * PUBLIC interface initialization routine ++ */ ++ void ++ _etherStatsTable_initialize_interface(etherStatsTable_registration ++ * user_ctx, u_long flags); ++ void ++ _etherStatsTable_shutdown_interface(etherStatsTable_registration * ++ user_ctx); ++ ++ etherStatsTable_registration *etherStatsTable_registration_get(void); ++ ++ etherStatsTable_registration ++ *etherStatsTable_registration_set(etherStatsTable_registration * ++ newreg); ++ ++ netsnmp_container *etherStatsTable_container_get(void); ++ int etherStatsTable_container_size(void); ++ ++ u_int etherStatsTable_dirty_get(void); ++ void etherStatsTable_dirty_set(u_int status); ++ ++ etherStatsTable_rowreq_ctx *etherStatsTable_allocate_rowreq_ctx(void ++ *); ++ void ++ etherStatsTable_release_rowreq_ctx(etherStatsTable_rowreq_ctx * ++ rowreq_ctx); ++ ++ int etherStatsTable_index_to_oid(netsnmp_index * oid_idx, ++ etherStatsTable_mib_index ++ * mib_idx); ++ int etherStatsTable_index_from_oid(netsnmp_index * oid_idx, ++ etherStatsTable_mib_index ++ * mib_idx); ++ ++ /* ++ * access to certain internals. use with caution! ++ */ ++ void etherStatsTable_valid_columns_set(netsnmp_column_info ++ *vc); ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* ETHERSTATSTABLE_INTERFACE_H */ ++/** @} */ +Index: agent/mibgroup/rmon-mib/etherStatsTable_oids.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/rmon-mib/etherStatsTable_oids.h 2008-09-11 22:27:51.951791682 +0200 +@@ -0,0 +1,107 @@ ++/* ++ * Note: this file originally auto-generated by mib2c using ++ * : generic-table-oids.m2c 12855 2005-09-27 15:56:08Z rstory $ ++ * ++ * $Id:$ ++ */ ++#ifndef ETHERSTATSTABLE_OIDS_H ++#define ETHERSTATSTABLE_OIDS_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++ /* ++ * column number definitions for table etherStatsTable ++ */ ++#define ETHERSTATSTABLE_OID 1,3,6,1,2,1,16,1,1 ++ ++#define COLUMN_ETHERSTATSINDEX 1 ++#define COLUMN_ETHERSTATSINDEX_FLAG (0x1 << 0) ++ ++#define COLUMN_ETHERSTATSDATASOURCE 2 ++#define COLUMN_ETHERSTATSDATASOURCE_FLAG (0x1 << 1) ++ ++#define COLUMN_ETHERSTATSDROPEVENTS 3 ++#define COLUMN_ETHERSTATSDROPEVENTS_FLAG (0x1 << 2) ++ ++#define COLUMN_ETHERSTATSOCTETS 4 ++#define COLUMN_ETHERSTATSOCTETS_FLAG (0x1 << 3) ++ ++#define COLUMN_ETHERSTATSPKTS 5 ++#define COLUMN_ETHERSTATSPKTS_FLAG (0x1 << 4) ++ ++#define COLUMN_ETHERSTATSBROADCASTPKTS 6 ++#define COLUMN_ETHERSTATSBROADCASTPKTS_FLAG (0x1 << 5) ++ ++#define COLUMN_ETHERSTATSMULTICASTPKTS 7 ++#define COLUMN_ETHERSTATSMULTICASTPKTS_FLAG (0x1 << 6) ++ ++#define COLUMN_ETHERSTATSCRCALIGNERRORS 8 ++#define COLUMN_ETHERSTATSCRCALIGNERRORS_FLAG (0x1 << 7) ++ ++#define COLUMN_ETHERSTATSUNDERSIZEPKTS 9 ++#define COLUMN_ETHERSTATSUNDERSIZEPKTS_FLAG (0x1 << 8) ++ ++#define COLUMN_ETHERSTATSOVERSIZEPKTS 10 ++#define COLUMN_ETHERSTATSOVERSIZEPKTS_FLAG (0x1 << 9) ++ ++#define COLUMN_ETHERSTATSFRAGMENTS 11 ++#define COLUMN_ETHERSTATSFRAGMENTS_FLAG (0x1 << 10) ++ ++#define COLUMN_ETHERSTATSJABBERS 12 ++#define COLUMN_ETHERSTATSJABBERS_FLAG (0x1 << 11) ++ ++#define COLUMN_ETHERSTATSCOLLISIONS 13 ++#define COLUMN_ETHERSTATSCOLLISIONS_FLAG (0x1 << 12) ++ ++#define COLUMN_ETHERSTATSPKTS64OCTETS 14 ++#define COLUMN_ETHERSTATSPKTS64OCTETS_FLAG (0x1 << 13) ++ ++#define COLUMN_ETHERSTATSPKTS65TO127OCTETS 15 ++#define COLUMN_ETHERSTATSPKTS65TO127OCTETS_FLAG (0x1 << 14) ++ ++#define COLUMN_ETHERSTATSPKTS128TO255OCTETS 16 ++#define COLUMN_ETHERSTATSPKTS128TO255OCTETS_FLAG (0x1 << 15) ++ ++#define COLUMN_ETHERSTATSPKTS256TO511OCTETS 17 ++#define COLUMN_ETHERSTATSPKTS256TO511OCTETS_FLAG (0x1 << 16) ++ ++#define COLUMN_ETHERSTATSPKTS512TO1023OCTETS 18 ++#define COLUMN_ETHERSTATSPKTS512TO1023OCTETS_FLAG (0x1 << 17) ++ ++#define COLUMN_ETHERSTATSPKTS1024TO1518OCTETS 19 ++#define COLUMN_ETHERSTATSPKTS1024TO1518OCTETS_FLAG (0x1 << 18) ++ ++#define COLUMN_ETHERSTATSOWNER 20 ++#define COLUMN_ETHERSTATSOWNER_FLAG (0x1 << 19) ++ ++#define COLUMN_ETHERSTATSSTATUS 21 ++#define COLUMN_ETHERSTATSSTATUS_FLAG (0x1 << 20) ++ ++ ++#define ETHERSTATSTABLE_MIN_COL COLUMN_ETHERSTATSINDEX ++#define ETHERSTATSTABLE_MAX_COL COLUMN_ETHERSTATSSTATUS ++ ++ ++ /* ++ * TODO:405:r: Review ETHERSTATSTABLE_SETTABLE_COLS macro. ++ * OR together all the writable cols. ++ */ ++#define ETHERSTATSTABLE_SETTABLE_COLS (COLUMN_ETHERSTATSINDEX_FLAG | COLUMN_ETHERSTATSDATASOURCE_FLAG | COLUMN_ETHERSTATSDROPEVENTS_FLAG | COLUMN_ETHERSTATSOCTETS_FLAG | COLUMN_ETHERSTATSPKTS_FLAG | COLUMN_ETHERSTATSBROADCASTPKTS_FLAG | COLUMN_ETHERSTATSMULTICASTPKTS_FLAG | COLUMN_ETHERSTATSCRCALIGNERRORS_FLAG | COLUMN_ETHERSTATSUNDERSIZEPKTS_FLAG | COLUMN_ETHERSTATSOVERSIZEPKTS_FLAG | COLUMN_ETHERSTATSFRAGMENTS_FLAG | COLUMN_ETHERSTATSJABBERS_FLAG | COLUMN_ETHERSTATSCOLLISIONS_FLAG | COLUMN_ETHERSTATSPKTS64OCTETS_FLAG | COLUMN_ETHERSTATSPKTS65TO127OCTETS_FLAG | COLUMN_ETHERSTATSPKTS128TO255OCTETS_FLAG | COLUMN_ETHERSTATSPKTS256TO511OCTETS_FLAG | COLUMN_ETHERSTATSPKTS512TO1023OCTETS_FLAG | COLUMN_ETHERSTATSPKTS1024TO1518OCTETS_FLAG | COLUMN_ETHERSTATSOWNER_FLAG | COLUMN_ETHERSTATSSTATUS_FLAG) ++ /* ++ * TODO:405:r: Review ETHERSTATSTABLE_REQUIRED_COLS macro. ++ * OR together all the required rows for row creation. ++ * default is writable cols w/out defaults. ++ */ ++#define ETHERSTATSTABLE_REQUIRED_COLS (COLUMN_ETHERSTATSDATASOURCE_FLAG | COLUMN_ETHERSTATSOWNER_FLAG | COLUMN_ETHERSTATSSTATUS_FLAG) ++ ++#define ETHERSTATSTABLE_VALID_COL COLUMN_ETHERSTATSJABBERS_FLAG ++ ++ ++ ++#ifdef __cplusplus ++} ++#endif ++#endif /* ETHERSTATSTABLE_OIDS_H */ +Index: agent/mibgroup/rmon-mib/ioctl_imp_common.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/rmon-mib/ioctl_imp_common.h 2008-09-11 22:27:51.995128138 +0200 +@@ -0,0 +1,34 @@ ++#include ++#include ++#include ++#include ++#include ++ ++/* use kernel's ethtool.h */ ++ ++#include ++typedef __u64 u64; ++typedef __u32 u32; ++typedef __u16 u16; ++typedef __u8 u8; ++#include ++ ++/* structure for storing the interface names in the system */ ++ ++struct ifname { ++ struct ifname *ifn_next; ++ char name [IF_NAMESIZE]; ++}; ++ ++static struct ifname *interface_name_list_get (struct ifname *, int *); ++static int interface_name_list_free (struct ifname *list_head); ++static u_long interface_ioctl_ifindex_get (int fd, const char *name); ++static int _etherStats_ioctl_get(int fd, int which, struct ifreq *ifrq, const char* name); ++int interface_ioctl_etherstats_get(etherStatsTable_rowreq_ctx *rowreq_ctx, int fd, const char* name); ++ ++/* for maintainability */ ++ ++#define BROADCOM_RECEIVE_JABBERS "rx_jabbers" ++ ++#define ETHERSTATSJABBERS(x) strstr(x, BROADCOM_RECEIVE_JABBERS) ++ +Index: agent/mibgroup/rmon-mib.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ agent/mibgroup/rmon-mib.h 2008-09-11 22:27:52.011791903 +0200 +@@ -0,0 +1,12 @@ ++/* ++ * module to include the modules ++ */ ++ ++config_require(rmon-mib/etherStatsTable) ++config_require(rmon-mib/etherStatsTable_interface) ++config_require(rmon-mib/etherStatsTable_data_get) ++config_require(rmon-mib/etherStatsTable_data_set) ++config_require(rmon-mib/etherStatsTable_data_access) ++config_add_mib(RMON-MIB) ++ ++ diff --git a/net-snmp-5.4.2_fix_dell_patches.patch b/net-snmp-5.4.2_fix_dell_patches.patch new file mode 100644 index 0000000..a07aa84 --- /dev/null +++ b/net-snmp-5.4.2_fix_dell_patches.patch @@ -0,0 +1,24 @@ +Index: agent/mibgroup/etherlike-mib/dot3StatsTable_data_access.c +=================================================================== +--- agent/mibgroup/etherlike-mib/dot3StatsTable_data_access.c.orig 2008-09-11 23:02:50.000000000 +0200 ++++ agent/mibgroup/etherlike-mib/dot3StatsTable_data_access.c 2008-09-11 23:34:29.252291547 +0200 +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + + #include + #include +Index: agent/mibgroup/rmon-mib/etherStatsTable_data_access.c +=================================================================== +--- agent/mibgroup/rmon-mib/etherStatsTable_data_access.c.orig 2008-09-11 23:02:50.000000000 +0200 ++++ agent/mibgroup/rmon-mib/etherStatsTable_data_access.c 2008-09-11 23:53:05.771791103 +0200 +@@ -4,6 +4,7 @@ + * + * $Id:$ + */ ++#include + /* + * standard Net-SNMP includes + */ diff --git a/net-snmp.changes b/net-snmp.changes index 28abfb5..bdd96c7 100644 --- a/net-snmp.changes +++ b/net-snmp.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Fri Sep 12 18:44:53 CEST 2008 - mrueckert@suse.de + +- add patches from Dell: (Fate#304310) + net-snmp-5.4.1.2-etherlike-mib-revised.patch + net-snmp-5.4.1.2-rmon-mib.patch + net-snmp-5.4.2_fix_dell_patches.patch + + ------------------------------------------------------------------- Sat Sep 6 16:15:57 CEST 2008 - mrueckert@suse.de diff --git a/net-snmp.spec b/net-snmp.spec index 812de64..d785c43 100644 --- a/net-snmp.spec +++ b/net-snmp.spec @@ -20,7 +20,7 @@ Name: net-snmp Version: 5.4.2 -Release: 1 +Release: 3 # License: BSD 3-Clause; X11/MIT Group: Productivity/Networking/Other @@ -72,6 +72,9 @@ Patch8: net-snmp-5.4_net-snmp-config_headercheck.patch Patch9: net-snmp-5.4.1_perl_tk_warning.patch Patch10: net-snmp-5.1.2-snmpconf-selinux.patch Patch11: net-snmp-5.3.0.1_trap-agent-addr_v2.patch +Patch12: net-snmp-5.4.1.2-etherlike-mib-revised.patch +Patch13: net-snmp-5.4.1.2-rmon-mib.patch +Patch14: net-snmp-5.4.2_fix_dell_patches.patch # Summary: SNMP Daemon @@ -193,6 +196,9 @@ Authors: %patch9 %patch10 -p1 %patch11 +%patch12 +%patch13 +%patch14 find -name "CVS" -type d | xargs -r %{__rm} -rfv find -name ".cvsignore" | xargs -r %{__rm} -fv find -name "*.orig" | xargs -r %{__rm} -fv @@ -211,6 +217,7 @@ export CFLAGS="$CFLAGS -fstack-protector-all" --with-sys-contact="root@localhost" \ --with-mib-modules="misc/ipfwacc \ ucd-snmp/diskio \ + etherlike-mib rmon-mib \ %if 0%{?with_sensors} ucd-snmp/lmSensors \ %endif @@ -392,6 +399,11 @@ fi %{_bindir}/tkmib %changelog +* Fri Sep 12 2008 mrueckert@suse.de +- add patches from Dell: (Fate#304310) + net-snmp-5.4.1.2-etherlike-mib-revised.patch + net-snmp-5.4.1.2-rmon-mib.patch + net-snmp-5.4.2_fix_dell_patches.patch * Sat Sep 06 2008 mrueckert@suse.de - update to version 5.4.2 - [PATCH 1921861]: Avoid endless loop after truncating 64bit int