Hi Dave

Sorry, I did not provide the 'implemented' x_access.c/h files because I
thought get_first_data and get_next_data are only responsible to find the
correct row and have nothing to do with columns. And in my case the rows are
found correctly (How do the get_first/next routines affect the finding of a
column?)

I have now attached the access_c/h files.

But the code does still not compile, because the access.c makes further
calls to get the data row from the internal data representation - code which
you are probably not interested in. The structure of a row can be seen in
the file TtfCfgTableWrapper.h.

Maybe you can give an advice already? Or a tip, what I have to care about in
the get_first / get_next functions to handle gaps between oids correctly?

I can still provide you with a compilable example if you prefere but I have
to unhinge it from our code first which needs a little time (which I have,
of course!).


One other question:

To understand the problem better I experimented with the example tables from
the NET-SNMP-EXAMPLE-MIB. I tried to change the netSnmpHostsTable example to
support gaps in the oids. I added a gap between netSnmpHostAddress and
netSnmpHostStorage. Then I adapted the generated code.
Unfortunately I could not manage to make it functioning correctly. Getnext
stops after the gap and does not jump over it.

 If you find it easier, I could also provide you with this 'changed' example
code (less code, probably known to you).


Many thanks

Boris



2011/4/24 Dave Shield <[email protected]>

> On 21 April 2011 08:44, Boris Zweimueller <[email protected]> wrote:
> >> Could you please post the rest of the header files   (ttfCfgTable.h and
> >> ttfCfgTable_checkfns.h).    I can't really attempt to reproduce the
> >> problem without the full code that you are using.
>
> > Sure, here they are!
>
> Sorry - that code doesn't compile.
>
> The file 'ttfCfgTable_access.c'  that you posted is still the template
> code as generated by mib2c.  The get_first/next routines are incomplete:
>
>    *my_loop_context = /** XXX */;
>    *my_data_context = /** XXX */;
>
> (there may be problems elsewhere - I haven't looked)
> If you want assistance with this problem, you need to provide the full code
> that you are actually using.
>
> Dave
>
>
> ------------------------------------------------------------------------------
> Fulfilling the Lean Software Promise
> Lean software platforms are now widely adopted and the benefits have been
> demonstrated beyond question. Learn why your peers are replacing JEE
> containers with lightweight application servers - and what you can gain
> from the move. http://p.sf.net/sfu/vmware-sfemails
> _______________________________________________
> Net-snmp-users mailing list
> [email protected]
> Please see the following page to unsubscribe or change other options:
> https://lists.sourceforge.net/lists/listinfo/net-snmp-users
>
//lint -e613
/*
 * Note: this file originally auto-generated by mib2c using
 *        : mib2c.access_functions.conf 11358 2004-10-14 12:57:34Z dts12 $
 */
 /* created based on the 
 * 
 * TemplateAccessStatic.template 
 * 
 * file of mibGen2cpp
 */

#include "PrecompIncludesForC.h"
#include "ttfCfgTable_access.h"
#include "ttfCfgTable_enums.h"

#include "TtfCfgTableWrapper.h"

#include "LogWrapper.h"

enum TABLE_ENTRY_STATUS {
	NOT_ACTIVE = -1, UNDER_CONSTRUCTION = 2, ACTIVE = 1
};

netsnmp_variable_list* 
ttfCfgTable_get_first_data_point(void **my_loop_context, void **my_data_context,
		netsnmp_variable_list *put_index_data,
		netsnmp_iterator_info *mydata) {
	
	//logWrapper_debug("ttfCfgTable_get_first_data_point");
	
	*my_loop_context = ttfCfgTableWrapper_getFirstRow();
	return ttfCfgTable_get_next_data_point(my_loop_context, my_data_context, put_index_data, mydata);
}


netsnmp_variable_list *
ttfCfgTable_get_next_data_point(void **my_loop_context, void **my_data_context,
		netsnmp_variable_list *put_index_data, netsnmp_iterator_info *mydata) {

	//logWrapper_debug("ttfCfgTable_get_next_data_point");

	ttfCfgTableRow* entry = (ttfCfgTableRow*) *my_loop_context;
	netsnmp_variable_list *idx = put_index_data;	

	if (entry) {
		snmp_set_var_typed_integer(idx, ASN_INTEGER, entry->ttfcfgslot);
		idx = idx->next_variable;
		snmp_set_var_typed_integer(idx, ASN_INTEGER, entry->ttfcfgfunctiongroup);
		idx = idx->next_variable;
		snmp_set_var_typed_integer(idx, ASN_INTEGER, entry->ttfcfgfunctionunit);
		idx = idx->next_variable;
		
		*my_data_context = (void *)entry;
		*my_loop_context = (void *)ttfCfgTableWrapper_getNextRow();

		return put_index_data;
	}
	else {
		return NULL;
	}
}


void*
ttfCfgTable_create_data_context(netsnmp_variable_list* index_data, int column) {
	logWrapper_error( "This should never happen as this is a static table !");
	return NULL;
}


int
ttfCfgTable_commit_row(void **my_data_context, int new_or_del) {
	char buf[64] = {0};
	sprintf(buf, "ttfCfgTable_commit_row: %s", (new_or_del == 1)?("new"):((new_or_del == -1)?("del"):("modification")));
	logWrapper_debug(buf);

	return SNMP_ERR_NOERROR;
}


long *get_ttfCfgSpiForcedShutdown(void *data_context, size_t *ret_len) {
	ttfCfgTableRow* data = data_context;
	*ret_len = 1*sizeof(long);
	return (long*) &data->ttfCfgSpiForcedShutdown;
}

int set_ttfCfgSpiForcedShutdown(void *data_context, long *val, size_t val_len) {
	ttfCfgTableRow* tempRow = ttfCfgTableWrapper_getTempRow();
	tempRow->ttfCfgSpiForcedShutdown = *val;

	return SNMP_ERR_NOERROR;
}

long *get_ttfCfgSpiAls(void *data_context, size_t *ret_len) {
	ttfCfgTableRow* data = data_context;
	*ret_len = 1*sizeof(long);
	return (long*) &data->ttfCfgSpiAls;
}

int set_ttfCfgSpiAls(void *data_context, long *val, size_t val_len) {
	ttfCfgTableRow* tempRow = ttfCfgTableWrapper_getTempRow();
	tempRow->ttfCfgSpiAls = *val;

	return SNMP_ERR_NOERROR;
}

long *get_ttfCfgSpiLaserOnManual(void *data_context, size_t *ret_len) {
	ttfCfgTableRow* data = data_context;
	*ret_len = 1*sizeof(long);
	return (long*) &data->ttfCfgSpiLaserOnManual;
}

int set_ttfCfgSpiLaserOnManual(void *data_context, long *val, size_t val_len) {
	ttfCfgTableRow* tempRow = ttfCfgTableWrapper_getTempRow();
	tempRow->ttfCfgSpiLaserOnManual = *val;

	return SNMP_ERR_NOERROR;
}

long *get_ttfCfgSpiPortMode(void *data_context, size_t *ret_len) {
	ttfCfgTableRow* data = data_context;
	*ret_len = 1*sizeof(long);
	return (long*) &data->ttfCfgSpiPortMode;
}

int set_ttfCfgSpiPortMode(void *data_context, long *val, size_t val_len) {
	ttfCfgTableRow* tempRow = ttfCfgTableWrapper_getTempRow();
	tempRow->ttfCfgSpiPortMode = *val;

	return SNMP_ERR_NOERROR;
}

long *get_ttfCfgLoopInt(void *data_context, size_t *ret_len) {
	ttfCfgTableRow* data = data_context;
	*ret_len = 1*sizeof(long);
	return (long*) &data->ttfCfgLoopInt;
}

int set_ttfCfgLoopInt(void *data_context, long *val, size_t val_len) {
	ttfCfgTableRow* tempRow = ttfCfgTableWrapper_getTempRow();
	tempRow->ttfCfgLoopInt = *val;

	return SNMP_ERR_NOERROR;
}

long *get_ttfCfgLoopExt(void *data_context, size_t *ret_len) {
	ttfCfgTableRow* data = data_context;
	*ret_len = 1*sizeof(long);
	return (long*) &data->ttfCfgLoopExt;
}

int set_ttfCfgLoopExt(void *data_context, long *val, size_t val_len) {
	ttfCfgTableRow* tempRow = ttfCfgTableWrapper_getTempRow();
	tempRow->ttfCfgLoopExt = *val;

	return SNMP_ERR_NOERROR;
}

long *get_ttfCfgLoopIntLaserOn(void *data_context, size_t *ret_len) {
	ttfCfgTableRow* data = data_context;
	*ret_len = 1*sizeof(long);
	return (long*) &data->ttfCfgLoopIntLaserOn;
}

int set_ttfCfgLoopIntLaserOn(void *data_context, long *val, size_t val_len) {
	ttfCfgTableRow* tempRow = ttfCfgTableWrapper_getTempRow();
	tempRow->ttfCfgLoopIntLaserOn = *val;

	return SNMP_ERR_NOERROR;
}

long *get_ttfCfgLoopRemoveTime(void *data_context, size_t *ret_len) {
	ttfCfgTableRow* data = data_context;
	*ret_len = 1*sizeof(long);
	return (long*) &data->ttfCfgLoopRemoveTime;
}

int set_ttfCfgLoopRemoveTime(void *data_context, long *val, size_t val_len) {
	ttfCfgTableRow* tempRow = ttfCfgTableWrapper_getTempRow();
	tempRow->ttfCfgLoopRemoveTime = *val;

	return SNMP_ERR_NOERROR;
}

long *get_ttfCfgRegJ0Enable(void *data_context, size_t *ret_len) {
	ttfCfgTableRow* data = data_context;
	*ret_len = 1*sizeof(long);
	return (long*) &data->ttfCfgRegJ0Enable;
}

int set_ttfCfgRegJ0Enable(void *data_context, long *val, size_t val_len) {
	ttfCfgTableRow* tempRow = ttfCfgTableWrapper_getTempRow();
	tempRow->ttfCfgRegJ0Enable = *val;

	return SNMP_ERR_NOERROR;
}

long *get_ttfCfgMultiBadSecEbcThreshold(void *data_context, size_t *ret_len) {
	ttfCfgTableRow* data = data_context;
	*ret_len = 1*sizeof(long);
	return (long*) &data->ttfCfgMultiBadSecEbcThreshold;
}

int set_ttfCfgMultiBadSecEbcThreshold(void *data_context, long *val, size_t val_len) {
	ttfCfgTableRow* tempRow = ttfCfgTableWrapper_getTempRow();
	tempRow->ttfCfgMultiBadSecEbcThreshold = *val;

	return SNMP_ERR_NOERROR;
}

long *get_ttfCfgMultiBadSecThreshold(void *data_context, size_t *ret_len) {
	ttfCfgTableRow* data = data_context;
	*ret_len = 1*sizeof(long);
	return (long*) &data->ttfCfgMultiBadSecThreshold;
}

int set_ttfCfgMultiBadSecThreshold(void *data_context, long *val, size_t val_len) {
	ttfCfgTableRow* tempRow = ttfCfgTableWrapper_getTempRow();
	tempRow->ttfCfgMultiBadSecThreshold = *val;

	return SNMP_ERR_NOERROR;
}

/*
 * Note: this file originally auto-generated by mib2c using
 *        : mib2c.access_functions.conf 11358 2004-10-14 12:57:34Z dts12 $
 */
#ifndef TTFCFGTABLE_ACCESS_H
#define TTFCFGTABLE_ACCESS_H

/** User-defined data access functions for data in table ttfCfgTable */
/** row level accessors */
Netsnmp_First_Data_Point  ttfCfgTable_get_first_data_point;
Netsnmp_Next_Data_Point   ttfCfgTable_get_next_data_point;
int ttfCfgTable_commit_row(void **my_data_context, int new_or_del);
void * ttfCfgTable_create_data_context(netsnmp_variable_list *index_data, int column);

/** column accessors */
      long *get_ttfCfgSpiForcedShutdown(void *data_context, size_t *ret_len);
      int set_ttfCfgSpiForcedShutdown(void *data_context, long *val, size_t val_len);
      long *get_ttfCfgSpiAls(void *data_context, size_t *ret_len);
      int set_ttfCfgSpiAls(void *data_context, long *val, size_t val_len);
      long *get_ttfCfgSpiLaserOnManual(void *data_context, size_t *ret_len);
      int set_ttfCfgSpiLaserOnManual(void *data_context, long *val, size_t val_len);
      long *get_ttfCfgSpiPortMode(void *data_context, size_t *ret_len);
      int set_ttfCfgSpiPortMode(void *data_context, long *val, size_t val_len);
      long *get_ttfCfgLoopInt(void *data_context, size_t *ret_len);
      int set_ttfCfgLoopInt(void *data_context, long *val, size_t val_len);
      long *get_ttfCfgLoopExt(void *data_context, size_t *ret_len);
      int set_ttfCfgLoopExt(void *data_context, long *val, size_t val_len);
      long *get_ttfCfgLoopIntLaserOn(void *data_context, size_t *ret_len);
      int set_ttfCfgLoopIntLaserOn(void *data_context, long *val, size_t val_len);
      long *get_ttfCfgLoopRemoveTime(void *data_context, size_t *ret_len);
      int set_ttfCfgLoopRemoveTime(void *data_context, long *val, size_t val_len);
      long *get_ttfCfgRegJ0Enable(void *data_context, size_t *ret_len);
      int set_ttfCfgRegJ0Enable(void *data_context, long *val, size_t val_len);
      long *get_ttfCfgMultiBadSecEbcThreshold(void *data_context, size_t *ret_len);
      int set_ttfCfgMultiBadSecEbcThreshold(void *data_context, long *val, size_t val_len);
      long *get_ttfCfgMultiBadSecThreshold(void *data_context, size_t *ret_len);
      int set_ttfCfgMultiBadSecThreshold(void *data_context, long *val, size_t val_len);

#endif /* TTFCFGTABLE_ACCESS_H */
/*
 * generated/usnTtf/ttfCfgTable/TtfCfgTableWrapper.h
 *
 * This file has been generated automatically 
 *
 * DO NOT EDIT !!
 */

#ifndef _TTFCFGTABLEWRAPPER_H_
#define _TTFCFGTABLEWRAPPER_H_

#ifdef __cplusplus
extern "C" {
#endif

typedef struct ttfCfgTableRow{
	/* housekeeping */
	long entryState;
	long myArrayIndex;

	/* indexes */
	long ttfcfgslot;
	long ttfcfgfunctiongroup;
	long ttfcfgfunctionunit;

	/* columns */
	long ttfCfgLoopExt;
	long ttfCfgLoopInt;
	long ttfCfgLoopIntLaserOn;
	long ttfCfgLoopRemoveTime;
	long ttfCfgMultiBadSecEbcThreshold;
	long ttfCfgMultiBadSecThreshold;
	long ttfCfgRegJ0Enable;
	long ttfCfgSpiAls;
	long ttfCfgSpiForcedShutdown;
	long ttfCfgSpiLaserOnManual;
	long ttfCfgSpiPortMode;

} ttfCfgTableRow;

ttfCfgTableRow* ttfCfgTableWrapper_getFirstRow(void);
ttfCfgTableRow* ttfCfgTableWrapper_getNextRow(void);
ttfCfgTableRow* ttfCfgTableWrapper_getRow(long index1, long index2, long index3);
ttfCfgTableRow* ttfCfgTableWrapper_getTempRow(void);

struct TtfCfgTable* ttfCfgTableWrapper_getTable(void);

#ifdef __cplusplus
}
#endif

#endif //_TTFCFGTABLEWRAPPER_H_
------------------------------------------------------------------------------
Fulfilling the Lean Software Promise
Lean software platforms are now widely adopted and the benefits have been 
demonstrated beyond question. Learn why your peers are replacing JEE 
containers with lightweight application servers - and what you can gain 
from the move. http://p.sf.net/sfu/vmware-sfemails
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to