Thanks for the remark but I'm not using pointers in the shared memory. There is 
only one global pointer to the shared memory but inside the shared memory, all 
components are ints and static arrays.

-----Original Message-----
From: Eirik Nordbrøden [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 15, 2006 4:28 PM
To: Shinar, Gil; Wes Hardaker
Cc: [email protected]
Subject: RE: snmpget V2 looping subagent

Hello

I have not looked at your problem at all. Just a quick remark on shared 
memeory. Pointers in shared memeory is not a good idea! Different processes 
will have different base pointers to the shared memeory, therefore linked lists 
and similar will not work.

> Hi,
>
> Thanks for the replay.
>
> This is an example code of the first_data_point function of
> one of the tables :
>
> netsnmp_variable_list *
> connectionToDBSTable_get_first_data_point(void **my_loop_context,
>                                           void **my_data_context,
>                                           netsnmp_variable_list *
>                                           put_index_data,
>                                          
> netsnmp_iterator_info *mydata) {
>     netsnmp_variable_list *vptr;
>     int i = 0;
>     if(pMIB)
>     {
>         pMIB->connectionDBS[0].index = 0;
>         pConDBS_m = &pMIB->connectionDBS[0];
>         i++;
>         while(i < SHM_MAX_NO_OF_AMS &&
> pMIB->connectionDBS[i].dbs_num != MAX_ENTITIES_NUM){
>                 pMIB->connectionDBS[i].index = i;
>                 pConDBS_m->next = &pMIB->connectionDBS[i];
>                 pConDBS_m = pConDBS_m->next;
>                 i++;
>         }
>         pConDBS_m->next = NULL;
>         pConDBS_head = pMIB->connectionDBS;
>         *my_loop_context = (void *)pConDBS_head;
>         *my_data_context = (void *)pConDBS_head;
>         vptr = put_index_data;
>         snmp_set_var_value(vptr,
>                       (u_char *)&pConDBS_head->index,
>                       sizeof(int));
>         return put_index_data;
>     }
>     else
>     {
>         return NULL;
>     }
> }
>
> I have removed the part of the code that checks if the table
> is empty and returns a NULL because this what causes the endless loop.
> pMIB is a pointer to a shared memory. pMIB->connectionDBS is
> an array in the shared memory that holds all the items of a
> certain table. In every get request, I create a new linked
> list from the array that holds all the items of the current
> table. The while loop runs till it finds an initialized item.
> (e.g.
> array[1,2,3,2,4,7,1,3,MAX_ENTITIES_NUM,MAX_ENTITIES_NUM...]
> so the linked list would be 1->2->3->2->4->7->1->3->NULL).
> Basically there should be an if clause that checks if
> pMIB->connectionDBS[0] == MAX_ENTITIES_NUM and return NULL
> for empty table.
>
> Let me know if you need other parts of my code.
>
> Thanks
>
>
> -----Original Message-----
> From: Wes Hardaker [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 14, 2006 6:36 PM
> To: Shinar, Gil
> Cc: [email protected]
> Subject: Re: snmpget V2 looping subagent
>
> >>>>> On Tue, 13 Jun 2006 18:06:11 +0300, "Shinar, Gil"
> <[EMAIL PROTECTED]> said:
>
> Gil> When I've tried to debug the code, I saw differences
> between what I
> get
> Gil> when I use snmpwalk then when I use the snmp manager.
>
> Unfortunately, it's unlikely we can help you without looking
> at the code you've written.  It certainly is related to how
> you're handling your code because the agent itself shouldn't
> be suffering from any issues related to multiple requests in
> a single PDU.
>
> Gil> Is there a patch that should fix it ? Is there a
> difference between
> V1
> Gil> mib file to V2 mib file and if there is, should I use V2 mib file
> to
> Gil> generate the code with mib2c command ?
>
> It shouldn't matter.
> --
> Wes Hardaker
> Sparta, Inc.
>
> ______________________________________________________________
> ____________________________
> This electronic message contains information from Verint
> Systems, which may be privileged and confidential.
> The information is intended to be for the use of the
> individual(s)or entity named above.
> If you are not the intended recipient, be aware that any
> disclosure, copying, distribution or use of the contents of
> this information is prohibited.
> If you have received this electronic message in error, please
> notify us by replying to this email (1).
>
>
>
> _______________________________________________
> Net-snmp-coders mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
>

__________________________________________________________________________________________
This electronic message contains information from Verint Systems, which may be 
privileged and confidential.
The information is intended to be for the use of the individual(s)or entity 
named above.
If you are not the intended recipient, be aware that any disclosure, copying, 
distribution or use of the contents of this information is prohibited.
If you have received this electronic message in error, please notify us by 
replying to this email (1).



_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to