4608 lines
163 KiB
Diff
4608 lines
163 KiB
Diff
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-16 16:36:36.675793898 +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 <net-snmp/net-snmp-config.h>
|
|
+#include <net-snmp/net-snmp-includes.h>
|
|
+#include <net-snmp/agent/net-snmp-agent-includes.h>
|
|
+
|
|
+/*
|
|
+ * include our parent header
|
|
+ */
|
|
+#include "dot3StatsTable.h"
|
|
+
|
|
+#include <net-snmp/agent/mib_modules.h>
|
|
+
|
|
+#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-16 16:36:36.687791867 +0200
|
|
@@ -0,0 +1,797 @@
|
|
+/*
|
|
+ * Note: this file originally auto-generated by mib2c using
|
|
+ * version : 14170 $ of $
|
|
+ *
|
|
+ * $Id:$
|
|
+ */
|
|
+/*
|
|
+ * standard Net-SNMP includes
|
|
+ */
|
|
+
|
|
+#include <net-snmp/net-snmp-config.h>
|
|
+#include <net-snmp/net-snmp-includes.h>
|
|
+#include <net-snmp/agent/net-snmp-agent-includes.h>
|
|
+
|
|
+/*
|
|
+ * include our parent header
|
|
+ */
|
|
+#include "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 = (long) 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 int
|
|
+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-16 16:36:36.723791619 +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-16 16:36:36.771791634 +0200
|
|
@@ -0,0 +1,1450 @@
|
|
+/*
|
|
+ * Note: this file originally auto-generated by mib2c using
|
|
+ * version : 12088 $ of $
|
|
+ *
|
|
+ * $Id:$
|
|
+ */
|
|
+/*
|
|
+ * standard Net-SNMP includes
|
|
+ */
|
|
+#include <net-snmp/net-snmp-config.h>
|
|
+#include <net-snmp/net-snmp-includes.h>
|
|
+#include <net-snmp/agent/net-snmp-agent-includes.h>
|
|
+
|
|
+/*
|
|
+ * include our parent header
|
|
+ */
|
|
+#include "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.
|
|
+ * <b>DO NOT</b> free the previous pointer.
|
|
+ * The MFD helper will release the memory you allocate.
|
|
+ *
|
|
+ * @remark If you call this function yourself, you are responsible
|
|
+ * for checking if the pointer changed, and freeing any
|
|
+ * previously allocated memory. (Not necessary if you pass
|
|
+ * in a pointer to static memory, obviously.)
|
|
+ */
|
|
+int
|
|
+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-16 16:36:37.036291779 +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-16 16:36:37.492292427 +0200
|
|
@@ -0,0 +1,28 @@
|
|
+/*
|
|
+ * Note: this file originally auto-generated by mib2c using
|
|
+ * version : 12077 $ of $
|
|
+ *
|
|
+ * $Id:$
|
|
+ *
|
|
+ */
|
|
+/*
|
|
+ * standard Net-SNMP includes
|
|
+ */
|
|
+#include <net-snmp/net-snmp-config.h>
|
|
+#include <net-snmp/net-snmp-includes.h>
|
|
+#include <net-snmp/agent/net-snmp-agent-includes.h>
|
|
+
|
|
+/*
|
|
+ * include our parent header
|
|
+ */
|
|
+#include "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-16 16:36:38.151791028 +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-16 16:36:38.676291554 +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-16 16:36:39.608291709 +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 <net-snmp/library/asn1.h>
|
|
+
|
|
+ /*
|
|
+ * 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-16 16:36:40.483792165 +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 <net-snmp/net-snmp-config.h>
|
|
+#include <net-snmp/net-snmp-includes.h>
|
|
+#include <net-snmp/agent/net-snmp-agent-includes.h>
|
|
+
|
|
+/*
|
|
+ * include our parent header
|
|
+ */
|
|
+#include "dot3StatsTable.h"
|
|
+
|
|
+
|
|
+#include <net-snmp/agent/table_container.h>
|
|
+#include <net-snmp/library/container.h>
|
|
+
|
|
+#include "dot3StatsTable_interface.h"
|
|
+
|
|
+#include <ctype.h>
|
|
+
|
|
+/**********************************************************************
|
|
+ **********************************************************************
|
|
+ ***
|
|
+ *** 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 %ld\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 %ld\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 %ld\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 %ld\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 %ld\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 %ld\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 %u\n", 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-16 16:36:40.923791934 +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-16 16:36:41.147792362 +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-16 16:36:41.212292001 +0200
|
|
@@ -0,0 +1,71 @@
|
|
+#include <sys/socket.h>
|
|
+#include <sys/types.h>
|
|
+#include <sys/ioctl.h>
|
|
+#include <net/if.h>
|
|
+#include <linux/sockios.h>
|
|
+#include <ifaddrs.h>
|
|
+
|
|
+/* use kernel's ethtool.h */
|
|
+
|
|
+#include <linux/types.h>
|
|
+typedef __u64 u64;
|
|
+typedef __u32 u32;
|
|
+typedef __u16 u16;
|
|
+typedef __u8 u8;
|
|
+#include <linux/ethtool.h>
|
|
+
|
|
+/* 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 int 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-16 16:36:41.247791806 +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)
|