I appreciate your help as always :-)

>> So I used the *dataContext to take the lpDhcpEntry pointer
>> and *loopContext to take the other one.

> But how is the iterator to know that's what you are doing?!
> You can't simply unilaterally decide to change the internal
> operation of a library routine. If you're given an API, then it's
> up to you to work with that. You can't just change an API to
> something you like better!

I know I am not supposed to do that. I actually tried to have a pointer
that points to the current DHCP node in the scope where both getFirst...
and getNext.. can access. Your way of changing the data structure is much

> The answer is to introduce a new "parent" link into the
> ipRange data structure. Currently, when you add a new
> IP range to a given DHCP pool, you have to locate the
> appropriate dhcpEntry structure, and add the new ipRange
> structure to the 'iprange' list.
> (Hopefully that will come out OK in a fixed width font!)

> That's the purpose of this new 'dhcp' field.
> The ipRange entry is what is passed from one call to the next.
> The 'dhcp' link gives you a handle to the relevant DCHP entry
> (both for the index value, and for moving on to the next pool).

> Try it - it should work OK.

I am working on this solution. I still have a problem that snmp crashes
when I try to snmpget the data from the iprange table. I thought it was
something wrong with the memory allocation with my linked lists.

Then some debug work...

Finally I am stuck in front of an error, Internal error in type switching.
It occurs:

snmp_set_var_value(pIndex, (u_char *)& lpDhcpEntry->index, sizeof(int));
pIndex = pIndex->next_variable;
// Before this!!!!!
snmp_set_var_value(pIndex, (u_char *)& lpIpRangeEntry->index, sizeof(int));

I doubt the error is caused by not registering two indexes correctly by
using netsnmp_table_helper_add_indexes(pTableInfo, ASN_INTEGER,

I can't find a tutorial or any documentation about this API. I use a '0'
for the last argument because I read an example comment from the table.c
saying this function can take a variable index parameter list. I wonder
what the last argument '0' stands for. My guess was the number of the
parameters, so I used 2 which is even worse (my getFirstIpRangeContext
even didn't get called).

> Trust me - I'm not a doctor :-)

lol. If my guess is wrong, what could cause the error? I have tried to
generate some debug information in the line "//Before this!!!!!" What I
know is pIndex is not NULL and trying pIndex->type also gives me the same


This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
Net-snmp-users mailing list
Please see the following page to unsubscribe or change other options: