Re: Wrong example

2012-06-07 Thread Dave Shield
On 6 June 2012 15:36,  reyn...@free.fr wrote:
 Hi

 the example

 http://www.net-snmp.org/tutorial/tutorial-5/toolkit/mib_module/nstAgentModuleObject.c

 Work with the snmpget -v2c -c tutget localhost: 
 NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 command

 but fail with

 snmpset -v2c -c tutset localhost: 
 NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 = 5

I presume this is on a 64-bit system?


 the reason is the int type, it could be nice for beginners to replace the 
 file with a working one,
 like the one in attachement which replace int by long.

Now fixed.
Thanks for the reminder

Dave

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Wrong example

2012-06-06 Thread reynum2
Hi

the example 

http://www.net-snmp.org/tutorial/tutorial-5/toolkit/mib_module/nstAgentModuleObject.c

Work with the snmpget -v2c -c tutget localhost: 
NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 command 

but fail with

snmpset -v2c -c tutset localhost: 
NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 = 5

the reason is the int type, it could be nice for beginners to replace the file 
with a working one, like the one in attachement which replace int by long.

Regards/*
 * Note: this file originally auto-generated by mib2c using
 *: mib2c.int_watch.conf,v 5.0 2002/04/20 07:30:13 hardaker Exp $
 */

#include net-snmp/net-snmp-config.h
#include net-snmp/net-snmp-includes.h
#include net-snmp/agent/net-snmp-agent-includes.h
#include nstAgentModuleObject.h

/*
 * the variable we want to tie an OID to.  The agent will handle all
 * * GET and SET requests to this variable changing it's value as needed.
 */

static long nstAgentModuleObject = 42;

/*
 * our initialization routine, automatically called by the agent 
 * (to get called, the function name must match init_FILENAME()) 
 */
void
init_nstAgentModuleObject(void)
{
static oid  nstAgentModuleObject_oid[] =
{ 1, 3, 6, 1, 4, 1, 8072, 2, 4, 1, 1, 1, 0 };

/*
 * a debugging statement.  Run the agent with -DnstAgentModuleObject to see
 * the output of this debugging statement. 
 */
DEBUGMSGTL((nstAgentModuleObject,
Initializing the nstAgentModuleObject module\n));


/*
 * the line below registers our variables defined above as
 * accessible and makes it writable.  A read only version of any
 * of these registration would merely call
 * register_read_only_int_instance() instead.  The functions
 * called below should be consistent with your MIB, however.
 * 
 * If we wanted a callback when the value was retrieved or set
 * (even though the details of doing this are handled for you),
 * you could change the NULL pointer below to a valid handler
 * function. 
 */
DEBUGMSGTL((nstAgentModuleObject,
Initalizing nstAgentModuleObject scalar integer.  Default value = %d\n,
nstAgentModuleObject));

netsnmp_register_long_instance(nstAgentModuleObject,
  nstAgentModuleObject_oid,
  OID_LENGTH(nstAgentModuleObject_oid),
  nstAgentModuleObject, NULL);

DEBUGMSGTL((nstAgentModuleObject,
Done initalizing nstAgentModuleObject module\n));
}
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders