1 <!-- Copyright (C) 2003 Red Hat, Inc. -->
2 <!-- This material may be distributed only subject to the terms -->
3 <!-- and conditions set forth in the Open Publication License, v1.0 -->
4 <!-- or later (the latest version is presently available at -->
5 <!-- http://www.opencontent.org/openpub/). -->
6 <!-- Distribution of the work or derivative of the work in any -->
7 <!-- standard (paper) book form is prohibited unless prior -->
8 <!-- permission is obtained from the copyright holder. -->
12 >Starting the SNMP Agent</TITLE
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
19 TITLE="eCos Reference Manual"
20 HREF="ecos-ref.html"><LINK
23 HREF="net-snmp-ecos-port.html"><LINK
25 TITLE="Changes to eCos sources"
26 HREF="net-snmp-ecos-changes.html"><LINK
28 TITLE="Configuring eCos"
29 HREF="net-snmp-configuring-ecos.html"></HEAD
40 SUMMARY="Header navigation table"
49 >eCos Reference Manual</TH
57 HREF="net-snmp-ecos-changes.html"
65 >Chapter 47. SNMP for <SPAN
77 HREF="net-snmp-configuring-ecos.html"
91 NAME="NET-SNMP-STARTING-THE-SNMP-AGENT">Starting the SNMP Agent</H1
93 >A routine to instantiate and start the SNMP agent thread in the default
94 configuration is provided in
97 >PACKAGES/net/snmp/agent/VERSION/src/snmptask.c</TT
100 >It starts the snmpd thread at priority
103 >CYGPKG_NET_THREAD_PRIORITY+1</TT
105 by default, ie. one step less important than the TCP/IP stack service
107 It also statically creates and uses a very large stack of around 100
109 To use that convenience function, this code fragment may be copied (in
118 CLASS="PROGRAMLISTING"
119 >#ifdef CYGPKG_SNMPAGENT
121 extern void cyg_net_snmp_init(void);
130 >In case you need to perform initialization, for example setting up SNMPv3
131 security features, when the snmp agent starts and every time it restarts,
132 you can register a callback function by simply writing the global variable:
140 CLASS="PROGRAMLISTING"
141 >externC void (*<SPAN
145 >snmpd_reinit_function</I
152 with a suitable function pointer.</P
154 >The entry point to the SNMP agent is
162 CLASS="PROGRAMLISTING"
177 so you can of course easily start it in a thread of your choice at another
178 priority instead if required, after performing whatever other
179 initialization your SNMP MIBs need. A larger than default stacksize is
183 > parameter is the callback
184 function mentioned above — a NULL parameter there is safe and
185 obviously means no callback is registered.</P
187 >Note that if you call <TT
199 >cyg_net_snmp_init();</TT
201 that routine, global variable, and the default large stack will not be
202 used. This is the recommended way control such features from your
203 application; create and start the thread yourself at the appropriate
206 >Other APIs from the <TT
209 > module are available,
218 CLASS="PROGRAMLISTING"
236 > to restart itself —
237 including the callback to your init function — as soon as possible.</P
245 > is ignored. It is there because in
249 >'s “natural environment” this routine
255 >The helper functions in the network stack for managing
264 when necessary, for example if network interfaces go down and/or come up
272 SUMMARY="Footer navigation table"
283 HREF="net-snmp-ecos-changes.html"
301 HREF="net-snmp-configuring-ecos.html"
311 >Changes to eCos sources</TD
317 HREF="net-snmp-ecos-port.html"
325 >Configuring eCos</TD