RE: snmpget V2 looping subagent

This is a discussion on RE: snmpget V2 looping subagent within the SNMP Coders forums, part of the Networking and Network Related category; Hello I have not looked at your problem at all. Just a quick remark on shared memeory. Pointers in shared ...


Go Back   Usenet Forums > Networking and Network Related > SNMP Coders

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-15-2006
Eirik Nordbrøden
 
Posts: n/a
Default 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:hardaker@users.sourceforge.net]
> Sent: Wednesday, June 14, 2006 6:36 PM
> To: Shinar, Gil
> Cc: net-snmp-coders@lists.sourceforge.net
> Subject: Re: snmpget V2 looping subagent
>
> >>>>> On Tue, 13 Jun 2006 18:06:11 +0300, "Shinar, Gil"

> <Gil.Shinar@verint.com> 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
> Net-snmp-coders@lists.sourceforge.net
> https://lists.sourceforge.net/lists/...et-snmp-coders
>



_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/...et-snmp-coders
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:27 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0