Hi all,
 
I have been implementing iterate_access style tables for the last couple of
week.  I coded up the last one today and it is behaving very oddly.
I have registered a get_first and get_next routine to iterate through the
tables.
 
 
My question is around what the net-snmp library expects back when the end of
table is found - inside the get_next routine.
It is tolerable to simple return NULL or must the put_index_data pointer
require its fields to be NULL'd out as well (shown below).
 
netsnmp_variable_list *exampleTable_get_next_data_point(void
**my_loop_context,
                                                              void
**my_data_context,
 
netsnmp_variable_list *put_index_data, 
 
netsnmp_iterator_info * mydata)
{
 netsnmp_variable_list *vptr;
 ITEM_STRUCT *curr;
 
 if (*my_data_context == NULL)
  curr= container.info.list_head;   //the first item
 else
 {
  curr = (ITEM_STRUCT *)(*my_data_context);  //the next item
  curr = curr->next;
 }
 
 *my_data_context = (void *)curr;
 
 //are there any more rows?
 if (curr_key == NULL)
 {
  printf("No more table data\n");
  vptr = put_index_data;                                //is NULLing out the
var list required?
  vptr->val.string = NULL;
  vptr->val_len = 0;
 
  vptr = vptr->next_variable;
  vptr->val.string = NULL;
  vptr->val_len = 0;
 
  vptr = vptr->next_variable;
  vptr->val.integer = NULL;
  vptr->val_len = 0;
 
  return NULL;                                                //or just
return NULL?
 }
 else
 {
  vptr = put_index_data;
  snmp_set_var_value(vptr, (u_char *)curr_key->data.ppk.short_title,
strlen(curr_key->data.ppk.short_title));
  
  vptr = vptr->next_variable;
  snmp_set_var_value(vptr, (u_char *)curr_key->data.ppk.edition,
SNMP_PPK_EDITION_LENGTH);
  
  vptr = vptr->next_variable;
  snmp_set_var_value(vptr, (u_char *)&curr_key->data.ppk.segment,
sizeof(UINT32));
 }
 
    return put_index_data;
}

 
 
 
Thanks,
Adam
 


  _____  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Makavy,
Erez (Erez)
Sent: Wednesday, June 06, 2007 12:21 PM
To: [email protected]
Subject: subagent crash on timeout with SIGPIPE


Hi,
 
The problem:
-------------------
My subagents crash if they don't return an answer (to SNMPGET) after less
then 8 seconds.
It seems that the master agent closes the agentx connection, and the
sub-agent gets BROKEN PIPE signal.
 
Solution:
------------
I thought that my sub-agents could catch the SIGPIPE signal,
and they re-establish the connection with the master agent.
 
The question:
--------------------
1) Do I have to run init_agent(_name) again in the subagent?
2) Do I have to run init_snmp(_name) again in the subagent?
3) I guess that the master agent deletes all of the sub-agents registration
info,
    So the sub-agent must register again all it's MIBs, right?
4) I guess that after all that I just have to go back to
   a loop on agent_check_and_process(), right?
 
5) Is there a different solution to this issue?
 
 
 
Thanks,
Erez.


The information contained in this electronic mail transmission may be 
privileged and confidential, and therefore, protected from disclosure. If you 
have received this communication in error, please notify us immediately by 
replying to this message and deleting it from your computer without copying or 
disclosing it.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
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