The remainder of this chapter describes the data flow through a standard SNMP agent. If you are using a distributed SNMP agent, you will also need to see 7.3 Data Flow between SNMP Master Agents and Subagents.
VxWorks starts SNMP by invoking usrSnmpInit( ) at boot-time, which eventually spawns a task which appears in the system task table as tSnmpd. The main entry point into this task is snmpIoMain( ); this routine is provided in source and can be customized by the agent writer to perform user-defined initialization functions, such as reading a configuration file.
The following diagram describes the agent's initialization. Routines are shown with the files in which they appear.
|
NOTE: Part of configuring WindNet SNMPv1/v2c for your site likely involved editing the file snmpIoLib.c to reflect your local network-management paradigm; see 5.2 Configuring snmpIoLib for details. |
For more information on individual routines, see F. SNMP Reference.
The loop occurs in snmpIoBody( ), which listens on the specified UDP port for incoming SNMP PDUs.
Routines are shown with the files in which they appear, if relevant. Arrows represent data flow.
The stages involved in packet processing can be described as follows.
For more information on individual routines, see F. SNMP Reference.
The following diagram describes the processing of traps, which are generated when a significant event occurs (see 4.7 Traps). Traps can be generated in two ways:
Also, if variables are to be relayed in the trap, a routine can be defined to bind those variables for transport. (For information on variable binding, see 4.10 Access to MIB Variables).
The stages involved in trap processing can be described as follows.
For more information on individual routines, see F. SNMP Reference.
In the event that the agent designer's code determines that the SNMP agent must exit, the code must free its allocated resources and then invoke the function snmpdExit( ).
snmpdExit( ) calls MIB termination routines and frees all resources allocated by the agent itself. The user's code must then delete the associated task. After snmpdExit( ) is called, no other SNMP services should be invoked.
For information on hook routines, see the reference entry for snmpdInitFinish( ) in F. SNMP Reference.