/*
*
* 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 5.5 2002/12/16 22:50:18 hardaker Exp $
*/
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include "stdhdr.h"
#include "entLogicalTable.h"
#include "entAliasMappingTable.h"
#include "entLastChangeTime.h"
#include "entLPMappingTable.h"
static int AddToLogicalTable(entLogicalEntry_t *);
static int FreeLogicalEntry(entLogicalEntry_t *);
int gLogicalTableSize;
/** Initialize the entLogicalTable 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 */
/* Fix for 4910624 - changing HANDLER_CAN_RWRITE to HANDLER_CAN_RONLY */
/* End of Fix for 4910624 */
return; /* mallocs failed */
/***************************************************
* Setting up the table's definition
*/
ASN_INTEGER, /* index: entLogicalIndex */
0);
/* iterator access routines */
/***************************************************
* registering the table with the master agent
*/
DEBUGMSGTL(("initialize_table_entLogicalTable",
"Registering table entLogicalTable as a table iterator\n"));
}
/** Initializes the entLogicalTable module */
void
init_entLogicalTable(void)
{
/* here we initialize all the tables we're planning on supporting */
gLogicalTableSize = 0;
}
/** returns the first data point within the entLogicalTable 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.
*/
{
while (zRunner) {
if (zRunner->entLogicalIndex > 0)
break;
}
*my_loop_context = (void *)zRunner;
*my_data_context = (void *)zRunner;
return put_index_data;
}
/** functionally the same as entLogicalTable_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. */
{
while (zRunner) {
break;
}
*my_loop_context = (void *)zRunner;
*my_data_context = (void *)zRunner;
return put_index_data;
}
/** handles requests for the entLogicalTable table, if anything else needs to be done */
int
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 entLogicalTable table in question */
continue;
}
/* XXX: no row existed, if you support creation and this is a
set, start dealing with it here, else continue */
}
/* 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_ENTLOGICALDESCR:
snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) zLogicalEntry->entLogicalDescr, strlen(zLogicalEntry->entLogicalDescr));
break;
case COLUMN_ENTLOGICALTYPE:
snmp_set_var_typed_value(var, ASN_OBJECT_ID, (u_char *) zLogicalEntry->entLogicalType, zLogicalEntry->entLogicalTypeSize);
break;
snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) zLogicalEntry->entLogicalCommunity, strlen(zLogicalEntry->entLogicalCommunity));
break;
snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) zLogicalEntry->entLogicalTAddress, strlen(zLogicalEntry->entLogicalTAddress));
break;
case COLUMN_ENTLOGICALTDOMAIN:
snmp_set_var_typed_value(var, ASN_OBJECT_ID, (u_char *) zLogicalEntry->entLogicalTDomain, zLogicalEntry->entLogicalTDomainSize);
break;
snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) zLogicalEntry->entLogicalContextEngineId, strlen(zLogicalEntry->entLogicalContextEngineId));
break;
snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) zLogicalEntry->entLogicalContextName, strlen(zLogicalEntry->entLogicalContextName));
break;
default:
/* We shouldn't get here */
}
break;
case MODE_SET_RESERVE1:
/* set handling... */
default:
}
}
return SNMP_ERR_NOERROR;
}
char *entLogicalDescr,
int entLogicalTypeSize,
char *entLogicalCommunity,
char *entLogicalTAddress,
char *entLogicalContextEngineId,
char *entLogicalContextName)
{
}
/*
* Allocates a Logical entry. if logicidx >0 attempts to reuse an
* existing entry
*/
int
{
int index;
/* Fix for 4893101 */
/* End of Fix for 4893101 */
/* Fix for 4927412 */
/* End of Fix for 4927412 */
/* Fix for 4927412: according to RFC 2737, entLogicalDescr has to be */
/* unique - NULL should be rejected. */
/* entLogicalTAddress should not accept NULL or "". */
/* entLogicalTDomain should not accept NULL */
/* entLogicalType will default to mib-2 for */
/* NULL. For the rest, we will force NULL = "" */
/* (zero-length string) */
return -1;
/* Fix for 4893101: We have to check for NULL so that it does not */
/* crash. Also we need to have mib-2 as the default, */
/* as outlined in the RFC */
}
/* End of Fix for 4893101 */
return -1;
return -1;
return -1;
/* End of Fix for 4927412 */
/* Fix for 4921309 */
return NULL;
/* End of Fix for 4921309 */
/* Fix for 4911817: Check for size and boundary limits */
/* entLogicalDescr 0..255 */
return -1;
/* entLogicalCommunity 0..255 (deprecated) */
return -1;
/* entLogicalTAddress 1..255 */
if (strlen(xnewLogicalEntry->entLogicalTAddress) < 1 || strlen(xnewLogicalEntry->entLogicalTAddress) > 255)
return -1;
/* entLogicalContextEngineId 0..32 */
return -1;
/* entLogicalContextName 0..255 */
return -1;
/* End of Fix for 4911817 */
return (-1);
}
/* Fix for 4884526 */
return (-1);
}
/* End of Fix for 4884526 */
/* Fix for 4884526 */
return (-1);
}
/* End of Fix for 4884526 */
/* Fix for 4884526 */
return (-1);
}
/* End of Fix for 4884526 */
/* Fix for 4884526 */
return (-1);
}
/* End of Fix for 4884526 */
/* Fix for 4926767: We do not want NULL TDomain */
} else {
}
/* End of Fix for 4926767 */
/* Fix for 4884526 */
return (-1);
}
/* End of Fix for 4884526 */
/* Fix for 4884526 */
return (-1);
}
/* End of Fix for 4884526 */
/* Fix for 4884526 */
return (-1);
}
/* End of Fix for 4884526 */
return (index);
}
static int
{
int zIndex;
/* Fix for 4921309 */
/* If index > 0, attempt to insert in appropriate place. */
if (xnewLogicalEntry->entLogicalIndex > 0) {
placeFound = 0;
if (xnewLogicalEntry->entLogicalIndex >
} else {
break;
}
}
/* If the indexes don't match, we can use the specified index */
placeFound = 1;
/* Index > last value, make this the last entry */
placeFound = 1;
} else if (xnewLogicalEntry->entLogicalIndex !=
/* Index < zRunner, insert entry before it */
if (zRunner == gLogicalTableHead) {
/* Index fits before list head, insert entry */
} else {
/* Index fits between two entries, insert entry */
}
placeFound = 1;
}
if (placeFound) {
return (xnewLogicalEntry->entLogicalIndex);
} else {
/* Re-initialize for code that follows */
}
}
/* Either index was zero or specified index is already taken */
/* End of Fix for 4921309 */
if (gLogicalTableSize > LARGE_TABLE) {
return (zIndex);
}
if (gLogicalTableHead) { /* A slightly slower way to add into the list */
return (zIndex);
}
}
} else {
}
return (zIndex);
}
int
{
int zLogicalIndex;
/* Fix for 4888088 */
return (-1);
/* End of Fix for 4888088 */
while (zRunner) {
if (zLogicalIndex < 0) {
if (zLogicalIndex == -(xLogicalIndex))
return (-2); /* Entry is already stale */
}
if (zLogicalIndex == xLogicalIndex) {
/* Fix for 4918876: We need to delete the related entries first */
/*
Delete all instances of this logical index in all other
tables to maintain table integrity. Should we roll-back if a
deletion fails, perhaps not
*/
/* End of Fix for 4918876 */
return (0);
}
}
return (-1);
}
int
{
int zLogicalIndex;
/* Fix for 4888088 */
return (-1);
/* End of Fix for 4888088 */
while (zRunner) {
if (zLogicalIndex > 0) {
if (zLogicalIndex == xLogicalIndex)
return (-2); /* Entry is already live */
}
if (zLogicalIndex == -(xLogicalIndex)) {
return (0);
}
}
return (-1);
}
{
int zLogicalIndex;
/* Fix for 4888088 */
return NULL;
/* End of Fix for 4888088 */
while (zRunner) {
if (zLogicalIndex > 0) {
if (zLogicalIndex == xLogicalIndex)
return zRunner;
}
if (zLogicalIndex == -(xLogicalIndex)) {
return NULL; /* The stale entry exist, we can stop the search*/
}
}
return NULL;
}
{
int zLogicalIndex;
/* Fix for 4888088 */
return NULL;
/* End of Fix for 4888088 */
while (zRunner) {
if (zLogicalIndex < 0) {
if (zLogicalIndex == -(xLogicalIndex))
return zRunner;
}
if (zLogicalIndex == xLogicalIndex) {
return NULL; /* The live entry exist, we can stop the search*/
}
}
return NULL;
}
int
{
int zLogicalIndex;
/* Fix for 4888088 */
return -1;
/* End of Fix for 4888088 */
while (zRunner) {
if (zLogicalIndex > 0) {
if (zLogicalIndex == xLogicalIndex) {
/* Fix for 4918876: We need to delete the related entries */
/* first */
/*
Delete all instances of this logical index in all other
tables to maintain table integrity. Should we roll-back if a
deletion fails, perhaps not
*/
/* End of Fix for 4918876 */
if (prevEntry)
else
return (0);
}
}
if (zLogicalIndex == -(xLogicalIndex)) {
return (-2); /* The stale entry exist, we can stop the search*/
}
}
return (-1);
}
int
{
return (1);
}