Error in Packet. ,,Reason: (gen Error) A general Failure occured)

Reza Salehi <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
 
  I compiled and ran nstAgentSubagentObject example successfully.Then I added a handler in registration call ( Please see the code below)(a simple subroutine just print a string).I can compile and run my subagent but when I try to run  snmpget or snmpset I get the error:
   
  Error in Packet.
  Reason: (gen Error) A general Failure occured)
  Faild Object: NET-SNMP-TUTORIAL-MIB::nstAgentSubagentObject.0
   
  If I remark that printf and compile it again then I can retrieve/set  MIB  through snmpget and set. 
  If I add a sum or sub in code it  wont work again
   
  I really appreciate if somebody  can help me.
   
  Regards,
  Reza
   
   
  #include <net-snmp/net-snmp-config.h>
  #include <net-snmp/net-snmp-includes.h>
  #include <net-snmp/agent/net-snmp-agent-includes.h>
  #include "nstAgentSubagentObject.h"
   
  /
  static int nstAgentSubagentObject = 2;
  /
  void
  init_nstAgentSubagentObject(void)
  {
  static oid nstAgentSubagentObject_oid[] =
  { 1, 3, 6, 1, 4, 1, 8072, 2, 4, 1, 1, 2, 0 };
  DEBUGMSGTL(("nstAgentSubagentObject",
  "Initializing the nstAgentSubagentObject module\n"));
   
  
  DEBUGMSGTL(("nstAgentSubagentObject",
  "Initalizing nstAgentSubagentObject scalar integer. Default value = %d\n",
  nstAgentSubagentObject));
  netsnmp_register_int_instance("nstAgentSubagentObject",
  nstAgentSubagentObject_oid,
  OID_LENGTH(nstAgentSubagentObject_oid),
  &nstAgentSubagentObject,Subhandler);
   
  DEBUGMSGTL(("nstAgentSubagentObject",
  "Done initalizing nstAgentSubagentObject module\n"));
  }
   
  int Subhandler(netsnmp_mib_handler *handler,netsnmp_handler_registration *reginfo,netsnmp_agent_request_info *reqinfo,netsnmp_request_info *requests)
  {
  int temp,uu,xx; 
  // printf("this is a test \n");
  temp=0;
  uu=0; 
  temp=25;
  uu=34;
  xx=123;
  // xx++;
   
   
  }

       
---------------------------------
Finding fabulous fares is fun.
Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.