Attached is the dummy routine that i've written to populate the table,
please take a look at it and tell me if it is sufficient. If i need
to add these entries to the table iterator, can someone point me to an
example.
void populate_sensorTable(void)
{
struct sensorTable_entry sdr;
struct sensorTable_entry *sdrp;
int i;
for (i = 25; i > 0; )
{
sdrp = sensorTable_createEntry(i--);
sdrp->sensorIndex = 0x51;
sdrp->sensorSdrVersion = 0x01;
sdrp->sensorRecordType = 2;
sdrp->sensorOwnerId = 12;
sdrp->sensorOwnerLun = sdr.sensorOwnerLun;
// let the rest of the fields be zero for now.
strcpy(sdrp->sensorIdString, "CorEdge");
}
}
Thanks
Sridhar
On 5/19/06, Sridhar Addagada <[EMAIL PROTECTED]> wrote:
May be i've found the problem, given below is the code generated after mib2c
netsnmp_variable_list *
sensorTable_get_next_data_point(void **my_loop_context,
void **my_data_context,
netsnmp_variable_list * put_index_data,
netsnmp_iterator_info *mydata)
{
struct sensorTable_entry *entry =
(struct sensorTable_entry *) *my_loop_context;
netsnmp_variable_list *idx = put_index_data;
if (entry) {
snmp_set_var_value(idx, entry->sensorIndex,
sizeof(entry->sensorIndex));
idx = idx->next_variable;
*my_data_context = (void *) entry;
*my_loop_context = (void *) entry->next;
} else {
return NULL;
}
}
One can notice that the function does not return any value if entry is
not null, Should one be returning idx here or anything else.
I put idx, then the crash goes away, but the table is not returned for
snmpwalk.... I am stumped.
Thanks
Sridhar
On 5/19/06, Sridhar Addagada <[EMAIL PROTECTED]> wrote:
> I ran into few problems when compiling my mib using
> mib2c.iterate.conf. Mentioned below is the sample of the table.
>
> 1. The data structure that got generated "sensorTable_entry" had
> problem. The sensorIndex was repeted twice.
> struct sensorTable_entry {
> /* Index values */
> long sensorIndex;
>
> /* Column values */
> long sensorIndex;
> long sensorSdrVersion;
> .....
> ....
> }
>
> 2. bad function definition sensorTable_createEntry(long sensorIndex,)
> as you can see the function prototype has a problem.
>
> 3. after fixing the above two and populating the table using a dummy
> function inviked in initialize_table_sensorTable, I had a crash when i
> performed snmpwalk. Attached is the backtrace from the crash.
>
> Hope someone can take a look and give me pointer to fix this, the
> crash problem but the problem with mib2c.iterate.conf, a perl expert
> need to take a look.
>
> Thanks,
> Sridhar
>
> -------------------------------- MIB-EXTRACT
> ---------------------------------------------
>
> SensorEntry ::= SEQUENCE {
> sensorIndex INTEGER, -- 01
> sensorSdrVersion INTEGER, -- 02
> sensorRecordType INTEGER, -- 03
> sensorOwnerId INTEGER, -- 04
> sensorOwnerLun INTEGER, -- 05
> sensorNumber INTEGER, -- 06
> sensorEntityId INTEGER, -- 07
> sensorEntityInstance INTEGER, -- 08
> sensorInitialization INTEGER, -- 09
> sensorCapabilities INTEGER, -- 10
> sensorType INTEGER, -- 11
> sensorEvent INTEGER, -- 12
> sensorAssertionEventMask INTEGER, -- 13
> sensorDeassertionEventMask INTEGER, -- 14
> sensorMask INTEGER, -- 15
> sensorUnits INTEGER, -- 16
> sensorBaseUnit INTEGER, -- 17
> sensorModifierUnit INTEGER, -- 18
> sensorLinearization INTEGER, -- 19
> sensorM INTEGER, -- 20
> sensorTolerance INTEGER, -- 21
> sensorB INTEGER, -- 22
> sensorAccuracy INTEGER, -- 23
> sensorAccuracyExp INTEGER, -- 24
> sensorRExp INTEGER, -- 25
> sensorBExp INTEGER, -- 26
> sensorCharacteristicFlags INTEGER, -- 27
> sensorNominalReading INTEGER, -- 28
> sensorNormalMaximum INTEGER, -- 29
> sensorNormalMinimum INTEGER, -- 30
> sensorMaximumReading INTEGER, -- 31
> sensorMinimumReading INTEGER, -- 32
> sensorUpperNonRecoverableThreshold INTEGER, -- 33
> sensorUpperCriticalThreshold INTEGER, -- 34
> sensorUpperNonCriticalThreshold INTEGER, -- 35
> sensorLowerNonRecoverableThreshold INTEGER, -- 36
> sensorLowerCriticalThreshold INTEGER, -- 37
> sensorLowerNonCriticalThreshold INTEGER, -- 38
> sensorPositiveGoingThresholdHysteresis INTEGER, -- 39
> sensorNegativeGoingThresholdHysteresis INTEGER, -- 40
> sensorOem INTEGER, -- 41
> sensorIdStringType INTEGER, -- 42
> sensorIdString DisplayString, -- 43
> }
>
> Thanks
> Sridhar
>
>
>
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
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