The agent libraries can be used from C++, so what we do is build the master 
agent using a C compiler and build our subagent with g++, and serve our MIBs 
using AgentX.

In fact, if you build libnetsnmpagent with a C compiler, you could probably 
then build your modules plus the snmp main loop and link them together. In our 
test environment we sometimes initialize all of the modules, even though it's 
linked with a C++ main loop.

  Bill


On Dec 30, 2011, at 3:17 PM, Suresh kumar <skjaiswa...@hotmail.com> wrote:

> thanks Dave for quick respone 
>  
> 
> Regarding net-snmp compilation using g++ compiler we are getting similar type 
> error one by one previously we getting from disk_hw.c 
> 
> and resolved using manually type casting in line 268(in disk_hw.c file)
> 
> disks = realloc( disks, maxdisks * sizeof( netsnmp_fsys_info*)); 
> 
> then we now geting in dlmod.c file.
> 
> any work around for avoiding manual type casting. .
> 
> ucd-snmp/dlmod.c: In function 'void dlmod_load_module(dlmod*)':
> ucd-snmp/dlmod.c:136: error: invalid conversion from 'void*' to 'int (*)()'
> ucd-snmp/dlmod.c: In function 'void dlmod_unload_module(dlmod*)':
> ucd-snmp/dlmod.c:161: error: invalid conversion from 'void*' to 'int (*)()'
> ucd-snmp/dlmod.c:164: error: invalid conversion from 'void*' to 'int (*)()'
> 
> complete compilers error are as flows
> 
>  
> /bin/sh ../../libtool  --mode=compile powerpc-montavista-linux-gnu-g++  
> -te500v2                                                                      
>                    -I../../include -I. -I../../agent -I../../agent/mibgroup 
> -I../../snmplib  -I/vo                                                        
>                                 bs/gxc/src/OpenSource/ace-tao/include 
> -I/vobs/gxc/src/OpenSource/ace-tao/include                                    
>                                                     /TAO 
> -I/vobs/gxc/src/OpenSource/ace-tao/include/ace -I/vobs/gxc/src/OpenSource/a   
>                                                                               
>        ce-tao/include/TAO/orbsvcs  -I/vobs/gxc/src/OpenSource/ace-tao/include 
> -I/vobs/g                                                                     
>                    xc/src/OpenSource/ace-tao/include/TAO 
> -I/vobs/gxc/src/OpenSource/ace-tao/include                                    
>                                                     /ace 
> -I/vobs/gxc/src/OpenSource/ace-tao/include/TAO/orbsvcs -I/vobs/gxc/src/incl   
>                                                                               
>        ude -I/vobs/gxc/src/include/TAO_INCLUDE 
> -I/vobs/gxc/src/include/ACE_INCLUDE -I/v                                      
>                                                   obs/gxc/src/CommonIDL 
> -I/vobs/gxc/src/NodeServices/CorbaSetup   -fno-strict-alia                    
>                                                                     sing -Os 
> -Ulinux -Dlinux=linux  -c -o ucd-snmp/dlmod.lo ucd-snmp/dlmod.c
> libtool: compile:  powerpc-montavista-linux-gnu-g++ -te500v2 -I../../include 
> -I.                                                                           
>               -I../../agent -I../../agent/mibgroup -I../../snmplib 
> -I/vobs/gxc/src/OpenSource                                                    
>                                     /ace-tao/include 
> -I/vobs/gxc/src/OpenSource/ace-tao/include/TAO -I/vobs/gxc/src/               
>                                                                          
> OpenSource/ace-tao/include/ace 
> -I/vobs/gxc/src/OpenSource/ace-tao/include/TAO/or                             
>                                                            bsvcs 
> -I/vobs/gxc/src/OpenSource/ace-tao/include -I/vobs/gxc/src/OpenSource/ace-    
>                                                                               
>       tao/include/TAO -I/vobs/gxc/src/OpenSource/ace-tao/include/ace 
> -I/vobs/gxc/src/O                                                             
>                            penSource/ace-tao/include/TAO/orbsvcs 
> -I/vobs/gxc/src/include -I/vobs/gxc/src/in                                    
>                                                     clude/TAO_INCLUDE 
> -I/vobs/gxc/src/include/ACE_INCLUDE -I/vobs/gxc/src/CommonIDL                 
>                                                                         
> -I/vobs/gxc/src/NodeServices/CorbaSetup -fno-strict-aliasing -Os -Ulinux 
> -Dlinux                                                                       
>                  =linux -c ucd-snmp/dlmod.c  -fPIC -DPIC -o 
> ucd-snmp/.libs/dlmod.o
> ucd-snmp/dlmod.c: In function 'void dlmod_load_module(dlmod*)':
> ucd-snmp/dlmod.c:136: error: invalid conversion from 'void*' to 'int (*)()'
> ucd-snmp/dlmod.c: In function 'void dlmod_unload_module(dlmod*)':
> ucd-snmp/dlmod.c:161: error: invalid conversion from 'void*' to 'int (*)()'
> ucd-snmp/dlmod.c:164: error: invalid conversion from 'void*' to 'int (*)()'
> make[3]: *** [ucd-snmp/dlmod.lo] Error 1
> make[3]: Leaving directory `/vobs/thirdparty/net-snmp-5.7.1/agent/mibgroup'
> make[2]: *** [subdirs] Error 1
> make[2]: Leaving directory `/vobs/thirdparty/net-snmp-5.7.1/agent'
> make[1]: *** [subdirs] Error 1
> make[1]: Leaving directory `/vobs/thirdparty/net-snmp-5.7.1'
> make: *** [build] Error 2
> 
> 
>  
> > Date: Fri, 30 Dec 2011 19:11:36 +0000
> > Subject: Re: dynamic table Table creation
> > From: d.t.shi...@liverpool.ac.uk
> > To: skjaiswa...@hotmail.com
> > CC: net-snmp-coders@lists.sourceforge.net
> > 
> > On 30 December 2011 18:09, Suresh kumar <skjaiswa...@hotmail.com> wrote:
> > > You haven't said which mib2c framework you are using for your table,
> > >> but a number of them take the option
> > >>
> > >> mib2c -Scache=1 .....
> > >>
> > >> which will include the basic cache handling code.
> > >
> > >
> > > 1. We are generating table code templates by executing the following
> > > command:
> > >   mib2c -c mib2c.create-dataset.conf calientChassis.
> > 
> > OK - that doesn't recognise the -Scache flag, as this whole approach
> > is essentially one big cache. It's really designed for a pure-SNMP
> > table - i.e. one where all updates are done via SNMP SET requests.
> > It's not really suited to integrating with an external data source.
> > 
> > >   Will it not be possible to handle updates efficiently using dataset 
> > > APIs?
> > 
> > I haven't done any benchmarking, but I wouldn't expect it to be as efficient
> > as some of the others - most notably the table_tdata helper.
> > Remember that the dataset helper uses a generic mechanism for handling
> > the individual columns, since it needs to work with *any* MIB module
> > (with no code changes).
> > The other helpers, such as table_tdata, will generate a dedicated data
> > structure to represent a row of this particular table, so can go straight to
> > the relevant column value.
> > 
> > But I haven't done any timings - your mileage may vary.
> > 
> > 
> > >    We do not want to create files as required for implementation using the
> > > cache option.
> > >    Are these files cleaned up on agent shutdown?.
> > 
> > The cache mechanism doesn't use any files.
> > It stores a local copy of the table in memory (updating it as required).
> > Obviously, this memory is released when the agent shuts down.
> > 
> > 
> > 
> > > 2 . We also trying integrate net-snmp 5.7 code with our CORBA stub.
> > > we made our C++ interfaces.
> > >        and want acess this interfce directely in net-snmp extended MIB 
> > > agent
> > > code for geting and seting functiinality.
> > >       hence   can we compile net-snmp code using g++ compile for acessing
> > > c++ code in directely in our extended
> > >                  calient agent code.?
> > 
> > It should be possible to compile the Net-SNMP code using g++, yes.
> > Certainly all of the files are wrapped in "extern C" blocks, and we have
> > had reports of this working in the past.
> > But the suite is primarily aimed at straight C applications, so there
> > may have been some code changes that break a C++ compilation.
> > Give it a go, and let us know how you get on.
> > 
> > 
> > 
> > Dave
> ------------------------------------------------------------------------------
> Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
> infrastructure or vast IT resources to deliver seamless, secure access to
> virtual desktops. With this all-in-one solution, easily deploy virtual 
> desktops for less than the cost of PCs and save 60% on VDI infrastructure 
> costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
> _______________________________________________
> Net-snmp-coders mailing list
> Net-snmp-coders@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to