/*
* Note: this file originally auto-generated by mib2c using
* : mib2c.create-dataset.conf 9375 2004-02-02 19:06:54Z rstory $
*/
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "dot3StatsTable.h"
/** Initialize the dot3StatsTable table by defining its contents and how it's structured */
void
initialize_table_dot3StatsTable(void)
{ static oid dot3StatsTable_oid[] = {1,3,6,1,2,1,10,7,2}; size_t dot3StatsTable_oid_len = OID_LENGTH(dot3StatsTable_oid);
netsnmp_table_data_set *table_set;
// variables declared – wrajnees
netsnmp_table_row *row;
static int _max_cols = 21; // there are 18 columns in this table.
int column = 0;
int index = 1;
int val = 20;
static oid objid_etherchipset[] = { 0 }; /* ethernetChipset vendor oid */
// end variables declared.
/* create the table structure itself */
table_set = netsnmp_create_table_data_set("dot3StatsTable");
/* comment this out or delete if you don't support creation of new rows */
table_set->allow_creation = 1;
/***************************************************
* Adding indexes
*/
DEBUGMSGTL(("initialize_table_dot3StatsTable", "adding indexes to table dot3StatsTable\n"));
netsnmp_table_set_add_indexes(table_set,
ASN_INTEGER, /* index: dot3StatsIndex */
0);
DEBUGMSGTL(("initialize_table_dot3StatsTable", "adding column types to table dot3StatsTable\n"));
netsnmp_table_set_multi_add_default_row(table_set,
/*COLUMN_DOT3STATSINDEX, ASN_INTEGER, 0,
NULL, 0,*/
COLUMN_DOT3STATSALIGNMENTERRORS, ASN_COUNTER, 0,
NULL, 0,
COLUMN_DOT3STATSFCSERRORS, ASN_COUNTER, 0,
NULL, 0,
COLUMN_DOT3STATSSINGLECOLLISIONFRAMES, ASN_COUNTER, 0,
NULL, 0,
COLUMN_DOT3STATSMULTIPLECOLLISIONFRAMES, ASN_COUNTER, 0,
NULL, 0,
COLUMN_DOT3STATSSQETESTERRORS, ASN_COUNTER, 0,
NULL, 0,
COLUMN_DOT3STATSDEFERREDTRANSMISSIONS, ASN_COUNTER, 0,
NULL, 0,
COLUMN_DOT3STATSLATECOLLISIONS, ASN_COUNTER, 0,
NULL, 0,
COLUMN_DOT3STATSEXCESSIVECOLLISIONS, ASN_COUNTER, 0,
NULL, 0,
COLUMN_DOT3STATSINTERNALMACTRANSMITERRORS, ASN_COUNTER, 0,
NULL, 0,
COLUMN_DOT3STATSCARRIERSENSEERRORS, ASN_COUNTER, 0,
NULL, 0,
COLUMN_DOT3STATSFRAMETOOLONGS, ASN_COUNTER, 0,
NULL, 0,
COLUMN_DOT3STATSINTERNALMACRECEIVEERRORS, ASN_COUNTER, 0,
NULL, 0,
COLUMN_DOT3STATSETHERCHIPSET, ASN_OBJECT_ID, 0,
NULL, 0,
COLUMN_DOT3STATSSYMBOLERRORS, ASN_COUNTER, 0,
NULL, 0,
COLUMN_DOT3STATSDUPLEXSTATUS, ASN_INTEGER, 0,
NULL, 0,
COLUMN_DOT3STATSRATECONTROLABILITY, ASN_INTEGER, 0,
NULL, 0,
COLUMN_DOT3STATSRATECONTROLSTATUS, ASN_INTEGER, 0,
NULL, 0,
0);
/* registering the table with the master agent */
/* note: if you don't need a subhandler to deal with any aspects
of the request, change dot3StatsTable_handler to "NULL" */
netsnmp_register_table_data_set(netsnmp_create_handler_registration("dot3StatsTable", NULL, dot3StatsTable_oid,
dot3StatsTable_oid_len,
HANDLER_CAN_RONLY),
table_set, NULL);
// Add code - wrajnees
/*
* create the a row for the table, and add the data
*/
row = netsnmp_create_table_data_row();
/*
* set the index to the IETF WG name "snmpv3"
*/
netsnmp_table_row_add_index(row, ASN_INTEGER, (u_char*)&index, sizeof(index));
/*
* set the column 2 and above
*/
for (column = 2; column <= _max_cols; column++) { // Following columns are not valid.
switch(column) { case 12: // INVALIDs
case 14:
case 15:
break;
case 17: // OID
netsnmp_set_row_column(row, column, ASN_OBJECT_ID,
(u_char*)objid_etherchipset, 1*sizeof(oid));
break;
case 19: // INTEGER
case 21:
netsnmp_set_row_column(row, column, ASN_INTEGER,
(u_char*)&val, sizeof(val));
break;
case 20: // TRUTH_VALUE
netsnmp_set_row_column(row, column, ASN_INTEGER,
(u_char*)&val, sizeof(val));
break;
default: // COUNTER
netsnmp_set_row_column(row, column, ASN_COUNTER,
(u_char*)&val, sizeof(val));
break;
}
}
/*
* add the row to the table
*/
netsnmp_table_dataset_add_row(table_set, row);
/*
* Finally, this actually allows the "add_row" token it the
* * snmpd.conf file to add rows to this table.
* * Example snmpd.conf line:
* * add_row netSnmpIETFWGTable eos "Glenn Waters" "Dale Francisco"
*/
netsnmp_register_auto_data_table(table_set, NULL);
// End add code - wrajnees
}
/** Initializes the dot3StatsTable module */
void
init_dot3StatsTable(void)
{
/* here we initialize all the tables we're planning on supporting */
initialize_table_dot3StatsTable();
}