Re: Using NET-SNMP API to Receive Traps

"Dave Shield" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
On 22/11/2007, [email protected] <[email protected]> wrote:
> I can see two functions that I think might be of use:
>
> netsnmp_transport_open_server and snmptrapd_add_session
>
> Are these the ones I need to be looking at?

netsnmp_transport_open_server  and snmp_add (or snmp_open) yes.
Those are the basic calls for setting up the listening ports.
(snmptrapd_add_session is just a wrapper round snmp_add)

>                     If so how do I just add a
> session to just monitor traps on port 162 of my IP address?

    transport = netsnmp_transport_open_server("snmptrap", "udp:162");
    ss = snmptrapd_add_session(transport);


This will then call the routine "snmp_input" whenever a request is received.

Dave

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
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.