|
Packit |
fcad23 |
/*
|
|
Packit |
fcad23 |
* Note: this file originally auto-generated by mib2c using
|
|
Packit |
fcad23 |
* version : 14170 $ of $
|
|
Packit |
fcad23 |
*
|
|
Packit |
fcad23 |
* $Id:$
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
/** \page MFD helper for etherStatsTable
|
|
Packit |
fcad23 |
*
|
|
Packit |
fcad23 |
* \section intro Introduction
|
|
Packit |
fcad23 |
* Introductory text.
|
|
Packit |
fcad23 |
*
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
/*
|
|
Packit |
fcad23 |
* standard Net-SNMP includes
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
#include <net-snmp/net-snmp-config.h>
|
|
Packit |
fcad23 |
#include <net-snmp/net-snmp-includes.h>
|
|
Packit |
fcad23 |
#include <net-snmp/agent/net-snmp-agent-includes.h>
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/*
|
|
Packit |
fcad23 |
* include our parent header
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
#include "etherStatsTable.h"
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
#include <net-snmp/agent/mib_modules.h>
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
#include "etherStatsTable_interface.h"
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
oid etherStatsTable_oid[] = { ETHERSTATSTABLE_OID };
|
|
Packit |
fcad23 |
int etherStatsTable_oid_size = OID_LENGTH(etherStatsTable_oid);
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
etherStatsTable_registration etherStatsTable_user_context;
|
|
Packit |
fcad23 |
static etherStatsTable_registration *etherStatsTable_user_context_p;
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
void initialize_table_etherStatsTable(void);
|
|
Packit |
fcad23 |
void shutdown_table_etherStatsTable(void);
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/**
|
|
Packit |
fcad23 |
* Initializes the etherStatsTable module
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
void
|
|
Packit |
fcad23 |
init_etherStatsTable(void)
|
|
Packit |
fcad23 |
{
|
|
Packit |
fcad23 |
DEBUGMSGTL(("verbose:etherStatsTable:init_etherStatsTable",
|
|
Packit |
fcad23 |
"called\n"));
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/*
|
|
Packit |
fcad23 |
* TODO:300:o: Perform etherStatsTable one-time module initialization.
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/*
|
|
Packit |
fcad23 |
* here we initialize all the tables we're planning on supporting
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
if (should_init("etherStatsTable"))
|
|
Packit |
fcad23 |
initialize_table_etherStatsTable();
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
} /* init_etherStatsTable */
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/**
|
|
Packit |
fcad23 |
* Shut-down the etherStatsTable module (agent is exiting)
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
void
|
|
Packit |
fcad23 |
shutdown_etherStatsTable(void)
|
|
Packit |
fcad23 |
{
|
|
Packit |
fcad23 |
if (should_init("etherStatsTable"))
|
|
Packit |
fcad23 |
shutdown_table_etherStatsTable();
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
}
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/**
|
|
Packit |
fcad23 |
* Initialize the table etherStatsTable
|
|
Packit |
fcad23 |
* (Define its contents and how it's structured)
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
void
|
|
Packit |
fcad23 |
initialize_table_etherStatsTable(void)
|
|
Packit |
fcad23 |
{
|
|
Packit |
fcad23 |
u_long flags;
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
DEBUGMSGTL(("verbose:etherStatsTable:initialize_table_etherStatsTable",
|
|
Packit |
fcad23 |
"called\n"));
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/*
|
|
Packit |
fcad23 |
* TODO:301:o: Perform etherStatsTable one-time table initialization.
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/*
|
|
Packit |
fcad23 |
* TODO:302:o: |->Initialize etherStatsTable user context
|
|
Packit |
fcad23 |
* if you'd like to pass in a pointer to some data for this
|
|
Packit |
fcad23 |
* table, allocate or set it up here.
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
/*
|
|
Packit |
fcad23 |
* a netsnmp_data_list is a simple way to store void pointers. A simple
|
|
Packit |
fcad23 |
* string token is used to add, find or remove pointers.
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
etherStatsTable_user_context_p
|
|
Packit |
fcad23 |
= netsnmp_create_data_list("etherStatsTable", NULL, NULL);
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/*
|
|
Packit |
fcad23 |
* No support for any flags yet, but in the future you would
|
|
Packit |
fcad23 |
* set any flags here.
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
flags = 0;
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/*
|
|
Packit |
fcad23 |
* call interface initialization code
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
_etherStatsTable_initialize_interface
|
|
Packit |
fcad23 |
(etherStatsTable_user_context_p, flags);
|
|
Packit |
fcad23 |
} /* initialize_table_etherStatsTable */
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/**
|
|
Packit |
fcad23 |
* Shutdown the table etherStatsTable
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
void
|
|
Packit |
fcad23 |
shutdown_table_etherStatsTable(void)
|
|
Packit |
fcad23 |
{
|
|
Packit |
fcad23 |
/*
|
|
Packit |
fcad23 |
* call interface shutdown code
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
_etherStatsTable_shutdown_interface(etherStatsTable_user_context_p);
|
|
Packit |
fcad23 |
netsnmp_free_all_list_data(etherStatsTable_user_context_p);
|
|
Packit |
fcad23 |
etherStatsTable_user_context_p = NULL;
|
|
Packit |
fcad23 |
}
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/**
|
|
Packit |
fcad23 |
* extra context initialization (eg default values)
|
|
Packit |
fcad23 |
*
|
|
Packit |
fcad23 |
* @param rowreq_ctx : row request context
|
|
Packit |
fcad23 |
* @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate)
|
|
Packit |
fcad23 |
*
|
|
Packit |
fcad23 |
* @retval MFD_SUCCESS : no errors
|
|
Packit |
fcad23 |
* @retval MFD_ERROR : error (context allocate will fail)
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
int
|
|
Packit |
fcad23 |
etherStatsTable_rowreq_ctx_init(etherStatsTable_rowreq_ctx * rowreq_ctx,
|
|
Packit |
fcad23 |
void *user_init_ctx)
|
|
Packit |
fcad23 |
{
|
|
Packit |
fcad23 |
DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_rowreq_ctx_init",
|
|
Packit |
fcad23 |
"called\n"));
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
netsnmp_assert(NULL != rowreq_ctx);
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/*
|
|
Packit |
fcad23 |
* TODO:210:o: |-> Perform extra etherStatsTable rowreq initialization. (eg DEFVALS)
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
return MFD_SUCCESS;
|
|
Packit |
fcad23 |
} /* etherStatsTable_rowreq_ctx_init */
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/**
|
|
Packit |
fcad23 |
* extra context cleanup
|
|
Packit |
fcad23 |
*
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
void
|
|
Packit |
fcad23 |
etherStatsTable_rowreq_ctx_cleanup(etherStatsTable_rowreq_ctx * rowreq_ctx)
|
|
Packit |
fcad23 |
{
|
|
Packit |
fcad23 |
DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_rowreq_ctx_cleanup", "called\n"));
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
netsnmp_assert(NULL != rowreq_ctx);
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/*
|
|
Packit |
fcad23 |
* TODO:211:o: |-> Perform extra etherStatsTable rowreq cleanup.
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
} /* etherStatsTable_rowreq_ctx_cleanup */
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/**
|
|
Packit |
fcad23 |
* pre-request callback
|
|
Packit |
fcad23 |
*
|
|
Packit |
fcad23 |
*
|
|
Packit |
fcad23 |
* @retval MFD_SUCCESS : success.
|
|
Packit |
fcad23 |
* @retval MFD_ERROR : other error
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
int
|
|
Packit |
fcad23 |
etherStatsTable_pre_request(etherStatsTable_registration * user_context)
|
|
Packit |
fcad23 |
{
|
|
Packit |
fcad23 |
DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_pre_request",
|
|
Packit |
fcad23 |
"called\n"));
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/*
|
|
Packit |
fcad23 |
* TODO:510:o: Perform etherStatsTable pre-request actions.
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
return MFD_SUCCESS;
|
|
Packit |
fcad23 |
} /* etherStatsTable_pre_request */
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/**
|
|
Packit |
fcad23 |
* post-request callback
|
|
Packit |
fcad23 |
*
|
|
Packit |
fcad23 |
* Note:
|
|
Packit |
fcad23 |
* New rows have been inserted into the container, and
|
|
Packit |
fcad23 |
* deleted rows have been removed from the container and
|
|
Packit |
fcad23 |
* released.
|
|
Packit |
fcad23 |
*
|
|
Packit |
fcad23 |
* @param user_context
|
|
Packit |
fcad23 |
* @param rc : MFD_SUCCESS if all requests succeeded
|
|
Packit |
fcad23 |
*
|
|
Packit |
fcad23 |
* @retval MFD_SUCCESS : success.
|
|
Packit |
fcad23 |
* @retval MFD_ERROR : other error (ignored)
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
int
|
|
Packit |
fcad23 |
etherStatsTable_post_request(etherStatsTable_registration * user_context,
|
|
Packit |
fcad23 |
int rc)
|
|
Packit |
fcad23 |
{
|
|
Packit |
fcad23 |
DEBUGMSGTL(("verbose:etherStatsTable:etherStatsTable_post_request",
|
|
Packit |
fcad23 |
"called\n"));
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/*
|
|
Packit |
fcad23 |
* TODO:511:o: Perform etherStatsTable post-request actions.
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/*
|
|
Packit |
fcad23 |
* check to set if any rows were changed.
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
if (etherStatsTable_dirty_get()) {
|
|
Packit |
fcad23 |
/*
|
|
Packit |
fcad23 |
* check if request was successful. If so, this would be
|
|
Packit |
fcad23 |
* a good place to save data to its persistent store.
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
if (MFD_SUCCESS == rc) {
|
|
Packit |
fcad23 |
/*
|
|
Packit |
fcad23 |
* save changed rows, if you haven't already
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
}
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
etherStatsTable_dirty_set(0); /* clear table dirty flag */
|
|
Packit |
fcad23 |
}
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
return MFD_SUCCESS;
|
|
Packit |
fcad23 |
} /* etherStatsTable_post_request */
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/** @{ */
|