/*
*
* U.S. Government Rights - Commercial software. Government users are subject
* to the Sun Microsystems, Inc. standard license agreement and applicable
* provisions of the FAR and its supplements.
*
*
* This distribution may include materials developed by third parties. Sun,
* Sun Microsystems, the Sun logo and Solaris are trademarks or registered
* trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
*/
/*
* Note: this file originally auto-generated by mib2c using
* : mib2c.iterate.conf,v 1.1.1.1 2003/03/26 18:12:29 pcarroll Exp $
*/
#include <stdio.h>
#include <errno.h>
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include "demo_module_2.h"
/********************************************************************/
/* Implemented simple link list for demo purpose */
/********************************************************************/
return FALSE;
}
/* Unable to get the file information, it could be more than file not exists
if (errno == ENOENT) {
return FALSE;
}
return FALSE;
*/
}
}
}
else {
}
return TRUE;
}
return FALSE;
}
return TRUE;
}
}
return FALSE;
}
}
}
return NULL;
}
/********************************************************************/
/** Initialize the me1FileTable table by defining its contents and how it's structured */
void
{
/* create the table structure itself */
/* if your table is read only, it's easiest to change the
HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY */
return; /* mallocs failed */
}
/***************************************************
* Setting up the table's definition
*/
ASN_UNSIGNED, /* index: me1FileIndex */
0);
/* iterator access routines */
/***************************************************
* registering the table with the master agent
*/
DEBUGMSGTL(("initialize_table_me1FileTable",
"Registering table me1FileTable as a table iterator\n"));
}
/** Initializes the demo_module_2 module */
void
init_demo_module_2(void)
{
/* here we initialize all the tables we're planning on supporting */
}
/** returns the first data point within the me1FileTable table data.
Set the my_loop_context variable to the first data point structure
of your choice (from which you can find the next one). This could
be anything from the first node in a linked list, to an integer
pointer containing the beginning of an array variable.
Set the my_data_context variable to something to be returned to
you later that will provide you with the data to return in a given
row. This could be the same pointer as what my_loop_context is
set to, or something different.
The put_index_data variable contains a list of snmp variable
bindings, one for each index in your table. Set the values of
each appropriately according to the data matching the first row
and return the put_index_data variable at the end of the function.
*/
{
if (!firstFile) {
return NULL;
}
return put_index_data;
}
/** functionally the same as me1FileTable_get_first_data_point, but
my_loop_context has already been set to a previous value and should
be updated to the next in the list. For example, if it was a
linked list, you might want to cast it and the return
my_loop_context->next. The my_data_context pointer should be set
to something you need later and the indexes in put_index_data
updated again. */
{
if (!nextNode) {
return NULL;
}
return put_index_data;
}
/** handles requests for the me1FileTable table, if anything else needs to be done */
int
char* undofn;
continue;
/* perform anything here that you need to do before each
request is processed. */
/* the following extracts the my_data_context pointer set in
the loop functions above. You can then use the results to
help return data for the columns of the me1FileTable table in question */
} else {
}
continue;
} else {
} else {
}
}
/* extracts the information about the table from the request */
/* table_info->colnum contains the column number requested */
/* table_info->indexes contains a linked list of snmp variable
bindings for the indexes of the table. Values in the list
have been set corresponding to the indexes of the
request */
if (table_info==NULL) {
continue;
}
/* the table_iterator helper should change all GETNEXTs
into GETs for you automatically, so you don't have to
worry about the GETNEXT case. Only GETs and SETs need
to be dealt with here */
case MODE_GET:
switch(table_info->colnum) {
case COLUMN_ME1FILEINDEX:
/* ASN_UNSIGNED */
break;
case COLUMN_ME1FILENAME:
break;
case COLUMN_ME1FILESIZE:
break;
case COLUMN_ME1FILEPERM:
break;
default:
/* We shouldn't get here */
}
break;
case MODE_SET_RESERVE1:
/* set handling... */
switch(table_info->colnum) {
/*
* Check that the value being set is acceptable
*/
case COLUMN_ME1FILENAME:
return SNMP_ERR_WRONGTYPE;
}
return SNMP_ERR_WRONGVALUE;
}
break;
default:
/* We shouldn't get here */
return SNMP_ERR_NOTWRITABLE;
}
break;
case MODE_SET_RESERVE2:
/*
* This is conventially where any necesary
* resources are allocated (e.g. calls to malloc)
*/
/* Store old info for undo later */
if (undofn) {
} else
free));
}
break;
case MODE_SET_FREE:
/*
* This is where any of the above resources
* are freed again (because one of the other
* values being SET failed for some reason).
*/
/*The netsnmp_free_list_data should take care of the
alocated resources */
break;
case MODE_SET_ACTION:
/*
* Set the variable as requested.
* Note that this may need to be reversed,
* so save any information needed to do this.
*/
}
break;
case MODE_SET_COMMIT:
/*
* Everything worked, so we can discard any
* saved information, and make the change
* permanent (e.g. write to the config file).
* We also free any allocated resources.
*
*/
/*The netsnmp_free_list_data should take care of the
alocated resources */
break;
case MODE_SET_UNDO:
/*
* Something failed, so re-set the
* variable to its previous value
* (and free any allocated resources).
*/
/******* Get the saved value ************/
}
}
break;
default:
}
}
return SNMP_ERR_NOERROR;
}