4.2   Directory Structure

Some source code is provided with WindNet SNMPv1/v2c in order that the agent designer might have some reference to the various routines utilized in the agent. For more information on the interaction between different routines, see 4.12 SNMP Agent Data Flow.

The source files shown in Figure 4-1 reside under the directory $WIND_BASE, which refers to the location where you installed WindNet SNMPv1/v2c. (For more information on installation, see 2. Installation).

4.2.1   $WIND_BASE/target/h/snmp/

This directory contains various header files used by the SNMP agent. These files should not be modified.

asn1.h
Defines various ASN.1 tags, data types, and macros used when dealing with the ASN.1 subset used by SNMP.

asn1conf.h
Contains type definitions for backward-compatibility.

auxfuncs.h
Function declarations for some of the routines in the SNMP auxiliary library.

auxmth.h
Function declarations for the method routines in the SNMP auxiliary library.

buffer.h
Defines the EBUFFER_T data structure, its supporting C macros, and the entry points contained in the buffer source code.

buildpkt.h
Defines the procedures which one would use when constructing an SNMP TRAP packet. These procedures should not be confused with those used to respond to an incoming REQUEST packet.

mib.h
Defines the data structures used to represent the Management Information Base (MIB); for example, snmpMib2.c.

ipcLib.h
Definitions needed to support the IPC mechanism used to pass messages between master agents and subagents.

objectid.h
Defines the entry points to the object-identifier module.

oemtypes.h
Defines various types in terms of VxWorks types.

snmpIoLib.h
Definitions for the snmpIoLib functions.

snmpdInit.h
Definitions used in the initialization phase.

snmpdefs.h
Defines the data types used for SNMP packet processing as well as entry points to the SNMP routines.

snmpstat.h
Definitions used to maintain SNMP statistics.

subagent .h
Definitions and structures needed to support distributed SNMP agents.

ui64.h
64-bit integer function definitions.

tree.h
Defines a generic tree structure TREENODE_T, its flags, C macros, and entry points into the agent.

vbdefs.h
Defines the data structures, C macros, and routines used to manipulate variable bindings.

view.h
Definitions for view-table manipulation functions.

envoy.h, install.h, snmp.h

Various definitions and compile-time constants needed to build the SNMP agent.

4.2.2   $WIND_BASE/target/src/snmpv1/agent/

The agent subdirectory consists of several source files, including:

snmpIoLib.c
This file contains routines which determine the operation of the SNMP agent. All SNMP agent behavior, including input and output, community validation, and trap generation is controlled by the routines in this library. This file is provided as source code; modify it to tailor the agent to your specific needs. See 5.2 Configuring snmpIoLib.

snmpMib2.mib
A definition of MIB-II facilities in ASN.1. This file, when input to mibcomp using the -mib.c option (see -mib.c), produces the file snmpMib2.c, which contains the tree structure used by the SNMP agent to access the MIB-II variables.

The following files in the agent directory provide the MIB-II agent method routines which interface the SNMP agent to system routines in the VxWorks m2 libraries. (For information about MIB-II system routines, see the manual entry for m2Lib in the VxWorks Reference Manual.) These files are provided as source code in order to provide a working example to those who need to write their own method routines.


*   

WARNING: Modifying these files is highly discouraged and could easily cause the agent to not function.
snmpIcmp.c
ICMP group method routines

snmpIf.c
Interface group method routines

snmpIp.c
IP group method routines

snmpSystem.c
System group method routines

snmpTcp.c
TCP group method routines

snmpUdp.c
UDP group method routines

snmpSnmp.c
Method routines for SNMPv1 statistics.

The following files provide functionality that support distributed agents. That is, an SNMP agent that consists of a master SNMP agent and one or more subagents. This is an optional feature. For more information, see 7. SNMP Distributed Agents.

masterIoLib.c
Master agent IPC routines.

saIoLib.c
Subagent IPC routines.

subagentLib.c
Distributed agent routines not part of the IPC mechanism.

taskRoutine.c
Implements a simple subagent that manages a task table.

4.2.3   $WIND_BASE/target/src/snmpv1/mibs/

The mibs subdirectory contains additional MIB definitions that can be used to extend the SNMP agent. Some of these files are used by snmpMib2.mib.

rfc1213.mib       rfc1381.mib       rfc1474.mib       rfc1573b.mib       rfc1694.mib
rfc1215.mib       rfc1382.mib       rfc1493.mib       rfc1595.mib       rfc1695.mib
rfc1231.mib       rfc1389.mib       rfc1512.mib       rfc1604.mib       rfc1696.mib
rfc1243.mib       rfc1398.mib       rfc1513.mib       rfc1611.mib       rfc1697.mib
rfc1253.mib       rfc1406.mib       rfc1514.mib       rfc1612.mib       rfc1724.mib
rfc1269.mib       rfc1407.mib       rfc1515.mib       rfc1628.mib       rfc1742.mib
rfc1271.mib       rfc1414.mib       rfc1516.mib       rfc1643.mib       rfc1747.mib
rfc1285.mib       rfc1447.mib       rfc1525.mib       rfc1650.mib       rfc1748.mib
rfc1304.mib       rfc1450.mib       rfc1559.mib       rfc1657.mib       rfc1749.mib
rfc1315.mib       rfc1451.mib       rfc1565.mib       rfc1658.mib       rfc1757.mib
rfc1316.mib       rfc1461.mib       rfc1566.mib       rfc1659.mib       rfc1759.mib
rfc1317.mib       rfc1471.mib       rfc1567.mib       rfc1660.mib
rfc1318.mib       rfc1472.mib       rfc1573.mib       rfc1665.mib
rfc1354.mib       rfc1473.mib       rfc1573a.mib       rfc1666.mib