Re: Writing C++ code for writing subagent - SNMP

This is a discussion on Re: Writing C++ code for writing subagent - SNMP ; On Mon, 2008-08-25 at 13:41 +0530, bhuvaneswar.lalith@wipro.com wrote: > Hi, > > I am writing a sub-agent to implement MIB objects. > > Could any one let me know whether I can use C++ code for implementing > the subagent? ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Re: Writing C++ code for writing subagent

  1. Re: Writing C++ code for writing subagent

    On Mon, 2008-08-25 at 13:41 +0530, bhuvaneswar.lalith@wipro.com wrote:
    > Hi,
    >
    > I am writing a sub-agent to implement MIB objects.
    >
    > Could any one let me know whether I can use C++ code for implementing
    > the subagent?


    Yes.

    > If it is possible to implement using C++, please do let me know the
    > procedure (compiling, etc).


    $ CC `net-snmp-config --base-cflags` your-module.C `net-snmp-config
    --base-agent-libs` -o your-module

    You might sadly have to prune the output of
    net-snmp-config --base-cflags since it includes lots and lots of cruft
    that most certainly shouldn't be in the output of a -config style
    program (I am thinking of optimization level options, varius defines and
    undefs, c-only options and similar things, what you wat is the include
    path).

    I would also look at the C file that is output by net-snmp-config
    --compile-supagent --norm foo foo.c (yes the command will fail but
    disregard that for now) in order to get a idea of how a driver looks.

    /MF




    -------------------------------------------------------------------------
    This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
    Build the coolest Linux based applications with Moblin SDK & win great prizes
    Grand prize is a trip for two to an Open Source event anywhere in the world
    http://moblin-contest.org/redirect.p...r_id=100&url=/
    _______________________________________________
    Net-snmp-coders mailing list
    Net-snmp-coders@lists.sourceforge.net
    https://lists.sourceforge.net/lists/...et-snmp-coders


  2. RE: Writing C++ code for writing subagent

    Hi Magnus,

    Thank you very much it is working.

    Just to add to whatever you said, I added these lines to
    example-demon.cpp to make it work:
    extern "C"{
    void init_vacm_vars();
    void init_usmUser();
    }

    Regards,
    Bhuvan

    -----Original Message-----
    From: Magnus Fromreide [mailto:magfr@lysator.liu.se]
    Sent: Tuesday, August 26, 2008 1:34 AM
    To: Bhuvaneswar Lalith(WT01 - Telecom Equipment)
    Cc: net-snmp-coders@lists.sourceforge.net
    Subject: Re: Writing C++ code for writing subagent

    On Mon, 2008-08-25 at 13:41 +0530, bhuvaneswar.lalith@wipro.com wrote:
    > Hi,
    >
    > I am writing a sub-agent to implement MIB objects.
    >
    > Could any one let me know whether I can use C++ code for implementing
    > the subagent?


    Yes.

    > If it is possible to implement using C++, please do let me know the
    > procedure (compiling, etc).


    $ CC `net-snmp-config --base-cflags` your-module.C `net-snmp-config
    --base-agent-libs` -o your-module

    You might sadly have to prune the output of
    net-snmp-config --base-cflags since it includes lots and lots of cruft
    that most certainly shouldn't be in the output of a -config style
    program (I am thinking of optimization level options, varius defines and
    undefs, c-only options and similar things, what you wat is the include
    path).

    I would also look at the C file that is output by net-snmp-config
    --compile-supagent --norm foo foo.c (yes the command will fail but
    disregard that for now) in order to get a idea of how a driver looks.

    /MF




    -------------------------------------------------------------------------
    This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
    Build the coolest Linux based applications with Moblin SDK & win great prizes
    Grand prize is a trip for two to an Open Source event anywhere in the world
    http://moblin-contest.org/redirect.p...r_id=100&url=/
    _______________________________________________
    Net-snmp-coders mailing list
    Net-snmp-coders@lists.sourceforge.net
    https://lists.sourceforge.net/lists/...et-snmp-coders


+ Reply to Thread