Professional Documents
Culture Documents
PROGRAMMER'S GUIDE
10.5
EDITION 6
Copyright Notice
Copyright © 2015 Wind River Systems, Inc.
All rights reserved. No part of this publication may be reproduced or transmitted in any
form or by any means without the prior written permission of Wind River Systems, Inc.
Wind River, Tornado, and VxWorks are registered trademarks of Wind River Systems, Inc.
The Wind River logo is a trademark of Wind River Systems, Inc. Any third-party
trademarks referenced are the property of their respective owners. For further information
regarding Wind River trademarks, please see:
www.windriver.com/company/terms/trademark.html
This product may include software licensed to Wind River by third parties. Relevant
notices (if any) are provided in your product installation at one of the following locations:
installDir/product_name/3rd_party_licensor_notice.pdf
installDir/legal-notices/
Wind River may refer to third-party documentation by listing publications or providing
Corporate Headquarters
Wind River
500 Wind River Way
Alameda, CA 94501-1153
U.S.A.
Toll free (U.S.A.): 800-545-WIND
Telephone: 510-748-4100
Facsimile: 510-749-2010
For additional contact information, see the Wind River Web site:
www.windriver.com
For information on how to contact Customer Support, see:
www.windriver.com/support
Edition 6
30 Sep 15
Contents
1 Overview ...................................................................................................... 1
iii
Wind River SNMP
Programmer's Guide, 10.5
3 SNMP ........................................................................................................... 11
iv
Contents
Proxies ................................................................................................................. 38
SNMPv3 Proxies ................................................................................................ 38
AgentX Options ................................................................................................. 39
Diffie-Hellman Cryptographic Key Exchange .............................................. 39
Coexistence ......................................................................................................... 40
IPv6 Transports .................................................................................................. 40
4.7.2 Header Configuration Files ............................................................................. 40
oemtypes.h ......................................................................................................... 40
snmptalk.h .......................................................................................................... 41
4.7.3 envoy.h ................................................................................................................ 41
Required Routines ............................................................................................. 41
Other System Routines ..................................................................................... 42
Locking ............................................................................................................... 43
AgentX Configuration Macros ........................................................................ 43
6 SNMPv3 ....................................................................................................... 51
v
Wind River SNMP
Programmer's Guide, 10.5
8 Server ........................................................................................................... 77
vi
Contents
vii
Wind River SNMP
Programmer's Guide, 10.5
viii
Contents
ix
Wind River SNMP
Programmer's Guide, 10.5
x
1
Overview
1.1 Introduction 1
1.2 Processing Standard (FIPS) 140-2 2
1.3 SNMP Network Management Model 2
1.4 Audience 3
1.5 Additional Documentation 4
1.6 Design Decisions 5
1.1 Introduction
This document describes the data structures and entry points for the Wind River
SNMP family of software products including: Wind River SNMP v1/v2c,
Wind River SNMP v3, and Wind River SNMP AgentX.
NOTE: Although all customers receive support for SNMP v1 and SNMP v2c, only
those customers who also have purchased Wind River SNMP v3, or Wind River
SNMP AgentX, can use the routines that support these protocols.
Wind River SNMP v1/v2c implements the Simple Network Management Protocol
(SNMP) as defined in RFC 1157, the Structure and Identification of Management
Information (SMI) as defined in RFC 1155, the Management Information Base,
second version (MIB-II) for version 2 as defined in RFC 1213, and the SNMP v2
features designed to increase the utility of SNMP including the administrative
model, protocol operations, and security defined by RFC 1901 and RFC 3416.
Wind River SNMP v3 implements the View-based Access Control Model (VACM),
security, the SNMP applications described in RFC 2573, authentication,
coexistence, notification, and privacy.
Wind River SNMP AgentX implements the AgentX protocol, also known as “per
VarBind multiplexing”, which allows a subagent to register items with the master
agent. The master agent distributes VarBinds from one SNMP message to
pre-registered subagents and reassembles the replies into a single response.
1
Wind River SNMP
Programmer's Guide, 10.5
At various points in the software, Wind River SNMP calls method routines,
user-exits, and completion routines, which you supply to give your application
opportunities to control processing. This document provides prototypes and
descriptions of method routines, user-exits, and completion routines that
customers must write.
2
1 Overview
1.4 Audience
1.4 Audience
Before you attempt to use Wind River SNMP, you should be familiar with the C
programming language in addition to your development system and your target
machine’s architecture, build environment, and compiler tools.
Although you do not need to be a networking expert to install Wind River SNMP
products, you should be familiar with fundamental networking concepts, for
example, how IP addresses work.
If you plan to implement Management Information Base (MIB) extensions, you
also should be familiar with the basics of SNMP. Recommended is Marshall T.
Rose’s The Simple Book: An Introduction to Management of TCP/IP-based Internets for
an explanation of SNMP. A more recent document, Paul Simoneau’s SNMP
Network Management, discusses SNMPv1, SNMPv2, SNMPv3, and AgentX.
Internetworking with TCP/IP, Volume I: Principles, Protocols, and Architecture by
Douglas E. Comer, A Practical Guide to SNMPv3 and Network Management by David
Zelterman, and SNMP, SNMPv2, SNMPv3, and RMON1 and RMON2 by William
Stallings are also useful as a references.
It also can be helpful to refer to the Request For Comments (RFC) for any protocol
or TCP/IP concept on which you are working. For a list of all supported RFCs, see
3.3 Supported RFCs, p.13.
Wind River SNMP is a collection of ANSI C subroutines that:
■ Supports customer selection of compilation of any combination of SNMPv1,
SNMPv2 and, with the SNMPv3 option, SNMPv3.
■ Supports additional customer-defined management parameters.
■ Supports additional customer-defined traps and informs.
■ Can be used as an agent in a managed device or within a management station.
■ Can execute within an operating system kernel, within an application, or on an
intelligent network front-end.
■ Supports a managed device processing multiple simultaneous SNMP requests
within a single thread.
■ Utilizes a small amount of memory.
■
Supports multiple MIB views that allow different sets of MIB variables to be
visible to different managers.
■
Provides a library of auxiliary functions useful to SNMP agents and managers.
This includes support for implementing row creation sets.
■
Supports a simple configuration system. By editing a single file the customer
may select the configuration options and compiler to use. The customer may
add new compilers easily.
■
Supports multiple MIB trees, allowing you to select a MIB tree on a per-packet
basis—perhaps based on the community string. This capability provides
another method for changing the data or routines associated with a particular
community string or context. The default is a single MIB tree, so no additional
work is necessary if you choose not to use this capability.
■ Provides general support for proxy schemes and specific support for proxies
using SNMPv1 and SNMPv2.
3
Wind River SNMP
Programmer's Guide, 10.5
■
Supports the SNMPv3 add-on that provides SNMPv3 proxy support.
■
Allows nodes to be dynamically added and removed from the MIB tree.
■ Supports the AgentX add-on that allows subagents to dynamically register
and de-register with a master agent, as well as support for multiple methods
for passing messages between the master agent and subagents.
This release includes manuals in HTML and PDF format. You can open the online
manuals from the Help > Help Contents menu in Workbench. A full-text search
facility is available within the Workbench help browser.
With the exception of API references, print-ready PDFs are available from the title
page of the corresponding online document. Navigate to the proper document,
then click the PDF icon to the right of the book title. Links to the PDF files are also
available by selecting Wind River > Documentation from your operating system
Start menu.
In addition, documentation is available on the Wind River Online Support site at:
http://documentation.windriver.com
Wind River provides a library of publications to support its products. The
following Wind River documents present information associated with Wind River
SNMP:
The following companion documents are particularly useful:
■ Wind River VxWorks Platforms Getting Started – describes how to install and
build components of the Wind River VxWorks Platforms product.
■
Wind River VxWorks Platforms Release Notes – describes reported and resolved
software defects, and new features for the Wind River VxWorks Platforms
product.
■
Wind River MIB Compiler User's Guide – describes how to install, use, and port
the Wind River MIB Compiler.
■
Wind River SNMP API Reference – provides online reference descriptions of all
Wind River SNMP libraries. Each library entry lists the routines found in that
library, including a one-line synopsis of each, along with a general description
of their use. The document also provides complete reference entries for all
Wind River SNMP user-exits, macros, and routines.
■ Wind River CLI, Web, MIBway Programmer’s Guide – describes how to use the
Wind River Management Integration Tool and the CLI, Web, MIBway source
code to create Web-based, and command line-based embedded device
4
1 Overview
1.6 Design Decisions
management interfaces. This guide also describes how to integrate your Web
or command line management interface with Wind River SNMP using
MIBway.
■ Wind River CLI, Web, MIBway API Reference – provides online reference
descriptions of all CLI, Web, and MIBway libraries. Each library entry lists the
routines found in that library, including a one-line synopsis of each, along with
a general description of their use.
A client (manager) must generate SNMP request packets, filter and correlate
incoming SNMP response packets with a request, handle incoming SNMP trap
packets and, if SNMPv2 or SNMPv3 are configured, generate or handle SNMP
inform packets. In addition, a manager typically includes a user interface,
management database, and, possibly, information analysis software.
A server (agent) may be a basic monolithic agent, or it may include code to support
proxies and master or subagents. A server may also process a single packet at a
time, or use the serialization or locking code to process multiple packets at once. In
any case, the agent must be connected to the actual management variables, receive
and transmit the SNMP packets with the chosen transport protocol (usually UDP),
and may generate and send traps and informs.
1.6.2 AgentX
If you have licensed the AgentX add-on, you also need to install and configure the
AgentX macros described in 4. Building Wind River SNMP for VxWorks.
You must provide the code to implement the transport layer. This code should be
able to receive messages asynchronously and pass them along to the handlers. The
handlers use the routines that you supply to send response messages or to pass
information to your code. The handlers themselves are envoy_ax_ma_handler( ),
envoy_ax_sa_handler( ), and envoy_ax_chunk_handler( ). The chunk handler
takes bytes from a stream protocol and turns them into packets for use by the other
two handlers.
Master Agent
5
Wind River SNMP
Programmer's Guide, 10.5
a subagent and calls the proper handler when a message arrives. You should also
arrange to call envoy_ax_ma_cleanup_sessions( ), if you detect that a transport
session has been destroyed. Finally, you need to examine the macros in the
configuration section to determine which ones you want or need.
Subagent
The first step in setting up a subagent is creating a state block for the subagent. If
you arrange for the memory for the state block yourself, initialize it with a call to
envoy_ax_sa_state_init( ), or use envoy_ax_sa_state_create( ) to allocate the space
and initialize it.
A subagent normally starts by building and sending a set of packets to the master
agent to open the connection and register the objects for which it would like to be
the owner. Response packets should be processed with envoy_ax_sa_handler( ),
which uses one of your completion routines to pass the information to you.
After processing is complete, your code should execute an infinite loop that waits
for a packet from the master agent and passes those packets to the routine
envoy_ax_sa_handler( ). The subagent handler processes the message and calls
your method routines as necessary. These method routines are where the bulk of
your work needs to be done.
6
2
Technical Description
2.1 Introduction 7
2.2 Functional Units 7
2.3 Simple Manager and Agent 10
2.1 Introduction
Wind River SNMP is a collection of subroutines written in ANSI standard C. The
software, as distributed, is not specific to any particular operating system or
execution environment. Rather, you must incorporate the software into the your
particular environment. As described in this chapter, the software’s design permits
installation in most systems without changing the main body of the code.
The core SNMP code contains calls to customer-provided routines at critical points
during SNMP processing. These user-exits give the application considerable ability
to control and alter the handling of incoming and outgoing SNMP traffic as well as
mediate access to the MIB.
7
Wind River SNMP
Programmer's Guide, 10.5
All of the functional units make use of a structured C data type to represent the
contents of an SNMP packet. The user of Wind River SNMP software never has to
deal with the ASN.1 format used in SNMP packets.
2.2.1 Decoder
The SNMPv1, SNMPv2c and SNMPv3 Decoder decodes an SNMP packet. The
decoding procedure takes as input a buffer containing an SNMP packet in ASN.1
format. The Decoder produces a C data structure representing the contents of the
packet.
Typically, an SNMP agent/server application calls the Received Packet Manager,
which then invokes the Decoder. For more information, see 2.2.4 Received Packet
Manager, p.8. Only in an SNMPv1 or SNMPv2 manager/client would the
application directly use the Decoder. The Decoder contains user-exits to interpret
the SNMP community string and select the MIB view.
2.2.2 Encoder
The SNMP encoder generates an SNMP packet. The input to the Encoder is a C
data structure. The Encoder produces a buffer in ASN.1 format suitable for
transmission via UDP.
Typically, an SNMP agent/server application calls the Encoder from the Received
Packet Manager, the MIB interface, and the Packet Generator functional units, as
well as from the notification code. An SNMP manager/client application calls the
Encoder directly.
8
2 Technical Description
2.2 Functional Units
The Packet Generator functional unit gives applications the ability to construct
SNMP TRAP, INFORM, and REQUEST PDUs.
The Generator provides tools to construct the standard C data structure used to
represent SNMP packets. The Packet Generator calls upon the Encoder to produce
a packet ready for transmission.
SNMPv3 requires you to use an RFC 3415 view scheme that allows views to be
modified at run-time. Wind River SNMP provides a collection of routines to create
and maintain the RFC 3415 view database, which is required by SNMPv3.
Included in this collection are several routines that allow access through the SNMP
protocol. Use the RFC 3415 view scheme for new applications and when you
update older applications.
2.2.7 AgentX
The AgentX add-on allows you to use a subagent approach (per VarBind
multiplexing) when building network management elements. The AgentX add-on
includes routines to encode and decode messages for transmission between the
master agent and subagents, handlers for the master and subagents to decode
messages and perform the appropriate actions, and method routines for use by the
master to request information or actions from a subagent.
Subagent Handler
These routines have several related functions. One function distributes VarBinds
from an SNMP message to the appropriate subagents. Another processes messages
from subagents. These messages are either responses to master agent requests, in
which case the information is integrated into the SNMP response, or AgentX
control messages that cause the master agent to update the database it maintains
for forwarding requests. Some control messages, such as notifications and changes
to agent capabilities, are passed to user-supplied code for further processing.
9
Wind River SNMP
Programmer's Guide, 10.5
These simple manager and agent tools are particularly useful for regression and
basic inter-operability testing. In addition, the simple agent may serve as a
foundation for a more fully developed agent, especially one that runs as a user
process on a UNIX host.
10
3
SNMP
11
Wind River SNMP
Programmer's Guide, 10.5
■
A proxy forwarder receives SNMP messages and forwards them to another
SNMP entity.
Most implementations include functions from more than one of the above terms.
For example, a classic agent contains both a command responder and a notification
originator. A classic manager contains a command generator and a notification
receiver.
12
3 SNMP
3.3 Supported RFCs
NOTE: Although Wind River SNMP 10.5 supports legacy applications based on
the RFC 1445 view scheme, support for RFC 1445 has been deprecated.
The Epilogue proprietary agent and subagent have been deprecated, although
legacy applications using the Epilogue agent/subagent scheme will continue to
run. Use AgentX (RFC 2258, RFC 2741, and RFC 2742) for new applications.
■
RFC 1155: Structure and Identification of Management Information for
TCP/IP-based Internets
– Provides the complete set of data types.
■ RFC 1157: Simple Network Management Protocol (SNMP)
– Obsoletes RFC 1098.
■ RFC 1212: Concise MIB Definitions
– Describes an approach for producing concise, yet descriptive, MIB
modules.
■ RFC 1213: Management Information Base for Network Management of
TCP/IP-based internets: MIB-II
– The RFC obsoletes RFC 1158, is updated by RFC 2011, RFC 2012,
RFC 2013, and is also defined as STD0017.
■
RFC 1215: A Convention for Defining Traps for use with the SNMP
– Suggests a straight-forward approach towards defining traps used with
SNMP.
■
RFC 1445: Administrative Model for version 2 of the Simple Network Management
Protocol (SNMPv2)
– Wind River SNMP supports a subset of this RFC to provide
backward-compatibility for legacy applications.
■
RFC 1901: Introduction to Community-based SNMPv2
– An introduction to SNMPv2 describing the components of the SNMPv2
Framework.
■
RFC 2578: Structure of Management Information Version 2 (SMIv2)
– Defines the Structure of Management Information (SMI) for SNMPv2 and
explains new ASN.1 macros for use with SNMPv2. This RFC obsoletes
RFC 1902 and is also defined as STD0058.
■
RFC 2579: Textual Conventions for SMIv2
– Defines the initial set of textual conventions available to all MIB modules
for SMIv2. In comparison to a type defined in the SMIv1, each new type
has a different name, a similar syntax, but more precise semantics. This
RFC obsoletes RFC 1903 and is also defined as STD0058.
13
Wind River SNMP
Programmer's Guide, 10.5
■
RFC 2580: Conformance Statements for SMIv2
– Defines and describes conformance statements for SNMPv2. This RFC
obsoletes RFC 1904 is also defined as STD0058.
■ RFC 2631: Diffie-Hellman Key Agreement Method
– Describes one particular Diffie-Hellman key agreement algorithm used by
two parties to agree on a shared secret, and provides an algorithm for
converting the shared secret into an arbitrary amount of keying material,
useful for a symmetric encryption key.
■
RFC 2741: Agent Extensibility (AgentX) Protocol Version 1
– Defines a standardized framework for extensible SNMP agents, as well as
processing entities called master agents and subagents, a protocol
(AgentX) used to communicate between them, and the elements of
procedure by which the extensible agent processes SNMP protocol
messages. This RFC obsoletes RFC 2257.
■ RFC 2742: Definitions of Managed Objects for Extensible SNMP Agents
– Describes objects managing SNMP agents that use the Agent Extensibility
(AgentX) Protocol.
■ RFC 2786: Diffie-Helman USM Key Management Information Base and Textual
Convention
– Describes a textual convention for doing Diffie-Hellman key agreement
key exchanges and a set of objects which extend the usmUserTable to
permit the use of a DH key exchange in addition to the USM key change
method described in RFC 3414.
■ RFC 2863: The Interfaces Group MIB
– A MIB module that manages network interface objects (the interfaces
group).
■ RFC 3410: Introduction and Applicability Statements for Internet-Standard
Management Framework
– Describes an overview of the third version of the Internet-Standard
Management Framework, termed the SNMP version 3 Framework
(SNMPv3). This RFC obsoletes RFC 2570.
■
RFC 3411: An Architecture for Describing Simple Network Management Protocol
(SNMP) Management Frameworks
– Describes an architecture for describing SNMP Management Frameworks.
This RFC obsoletes RFC 2571 and is also defined as STD0062.
■
RFC 3412: Message Processing and Dispatching for the Simple Network
Management Protocol (SNMP)
– Describes the Message Processing and Dispatching for SNMP messages
within the SNMP architecture. This RFC obsoletes RFC 2572 and is also
defined as STD0062.
■ RFC 3413: Simple Network Management Protocol (SNMP) Applications
– Describes five types of SNMP applications which make use of an SNMP
engine: Command Generators, Command Responders, Notification
Originators, Notification Receivers, and Proxy Forwarders. It also
14
3 SNMP
3.3 Supported RFCs
15
Wind River SNMP
Programmer's Guide, 10.5
■
RFC 3826: The Advanced Encryption Standard (AES) Cipher Algorithm in the
SNMP User-based Security Model
– Describes the Advanced Encryption Standard (AES) cipher algorithm
used in Cipher FeedBack Mode (CFB) with a key size of 128 bits, a
symmetric encryption protocol that supplements the protocols described
in the User-based Security Model (USM), which is a Security Subsystem
for version 3 of SNMP for use in the SNMP Architecture.
■
RFC 4293: Management Information Base for the Internet Protocol (IP)
– Defines modifications to the IP-MIB, which was originally defined in
RFC 1213. This RFC obsoletes RFC 2011, RFC 2465 and RFC 2466.
■
RFC 5343: Simple Network Management Protocol (SNMP) Context EngineID
Discovery
– Introduces a well-known localEngineID and a discovery mechanism that
can be used to learn the snmpEngineID of a remote SNMP protocol
engine.
■ RFC 5590: Transport Subsystem for the Simple Network Management Protocol
(SNMP)
– Defines a transport subsystem, extending the SNMP architecture defined
in RFC 3411, to contain transport models that are comparable to other
subsystems in the RFC 3411 architecture.
■ RFC 5591: Transport Security Model for the Simple Network Management Protocol
(SNMP)
– Describes a transport security model for SNMP.
■ RFC 5592: Secure Shell Transport Model for the Simple Network Management
Protocol (SNMP)
– Describes a transport model for SNMP using SSH.
■ RFC 5935: Expressing SNMP SMI Datatypes in XML Schema Definition Language
– Defines the IETF standard expression of Structure of Management
Information (SMI) base datatypes in the XML Schema Definition (XSD)
language.
■ RFC 6353: Transport Layer Security (TLS) Transport Model for the Simple Network
Management Protocol (SNMP). This RFC obsoletes RFC 5953.
– Describes a transport model for SNMP that uses either the TLS protocol or
the Datagram TLS (DTLS) protocol.
16
3 SNMP
3.5 Obsoleted RFCs
■
RFC 2617: Basic and Digest Access Authentication
■
RFC 2818: HTTP Over TLS
■ RFC 2854: The ‘text/html’ Media Type.
■ RFC 2965: HTTP State Management Mechanism
17
Wind River SNMP
Programmer's Guide, 10.5
18
3 SNMP
3.6 Supported MIBs in the Wind River Network Stack
■
RFC 2272: Message Processing and Dispatching for the Simple Network
Management Protocol (SNMP)
– Obsoletes RFC 2262 and is obsoleted by RFC 2572.
■ RFC 2273: SNMPv3 Applications
– Obsoletes RFC 2263 and is obsoleted by RFC 2573.
■
RFC 2274: User-based Security Model (USM) for version 3 of the Simple Network
Management Protocol (SNMPv3)
– Obsoletes RFC 2264 and is obsoleted by RFC 2574.
■
RFC 2275: View-based Access Control Model (VACM) for the Simple Network
Management Protocol (SNMP)
– Obsoletes RFC 2265 and is obsoleted by RFC 2575.
■ RFC 2570: Introduction to Version 3 of the Internet-standard Network Management
Framework
– Obsoleted by RFC 3410.
■ RFC 2571: An Architecture for Describing SNMP Management Frameworks
– Obsoletes RFC 2271 and is obsoleted by RFC 3411.
■ RFC 2572: Message Processing and Dispatching for the Simple Network
Management Protocol (SNMP)
– Obsoletes RFC 2272 and is obsoleted by RFC 3412.
■ RFC 2573: SNMP Applications
– Obsoletes RFC 2273 and is obsoleted by RFC 3413.
■ RFC 2574: User-based Security Model (USM) for version 3 of the Simple Network
Management Protocol (SNMPv3)
– Obsoletes RFC 2274 and is obsoleted by RFC 3414.
■ RFC 2575: View-based Access Control Model (VACM) for the Simple Network
Management Protocol (SNMP)
– Obsoletes RFC 2275 and is obsoleted by RFC 3415.
■ RFC 2576: Coexistence between Version 1, Version 2, and Version 3 of the
Internet-standard Network Management Framework
– Obsoletes RFC 1908 and RFC 2089 and is obsoleted by RFC 3584.
■
RFC 5953 Transport Layer Security (TLS) Transport Model for the Simple Network
Management Protocol (SNMP)
– Obsoleted by RFC 6353.
19
Wind River SNMP
Programmer's Guide, 10.5
■
RFC 2006: The Definitions of Managed Objects for IP Mobility Support using
SMIv2.
– Defines the MIP-MIB. The Wind River Network Stack supports the
following objects:
faRegistration
■
RFC 2863: The Interfaces Group MIB
– Modifies the definitions of the IF-MIB, which was previously defined by
RFC 1213, RFC 1229, and RFC 2233. The Wind River Network Stack
supports the following objects:
(scalars)
ifTable
ifXTable
■ RFC 3873: Stream Control Transmission Protocol (SCTP) Management Information
Base (MIB)
– Defines the SCTP-MIB. The Wind River Network Stack supports the
following objects:
sctpObjects :
sctpStats (scalars)
sctpParameters (scalars)
sctpAssocTable
sctpAssocLocalAddrTable
sctpAssocRemAddrTable
sctpLookupLocalPortTable
sctpLookupRemPortTable
sctpLookupRemHostNameTable
sctpLookupRemPrimIPAddrTable
sctpLookupRemIPAddrTable
sctpMibConformance :
sctpMibCompliances
sctpMibGroups
■ RFC 4022: Management Information Base for the Transmission Control Protocol
(TCP)
– Modifies the definitions of the TCP-MIB, which was previously defined by
RFC 793, RFC 1213, RFC 2012, RFC 2452, and RFC 3418. The Wind River
Network Stack supports the following objects, for both IPv4 and IPv6):
(scalars)
tcpConnectionTable
tcpListenerTable
■
RFC 4113: Management Information Base for the User Datagram Protocol (UDP)
– Modifies the definitions of the UDP-MIB, which was previously defined by
RFC 768, RFC 1213, RFC 2013, RFC 2454, and RFC 3418. The Wind River
Network Stack supports the following objects (for both IPv4 and IPv6):
(scalars)
udpEndpointTable
■ RFC 4292: IP Forwarding Table MIB
20
3 SNMP
3.6 Supported MIBs in the Wind River Network Stack
– Modifies the defined by RFC 1213, RFC 2011, RFC 2096, and RFC 2465. The
Wind River Network Stack supports the following objects:
ipForward
inetCidrRouteNumber
inetCidrRouteDiscards
inetCidrRouteTable
■
RFC 4293: Management Information Base for the Internet Protocol (IP)
– Defines modifications to the IP-MIB, which was originally defined by
RFC 1213, RFC 2011, RFC 2465 and RFC 2466. The Wind River
Network Stack supports the following objects:
ip (scalars)
ipAddressPrefixTable
ipAddressTable
ipNetToPhysicalTable
ipSystemStatsTable
ipIfStatsTable
ipDefaultRouterTable
ipv4InterfaceTable
ipv6InterfaceTable
ipv6ScopeZoneIndexTable
ipv6RouterAdvertTable
icmpStatsTable
icmpMsgStatsTable
NOTE: VxWorks 6.7, support for network stack MIB objects defined in
RFC 4293 supercedes support for MIB objects defined in RFC 2011, RFC 2465,
and RFC 2466.
■
RFC 4295: Mobile IPv6 Management Information Base
– This RFC defines the MOBILIPV6-MIB. The Wind River Network Stack
supports the following objects:
mip6System
mip6TotalTrafficGroup
mip6MnConfGroup
mip6MnRegistrationGroup
21
Wind River SNMP
Programmer's Guide, 10.5
22
4
Building Wind River SNMP for
VxWorks
4.1 Introduction 23
4.2 VxWorks Source Build Project 24
4.3 Creating a VIP 25
4.4 SNMP Integration in an Image Project 25
4.5 Configuring SNMP Using Workbench 26
4.6 Configuring Wind River SNMP Using vxprj 28
4.7 Customizing the Wind River SNMP Configuration 32
4.1 Introduction
Wind River SNMP is shipped as source code that you must compile before it can
be used with either kernel or real-time process (RTP) applications.
To compile your source code you must create a VxWorks source build (VSB) project
as directed in the user’s guide for your Platform. The user’s guide for your
Platform provides the following information:
■
instructions for creating a VSB project with Workbench or from the command
line
■
instructions on how to configure and compile the source code libraries used to
develop VxWorks kernel and user-space applications
■
a description of the configuration options for libraries used to develop the
VxWorks operating system facilities, such as support for multiprocessing,
real-time processes, and object management
23
Wind River SNMP
Programmer's Guide, 10.5
Enable Secure Key database support for sn For SNMPv3, set to y to enable
mp tls or dtls transports secure key database support for
(SNMP_USE_SEC_KEY_DB) SNMP TLS and DTLS transports.
Enable TLS and DTLS Transport Support For SNMPv3, set to y to enable TLS
(SNMP_USE_TLS_DTLS_TRANSPORT) and DTLS transport for SNMP.
NOTE: Both the SNMPv3 and AgentX source code relies upon functionality
provided in the core SNMP component. To use either SNMPv3 or AgentX, you
must also inlcude the COMPONENT_SNMP option.
To enable the Federal Information Processing Standard (FIPS) 140-2 mode in your
VSB, set the Enable FIPS-140-2 validated crypto libraries
(COMPONENT_IPCRYPTO_USE_FIPS_140_2) option to yes.
24
4 Building Wind River SNMP for VxWorks
4.3 Creating a VIP
When VxWorks is compiled in FIPS mode, the affected algorithms are compiled
out. The MD5 hash algorithm is not compiled out, but it is disabled at run time if
the system is running in FIPS 140-2 mode.
The algorithms that are not FIPS-approved are MD2, MD4, MD5, and RIPEMD
cryptographic hash operations, and Arcfour, Blowfish, CAST, and DES symmetric
block cipher methods.
For additional information on FIPS 140-2, see the Wind River Cryptography Libraries
Programmer’s Guide.
NOTE: In this guide, as well as in the online VxWorks API references, VxWorks
components and their configuration parameters are identified by the names used
in component description files. The names take the form, for example, of
INCLUDE_FOO and NUM_FOO_FILES (for components and parameters,
respectively).
You can use these names directly to configure VxWorks using the command-line
configuration facilities.
Wind River Workbench displays descriptions of components and parameters, as
well as their names, in the Components tab of the Kernel Configuration editor. Use
the Find dialog to locate a component or parameter using its name or description.
To access the Find dialog from the Components tab, type CTRL+F, or right-click
and select Find.
25
Wind River SNMP
Programmer's Guide, 10.5
26
4 Building Wind River SNMP for VxWorks
4.5 Configuring SNMP Using Workbench
27
Wind River SNMP
Programmer's Guide, 10.5
From a VxWorks development shell, use vxprj commands from the project
directory to list the available components and their parameters. For example:
> vxprj component list all SNMP
INCLUDE_WINDMANAGE_SNMP_AGENTX_COMMONCORE
INCLUDE_WINDMANAGE_SNMP_AGENTX_MASTERCORE
INCLUDE_WINDMANAGE_SNMP_AGENTX_SUBAGENTCORE
28
4 Building Wind River SNMP for VxWorks
4.6 Configuring Wind River SNMP Using vxprj
INCLUDE_WINDMANAGE_SNMP_CORE
INCLUDE_WINDMANAGE_SNMP_V3CORE
INCLUDE_SNMP_STATIC_INIT
INCLUDE_WM_SNMP_INIT
To view the settings for SNMP-related parameters, use the following command
from the project directory. For example:
> vxprj parameter value SNMP
SNMP_USE_M2LIB = FALSE
To view the settings for SNMP-related parameters, use the following command:
Once you have included the Wind River SNMP component and set the Wind River
SNMP initialization method, use the vxprj parameter set and vxprj
parameter setstring commands to configure the parameter values.
Refer to Table 4-2 for a description of the configuration parameters. Set the
parameter values to suit your installation.
29
Wind River SNMP
Programmer's Guide, 10.5
Once you have included the Wind River SNMP component and set the Wind River
SNMP initialization method, use the vxprj parameter set and vxprj
parameter setstring commands to configure the parameter values.
Refer to Table 4-2 for a description of the configuration parameters. Set the
parameter values to suit your installation.
30
4 Building Wind River SNMP for VxWorks
4.6 Configuring Wind River SNMP Using vxprj
Once you have included the Wind River SNMP component and set the Wind River
SNMP initialization method, use the vxprj parameter set and
vxprj parameter setstring commands to configure the parameter values.
31
Wind River SNMP
Programmer's Guide, 10.5
Refer to Table 4-2 for a description of the configuration parameters. Set the
parameter values to suit your installation.
The compiler specification selects a file containing macros to use when expanding
the generic makefile.cfg files found in some directories. You can choose one of the
files provided with Wind River SNMP or you can write your own if necessary. The
compiler specification files must be in the current directory or the directory that
was compiled into the makmak utility. The default location for the compiler
specification files for VxWorks is as follows:
installDir/vxworks-6.x/host/src/wrn/wm/maksrc
You supply a default set of configuration directives for makmak by specifying the
default configuration file. For VxWorks, the default Wind River SNMP file,
envoy.cfg, is located in the following directory:
32
4 Building Wind River SNMP for VxWorks
4.7 Customizing the Wind River SNMP Configuration
installDir/vxworks-6.x/target/src/wrn/wm/snmp
As stated above, this file specifies a default configuration and includes all other
options as comment lines. Do not change this file; make any changes to the
makmak input file.
To include the specification for Wind River SNMP, add the following line to your
configuration file:
loadconfig ’snmp/envoy.cfg’
The outputs of makmak are the file install.h and makefiles for those directories
that require them. The Wind River SNMP source files include install.h and various
bits of the code are included or not, based on what is defined in install.h.
The options for envoy.cfg follow. Some combinations of options are illegal and
error directives have been included to prevent their use. Some of the other
combinations are not useful but are allowed. It is especially helpful to notice that
many of the options are for an agent and are not useful for a manager.
To install options that, by default, are not installed, use a plain text editor to add an
install command to your file:
install OPTION
To uninstall an option, use a plain text editor to add an uninstall command to the
file:
uninstall OPTION
SNMP Version 1
SNMP Version 2
SNMP Version 3
The default configuration does not includes code that implements version 3 of the
SNMP protocol. If you have licensed SNMPv3, include the following lines in your
configuration file:
install ENVOY_SNMP_VERSION_3
install SNMP_VERSION_3_LICENSED
NOTE: If you need to use dynamic configuration with SNMPv1 and SNMPv2c,
you must install the ENVOY_SNMP_VERSION_3 option.
33
Wind River SNMP
Programmer's Guide, 10.5
SNMP Statistics
MIB II defines an SNMP group that keeps statistics on the SNMP implementation
itself. This group was modified in the SNMPv2 MIB with some objects being
removed and others added. By default, code to maintain all of these counters is
included in Wind River SNMP. To remove sections of this code, include one or
both of the following lines in your configuration file:
uninstall ENVOY_SNMP_GROUP_V1
uninstall ENVOY_SNMP_GROUP_V2
NOTE: If you install the SNMPv3 add-on, you must also install the
ENVOY_SNMP_GROUP_V1 and ENVOY_SNMP_GROUP_V2 options to support the
SNMP statistics counters in SNMPv3.
Macros or Routines
The following installation option, which is installed by default, allows the various
getproc_got*( ), *proc_started*( ), and *proc_good*( ) routines to be macros. If this
option is uninstalled, these routines are built as functions:
install ENVOY_SNMP_UTIL_MACROS
Stack or Heap
In several functions, Wind River SNMP makes use of temporary structures that are
placed on the stack by default. In order to allow customers to minimize stack
usage, Wind River SNMP allows some of the larger structures to be allocated from
the heap rather than the stack. If you include the following line in your
configuration file, structures that exceed one hundred bytes in length are allocated
from the heap by calls to the SNMP_memory_alloc( ) routine:
install ENVOY_HEAP_LARGE_VARS
The base SNMPv3 documents specify several authentication and privacy routines.
For authentication, SNMPv3 uses HMAC-MD5-96 and HMAC-SHA-96 or
AES-128, and for privacy it uses either CBC-DES or CFB-AES. These options
control the installation of the Wind River SNMP code that interfaces to the digest
or encryption code. The actual digest and encryption code are found in the
common directory, which has its own set of installation options. By default, the
MD5 and SHA code are installed and the DES is uninstalled; to change this state,
add some of the following lines to your configuration file.
34
4 Building Wind River SNMP for VxWorks
4.7 Customizing the Wind River SNMP Configuration
RFC 3414 specifies MD5 as the default value for use in creating a new row in the
user table. If you do not install MD5, it uses NOAUTH as the default value:
uninstall ENVOY_MD5
uninstall ENVOY_SHA
install ENVOY_DES
install ENVOY_AESCFB128
Wind River SNMP supports the SNMPv3 Target MIB described in RFC 3413. The
Target MIB is uninstalled by default. If you want to use the Target MIB, you must
install the new configuration option, ENVOY_SNMP_V3_TARGET, by putting the
following line in your top-level configuration file:
install ENVOY_SNMP_V3_TARGET
If you install this option, you must provide timer routines for the user exits
ENVOY_NOW( ) and ENVOY_CALL_TIMER( ).
Wind River SNMP supports the SNMPv3 Notification MIB described in RFC 3413.
The Notify MIB is uninstalled by default. If you want to install the Notify MIB
code, you must install both the ENVOY_SNMP_V3_TARGET and the
ENVOY_SNMP_V3_NOFTIFY options. Put the following lines in your top-level
configuration file:
install ENVOY_SNMP_V3_TARGET
install ENVOY_SNMP_V3_NOTIFY
If either of these options are installed, you must provide timer routines for each of
these user exits:
■ ENVOY_NOW( )
■ ENVOY_CALL_TIMER( )
■ ENVOY_SNMPADDR_TO_TADDRESS( )
■ ENVOY__TADDRESS_TO_SNMPADDR( )
For more information about these routines, see the Wind River SNMP API
reference entries.
35
Wind River SNMP
Programmer's Guide, 10.5
DYNCFG_EXTERN_FUNCPTR3(SNMP_community_coexistence_lookup,int,void *, void *,
void *)
extern int my_lookup_SNMP_community(void *rp, void *pktsrc, void *pktdst);
void customerSnmpInit()
{
DYNCFG_FUNCPTR_SET(SNMP_community_coexistence_lookup,my_lookup_SNMP_community);
}
View Scheme
Wind River SNMP defaults to the RFC 3415 view scheme because it is required by
SNMPv3. To use the RFC 3415 view scheme, you must initialize the view table and
choose a view name. In SNMPv1 and SNMPv2, set the name in the packet structure
while evaluating the community string in SNMP_validate_community( ). In
SNMPv3, the index is set by the packet processing code.
If you have a legacy application that uses the original Envoy view scheme, include
the following line in your configuration file to disable the RFC 3415 view scheme.
Although RFC 2275 has been upgraded to RFC 3415, the installation option name
has not been changed:
uninstall ENVOY_SNMP_RFC2275_VIEWS
Locking
36
4 Building Wind River SNMP for VxWorks
4.7 Customizing the Wind River SNMP Configuration
There is some simple locking code in the example envoy.h files. This code is
included only for test purposes. In real use, the locking code should block until the
lock is obtained.
You can install either the locking code or serialization code, but not both. To install
the locking code, include the following line in your configuration file:
install ENVOY_SNMP_LOCK
The SNMP_Continue( ) routine and deferred method routines can also require
locking. If you structure your code so that multiple tasks can operate on the packet,
use this locking mechanism to ensure that only one routine is updating the packet
at a time.
For example, a multiprocessor system with shared memory with method routines
that transfer each task to a separate processor would require locks. As each
processor finished its task, it updates the packet with its results, and calls
SNMP_Continue( ). To prevent subsequent calls to SNMP_Continue( ) from
receiving stale information, each routine that updates the packet must acquire the
per packet write lock before modifying the packet. SNMP_Continue( ) expects
any callers to have already acquired the lock and releases the lock before returning.
It is recommended you try to cluster the code to modify the packet and call
SNMP_Continue( ) at the end of your routine.
To avoid per-packet locking, you can keep routines that modify the packet and call
SNMP_Continue( ) in one task. The method routines can use a different task to
perform the requested operation and when the operation finishes, the information
is transferred to the original task and integrated into the packet there. This scheme
allows you to distribute the request between several tasks but modify the packet
in only one task.
By default, the ENVOY_CONTINUE_REENTRANT option is not installed. To install
this option, you must install the ENVOY_SNMP_LOCK option and include the
following line in your configuration file:
install ENVOY_CONTINUE_REENTRANT
The use of a subagent or deferred processing with locking poses some extra
concerns. It is possible to deadlock an SNMP agent in situations with a limited
number of tasks. For example, if an SNMP GET REQUEST is received that requires
information from a subagent and only three tasks are available for processing, a
deadlock condition can occur. The first task holds the SNMP_CoarseLock( ) for
reading, sends the request to the subagent, and returns. If three SET requests
arrive, each is queued to an available SNMP processing task, attempts to lock
SNMP_CoarseLock( ), and blocks. When the response returns from the subagent,
no tasks are available to process the response creating a deadlock condition. To
prevent this sort of deadlock, reserve at least one task for processing responses
from subagents and other situations that could result in deferred requests.
Serialization
Whether or not you use Wind River SNMP in a reentrant environment, if you use
the asynchronous capabilities of the method routines, you need to serialize some
actions. For example, an asynchronous master agent sends requests off to
subagents and continues processing SNMP requests while waiting for the
subagents to reply. The master agent should not process SET REQUESTs until the
subagents have replied. To avoid the expense of locks, Wind River SNMP supports
37
Wind River SNMP
Programmer's Guide, 10.5
Proxies
SNMPv3 Proxies
Wind River SNMP supports the SNMPv3 Proxies as described in RFC 3413.
An SNMP entity which acts as a proxy forwarder receives SNMP messages and
determines, based on context information, whether to process them locally (as a
command responder/generator) or to forward it (as a proxy forwarder).
When acting as a proxy forwarder, Wind River SNMP forwards the following four
types of messages:
■ Read-Class or Write-Class PDUs, which includes Gets, GetNexts, GetBulks,
and Sets. Wind River SNMP forwards these PDUs to at most one target using
the Proxy and Target MIBs.
■
Notification-Class PDUs, such as SNMPv1 Traps, SNMPv2 Traps and Informs.
SNMPv3 uses the SNMPv2-Trap PDU specification.
■
Response-Class PDUs. Wind River SNMP only forwards these PDUs if they
are responses to a message previously forwarded by this entity.
■
Internal-Class PDUs such as Reports. Wind River SNMP only forwards these
PDUs if they are a response to a message previously forwarded by this entity.
Notification-Class messages can be forwarded to multiple targets using the Proxy
and Target MIBs.
If you want to install SNMPv3 Proxy support, you must also install the
ENVOY_SNMP_V3_TARGET options, and uninstall the SNMPv1/2 Proxy support
using the ENVOY_SNMP_PROXY option. To install SNMPv3 Proxy support,
include the following lines in your configuration file:
install ENVOY_SNMP_V3_TARGET
38
4 Building Wind River SNMP for VxWorks
4.7 Customizing the Wind River SNMP Configuration
install ENVOY_SNMP_V3_PROXY
uninstall ENVOY_SNMP_PROXY
AgentX Options
If you choose to use the subagent functionality, you must decide what role each of
your programs will play. A master agent generally receives SNMP packets from
the transport layer and sends requests to any subagents that have registered with
it. A subagent must send registration requests to the master agent and wait for the
master agent to send it queries for SNMP information.
NOTE: The Epilogue master agent and subagent formerly supplied with Envoy
have been deprecated. Use AgentX for new applications.
If you use the Epilogue AgentX implementation, you must install the
ENVOY_AGENTX option, the SNMP_AGENTX_LICENSED option, and either one or
both of the master and subagent options in your configuration file. By default, all
of these options are uninstalled. If you do not need to register index entries in the
master agent and would like to save some space, leave the
ENVOY_AGENTX_INDEX option uninstalled. Although this option is installed by
default, it is only compiled when the master option is also installed:
install ENVOY_AGENTX
install SNMP_AGENTX_LICENSED
install ENVOY_AGENTX_MASTER
uninstall ENVOY_AGENTX_INDEX
install ENVOY_AGENTX_SUB
NOTE: If you are using the dynamic VxWorks configuration code, by installing the
ENVOY_SNMP_VERSION_3 and COMMON_DYNAMIC_COMP_CONFIG options,
you must also install the ENVOY_AGENTX, ENVOY_AGENTX_MASTER, and
ENVOY_AGENTX_SUB options.
The new AgentX RFC clarifies how OIDs are handled in range requests. By default,
Wind River SNMP conforms to the new standard. If you would prefer to use the
old scheme, install the following backward-compatibility option:
install ENVOY_AGENTX_2257_RANGE
39
Wind River SNMP
Programmer's Guide, 10.5
Coexistence
Wind River SNMP implements support for SNMP version coexistence, as defined
by RFC 3584. Coexistence makes it possible for large portions of a multi-version
SNMP entity to operate within a standardized framework.
To make use of the coexistence support in Wind River SNMP, include the
following line in your configuration file:
install ENVOY_SNMP_COEXISTENCE
IPv6 Transports
Wind River SNMP implements support for VxWorks SNMP agents over IPv6,
allowing them to use IPv6 sockets to send and receive packets over IPv6
transports.
To make use of the IPv6 transport support in Wind River SNMP, include the
following line in your configuration file:
install SNMP_VXWORKS_IPV6
Wind River SNMP has three configuration files: envoy.h, snmptalk.h, and
oemtypes.h. The distribution includes samples of these configuration files as
examples, and as a starting point for creating the specific configuration you need.
For VxWorks, the sample files are located in a subdirectory under the following
directory:
installDir/vxworks-6.x/target/h/wrn/wm/util/port/vxworks
If you need to modify these files, you should make a new directory and create
working copies of the files in that directory. This will prevent the working copies
from being overwritten when a new Wind River SNMP release is installed. By
including the directory name in the makmak configuration file, you will instruct
the makmak program to place it into the include paths.
oemtypes.h
The types.h file defines the basic data types used by all of Wind River SNMP. For
VxWorks, this file is located in the directory:
installDir/vxworks-6.x/target/h/wrn/wm/util/common
Where portability is an issue, Wind River SNMP uses portable data types defined
in types.h. These portable types are all known sizes and are set, by the developer,
to objects that should result in the correct size. You should not modify this file. If
you need to change some of the base types, modify the file oemtypes.h. For
VxWorks, this file is located in the following directory:
40
4 Building Wind River SNMP for VxWorks
4.7 Customizing the Wind River SNMP Configuration
installDir/vxworks-6.x/target/h/wrn/wm/util/port/vxworks
To override a given type, create a typedef for the type you are changing, and define
a preprocessor line to indicate that type has been defined and should not be
redefined. For example, to change the 8-bit type to be an OCTET instead of a char,
include the following in oemtypes.h:
#define __TYPES_HAVE_bits8_t_
typedef OCTET bits8_t;
For the most part, you should not have to change the Wind River SNMP data types
in the examples. There is one possible exception: if you are using an older C
compiler that does not understand void*, change the data type PTR_T to be char*
instead:
#define __TYPES_HAVE_ptr_t_ 1
typedef char * PTR_T;
snmptalk.h
The snmptalk.h file contains items that are specific to the demonstration program,
snmptalk.
4.7.3 envoy.h
The envoy.h file defines customer-specific items used by all of Wind River SNMP.
The envoy.h file is split by an #ifdef into two sections: the first part (formerly
referred to as the preamble) and the main section. Define each entry in the correct
section of the file.
The example envoy.h file is split into two files to make it easier to build the
Wind River SNMP demos. One of the files is found in port/genericc and contains
information that is the same across all the demos. The other is located in the port
directory for a specific operating system. It defines any system-specific items and
then includes the generic version.
NOTE: Use a single envoy.h file to contain all of the Wind River SNMP
configuration directives.
At various points during SNMP packet processing, Wind River SNMP needs to
call customer-supplied code to determine its course of action. These user-exits are
provided by way of macros defined in envoy.h. If you reference other routines in
these macros, declare them in your envoy.h file. If you do not need a particular
function, leave the user-exits undefined or defined as a blank.
Required Routines
You must define the following required routines and any header files, user-exits,
or other functions they require in the first section of envoy.h:
MEMCPY( )
MEMSET( )
MEMCMP( )
41
Wind River SNMP
Programmer's Guide, 10.5
min( )
max( )
SNMP_memory_alloc( )
SNMP_memory_free( )
SNMP_MAX_PACKET_SIZE( )
MAX_OID_COUNT( )
If you use SNMPv1 or SNMPv2, you must define the
SNMP_validate_community( ) routine to validate the packet before Wind River
SNMP processes it. If you use SNMPv3, you must define the
SNMP_validate_address( ) routine in the first section of envoy.h.
If you use RFC 3584 SNMP version coexistence, you must define the
SNMP_community_coexistence_lookup( ) routine. A default version of this
routine exists.
If you use the proxy, master, or subagent, or SNMPv3 notify functions, you must
implement all three of the timer functions. Wind River SNMP requires that you
must define the first two timer macros even if they are not implemented in the first
section of envoy.h:
ENVOY_NOW( )
ENVOY_CALL_TIMER( )
ENVOY_TIME( )
For more information about these routines, see the Wind River SNMP API
reference entries.
If you are using SNMPv3 notify functions, you must provide functions to convert
between the SNMPADDR_T format and the TDomain/TAddress textual
convention. If you use Attaché Plus as your TCP/IP stack, Wind River SNMP
provides these conversion routines; otherwise, you must write them and include
them in the first section of envoy.h:
ENVOY_SNMPADDR_TO_TADDRESS( )
ENVOY_TADDRESS_TO_SNMPADDR( )
There is also a mechanism for determining the request ID and message ID of
outgoing notification packets. By default, Wind River SNMP chooses the next
number in a monotonically increasing sequence. If you want to have more control
over the values assigned, implement the following routine in the first section of
envoy.h:
ENVOY_SET_RETRANS_ID( )
For more information about Wind River SNMP routines and macros, see the
Wind River SNMP API reference entries and C. Wind River SNMP Macro Entries.
Although Wind River SNMP does not require the following routines (or macros),
they are useful.
42
4 Building Wind River SNMP for VxWorks
4.7 Customizing the Wind River SNMP Configuration
If you want to have several MIB trees in one process, the following macro allows
you to specify different MIB trees under different circumstances:
ENVOY_DEFAULT_MIB_ROOT_NODE( )
Packet Tracing
The following routines are available for tracing the processing of input or output
SNMP packets. Their definitions should go in the main section of envoy.h:
SNMP_TRACE_INPUT( )
SNMP_TRACE_OUTPUT( )
These four macros allow you the opportunity to examine and manipulate the
entire packet when processing a SET REQUEST. Their definitions should go in the
main section of envoy.h:
SNMP_validate_set_pdu( )
SNMP_user_pre_set( )
SNMP_user_post_set( )
SNMP_user_set_failed( )
If you choose to use the private field, you can define the following macro in order
to cleanup any resources the private field references when the packet structure is
freed. The definition for this routine should go in the main section of envoy.h:
SNMP_release_private( )
Locking
The following routines (or macros) must be defined if you install locking. The
definitions of these functions should go in the main section of envoy.h:
ENVOY_LOCK_T
ENVOY_SNMP_LOCK( )
ENVOY_SNMP_LOCK_EXTERN( )
ENVOY_SNMP_INIT_LOCK( ) or ENVOY_SNMP_INIT_LOCK_TAG( )
ENVOY_SNMP_GET_READ_LOCK( )
ENVOY_SNMP_RELEASE_READ_LOCK( )
ENVOY_SNMP_GET_WRITE_LOCK( )
ENVOY_SNMP_RELEASE_WRITE_LOCK( )
ENVOY_SNMP_FREE_LOCK_TAG( )
For more information about these routines, see the online help.
The following macros must be defined if you install AgentX. The definitions of
these functions should go in the main section of envoy.h.
43
Wind River SNMP
Programmer's Guide, 10.5
The following macro is common to both the master agent and subagent. Although
you can change the value if necessary, the default value is appropriate for most
applications:
ENVOY_AX_COOKIE_CMP( )
You must supply the following macro for the master:
ENVOY_GET_SYSUPTIME( )
These macros are required if you include support for the AgentX MIB:
AX_RESPONSE_PREPROCESS( )
ENVOY_AX_CONN_ENTRY( )
ENVOY_AX_GET_CONNID( )
ENVOY_AX_TRANSPORTS_SUPPORTED( )
ENVOY_AX_TRANSLATE_CONTEXT( )
ENVOY_AX_FIND_MIB( )
ENVOY_AX_DEFAULT_TIMEOUT( )
The following macros allow the AgentX agent capabilities messages to connect to
the code that maintains that MIB group. By default these routines, do not recognize
agent capabilities. The add and remove macros return an error, and the clean
macro does nothing:
ENVOY_AX_MA_AC_ADD( )
ENVOY_AX_MA_AC_REMOVE( )
ENVOY_AX_MA_AC_CLEAN( )
The following subagent macros are optional. The defaults are sufficient for most
applications:
ENVOY_AX_SA_MIB_ROOT_NODE( )
ENVOY_AX_SA_TIMEOUT( )
For more information about these routines, see the online help.
44
5
Data Types and Data Structures
ALENGTH_T
The fully decoded value of an ASN.1 length field.
ATVALUE_T
The fully decoded value of an ASN.1 tag, excluding the context and
constructor bits.
bits8_t
Unsigned 8-bit integer.
bits16_t
Unsigned 16-bit integer.
bits32_t
Unsigned 32-bit integer. Use this type for MIB variables of type COUNTER,
GAUGE, and TIMETICKS.
45
Wind River SNMP
Programmer's Guide, 10.5
envoy_err_t
This type is used for error codes. At this time, the available codes are:
ENVOY_ERR_NOERR (0), ENVOY_ERR_INSUFFICIENT_MEMORY (-1),
ENVOY_ERR_BAD_INSTANCE (1), ENVOY_ERR_EXISTS(2),
ENVOY_ERR_LOCK_FAILED (3), ENVOY_ERR_NO_TARGET(4),
ENVOY_ERR_UNKNOWN(5), ENVOY_ERR_NO_FORWARD(6), and
ENVOY_ERR_TOO_BIG(7).
EBUFFER_T
Variables of type EBUFFER_T hold strings of bytes generated by the ASN.1
encoding routines. EBUFFER_T is also used as a general mechanism for
managing variable length byte strings.
The EBUFFER_T type does not itself include the storage to hold the byte string.
That storage is provided by the user of the EBUFFER_T. Such storage may be
dynamic or static (relative to the lifetime of the EBUFFER_T variable itself.)
LCL_FILE
The local file abstraction provides a means for the ASN.1 decoding routines to
deal with a buffer as if it were a read-only I/O stream. The state of such a
stream is held in variables of type LCL_FILE.
OBJ_ID_T
An ASN.1 object identifier, in local representation.
Manipulation of data structures of this type comprises a significant portion of
the execution time used by this SNMP implementation.
OIDC_T
An object identifier component. This is a 32-bit unsigned integer.
sbits8_t
Signed 8-bit integer.
sbits16_t
Signed 16-bit integer.
sbits32_t
Signed 32-bit integer. Use this type for MIB variables of type Integer.
SNMPADDR_T
This type is used to hold network addresses in a general way. It is very similar
to the sockaddr structure used with the Berkeley socket interface.
UINT_64_T
Unsigned 64-bit integer. A structure composed of two 32-bit unsigned
integers.
Some data types (INT_16_T, INT_32_T, OCTET_T, UINT_8_T, UINT_16_T, UINT_32_T,
and PTR_T) are defined in terms of other types that are found in types.h. These are
included for backward compatibility, but should not be used for new code.
OCTET_T
Unsigned 8-bit character.
PTR_T
A generic pointer. For ANSI C compilers, leave this unchanged as void*. Older
compilers that do not have void* may require you to use char* instead.
46
5 Data Types and Data Structures
5.2 MIB Tree Types
47
Wind River SNMP
Programmer's Guide, 10.5
SNMP_PKT_T
An SNMP packet is represented internally by an element of type
SNMP_PKT_T. This type contains a tagged union with two principal
variations, one for REQUEST and RESPONSE PDUs, the other for TRAP PDUs.
These are both used in SNMPv1. In SNMPv2 the TRAP PDU is structured to fit
into a standard PDU and therefore SNMPv2 uses only the REQUEST and
RESPONSE union type.
Various additional fields are present to give the agent writer a means to
determine access privileges, MIB views, and other values. In addition, a
pointer is provided through which the agent writer may attach a private data
structure.
NOTE: There is one root, of type TREENODE_T, for each tree that you build. It is
your responsibility to allocate this root and initialize it to a zero pointer. Do not
manipulate the tree structures directly; always use the Wind River SNMP API calls
to accomplish tasks.
48
5 Data Types and Data Structures
5.6 SNMP Version 3 Types
NOTE: The RFC 3415 view scheme was originally defined in RFC 2275 and
modified in RFC 2575.
49
Wind River SNMP
Programmer's Guide, 10.5
SNMP_PRIV_T
The generic privacy code uses structures of this type to contain the knowledge
of a particular encryption algorithm. You do not need to manipulate structures
of this form unless you plan to add your own encryption algorithms.
SNMP_TARGET_ADDR_T
This type is used to build the TargetAddr table from RFC 3413.
SNMP_TARGET_PARAMS_T
This type is used to build the TargetParams table from RFC 3413.
SNMP_USER_ENG_T
SNMP_USER_T
These types are used to build the user table from RFC 3414. The table contains
the keys an engine uses when running the authentication or encryption
routines on a packet.
50
6
SNMPv3
6.1 Description 51
6.2 Database Initialization 60
6.1 Description
This chapter provides a brief description of SNMPv3 functionality and software
components. For a more detailed description, read the associated RFCs (see
3SNMP, p.11).
6.1.1 Engine ID
Each SNMP entity has an engine ID. This is a short tag (5 to 32 bytes) used to name
the entity in SNMP messages and used as an index in some tables. The tag must be
unique across the administrative domain in which it is used or globally unique.
How the tag is constructed is up to the developer; however, RFC 3411 suggests
several options that can be used to decrease the probability of non-unique IDs in a
domain. Also associated with each entity is a boots counter. This is a count of the
number of times that the system has been re initialized since its initial
configuration. The following sections describe how the ID and boots information
is used, which depends on which models are in use.
NOTE: According to RFC 3414, you must store the engine ID boot counter in
non-volatile storage.
6.1.2 Contexts
Contexts are defined by an engine ID and a name and are used to specify where
the information being processed is available. The engine ID specifies the entity that
is the target of a command request or the originator of a notify. For agents, the
context engine ID should match the local engine ID.
51
Wind River SNMP
Programmer's Guide, 10.5
The name can be used to select amongst different sets of objects on the given entity.
The default name is the zero length string.
The user security model describes how an SNMP message can be authenticated,
protected from disclosure, and given some protection against being replayed. In
this model, one end of a communication is defined to be authoritative for the
security information. For command requests and informs, the receiver is deemed
to be authoritative: for traps, responses and reports, it is the sender. The engine ID,
the number of times that the engine has rebooted, and time information of the
authoritative engine are included in the packet and validated by the receiver. It is
the responsibility of the originator of the packet to acquire any security
information it needs. The engine ID can be predetermined or it can be learned
through some sort of discovery process.
In most cases an engine (A) learns the number of reboots and time information of
some other engine (B) automatically. A sends B a request message with an incorrect
number of engine reboots or time information. B returns an error report with the
correct number of engine reboots and time information which A can then save for
future reference. This auto-synchronizing feature works only when the time
information the non-authoritative entity (A) is maintaining about the authoritative
entity (B) is earlier than the actual information stored on the authoritative entity
(B). Simple agents that respond only to command requests need only to know their
own engine ID, number of reboots and time information. More complicated
entities need to know the information for other entities.
The currently specified algorithms use shared keys either to authenticate a user or
to provide protection from disclosure. Authentication is provided by a
keyed-digest algorithm that uses private keys. Wind River SNMP supports two
digests: HMAC-MD5-96 and HMAC-SHA-96. Privacy is provided by use of
CBC-DES or CFB128-AES-128. The user table provides a place for these keys to be
stored, as well as information about which algorithms a given user can use. It also
defines a standard way of manipulating this security information via SNMP. An
entry in the user table is indexed by the engine ID of the entity that is authoritative
for this entry and by a user name that is a string representing the name of the user.
As with the engine information above, it is the responsibility of the originator of
the request to acquire the user entry information. Simple agents can store all of
their user entries in some sort of non-volatile memory and initialize the database
at boot time. More complicated entities can allow for some form of discovery.
These entities can make use of the password-to-key transform described in the user
security model. This transform takes a password and an engine ID (generally the
ID of the authoritative engine) and uses one of the digesting routines to create a
key. On a manager, such a scheme could be used to allow a previously unknown
user to enter their password and, after discovering the engine ID of the target,
create the user entry necessary to communicate with the target.
52
6 SNMPv3
6.1 Description
Agreement Method and RFC 2786 Diffie-Helman USM Key Management Information
Base and Textual Convention. Wind River SNMP supports a textual convention for
performing Diffie-Hellman key exchanges, as well a set of objects which extend the
usmUserTable to permit the use of a DH key exchange in addition to the key
change method described in RFC 3414. This MIB adds the possibility of forward
secrecy to the USM model.
The group table maps a user’s security names to group names. This model can be
used to allow multiple users to share a single set of access control information, thus
reducing the number of entries in the access table.
The access table is used to map a user to the views of the MIB they are permitted
to use. Which entry to use when processing a given message is determined by the
group and context names associated with the message, the security model, and the
security level being used to process the packet. Once an entry is selected, the name
of the view to use is selected from the entry’s set of read, write, and notify views.
If the view is the zero length string, no access to the MIB is granted.
A family of entries in the view table serve to specify the list of objects that are
accessible.
You use five MIB tables to determine how and where to send notifications: notify
table, target address table, target parameters table, notify filter profile table, and
notify filter table. Each table is described separately later in this chapter. The flow
of information between the tables is as follows:
1. Each entry in snmpNotifyTable uses a tag to map to one or more entries in the
snmpTargetAddrTable, which contains information about retransmissions,
time-outs, and addressing.
2. Each entry in the snmpTargetAddrTable maps to exactly one entry in the
snmpTargetParamsTable, which contains information about SNMP version
and security.
3. Each entry in the snmpTargetParamsTable maps to exactly one entry in the
snmpNotifyFilterProfileTable, which contains information used to group
rows in the snmpNotifyFilterTable.
4. Each entry in the snmpNotifyFilterProfileTable maps to one or more entries
in the snmpNotifyFilterTable, which contains a list of filters.
5. Wind River SNMP checks every outgoing VarBind in the notify to verify that
it is authorized to send the message to that particular target.
This section describes in detail the steps that Wind River SNMP take upon
receiving each of the four categories of PDUs with which a proxy forwarder must
concern itself.
53
Wind River SNMP
Programmer's Guide, 10.5
NOTE: Wind River SNMP uses no wild cards in snmpProxyTable entry matching.
If more than one match is found, Wind River SNMP uses the row in the
snmpProxyTable that is lexicographically first, as RFC 3413 specifies.
2. From the chosen row in the snmpProxyTable, Wind River SNMP looks up
snmpProxySingleTargetOut, which selects an entry in the
snmpTargetAddrTable.
At this point, Wind River SNMP should have a valid target. If Wind River
SNMP has not found a valid target, then it increments the snmpProxyDrops
counter and stops processing the packet. If Wind River SNMP does have a
valid target, it constructs an appropriate PDU to send to the valid target.
Wind River SNMP should have all the necessary information except the
msg_id and the security engine id. The proxy forwarder will generate a unique
msg_id to be used in the forwarded PDU. If Wind River SNMP does not
already know what engine id corresponds to a given target, it constructs a
probe packet (an empty request sent to the target) in an effort to learn the
engine id.
Wind River SNMP sets the new request to point to the varbind list of the
original request, for the sake of efficiency. This may not work in some cases
where a request needs to be retransmitted with a changed varbind list. It also
requires some diligence to make sure that Wind River SNMP does not try to
free the memory used by the varbind multiple times.
3. Wind River SNMP stores information about the received request in a proxy
control block as part of a global linked list, indexed by message id., in order to
send any responses back.
4. Wind River SNMP forwards the SNMP request, using the function the
customer defines in the ENVOY_SEND_SNMP_PROXY( ) user-exit. This
function uses an IO_COMPLETE_T structure. Currently, the cookie is set to
54
6 SNMPv3
6.1 Description
NULL, although Wind River SNMP reserves this space for future use as
appropriate.
5. Wind River SNMP puts a timestamp into the request's proxy block structure,
and sends the request. Wind River SNMP monitors the proxy block list by a
timer which fires at an interval equal to the number of milliseconds set in the
variable PROXY_SWEEP_TIME, and cleans up all proxy blocks which have
been waiting longer than the value set in snmpTargetAddrTimeout for their
target. In this case, the RFC specifies that no response should be sent back to
the originator of the request. The timer will only fire if the list of waiting proxy
requests is not empty.
Notification-Class PDUs
55
Wind River SNMP
Programmer's Guide, 10.5
When the proxy forwarder code in Wind River SNMP receives a Response-Class
PDU or an Internal-Class PDU, it must determine whether the request id for the
PDU matches any of the forwarded requests found in the proxy control block list.
If Wind River SNMP finds a match, it constructs a response using the information
from the originally received PDU.
The proxy block is cleaned up and removed, and then the response is sent. In the
case of a Confirmed-Class Notification-Class PDU, which may have been sent to
multiple targets, additional responses received will simply be dropped, since only
one response is needed.
The coexistence standard affects the protocol operation of Wind River SNMP in
three primary areas:
■
Receiving and Processing SNMPv1/v2c PDUs
■
Constructing and Sending Notifies
■
Proxy Forwarding
56
6 SNMPv3
6.1 Description
into the Community table and does view selection automatically. You must, of
course, populate the Community table.
57
Wind River SNMP
Programmer's Guide, 10.5
■
If the PDU-type is GET, GETNEXT, or GETBULK, Wind River SNMP sets
the view to the value of vacmAccessReadViewName
■ If the PDU-type is SET, Wind River SNMP sets the view to the value of
vacmAccessWriteViewName
6. Having a view to use for the packet, Wind River SNMP processes the
remainder of the PDU using the existing SNMP engine.
Under the Wind River SNMP coexistence code scheme, users may send SNMPv1,
v2c, or v3 notifications to a variety of targets using the
SNMP_Send_Notify_Name( ) routine.
The snmpTargetParamsTable has a field called snmpTargetParamsMPModel,
which indicates what SNMP version an outgoing notify should use. Wind River
SNMP coexistence code supports MPModels of 0 (SNMPv1), 1 (SNMPv2c) and 3
(SNMPv3).
58
6 SNMPv3
6.1 Description
In either case, Wind River SNMP performs all appropriate checking, including
filter and view checking to ensure that the contents of the notification are
allowed to be sent to the given target.
In certain cases the Received Packet Manager does not send the proper number
of SNMPv3 INFORM PDUs (including an original INFORM PDU request for
an engineID), and the SNMP engine may timeout before it receives a
successful response. There is a mechanism to manage responses or to indicate
a timeout on the connection.
There are two callback routines defined in the RETRANS_COOKIE_T data
structure in sendntfy.h:
typedef struct RETRANS_COOKIE_S{
struct RETRANS_COOKIE_S *next;
int ref_cnt;
RETRANS_CLEANUP_T *cleanup_rtn;
ACK_CALLBACK_T *ack_rtn;
TIMEOUT_CALLBACK_T *timeout_rtn;
PTR_T cookie;
} RETRANS_COOKIE_T;
The cleanup_rtn, ack_rtn and timeout_rtn callback routines all use the same
cookie value.
The header file snmpdefs.h defines the callback routines:
typedef void ACK_CALLBACK_T __((ptr_t cookie));
typedef void TIMEOUT_CALLBACK_T __((ptr_t cookie));
Proxy Forwarding
The Wind River SNMP coexistence code has to handle two cases:
■ Receiving SNMPv1 or SNMPv2c PDUs
■ Sending out SNMPv1 and SNMPv2c PDUs.
59
Wind River SNMP
Programmer's Guide, 10.5
GetBulkRequest-PDUs
Trap-PDUs
If Wind River SNMP receives a Trap-PDU (used for SNMPv1) which needs to be
forwarded using either SNMPv2c or SNMPv3, Wind River SNMP translates the
PDU into an SNMPv2-Trap-PDU.
SNMPv2-Trap-PDUs
InformRequest-PDUs
60
6 SNMPv3
6.2 Database Initialization
installDir/vxworks-6.x/target/src/wrn/wm/snmp/vxagent/base
Every entity must have an engine ID that is used to identify that entity to other
SNMPv3 entities. Each entity also needs to maintain a boots counter, which counts
the number of times it has re initialized itself since its initial configuration. To insert
this information into Wind River SNMP, you must call the following routine. Use
this routine when some of the information changes, for example, if the clock wraps
and the boots field should be incremented:
SNMP_Engine_Set_My_Info( )
The engine table is a list of the engines known to this entity. You will need to
populate this table with any foreign engines that will be authoritative for messages
this entity might process. You can add a new engine with the following routine:
SNMP_Engine_Install( )
Using 0 for the boots and timestamp fields allows SNMPv3 to automatically
synchronize the boots and time information. The mechanism for this
synchronization returns a usmStatsNotInTime report instead of a response for
some messages. Applications that can encounter this mechanism must be prepared
for these reports.
If you are using SNMPv3 notifies, it is also possible to associate an address and
address class with a foreign engine using the following routine:
SNMP_Engine_Set_Address( )
How you determine which engines to add to the table is up to you. One simple
way to populate the table is to store information about the foreign engines in
non-volatile storage and to populate the table when the system restarts. We also
supply a macro that, when defined, is called when an unknown engine ID is found
while processing a packet. If you wish to allow for discovery of new engines, you
can define this macro to add the engine to the engine table:
ENVOY_ADD_ENGINE_ID( )
Most likely you would also add a new user to the user table with the new engine
ID as one of its indices.
With SNMPv3 notifies, it can also be necessary to associate an address with a
newly-received engine ID. The following macro is automatically defined if
SNMPv3 notifies are enabled—you can change its definition and behavior at your
discretion:
ENVOY_ADD_ENGINE_ADDRESS( )
This macro is used instead of ENVOY_ADD_ENGINE_ID( ), if it is defined. If
necessary, this macro adds the engine ID to the engine table.
61
Wind River SNMP
Programmer's Guide, 10.5
Contexts are required for entities that act in a command responder or notification
originator role (basically an agent). It is up to you as to which contexts you
implement. Most agents should include the default context that is named by the
zero length string. Before a context is available for use on your system, you need
to add it to the context table:
SNMP_V3_Context_Add( )
The access and group tables are used on a command responder or notification
originator to determine which view to use when processing a request or creating a
notification:
SNMP_Group_Create( )
SNMP_Group_Set_Status( )
SNMP_Group_Install( )
SNMP_V3_Access_Create( )
SNMP_V3_Access_Set_Status( )
SNMP_V3_Access_Install( )
The user table is required on all entities. It contains the authentication and privacy
information that is used to secure the packet. As with the engine information, you
can populate this table from information stored in non-volatile memory, or you can
add entries as new users arrive and engine IDs are discovered:
SNMP_User_Create( )
SNMP_User_Set_AuthKey( )
SNMP_User_Set_PrivKey( )
SNMP_User_Set_Status( )
SNMP_User_Install( )
The target address table is required for all notification originators. It contains
domain and addressing information that allows applications, such as the
notification originator, to determine where to send notifications. It also contains
information about how often and how quickly packets should be retransmitted.
You can populate this table from information stored in non-volatile memory, or
you can add entries as new target addresses are discovered:
SNMP_Target_Addr_Create( )
SNMP_Target_Addr_Set_Status( )
SNMP_Target_Addr_Set_TAddress( )
SNMP_Target_Addr_Set_Params( )
SNMP_Target_Addr_Install( )
62
6 SNMPv3
6.2 Database Initialization
The target params table is used in conjunction with the target address table. It is
required for all notification originators. It contains information about SNMP
versions and security levels that is used when sending notifications to particular
domains and addresses. This information is separate from the target address table
to allow multiple rows in the target address table to correspond to a single row in
the target paramstable. You can populate this table from information stored in
non-volatile memory, or you can add entries as new targets are discovered:
SNMP_Target_Params_Create( )
SNMP_Target_Params_Set_MP_Model( )
SNMP_Target_Params_Set_Sec_Model( )
SNMP_Target_Params_Set_Sec_Name( )
SNMP_Target_Params_Set_Status( )
SNMP_Target_Params_Install( )
The notify table is required for all notification originators. It contains information
about how to group targets for sending notifications and what type of notification
to send. This table can be populated from non-volatile memory, or you can add
entries dynamically:
SNMP_Notify_Create( )
SNMP_Notify_Set_Status( )
SNMP_Notify_Install( )
The notify filter profile table is required for all notification originators. It is used to
obtain a list of filters to be applied against a notify to test the validity of a target.
This table can be populated from non-volatile memory, or you can add entries
dynamically:
SNMP_Notify_Profile_Create( )
SNMP_Notify_Profile_Set_Profile( )
SNMP_Notify_Profile_Set_Status( )
SNMP_Notify_Profile_Install( )
The notify filter table is required for all notification originators. It defines filters
used to limit the number of notifications generated for particular targets. This table
can be populated from non-volatile memory, or you can add entries dynamically:
SNMP_Notify_Filter_Create( )
SNMP_Notify_Filter_Set_Status( )
SNMP_Notify_Filter_Install( )
63
Wind River SNMP
Programmer's Guide, 10.5
The Proxy table is required for proxy forwarding operations, and is used to define
translations between management targets for use when forwarding messages. This
table can be populated from non-volatile memory, or you can add entries
dynamically:
SNMP_Proxy_Create( )
SNMP_Proxy_Set_Status( )
SNMP_Proxy_Install( )
If you allow any of the SNMPv3 tables to be accessed with SNMP, you can choose
to implement the following macros. These macros are required if you want
changes to the view table saved across reboots. You can also use them to
implement policies concerning modifying the tables.
You are responsible for deciding what information to store in non-volatile memory,
and the appropriate method to move the information to non-volatile memory.
The definition for these macros should go in the main section of envoy.h. The file
nvutils.c contains sample macro implementations. In VxWorks, this file is located
in the directory:
installDir/vxworks-6.x/target/src/wrn/wm/demo/lib
All of the macros can be left in their default state if the functions are not desired.
The default for the test functions is to return NO_ERROR. The default for the other
macros is to do nothing.
We have defined this large number of macros to provide you fine-grained control.
You may find it more convenient to write a smaller number of routines and use
your envoy.h file to map the macros to your routines.
The test routines are called during the test phase of a request. For each test routine
that returned successfully Wind River SNMP calls a set routine as part of the
commit phase or, when another test routine has failed, calls a back out routine. For
each set routine that returned successfully, Wind River SNMP calls the finished
routine as an end of processing marker or, if another set method routine failed, an
64
6 SNMPv3
6.2 Database Initialization
SNMP_V3_ACCESS_DESTROY_TEST( ) SNMP_V3_NPROF_DESTROY_TEST( )
SNMP_V3_ACCESS_CREATE_TEST( ) SNMP_V3_NPROF_CREATE_TEST( )
SNMP_V3_ACCESS_UPDATE_TEST( ) SNMP_V3_NPROF_UPDATE_TEST( )
SNMP_V3_ACCESS_DESTROY_BACKOUT( ) SNMP_V3_NPROF_DESTROY_BACKOUT( )
SNMP_V3_ACCESS_CREATE_BACKOUT( ) SNMP_V3_NPROF_CREATE_BACKOUT( )
SNMP_V3_ACCESS_UPDATE_BACKOUT( ) SNMP_V3_NPROF_UPDATE_BACKOUT( )
SNMP_V3_ACCESS_DESTROY_SET( ) SNMP_V3_NPROF_DESTROY_SET( )
SNMP_V3_ACCESS_CREATE_SET( ) SNMP_V3_NPROF_CREATE_SET( )
SNMP_V3_ACCESS_UPDATE_SET( ) SNMP_V3_NPROF_UPDATE_SET( )
SNMP_V3_ACCESS_DESTROY_UNDO( ) SNMP_V3_NPROF_DESTROY_UNDO( )
SNMP_V3_ACCESS_CREATE_UNDO( ) SNMP_V3_NPROF_CREATE_UNDO( )
SNMP_V3_ACCESS_UPDATE_UNDO( ) SNMP_V3_NPROF_UPDATE_UNDO( )
SNMP_V3_ACCESS_FINISHED( ) SNMP_V3_NPROF_FINISHED( )
SNMP_V3_COMM_DESTROY_TEST( ) SNMP_V3_PROXY_DESTROY_TEST( )
SNMP_V3_COMM_CREATE_TEST( ) SNMP_V3_PROXY_CREATE_TEST( )
SNMP_V3_COMM_UPDATE_TEST( ) SNMP_V3_PROXY_UPDATE_TEST( )
SNMP_V3_COMM_DESTROY_BACKOUT( ) SNMP_V3_PROXY_DESTROY_BACKOUT( )
SNMP_V3_COMM_CREATE_BACKOUT( ) SNMP_V3_PROXY_CREATE_BACKOUT( )
SNMP_V3_COMM_UPDATE_BACKOUT( ) SNMP_V3_PROXY_UPDATE_BACKOUT( )
SNMP_V3_COMM_DESTROY_SET( ) SNMP_V3_PROXY_DESTROY_SET( )
SNMP_V3_COMM_CREATE_SET( ) SNMP_V3_PROXY_CREATE_SET( )
SNMP_V3_COMM_UPDATE_SET( ) SNMP_V3_PROXY_UPDATE_SET( )
SNMP_V3_COMM_DESTROY_UNDO( ) SNMP_V3_PROXY_DESTROY_UNDO( )
SNMP_V3_COMM_CREATE_UNDO( ) SNMP_V3_PROXY_CREATE_UNDO( )
SNMP_V3_COMM_UPDATE_UNDO( ) SNMP_V3_PROXY_UPDATE_UNDO( )
SNMP_V3_COMM_FINISHED( ) SNMP_V3_PROXY_FINISHED( )
SNMP_V3_NFILT_DESTROY_TEST( ) SNMP_V3_TPARAM_DESTROY_TEST( )
SNMP_V3_NFILT_CREATE_TEST( ) SNMP_V3_TPARAM_CREATE_TEST( )
SNMP_V3_NFILT_UPDATE_TEST( ) SNMP_V3_TPARAM_UPDATE_TEST( )
65
Wind River SNMP
Programmer's Guide, 10.5
(cont’d)
SNMP_V3_NFILT_DESTROY_BACKOUT( ) SNMP_V3_TPARAM_DESTROY_BACKOUT( )
SNMP_V3_NFILT_CREATE_BACKOUT( ) SNMP_V3_TPARAM_CREATE_BACKOUT( )
SNMP_V3_NFILT_UPDATE_BACKOUT( ) SNMP_V3_TPARAM_UPDATE_BACKOUT( )
SNMP_V3_NFILT_DESTROY_SET( ) SNMP_V3_TPARAM_DESTROY_SET( )
SNMP_V3_NFILT_CREATE_SET( ) SNMP_V3_TPARAM_CREATE_SET( )
SNMP_V3_NFILT_UPDATE_SET( ) SNMP_V3_TPARAM_UPDATE_SET( )
SNMP_V3_NFILT_DESTROY_UNDO( ) SNMP_V3_TPARAM_DESTROY_UNDO( )
SNMP_V3_NFILT_CREATE_UNDO( ) SNMP_V3_TPARAM_CREATE_UNDO( )
SNMP_V3_NFILT_UPDATE_UNDO( ) SNMP_V3_TPARAM_UPDATE_UNDO( )
SNMP_V3_NFILT_FINISHED( ) SNMP_V3_TPARAM_FINISHED( )
SNMP_V3_NOTIFY_DESTROY_TEST( ) SNMP_V3_USER_DESTROY_TEST( )
SNMP_V3_NOTIFY_CREATE_TEST( ) SNMP_V3_USER_CREATE_TEST( )
SNMP_V3_NOTIFY_UPDATE_TEST( ) SNMP_V3_USER_UPDATE_TEST( )
SNMP_V3_NOTIFY_DESTROY_BACKOUT( ) SNMP_V3_USER_DESTROY_BACKOUT( )
SNMP_V3_NOTIFY_CREATE_BACKOUT( ) SNMP_V3_USER_CREATE_BACKOUT( )
SNMP_V3_NOTIFY_UPDATE_BACKOUT( ) SNMP_V3_USER_UPDATE_BACKOUT( )
SNMP_V3_NOTIFY_DESTROY_SET( ) SNMP_V3_USER_DESTROY_SET( )
SNMP_V3_NOTIFY_CREATE_SET( ) SNMP_V3_USER_CREATE_SET( )
SNMP_V3_NOTIFY_UPDATE_SET( ) SNMP_V3_USER_UPDATE_SET( )
SNMP_V3_NOTIFY_DESTROY_UNDO( ) SNMP_V3_USER_DESTROY_UNDO( )
SNMP_V3_NOTIFY_CREATE_UNDO( ) SNMP_V3_USER_CREATE_UNDO( )
SNMP_V3_NOTIFY_UPDATE_UNDO( ) SNMP_V3_USER_UPDATE_UNDO( )
SNMP_V3_NOTIFY_FINISHED( ) SNMP_V3_USER_FINISHED( )
During initialization, Wind River SNMP adds any installed authentication and
privacy routines. These additions can fail when there is not enough memory or the
underlying digest or encryption routines are not available. Since this is not likely
to occur in routine operation, the main initialization routine does not return an
error. If you need to verify that security has been installed, you can attempt to find
the authentication or privacy structure, possibly as part of initializing the users
that rely on those structures.
66
6 SNMPv3
6.2 Database Initialization
While Wind River SNMP includes code to implement the currently specified
authentication and, for domestic customers, privacy routines, it also includes the
following routines to allow you to add your own routines:
SNMP_Auth_Add( )
SNMP_Priv_Add( )
The following routine is useful for translating password-like strings into keys,
according to the SNMPv3 key localization scheme:
SNMP_V3_Pass2Key( )
67
Wind River SNMP
Programmer's Guide, 10.5
68
7
Using Wind River SNMP AgentX
7.1 Introduction 69
7.2 Wind River SNMP and User-Supplied AgentX Routines 70
7.3 Constructing a Master Agent 71
7.4 Constructing a Subagent 73
7.1 Introduction
AgentX is an extension of the SNMP protocol that enables master agents and
subagents to interact in a standardized way. The Wind River SNMP AgentX API
allows you to create subagents that support your MIB and work with any AgentX
master agent. You can also create Wind River SNMP AgentX master agents that
can interact with any AgentX subagents, whether or not they were created with the
Wind River SNMP AgentX API.
■
AgentX Master Agents
69
Wind River SNMP
Programmer's Guide, 10.5
For more information on the AgentX protocol, see RFC 2742: Definitions of Managed
Objects for Extensible SNMP Agents, and RFC 2741: Agent Extensibility (AgentX)
Protocol Version 1.
ENVOY_AX_ADMINT_T( )
void ENVOY_AX_ADMIN_T (ptr_t cookie, ptr_t ax_pkt)
Called to handle errors and free any resources associated with the cookie.
ENVOY_AX_ADD_T( )
void ENVOY_AX_ADD_T (ptr_t cookie)
70
7 Using Wind River SNMP AgentX
7.3 Constructing a Master Agent
interact with user-supplied code. For more information on these routines, see the
Wind River SNMP API reference entries.
The Wind River SNMP API does not provide a transportation mechanism, nor is
one specified by the AgentX protocol. Although the examples in this chapter use
sockets, the API does not require sockets.
NOTE: The user must provide a MIB and the method routines to support it.
71
Wind River SNMP
Programmer's Guide, 10.5
No more data
72
7 Using Wind River SNMP AgentX
7.4 Constructing a Subagent
73
Wind River SNMP
Programmer's Guide, 10.5
prepares a memory area to buffer data into AgentX packets. This is needed
because a stream-type interface, rather than packet-based sockets interface, is
used in the sample code.
3. The subagent opens a session with the master agent. According to the AgentX
protocol a session must be opened and one or more sub trees registered with
the master agent before any requests will be sent to the subagent. The open
procedure follows the flow of operations depicted in Figure 7-3, which is
essentially the same for registering and closing in addition to other common
operations such as pinging and setting agent capabilities. The difference
between these operations is in the type of packet created in the first step. To
open a session, call the function envoy_ax_pkt_create_open( ).
OPEN procedure
REGISTER procedure
74
7 Using Wind River SNMP AgentX
7.4 Constructing a Subagent
4. The subagent waits for the master agent to respond to the open request. When
data is available, it reads it and calls the envoy_ax_chunk_handler( ) routine,
repeating the process until no more data is available. The arguments to the
envoy_ax_chunk_handler( ) routine include your four completion routines, a
pointer to the received data, the number of bytes received, and a pointer to the
chunk, which is the data area initialized by the envoy_ax_chunk_init( )
routine. The third argument is a pointer to the function which should be called
when enough data has been received to constitute an AgentX packet. For a
subagent, this should always be the envoy_ax_sa_handler( ) routine. If an
error occurs while receiving data or calling the envoy_ax_chunk_handler( )
routine, close the connection (for sockets, call the close( ) routine) and call the
envoy_ax_chunk_clean( ) routine to clean up the connection and release
resources.
NOTE: At this point, robust subagents might attempt to reconnect to the master
agent to reregister their objects.
5. After opening the session, the subagent registers the MIB sub tree it wants to
manage. The OID of the MIB sub tree is passed as an argument to the packet
creation routine envoy_ax_pkt_create_registrations( ). The rest of the
registration procedure is the same as the open procedure. Repeat the
registration procedure for each MIB sub tree that you want the subagent to
register. For a source code example of session opening and subagent
registration, see the function axSubagentInit( ) in the file ax_sub.c.
6. After registration, the subagent waits to receive requests from the master
agent. If you use sockets, call the select( ) routine. When data is available, it is
read and passed to the envoy_ax_chunk_handler( ) routine with the same
arguments as described above. The task continues to function as a subagent as
long as data is read and passed to the envoy_ax_chunk_handler( ) routine. For
a source code example, see the function snmpAxSubagentTask( ) in the file
ax_sub.c. This file is available for VxWorks and is located in the following
directory:
installDir/vxworks-6.x/target/src/wrn/wm/snmp/vxagent/ax_sub
75
Wind River SNMP
Programmer's Guide, 10.5
Create packet:
OPEN: Call envoy_ax_pkt_create_open( )
REGISTER: Call envoy_ax_pkt_create_registrations( )
CLOSE: Call envoy_ax_pkt_create_close( )
Return OK
76
8
Server
77
Wind River SNMP
Programmer's Guide, 10.5
78
8 Server
8.4 MIB Variables
Simple variables (for example, those not in a table) in the same address space as the
SNMP program can be referenced from the MIB tree using the generic method
routines without writing additional code.
MIB tables always require additional code from you: code for decoding the
instance part of the MIB variable’s object identifier (OID), doing the table lookup,
and computing the next function. Most tables also require code to access the
variables themselves, as they are not simple variables in memory whose address
can be compiled into the internal MIB tree.
Another method for attaching variables is the subagent approach. In this scheme,
a subagent can dynamically register objects and instances with a master agent. In
the subagent, you need to have routines as described above. During registration,
new nodes are created and added to the MIB tree on the master agent. These nodes
will use a special group of method routines that collect the appropriate
information from the packet and send it to the subagent. On the subagent side,
Wind River-supplied code examines this new message and calls the appropriate
customer-supplied method routines in the subagent space. The method routines in
a subagent use the same API as those in a master agent or in a monolithic agent.
When the method routines are finished, a response is assembled and returned to
the master agent. The returned message is examined and integrated into the packet
structure on the master.
The MIB is generally defined in mib.c. The MIB is represented within the SNMP
code as a tree of data structures. The branches of the tree correspond to the
components of the object identifiers naming the management objects. The
sequence of components in an object identifier forms a path through the tree
leading to a leaf on the tree.
The leaves of the tree are data structures describing how to get to the actual
variable holding the data. Each leaf contains pointers to four procedures used to
deal with the variable. These are getproc, setproc, testproc, and nextproc. The
Wind River MIB Compiler assists in creating the MIB tree. It takes MIB and control
files and can produce header or structure files for use with Wind River SNMP. For
more information see the Wind River MIB Compiler User’s Guide.
Each internal node of the tree is defined by an instance of MIBNODE_T. Each leaf
is defined by an instance of MIBLEAF_T.
Associated with each internal leaf is a list of the nodes and leaves descending from
that node. This list is defined by an array of instances of MIBARC_T. Each list must
contain at least one element.
The file mib.h defines a number of C macros to simplify the creation of the MIB
tree. For VxWorks, this file is located in the following directory:
installDir/vxworks-6.x/target/h/wrn/wm/snmp/engine
79
Wind River SNMP
Programmer's Guide, 10.5
described in C. Wind River SNMP Macro Entries. The MIB root is generally defined
at the end of the MIB file, which by default is mib.c.
The Wind River MIB Compiler is a Wind River software tool used to aid MIB
instrumentors. The Wind River MIB Compiler compiles textual descriptions of
MIBs into a number of different output formats, including the mib.c file needed to
interface Wind River SNMP to its MIB. For more information about the Wind River
MIB Compiler, see the Wind River MIB Compiler User’s Guide.
The MIB tree can be expanded in three ways. It can be expanded statically by
modifying mib.c. Normally you would do this by running the MIB compiler again
with an expanded set of input files. If you need to extend mib.c manually, which
is not recommended, use the same structures as the basic MIB tree.
The module mib.c should be extended with NODE( ), NODE_NT( ), ARC( ),
END_OF_ARC_LIST( ), and leaf macros. Wind River SNMP currently uses the
LEAF_NT_ASYS( ), LEAF_NT_ASY( ), LEAF_NT_COMS( ) and LEAF_NT_COM( )
macros. There are a few naming conventions that apply to these macros:
■ If the last character of the macro’s name is S, you can use the macro for a static
structure.
■
If the macro’s name contains the string ASY, you can use the macro for method
routines that access the asynchronous API directly.
■
If the macro’s name contains the string COM, you can use the macro for
backward-compatibility with obsolete (prior to Envoy 8.0) synchronous API.
The structure of mib.c is upside down—NODE( ) or NODE_NT( ) macros
immediately follow the associated list of ARC( ) macros. Descendant NODE( )
macros precede superior nodes; leaf macros precede the list of ARC( ) entries that
reference the leaves. Further note that the number that corresponds to the last
component of the object identifier for an internal node or leaf is found in the ARC( )
macro attached to the superior node.
80
8 Server
8.4 MIB Variables
Another way to modify the MIB tree is to add nodes to it dynamically, or remove
nodes from it dynamically, using the Add_Node_From_Root( ) and
Remove_Node_From_Root( ) functions. To use these functions, you must create a
node and use the node’s OID to add the node to the tree. You can also use the
subagent mechanism, which effectively expands the MIB tree as you register new
objects.
In most cases, the user’s extensions fall under the enterprise branch of the MIB.
The user must obtain an enterprise number from the appropriate naming authority,
which can be found in the most recent Assigned Numbers RFC (currently
RFC 1700). At the time of this writing, an enterprise number can be obtained from:
http://pen.iana.org/pen/PenApplication.page
For further contact information:
Internet Assigned Numbers Authority
P.O. Box 12607 Marina Del Rey, California 90292-3607
iana@iana.org
The connection between Wind River SNMP and the system management variables
is made by the leaves of the MIB tree.
Leaves of the MIB are constructed by the LEAF_NT_ASY and LEAF_NT_ASYS
macros:
LEAF_NT_ASY(LN, CN, NT, NM, VT, AC, TB, TS, GT, ST, NX, CKE, LOC, VMK, WMK)
81
Wind River SNMP
Programmer's Guide, 10.5
VT_GAUGE
VT_TIMETICKS
VT_OPAQUE
VT_COUNTER64
AC
Should be one of the following manifest constants: READ_ACCESS (for
Read-Only), WRITE_ACCESS (for Write-Only), or READ_WRITE_ACCESS (for
Read-Write) (defined in h/mib.h).
TB
Either TABULAR or SCALAR to specify if this object belongs to a table or not.
TS
This is an access function to test the accessibility of a variable (testproc). This
test is above and beyond the constraints imposed by the access parameter
described above. For scalar variables, additional testing is rarely needed; use
the standard routine it_exists_async( ) (for the asynchronous API).
GT
This is an access function to retrieve the value of a variable (getproc).
ST
This is an access function to assign a new value to a variable (setproc).
NX
This is an access function to assist in the location of the SNMP lexicographical
successor of a given object identifier (nextproc). For scalar variables, use
std_next_async( ).
CKE
This is a cookie value that is passed to the access functions without change.
CKE is held as a pointer to a character. Consequently, the number of bits varies
from system to system.
The most frequent use of CKE is as a pointer to a directly addressable scalar
variable. A set of pre-written access functions can use the CKE to locate the
variable and perform the appropriate action.
LOC
This is a 16-bit value that is used as a shorthand name for an item in the MIB.
This is a holdover from an older version of Wind River SNMP. Another (and
usually better) shorthand is simply the address of the MIB leaf node itself.
VMK
This is a 32-bit value that indicates in which MIB views this element
participates (view mask).
WMK
This is a 32-bit value that indicates in which MIB views this element is
potentially writable (write mask).
If the ENVOY_SNMP_RFC2275_VIEWS option is installed, the RFC 3415 view table
is used. It is a more powerful method than the view masks above. For more
information on this mechanism, see RFC 3415 (which obsoletes RFC 2275). Set
these masks to 0 if you are not using them.
More information on these parameters and on the access functions themselves can
be found in the online help.
82
8 Server
8.5 Strategies for Building MIBs
Access functions are most easily used when the SNMP software exists within the
same address space as the management variables themselves. However, the SNMP
code can be within a user process, outside the system kernel, and thus access to
system variables can be through a memory driver (for example, /dev/kmem) or
I/O control system calls.
Typical LEAF_ASYS macros for a directly addressable scalar variable (one that
counts the number of hundredths of a second that have elapsed since system
startup) would appear as follows:
LEAF_ASYS(sysuptime_leaf, "sysUpTime", VT_TIMETICKS,
RO, SCALAR, it_exists_async, get_uint_async, null_set_async,
std_next_async, (char *)&system_clicks, 0x0000, 0xff, 0xff );
The system variable in this example is named system_clicks and is held as a signed
long. Although the local representation is a signed long, SNMP deals with this as
timeticks, an unsigned value.
You must generate a MIB tree fragment, using the MIB compiler's -start option.
For example, to generate a partial MIB tree for RFC 2571 (the SNMPv3 Framework
MIB), issue the following command:
mibcomp -o m2571.c -rootname v3_snmp_engine_node -start snmpEngine rfc2571.mib
v3mib.ctl
83
Wind River SNMP
Programmer's Guide, 10.5
NOTE: The actual command that you need to issue to generate the MIB fragment
file is somewhat longer, but the remaining options are relatively unimportant. For
more information concerning the complete command syntax in VxWorks, see the
file makefile.wmsnmp located in the following directory:
installDir/vxworks-6.x/target/src/wrn/wm/snmp/vxagent
The above command generates the output file m2571.c. The following declaration
appears at the top of this file:
/**
** Subtree Object Identifier for Add_Node_From_Root
** snmpEngine OBJECT IDENTIFIER ::= { snmpFrameworkMIBObjects 1 }
**/
STATIC OIDC_T oid_v3snmp_engine_node[] = { 1, 3, 6, 1, 6, 3, 10, 2, 1 };
OBJ_ID_T objid_v3snmp_engine_node = {
sizeof(oid_v3snmp_engine_node)/sizeof(OIDC_T),
oid_v3snmp_engine_node
};
These are the declarations for the top node of the partial MIB tree. You need them
to add this fragment to the main MIB tree. Now that you have the MIB tree
fragment, you need to write the code that adds the fragment to the main MIB tree.
The API call that adds the MIB fragment to the main MIB tree is called
Add_Node_From_Root( ). The function prototype for this routine is:
int Add_Node_From_Root(
MIBNODE_T * root,
OBJ_ID_T * objp,
MIBNODE_T * anode,
MIBNODE_T ** rnode
)
To add a MIB fragment to the main MIB tree, your initialization code must make a
call similar to the following:
-----------------begin code fragment---------------
/**
From RFC2571.MIB
84
8 Server
8.5 Strategies for Building MIBs
**/
/* RFC2571.MIB */
status = Add_Node_From_Root(&mib_root_node,
&objid_v3snmp_engine_node,
&v3snmp_engine_node,
&rnode);
}
There are some timing issues that you must consider when adding the MIB tree
fragments to the MIB tree:
1. When adding the MIB tree fragment before the SNMP agent has been
completely initialized (i.e. before you call the initStartSnmpd( ) routine), the
only concern is that your component be fully initialized (or at least in a
determinate state) before initializing the SNMP agent.
This is to prevent calls to your method routines from causing problems by
trying to get data from an uninitialized component.
2. When adding the MIB tree fragment after the SNMP agent has been initialized,
your component must be in a determinate state (as above). Additionally, you
must guard against the system processing any SNMP requests while you
manipulate the MIB tree.
Use the ENVOY_SNMP_GET_WRITE_LOCK( ) macro to grab the
SNMP_CoarseLock, using the following API call:
ENVOY_SNMP_GET_WRITE_LOCK(SNMP_CoarseLock);
85
Wind River SNMP
Programmer's Guide, 10.5
In some cases, you may need to add more than one MIB tree fragment to the main
MIB tree. The two MIB trees cannot overlap. This is particularly likely to be the case
at the top node.
For example, RFC 3415 (the VACM MIB) contains four main subsections:
■
vacmContextTable { vacmMIBObjects 1 }
■
vacmSecurityToGroupTable { vacmMIBObjects 2 }
■
vacmAccessTable { vacmMIBObjects 4 }
■
vacmMIBViews object { vacmMIBObjects 5 }
NOTE: The SNMP agent always adds the vacmMIBViews object to the main MIB
tree, whether SNMPv3 is a part of the installation or not. You only use the other
three objects if you have installed SNMPv3.
In order to avoid conflicts, generate a separate partial MIB tree for each of the four
objects and add them separately. This prevents any conflict over the
vacmMIBObjects node, under which all four objects exist.
86
8 Server
8.6 Method Routine Processing
The lastmatch and vbp parameters to the access functions are important tools to
avoid writing a special set of functions for each separate tabular variable.
The nextproc access function is usually the most difficult access function to write.
The function must locate the successor, if any, to the given object.
The data structure for leaf nodes of the MIB tree contains a cookie field. For the
built-in access functions for scalar variables, the cookie is, by convention, the
address of the target management variable. For tabular variables, or where you
choose to bypass the built-in functions, you are free to place any value in the leaf
structure. You can access this field using the VB_TO_COOKIE( ) macro.
The vb_link field in the VB_T structure is available to the application as a means
to link related VarBinds to one another. For example, during the first user-exit or
during the calls to the testprocs, the application could link a number of related
VarBinds so that they could be processed together during the setprocs or in a
subsequent user-exit.
The routines group_by_getproc_and_instance( ), vb_extract_row_loose( ) and
vb_extract_row( ) are provided to help you group VarBindstogether. For more
information about them, consult the online help.
You can also use the locator field of the MIBLEAF_T structure to help an application
find related VarBinds in a query. The locator can be used to assign a unique, easily
handled, numeric name to each item in the MIB. The scan_vb_for_locator( ) and
index_to_vbp( ) procedures are available to determine whether a VarBindList
contains particular items. For tabular elements of the MIB, it is necessary to
examine instance information once a VarBind entry has been located in a query.
For example, the elements of the IP routing table, ipRouteDest through
ipRouteAge, could be assigned names 1001 through 1010. Suppose that the first
user-exit or a testproc finds that the SET REQUEST is attempting to set
ipRouteDest. The scan_vb_for_locator( ) and index_to_vbp( ) procedures could
be used to determine whether the request also contained a related set on
ipRouteNextHop (remember that ipRouteDest and ipRouteNextHop need the
same instance to be related). Once found, the entry for ipRouteNextHop could be
linked via the vb_link field in the VB_T for ipRouteDest. And the VB_T for
ipRouteNextHop can be marked for bypassing of testproc processing. Then, when
the setproc for ipRouteNextHop is called, it can use vb_link to find the entry for
ipRouteDest and set both at the same time, at which point the entry for
ipRouteNextHop would be marked as set to bypass its setproc.
This example is a bit simplistic in that it is likely the code wants to correlate more
than just two variables, and the variables can occur in any order in the
VarBindList. The vb_link field is completely under the application’s control. It can
be used to build a list or a ring of related elements. One simplifying fact is that the
VarBindList is always scanned in the same order, so testprocs or setprocs can be
bypassed if that operation is marked as already done by an earlier user-exit,
testproc, or setproc.
87
Wind River SNMP
Programmer's Guide, 10.5
GET REQUEST PDUs are handled in the module getpdu.c, which is accessed from
rpktasy.c.
Another VarBindList is allocated and initialized to hold the response information.
Then the request VarBindList is processed in two passes. In the first pass, each
variable’s leaf is located and checked for visibility in the current MIB view.
In the second pass, Wind River SNMP calls the getprocs to do instance-level
testing and to find the values for the objects. Each getproc is responsible for
installing the value in the vbp by calling one of the getproc_got_* functions
described in 10. Method Routines. A getproc can also assume responsibility for
other vbps in which case it should call one of the getproc_got_* functions on the
vbps’ behalf.
An exception is generated if an object does not exist (VT_NOSUCHOBJ) or if an
instance does not exist (VT_NOSUCHINS). In SNMPv2, these exceptions are
incorporated into the response and processing of the packet continues. For other
errors or in SNMPv1, the response VarBindList is discarded and the original list is
converted into a response with an appropriate error code and encoded into a
buffer.
Wind River SNMP calls SNMP_Continue( ) after all the getproc routines have
been started. You should also call it when any deferred tasks complete. (A deferred
task is one that was started by a getproc but that did not complete before the
getproc returned.) It will examine the packet and if all of the tasks have been
completed, it will cause the response to be encoded into a buffer for transmission
by calling the completion routine.
88
8 Server
8.6 Method Routine Processing
GET NEXT, and GET BULK REQUEST PDUs are handled in the module nextpdu.c,
which is called from rpktasy.c.
Another VarBindList is allocated and initialized to hold the response information.
Then the request VarBindList is processed in multiple passes. For each vbp, the
first pass locates a leaf which has an object id that is the first successor to the object
id of the vbp that is visible in the current MIB view.
In the next pass Wind River SNMP calls the nextprocs to do instance-level
searching and to find the object ID and value for the vbp. The nextproc should call
one of the getproc_got_* functions to install the value and
nextproc_next_instance( ) to install the instance portion of the object ID. If no
instance is found, the nextproc should call nextproc_no_next( ).
Wind River SNMP calls SNMP_Continue( ) after all the nextproc routines have
been started. You should also call it when any deferred tasks complete. (A deferred
task is one that was started by a nextproc but that did not complete before the
nextproc returned.) When all of the tasks have completed, Wind River SNMP steps
through the response VarBindList and, for any vbps that were tagged with
nextproc_no_next( ), steps to the next object, and starts that object’s nextproc.
When all of the vbps have been assigned valid objects or the exception code
VT_ENDOFMIB, Wind River SNMP proceeds to the next step. Generating the
correct response to GET NEXT PDUs can require an additional step. If you have an
exception, you must translate it into an error. For GET BULK PDUs, Wind River
SNMP can perform several iterations on the entire VarBindList. Each iteration
performs the equivalent of a GET NEXT, using the result of the previous iteration
as its starting point. The routine stops when the packet is at the maximum size, the
number of iterations is equal to the maximum requested in the packet, or all
requested variables are at the end of the MIB. When the last iteration is finished, or
an error is encountered, Wind River SNMP attempts to generate the response
packet by calling the completion routine.
SET REQUEST PDUs are handled in module setpdu.c that is accessed from
rpktasy.c.
The processing of SET REQUEST PDUs requires a number of passes through the
VarBindList.
On the first pass, each variable’s leaf is located, checked for visibility in the current
MIB view, checked for writability, and type matched against the SET REQUEST.
At this point, a user-exit, SNMP_validate_set_pdu( ), if defined, is called to let
your code perform an overall validation. This routine can return with -1 to indicate
the PDU is bad and should be rejected with a GEN_ERR error, 0 to indicate the PDU
is good and normal handling should proceed, or +1 to indicate the PDU is good
and this routine has already performed all the set operations.
On the second pass through the VarBindList, a call can be made to the testproc for
each variable to check for accessibility and to test whether the proposed value is
acceptable. The previously mentioned user-exit can tag particular VarBind entries
with a mark, indicating that the associated testproc should be bypassed.
89
Wind River SNMP
Programmer's Guide, 10.5
Wind River SNMP calls SNMP_Continue( ) when all the testprocs have been
started, and you should call it when any tasks that testprocs started but did not
finish complete. When all of the tasks have completed another user-exit is called.
If no errors occurred in the test phase, SNMP_user_pre_set( ) is called. Its return
values are the same as for SNMP_validate_set_pdu( ). If an error occurred during
the test phase, SNMP_user_set_failed( ) is called and returns void.
After the second user-exit returns, another pass is made over the VarBindList and
a call is made to the setproc for each variable that has not otherwise been set in the
previous user-exit.
Wind River SNMP calls SNMP_Continue( ) again when all the setprocs have been
started, and you should call it when any tasks that setprocs started but did not
finish complete. When all tasks have completed, a final user-exit,
SNMP_user_post_set( ), is called to give you the means to clear any caches or to
actually trigger the accumulated sets. This routine returns void.
If an error occurs in a setproc Wind River SNMP attempts to undo any sets that
have already been performed. To do so Wind River SNMP examines the vbps and
runs any routines it finds in the undoproc field. This field should be set by the
testproc or setproc responsible for the vbp. If you set this field during the testproc
routine, you are allowing it to be called before the setproc finishes; if the setproc
cannot be interrupted (or you do not want to write the code to allow that), you
should set the undo field at the end of the set task. Wind River SNMP calls
SNMP_Continue( ) after the undoprocs have been started, and when any tasks
that setprocs or undoprocs started but did not finish do complete. Wind River
SNMP attempts to start any undoprocs that have not already been started. After
all undoprocs complete, the user-exit SNMP_user_set_failed( ) is called. It returns
void.
When all tasks from the setprocs and, in case of errors, the undoprocs have
completed, the internal packet structure for the original request packet is modified
to become the response packet. Wind River SNMP then attempts to generate the
response packet by calling the completion routine.
Undoing a Set
Row creation refers to what might happen when a network management station
does an SNMP set to a variable in a table with an instance that does not exist. The
SNMP agent could simply return the SNMP error noSuchName to indicate that
this variable does not exist. This is often a perfectly valid response; for example,
90
8 Server
8.6 Method Routine Processing
91
Wind River SNMP
Programmer's Guide, 10.5
92
8 Server
8.7 SNMPv1 and SNMPv2 Traps
The next section of code determines what actions are necessary to integrate the
working entry into the database. Because the view table can have dependencies on
a non-volatile memory system, there are checks to insure consistency across the
agent. When the routine finishes, almost all the work associated with the set will
have been performed. All that will be left for the setproc is the final connections in
the database and adjusting the cleanup routines.
After Wind River SNMP has called all the testprocs and they have reported success
it calls all the setprocs. In the above example, because it marked most of the
VarBinds as having been set, only the setproc for one of the VarBinds is called.
This would also be the case if vb_extract_row( ) had been used. The setproc is the
next routine in the appendix, viewtable_set( ). As mentioned above, in this
implementation the set routine does not do much. It basically installs or removes
the entry in the database, switches the cleanup routine information and sets up the
undo routine information.
You should realize that, while this set of routines generates a new entry even for
updates, your routines would not need to do so. It is acceptable to modify the entry
in place; however, your routines should be able to restore the original state if some
other test or set routine fails.
93
Wind River SNMP
Programmer's Guide, 10.5
Typical code to generate a cold start trap packet in SNMPv2 would look las
follows:
#include <snmp.h>
#include <buildpkt.h>
#include <auxfuncs.h>
#include <wkobj.h>
#include "snmpvars.h"
OIDC_T csoidc[] = {SNMP_COLDSTART};
OIDC_T stoidc[] = {SNMP_SNMPTRAPOID, 0};
OIDC_T sysupoidc[] = {1, 3, 6, 1, 2, 1, 1, 3, 0};
SNMP_PKT_T *rp;
EBUFFER_T ebuff;
/* create the trap packet */
rp = SNMP_Create_Request2(TRAP2_PDU, SNMP_VERSION_2,
strlen(snmp_trap_community),
snmp_trap_community, 0, 2, 0, 0);
if (rp == 0)
return;
/* install the var binds into the packet */
SNMP_Bind_Timeticks(rp, 0,
sizeof(sysupoidc)/sizeof(OIDC_T),
sysupoidc, sysuptime());
SNMP_Bind_Object_ID(rp, 1,
sizeof(stoidc)/sizeof(OIDC_T), stoidc,
sizeof(csoidc)/sizeof(OIDC_T), csoidc);
/* encode the packet */
EBufferInitialize(&ebuff);
If you have installed the SNMPv3, Notification and Coexistence options, you can
use the SNMP_Send_Notify_Name( ) routine to send SNMPv1, SNMPv2c, and
SNMPv3 traps and informs.
The SNMP specifications say nothing about the destinations to which traps should
be sent. The best approach is to specify a list of zero or more recipients that are to
receive copies of each trap message. For descriptions of SNMPv3 traps, see
8.8 SNMPv3 Notifications, p.95.
94
8 Server
8.8 SNMPv3 Notifications
A special type of trap is the SNMP Authentication Trap. Because of the danger that
a network might be overloaded by a flood of these trap messages, the SNMP
specification requires that implementations provide a software switch to prevent
authentication traps.
95
Wind River SNMP
Programmer's Guide, 10.5
sysupoidc, sysuptime());
VBL_Bind_Object_ID(vblp, 1,
sizeof(stoidc)/sizeof(OIDC_T), stoidc,
sizeof(csoidc)/sizeof(OIDC_T), csoidc);
/* hand appropriate information off to Notify API */
SNMP_Send_Notify(notify,
vblp,
&loc_addr,
context,
0,
notify_complete,
notify_err_complete,
notify_cleanup,
0);
Clean_vb_list(vblp);
SNMP_memory_free(vblp);
NOTE: Write access is not permitted for variables that are not specified as writable
in the MIB. For an object to be writable, the access_type field must be
WRITE_ACCESS, READ_WRITE_ACCESS, or READ_CREATE_ACCESS.
To use the RFC 3415 view scheme, three things must be done.
The view database must be initialized. Generally this occurs when the agent starts
by reading information from non-volatile memory and calling the supplied
routines to create (SNMP_View_Create( )) and install the view
(SNMP_View_2275_Install( )). You can find some of the other supplied routines
useful for maintaining the view table during processing.
The second requirement is to select the view to use on a per-packet basis. SNMPv3
specifies how this should be done using the access, group, user, target, and notify
tables. For SNMPv1 or SNMPv2 packets, specify the indexing information and
insert it into the packet structure with SNMP_validate_community( ). If you are
using coexistence for SNMPv3 packets, specify the indexing information and
insert it into the packet structure with SNMP_community_coexistence_lookup( ).
For RFC 3415, insert the name of the view to use into the view_name field of the
SNMP_PKT_T structure.
You must use the SNMP_View_Set_Status( ) routine to ensure that all views that
you want to use are set to be active. Only rows whose status are set to be active will
be used.
If you use the RFC 3415 view scheme and allow the view table to be accessed with
SNMP, you can choose to implement the following macros. Use these macros to
implement view table policies (for example, to save changes to the view table
across reboots.)
96
8 Server
8.10 SNMPv1 and SNMPv2c Proxy Requirements
You are responsible for deciding what information to store in non-volatile memory,
and the appropriate method to move the information to non-volatile memory.
The definition for these macros should go in the main section of envoy.h. The file
nvutils.c contains sample macro implementations. In VxWorks, this file is located
in the following directory:
installDir/vxworks-6.x/target/src/wrn/wm/demo/lib
All of the macros can be left in their default state if the functions are not desired.
The default for the test functions is to return NO_ERROR. The default for the other
macros is to do nothing.
Although RFC 2275 has been upgraded to RFC 3415, the names of the following
macros refer to the original RFC.
SNMP_VIEW_2275_DESTROY_TEST( )
SNMP_VIEW_2275_CREATE_TEST( )
SNMP_VIEW_2275_UPDATE_TEST( )
SNMP_VIEW_2275_DESTROY_SET( )
SNMP_VIEW_2275_CREATE_SET( )
SNMP_VIEW_2275_UPDATE_SET( )
SNMP_VIEW_2275_DESTROY_BACKOUT( )
SNMP_VIEW_2275_CREATE_BACKOUT( )
SNMP_VIEW_2275_UPDATE_BACKOUT( )
SNMP_VIEW_2275_DESTROY_UNDO( )
SNMP_VIEW_2275_CREATE_UNDO( )
SNMP_VIEW_2275_UPDATE_UNDO( )
SNMP_VIEW_2275_FINISHED( )
97
Wind River SNMP
Programmer's Guide, 10.5
routine must attach the translation routine to the proxy_routine field in the
SNMP_PKT_T structure.
The translation routine calls the transport routine. It is an implementation detail
how the translation routine knows which transport routine to use. The SNMPv1
and SNMPv2 translation routines supplied with Wind River SNMP expect a
transport routine, any transport information the transport routine requires and a
new community string to be placed into a PROXY_BLOCK_T structure that should
be attached to the user_private field in the SNMP_PKT_T structure. If you choose
to write your own translation routines you can use a different scheme, possibly
building the transport routine into the translation routine.
In order for a proxy agent to work successfully it must be able to receive responses
from its requests and, in turn, generate responses. For SNMPv1 and SNMPv2 you
simply need to arrange the receiving code to accept response packets from the
proxy target and to call Process_Rcvd_SNMP_Packet_Async( ) with them. If you
implement foreign proxies, you must translate the message to an SNMP_PKT_T
structure and call SNMP_Proxy_Response( ). You must attach an error completion
routine to the packet because it does get called.
Your first step in setting up a subagent is to create a state block for the subagent.
You can arrange for the memory for the state block yourself (in which case you
should initialize it by calling the envoy_ax_sa_state_init( ) routine) or you can use
the envoy_ax_sa_state_create( ) routine to allocate the space and initialize it.
98
8 Server
8.11 AgentX Requirements
A subagent normally starts by building and sending a set of packets to the master
agent to open the connection and register the objects for which it would like to be
the owner. Most of the time you should be able to use the routines described in the
online help or 10. Method Routines to build the AgentX packet structure and encode
it into a buffer. This document also describes AgentX packet manipulation and
packet building routines for handling for more complicated requests. Response
packets should be processed through envoy_ax_sa_handler( ), which uses one of
your completion routines to pass the information to you.
After completing this step, your code will likely execute an infinite loop waiting to
receive a packet from the master agent and forward those packets to the
envoy_ax_sa_handler( ) routine. The subagent handler processes the message and
calls your method routines as necessary. You also need to configure the
appropriate set of AgentX macros for your application.
8.11.3 Examples
There are two AgentX code examples. One adds master agent capability to the
snmptalk example while the other, agentx, builds a subagent with a user interface
similar to that of snmptalk. Both of these examples require the TCP option from
Attaché Plus as their transport layer. You should build the examples using the
demo library. For VxWorks, this library is located in the following directory:
installDir/vxworks-6.x/ target/src/wrn/wm/demo
99
Wind River SNMP
Programmer's Guide, 10.5
100
9
Client
101
Wind River SNMP
Programmer's Guide, 10.5
SNMP in a management station can ignore most of this; the important parts are
how snmptalk creates SNMP requests and how it interprets the responses.
There is code to implement a simple SNMP manager for VxWorks in the vxtalk
directory at:
installDir/vxworks-6.x/target/src/wrn/snmp/vxtalk
The vxtalk software is primarily intended as an example of using Wind River
SNMP in management code. However, it is also useful as a debugging and testing
tool for customers who are developing agents.
102
10
Method Routines
10.1 Introduction
Method routines are sections of code that you must write to perform the actions
specified by SNMP directives, such as retrieving (GET) or setting (SET) the value
of a certain MIB variable. Method routines are also known as access functions.
As a starting point for writing your own method routines, you can use the Wind
River MIB Compiler to produce a stub version and customize it. If you are using
Microsoft Windows NT, Windows 2000 or Windows XP, an interactive GUI is also
available. For more information on the command-line Wind River MIB Compiler,
see the Wind River MIB Compiler User’s Guide. For more information on the GUI for
the MIB Compiler, see the Wind River CLI, Web, MIBway Programmer’s Guide.
You can write method routines that behave synchronously, which process and
release packets, or asynchronously, which defer processing. An asynchronous
method routine spawns a task to complete the requested activities, and the method
routine returns before the task completes. For more information, see
10.10 Asynchronous Method Routines, p.116.
103
Wind River SNMP
Programmer's Guide, 10.5
NOTE: Processing a single message from an SNMP master agent can require
several method routines. Although you can call these method routines
asynchronously, the SNMP agent processes messages from the SNMP manager
synchronously. It can not accept a new message until it has completed processing
the current message. To process multiple requests simultaneously, requires locking
or serialization.
104
10 Method Routines
10.3 Writing Method Routines
should install the value and instance of the variable using the getproc_got_*( )
and nextproc_next_instance( ) routines.
NOTE: Wind River SNMP does not require a separate method routine to process
getbulk requests; it uses nextproc operations.
testproc
The testproc operation is activated before setting a variable to determine
whether the proposed SET will succeed. Although the leaf’s setproc routine is
usually called after a testproc operation completes, the agent can not
guarantee this will always happen.
setproc
The setproc operation is called to write a new value of a variable.
undoproc
The undoproc operation is called to back out a committed change when
another part of the same SET request fails.
The design of method routines is fairly standardized. All method routines use the
same API shown below:
void method_routine(
OIDC_T last_match,
int tcount,
OIDC_T * tlist,
SNMP_PKT_T * pktp,
VB_T * vbp
)
SNMP variable names are composed of two parts, which when concatenated form
the single unique object identifier in a PDU:
■
The first part is the sequence of numbers that form the object identifier for the
variable.
■
The second part is a sequence of one or more numbers which name the
instance of the variable.
For scalar variables, SNMP defines the instance to be the single number 0.
Therefore, tcount and *tlist, are not particularly useful for scalars.
For tabular variables, RFC 1157 defines how the instance is represented for each
table found in RFC 1213. RFC 2578 defines how instances are formed for SNMPv2
and SNMPv3. In other words, they define the row of the table in which the variable
is located. The access functions use this information to look up variables in internal
data structures.
During the processing of a GET, GET NEXT, GET BULK or SET REQUEST PDU, the
object identifier in the VarBind becomes a search target. The search descends the
MIB tree. As the search progresses, the components of the target object identifier
are consumed, starting from the high-order, left-most end. Assuming that the
target is valid, the search continues until it reaches a leaf of the MIB tree. Once the
leaf is reached, the method routines functions may be called depending on the type
of PDU being processed.
Your method routine should include the following parameters:
105
Wind River SNMP
Programmer's Guide, 10.5
last_match
Specify the value of the last component of the object identifier consumed
during the tree search. For example, if the target is the object identifier
1.2.3.4.5.6, and there exists a variable whose name is 1.2.3.4, then the value of
last_match is 4.
This parameter is useful when dealing with tabular variables. last_match
allows you to write a single set of access functions for each table. It provides
access functions a way to determine which column in the table is being
accessed.
For example, a table whose RFC 1213 identifier is 1.2.3.4 contains three
variables in each row named interfaceName, bytesIn, and bytesOut with object
IDs, respectively, 1.2.3.4.1, 1.2.3.4.2, and 1.2.3.4.3. Without the last_match
parameter, it would be necessary to provide a distinct set of access functions
for interfaceName, bytesIn, and bytesOut. You can use the last_match parameter
to merge the access functions for all three. The value of last_match accessing
interfaceName is 1, when accessing bytesIn is 2, and when accessing bytesOut is
3.
tcount
Specify the count of components pointed to by tlist. This usually refers to the
instance portion of the OID. For example, if the target is the object identifier
1.2.3.4.5.6 and a leaf is encountered at 1.2.3.4, tcount is 2.
*tlist
Point to the list of unconsumed components (the unused portion of the target).
For example, if the target is the object identifier 1.2.3.4.5.6 and a leaf is
encountered at 1.2.3.4, *tlist points to an array containing the values 5 and 6.
*pktp
Point to the request packet structure. Each method routine has the ability to
view the request packet structure in its entirety.
*vbp
Point to the VB_T structure that caused the access routine to be called.
106
10 Method Routines
10.4 Wind River SNMP-Supplied Method Routines
Getting an integer
The routine get_int_async( ) uses the cookie field in the mibleaf as a pointer
to a location containing the desired 32-bit integer.
Getting an IP address
The routine get_ip_address_async( ) uses the cookie field as a pointer to a
location containing the IP address.
Getting an object identifier
The routine get_object_identifier_async( ) uses the cookie field as a pointer to
a location containing an object identifier structure.
Getting a string
The routine get_string_async( ) uses the cookie field as a pointer to a location
containing the desired string.
Getting a TestAndIncr object
The routine get_TestAndIncr_async( ) uses the cookie field as a pointer to a
location containing the desired 32-bit integer.
Getting an unsigned integer
The routine get_uint_async( ) uses the cookie field as a pointer to a location
containing the desired 32-bit unsigned integer. Unsigned integers include RFC
1155 types COUNTER, GAUGE, and TIMETICKS.
Getting a 64-bit unsigned integer
The routine get_ui64_async( ) uses the cookie field as a pointer to a UINT_64_T
structure containing the desired 64-bit unsigned integer.
Testing instance information
The routine std_next_async( ) tests the instance information, and, if tcount is 0,
it sets the instance information to a single sub ID of 0 and calls the getproc
routine associated with this object. If tcount is not 0, it calls
nextproc_no_next( ). This routine uses the standard nextproc API. It can be
used for non-tabular variables.
Testing instance information for scalar variables
The routine it_exists_async( ) is a standard testproc for scalar variables, and is
found in file exist_as.c. For VxWorks, this file is located in the following
directory:
installDir/vxworks-6.x/target/src/wrn/wm/snmp/engine
This routine only tests that the instance information is correct for a scalar
variable (a single sub ID of 0), it does not do any value checking.
Testing instance information for TestAndIncr objects
The routine test_TestAndIncr_async( ) is a standard testproc for TestAndIncr
type objects which may be found in the file sas_incr.c. For VxWorks, this file is
located in the following directory:
installDir/vxworks-6.x/target/src/wrn/wm/snmp/engine
It uses the cookie field as a pointer to a location containing the desired 32-bit
integer and checks that the value being set is equal to the current value.
Setting an integer
The routine set_int_async( ) uses the cookie field as a pointer to the 32-bit
integer to set.
107
Wind River SNMP
Programmer's Guide, 10.5
NOTE: The getproc_got_string( ) routine does not copy the string information in a
buffer, instead it maintains a pointer to the buffer space. Do not reuse this space
until after the packet has been encoded. You should now use the
getproc_got_octet_string( ) routine, which copies the string information, and thus
operates in the same manner as all of the other similar getproc_got_* routines.
Parameters
108
10 Method Routines
10.5 getproc Method Routines
error
Specify the error code. The only error that makes sense during GET processing
is GEN_ERR.
*pktp
Point to the request packet.
*string
Point to the text string.
*vbp
Point to the VarBind for the value being obtained.
type
Use when a given function may be used for more than one SNMP type, such
as VT_STRING or VT_OPAQUE.
Prototypes
getproc_error( )
void getproc_error(
SNMP_PKT_T * pktp,
VB_T * vbp,
INT_32_T error
)
getproc_got_int32( )
void getproc_got_int32(
SNMP_PKT_T * pktp,
VB_T * vbp,
INT_32_T data
)
getproc_got_ip_address( )
void getproc_got_ip_address(
SNMP_PKT_T * pktp,
VB_T * vbp,
UINT_32_T data
)
getproc_got_object_id( )
void getproc_got_object_id(
SNMP_PKT_T * pktp,
VB_T * vbp,
int oidclen,
OIDC_T * oidc,
int dynamic
)
getproc_got_octet_string( )
109
Wind River SNMP
Programmer's Guide, 10.5
void getproc_got_octet_string(
SNMP_PKT_T * pktp,
VB_T * vbp,
ALENGTH_T stringlen,
OCTET_T * string,
OCTET_T type
)
getproc_got_string( )
void getproc_got_string(
SNMP_PKT_T * pktp,
VB_T * vbp,
ALENGTH_T stringlen,
OCTET_T * string,
int dynamic,
OCTET_T type
)
getproc_got_uint32( )
void getproc_got_uint32(
SNMP_PKT_T * pktp,
VB_T * vbp,
UINT_32_T data,
OCTET_T type
)
getproc_got_uint64( )
void getproc_got_uint64(
SNMP_PKT_T * pktp,
VB_T * vbp,
UINT_64_T * data
)
getproc_got_uint64_high_low( )
void getproc_got_uint64_high_low(
SNMP_PKT_T * pktp,
VB_T * vbp,
UINT_32_T high,
UINT_32_T low
)
getproc_nosuchins( )
void getproc_nosuchins(
SNMP_PKT_T * pktp,
VB_T * vbp
)
110
10 Method Routines
10.6 nextproc Method Routines
111
Wind River SNMP
Programmer's Guide, 10.5
Prototypes
nextproc_error( )
void nextproc_error(
SNMP_PKT_T * pktp,
VB_T * vbp,
INT_32_T error
)
nextproc_next_instance( )
void nextproc_next_instance(
SNMP_PKT_T * pktp,
VB_T * vbp,
int rlistc,
OIDC_T * rlistl
)
nextproc_next_instance_string( )
void nextproc_next_instance_string(
SNMP_PKT_T * pktp,
VB_T * vbp,
ALENGTH_T str_len,
bits8_t * str_buf,
int imp_flag
)
nextproc_no_next( )
void nextproc_no_next(
SNMP_PKT_T * pktp,
VB_T * vbp
)
nextproc_started( )
void nextproc_started(
SNMP_PKT_T * pktp,
VB_T * vbp
)
112
10 Method Routines
10.7 testproc Method Routines
Parameters
113
Wind River SNMP
Programmer's Guide, 10.5
COMMIT_FAILED
All of the pre-set tests were passed but an assignment failed. Any assignments
already done must be undone before sending this error. If an assignment
cannot be undone UNDO_FAILED should be used. Implementations should
take all possible measures to avoid this error. A SNMPv2 and SNMPv3 code.
UNDO_FAILED
All of the pre-set tests were passed but an assignment failed and some other
assignment could not be undone. Implementations should take all possible
measures to avoid this error. A SNMPv2 and SNMPv3 code.
AUTHORIZATION_ERROR
This error should not be returned from a testproc, it is included here for
completeness of the error list. This error may be returned from the section of
code that determines that the source, destination, and context (or target,
subject, and resources) triple does not grant appropriate privileges for this
PDU type to be executed. A SNMPv2 and SNMPv3 code.
NOT_WRITABLE
The variable exists but cannot be modified no matter what new value is
specified. A SNMPv2 and SNMPv3 code.
INCONSISTENT_NAME
The variable cannot be created currently, though it could be created under
other circumstances. A SNMPv2 and SNMPv3 code.
Prototypes
testproc_error( )
void testproc_error(
SNMP_PKT_T * pktp,
VB_T * vbp,
INT_32_T error
)
testproc_good( )
void testproc_good(
SNMP_PKT_T * pktp,
VB_T * vbp
)
testproc_started( )
void testproc_started(
SNMP_PKT_T * pktp,
VB_T * vbp
)
114
10 Method Routines
10.9 undoproc Method Routines
setproc_error( ) indicates a failure (the only error that makes sense during the set
phase is COMMIT_FAILED). setproc_error( ) will set the SNMP error index to the
index of vbp and the error status to error.
A setproc may assume responsibility for other vbps by calling setproc_started( ) for
each vbp it plans to process. It or its testproc must call setproc_good( ) or
setproc_error( for each VB_T for which it or its testproc accepted responsibility.
Generally testproc routines will only call the setproc_started( ) and
setproc_good( ) routines when they are collecting related VB_T structures to build
a row in a table.
To defer some of the SET processing, you would return from the setproc before
calling one of the done or error functions. At some future time, you would be
responsible for calling one of the done or error functions and calling the
SNMP_Continue( ) routine to notify the Wind River SNMP engine that the packet
had been modified.
Prototypes
setproc_error( )
void setproc_error(
SNMP_PKT_T * pktp,
VB_T * vbp,
INT_32_T error
)
setproc_good( )
void setproc_good(
SNMP_PKT_T * pktp,
VB_T * vbp
)
setproc_started( )
void setproc_started(
SNMP_PKT_T * pktp,
VB_T * vbp
)
115
Wind River SNMP
Programmer's Guide, 10.5
Prototypes
undoproc_error( )
void undoproc_error(
SNMP_PKT_T * pktp,
VB_T * vbp,
INT_32_T error
)
undoproc_good( )
void undoproc_good(
SNMP_PKT_T * pktp,
VB_T * vbp
)
undoproc_set( )
void undoproc_set(
SNMP_PKT_T * pktp,
VB_T * vbp,
UNDOPROC_T * undoproc
)
undoproc_started( )
void undoproc_started(
SNMP_PKT_T * pktp,
VB_T * vbp
)
116
10 Method Routines
10.10 Asynchronous Method Routines
will need to be called for each VarBind. The deferred process can be spawned at this
point and the method routine returns. When the deferred process is ready to put
data into the SNMP packet, it must call the user-exit
ENVOY_SNMP_GET_WRITE_LOCK( ) to get a write lock on the SNMP packet.
Upon continuation of the deferred process, it must make the appropriate status
calls depending on the process type. If it’s a get process, a call must be made to one
of the getproc_got_*( ) functions, to getproc_error( ) or getproc_nosuchins( ) for
each VarBind for which it accepted responsibility. For a next process, a call must be
made to nextproc_error( ), nextproc_no_next( ), nextproc_next_instance( ), or
nextproc_next_instance_string( ) for each VarBind for which it accepted
responsibility. If it calls nextproc_next_instance( ) or
nextproc_next_instance_string( ), it must also call one of the getproc_got_*( )
functions. If the process is a test process, a call must be made to testproc_good( )
or testproc_error( ) for each VarBind for which it accepted responsibility. For a set
process, it or its test task must call setproc_good( ) or setproc_error( ) for each
VarBind for which it or its test task accepted responsibility. After the appropriate
calls have been made, the deferred process must call SNMP_Continue( ) to issue
the response to the agent.
For a short code example, see Example 4-1.
groupGet(
OIDC_T lastmatch,
int tcount,
OIDC_T * tlist,
SNMP_PKT_T * pktp,
VB_T * vbp)
{
int status
VB_T * pVbpSaved;
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
if ( (tcount != 1) || (*tlist != 0) )
{
for ( ; vbp != NULL; vbp = vbp->vb_link)
{
getproc_nosuchins (pktp, vbp);
}
return;
}
117
Wind River SNMP
Programmer's Guide, 10.5
{
getproc_error (pktp, pVbpSaved);
return;
}
}
return;
void asyncRtn(
OIDC_T lastmatch,
int tcount,
OIDC_T * tlist,
SNMP_PKT_T * pktp,
VB_T * vbp){
VB_T * pVbpSaved;
...
/* after doing all the time consuming tasks we are now ready to
install the values in the pkt. */
pVbpSaved->vb_link)
...
}
SNMP_Continue (pktp);
10.10.1 Locking
Method routines should never acquire locks directly. Locks are acquired by the
Wind River SNMP engine as part of packet processing. An attempt to acquire the
lock again inside a method routine can result in a deadlock condition and hang the
agent.
The only time a task would acquire a lock in the course of processing a packet is
when all of the following conditions apply:
■
You have installed the ENVOY_CONTINUE_REENTRANT option
■
You have method routines that defer processing
■
A deferred task has data to be inserted into the response packet
Under these conditions, the deferred task can lock the packet’s continue lock
(pktp -> continue_lock) and start processing the packet.
For example:
The Agent receives a GET request with a single VarBind, deferredObject.0.
Wind River SNMP processes the request as follows:
118
10 Method Routines
10.10 Asynchronous Method Routines
10.10.2 Serialization
119
Wind River SNMP
Programmer's Guide, 10.5
120
11
User-Supplied Code
11.1 Introduction
At various points during SNMP packet processing, Wind River SNMP needs to
call code that you supply to determine its course of action. These entry points are
provided by way of macros, handlers, completion routines, and other user-exits
defined in the envoy.h file.
This chapter provides prototypes and descriptions to help you write your own
user-exits, macros, and handlers. You can also use the sample programs in the
demo directory as working models. For VxWorks, these sample programs are
located in the following directory:
installDir/vxworks-6.x/target/src/wrn/wm/demo
You need to write only those routines in this chapter that are required, or those that
you choose to implement. For example, if you use non-volatile storage for
SNMPv3 MIB table objects, you need to implement the method routine macros
described in 11.8 SNMPv3 Method Routine Macros, p.132. If you have purchased
Wind River SNMP AgentX, you need to implement routines marked AgentX.
121
Wind River SNMP
Programmer's Guide, 10.5
For additional information about the various routines, user exits, and macros
introduced in this chapter, see B. User-Supplied Code Reference Entries, C. Wind River
SNMP Macro Entries, and the Wind River SNMP API reference entries.
Routine
max( )
MAX_OID_COUNT( )
MEMCPY( )
MEMSET( )
MEMCMP( )
122
11 User-Supplied Code
11.3 Required Routines
Routine
min( )
SNMP_memory_alloc( )
SNMP_memory_free( )
SNMP_MAX_PACKET_SIZE( )
In addition to these routines, the following routines must also be defined, given
certain conditions.
Timer Routines
Put the definitions for the following set of routines and any header files they
require into the envoy.h file.
If you use SNMPv1 or SNMPv2c, you must define SNMP_validate_community( )
to validate the packet before Wind River SNMP processes it. If you use Wind River
SNMP v3, you must define SNMP_validate_address( ).
If you use SNMPv1, SNMPv2c, and SNMPv3 with coexistence, you must define
the routine SNMP_community_coexistence_lookup( ), instead of the
SNMP_validate_community( ) routine.
Wind River SNMP requires you to define the first two timer functions macros even
if you do not choose to implement them. If you use proxy, Notifies, or AgentX, you
need to implement the first two timer functions as well. SNMPv3 Notify functions
require you to implement all three of the timer functions. SNMPv3 requires you to
implement only ENVOY_TIME( ).
■
ENVOY_NOW( )
■
ENVOY_CALL_TIMER( )
■
ENVOY_TIME( )
If you are using SNMPv3 Notifies, you must provide functions to convert between
the SNMPADDR_T format and the TDomain/TAddress textual convention. If you
use Attaché Plus or VxWorks as your TCP/IP stack, Wind River SNMP provides
these conversion routines. Otherwise, you’ll need to write them.
■
ENVOY_SNMPADDR_TO_TADDRESS( )
■
ENVOY_TADDRESS_TO_SNMPADDR( )
ID Setting Routine
There is also a mechanism for setting the request ID and message ID of outgoing
notification packets. By default, Wind River SNMP chooses the next number in a
monotonically increasing sequence. If you want to have more control over the
values assigned, implement the following routine.
■
ENVOY_SET_RETRANS_ID( )
123
Wind River SNMP
Programmer's Guide, 10.5
This macro allows you to specify different MIB trees under different
circumstances. It can be useful to have several MIB trees in one process. The
default MIB tree is the one pointed to by mib_root_node. If you would like to use
another, redefine this macro. You can also use SNMP_validate_community( )
and SNMP_validate_address( ) to choose a MIB tree.
ENVOY_NOW( )
bits32_t ENVOY_NOW(void)
This macro returns the relative time in milliseconds. You can use any
convenient resolution providing it is increases monotonically. Since
Wind River SNMP does not require a clock to run at any particular speed, you
can define any timing scheme. Proxies, master agents, or subagents require
that you define and implement this macro. If you do not use these options, you
need only define it. See also ENVOY_CALL_TIMER( ).
ENVOY_TIME( )
bits32_t ENVOY_TIME(void)
This macro returns the time in seconds. You can use any convenient resolution
providing it is increases monotonically. If it wraps, the engine boots field used
by SNMPv3 must be increased. Currently, this used only by the SNMPv3
engine code.
124
11 User-Supplied Code
11.5 Configuration Macros
ENVOY_CALL_TIMER( )
void ENVOY_CALL_TIMER(
bits32_t when,
void (*what)(void))
This macro schedules function what to be called when milliseconds from now.
It needs to remember only one function. If it is called while a function is
already scheduled, the override the previous settings.
This macro must guarantee that when what is called, ENVOY_NOW( ) is at least
when milliseconds greater then when ENVOY_CALL_TIMER( ) was called.
Since Wind River SNMP does not require a clock to run at any particular
speed, you can define any timing scheme. Proxies, master agents, or subagents
require that you define and implement this macro. If you do not use these
options, you need only define it. See also ENVOY_NOW( ).
ENVOY_SNMP_INIT_LOCK( )
void ENVOY_SNMP_INIT_LOCK(ENVOY_LOCK_T lock)
This routine is called to perform any initialization required by lock, which was
declared using ENVOY_LOCK_T. You can use the tag information when
initializing your lock structures, or you can use the default version that
discards the tagging information and call ENVOY_SNMP_INIT_LOCK( )
instead. The default tags are all 4-byte long strings but can be changed by
modifying the following macros. Some of the tags can be used for more than
one lock.
ENVOY_CONTINUELOCK_TAG
If the ENVOY_CONTINUE_REENTRANT installation option is installed,
this tag is used for all the continue locks. One continue lock is used per
packet that Wind River SNMP processes. It is used to protect the packet
itself. (Default value CONT)
ENVOY_AXLISTLOCK_TAG
This tag is used for the list lock in an AgentX sub agent. There is one such
lock per subagent. (Default value AXLS)
ENVOY_AXCOARSELOCK_TAG
This tag is used for the coarse lock in an AgentX sub agent. There is one
such lock per subagent. (Default value AXCO)
ENVOY_V3BOOTSLOCK_TAG
This lock is used to protect the boots and time information used on a
SNMPv3 agent. (Default value V3BT)
ENVOY_V3RETRANSLOCK_TAG
This lock is used to protect the retransmission list if Notifies are in use.
(Default value RETR)
SNMP_COARSELOCK_TAG
This is a coarse lock for safeguarding data in Wind River SNMP. (Default
value COAR)
125
Wind River SNMP
Programmer's Guide, 10.5
SNMP_TIMERLOCK_TAG
This is for the lock that protects the timer lists in Wind River SNMP.
(Default value TIMR)
SNMP_INFRASTRUCTURELOCK_TAG
This lock is used for locking sections of the Wind River SNMP
infrastructure. (Default value INFR)
SNMP_PROXYLOCK_TAG
This lock is used on a main agent if the ENVOY_SNMP_PROXY option is
installed. (Default value PROX)
ENVOY_SNMP_FREE_LOCK_TAG( )
void ENVOY_SNMP_FREE_LOCK_TAG( ENVOY_LOCK_T * lock, char * tag )
This macro attempts to get a read lock on lock.The parameter lock was declared
using the macro ENVOY_SNMP_LOCK( ). A return of 0, indicates that the lock
was acquired, anything else indicates an error. Your implementation of this
routine must block until it is able to obtain the lock. By default, this macro is
defined to do nothing.
ENVOY_SNMP_GET_WRITE_LOCK( )
int ENVOY_SNMP_GET_WRITE_LOCK( ENVOY_LOCK_T * lock )
This macro attempts to get a write lock on lock. The parameter lock is of a type
defined by you. A return of 0 indicates that the lock was acquired, anything
else indicates an error. Your implementation of this routine must block until it
is able to obtain the lock. By default, this macro is defined to do nothing.
ENVOY_SNMP_RELEASE_READ_LOCK( )
void ENVOY_SNMP_RELEASE_READ_LOCK( ENVOY_LOCK_T * lock )
This macro releases a read lock that is held on lock. By default this macro is
defined to do nothing.
ENVOY_SNMP_RELEASE_WRITE_LOCK( )
void ENVOY_SNMP_RELEASE_WRITE_LOCK( ENVOY_LOCK_T * lock )
This macro releases a write lock that is held on lock. By default this macro is
defined to do nothing.
ENVOY_SNMP_LOCK( )
ENVOY_LOCK_T
ENVOY_SNMP_LOCK( name )
ENVOY_SNMP_LOCK_EXTERN( name )
ENVOY_LOCK_T is a typedef for the definition of a lock. Define this in the first
section of envoy.h. This routine is a macro to generate the definition of name as
a variable of the lock type. ENVOY_SNMP_LOCK_EXTERN( ) is a macro to
generate the external declaration of name as a variable of the lock type. Define
both of these macros in the main section of envoy.h. If you need to ensure that
various databases are modified by only one process at a time, you must define
the locking macros.
126
11 User-Supplied Code
11.5 Configuration Macros
SNMP_community_coexistence_lookup( )
int SNMP_community_coexistence_lookup(
SNMP_PKT_T * pkt,
SNMPADDR_T * src,
SNMPADDR_T * dst )
This routine is for use with the SNMP version coexistence code, installed by
the ENVOY_SNMP_COEXISTENCE option. It provides SNMPv3 coexistence
support for SNMPv1 and SNMPv2c packets. It validates the community string
of a received SNMP packet and fills in some fields in pkt.
The SNMP_community_coexistence_lookup( ) routine is called with the
decoded packet and the source and destination addresses passed into
Process_Rcvd_SNMP_Packet_Async( ).
The SNMP_community_coexistence_lookup( ) routine uses the
snmpCommunityTable and other SNMPv3 tables to determine whether the
community string is acceptable. If the community string is acceptable, this
routine should return 0 and 1 if not. After finding a good community string,
this routine should do the following:
■ It must set the MIB view name field. Routines using the view name scheme
must check that the community string allows the type of access requested
by the PDU (field pdu_type in pkt).
■ It must save the src and dst addresses for later. If you are using
Process_Rcvd_SNMP_Packet_Async( )the arguments for the completion
routines will be supplied from pkt and the addresses are needed.
■ It may attach additional information to the packet by using the packet’s
user_private field. Any resources thus reserved may be released with the
macro SNMP_release_private( ).
■ It may assign the MIB tree that will be used for this packet by setting the
mib_root field to point to the root of the tree. If no root is chosen the default
will be used.
■ It may assign a value to the lcl_ident field for local use.
MAX_OID_COUNT( )
#define MAX_OID_COUNT 32
This macro allows you to define the maximum number of OID components
that you will ever return from a nextproc function.
Since this value includes the view nextproc functions, choose a number larger
than any of the instances from those tables. The prototype above sets the OID
count to 32. Define this macro in the first section of envoy.h.
SNMP_MAX_PACKET_SIZE( )
#define SNMP_MAX_PACKET_SIZE 1400
This macro allows you to define the maximum packet size that is accepted and
generated. This value is both the maximum packet size that Wind River SNMP
generates and the default value that Wind River SNMP uses for any maximum
message size field in any versions of SNMP that have a maximum message
127
Wind River SNMP
Programmer's Guide, 10.5
size. The specification requires that this value must be greater than 484 octets.
Define this macro in the first section of envoy.h.
This macro must be defined. The prototype above defines it to 1400, but you
can choose another value. You also can set the maximum outgoing message
size on a per packet basis using the Process_Rcvd_SNMP_Packet_Async( )
routine.
SNMP_memory_alloc( ),
SNMP_memory_free( )
extern void *malloc (unsigned);
extern void free (void *);
#define SNMP_memory_alloc(need) malloc(need)
#define SNMP_memory_free(buf) free(buf)
Wind River SNMP needs to allocate memory during the process of decoding
SNMP packets and computing the response. To do this, it uses two routines,
SNMP_memory_alloc( ) and SNMP_memory_free( ), which are defined as
macros in envoy.h. The header file should either declare the actual routine to
which each of these macros refer, or if the macro is defined to call a system
routine, include the appropriate system header files. Put the declarations or
header file include statement in the first section of envoy.h.
SNMP_memory_alloc( ) takes one argument, the size of the memory block to
allocate, and returns a PTR_T, which is a pointer to the memory on success, or
0 on failure.
SNMP_memory_free( ) takes a pointer to a block of memory, which was
allocated by a previous call to SNMP_memory_alloc( ), and puts it back into
the free memory pool. It returns nothing.
SNMP_release_private( )
void SNMP_release_private( SNMP_PKT_T * pkt )
This macro allows you to free any resources that your code may have placed
in the user_private field of pkt. It is used when an SNMP_PKT_T is freed. If you
do not use the user_private field, you can leave this macro undefined.
SNMP_TRACE_INPUT( )
void SNMP_TRACE_INPUT( SNMP_PKT_T * pkt )
This macro is available for tracing the processing of input SNMP packets. The
default definition does nothing. It is called by the
Process_Rcvd_SNMP_Packet_Async( ) routine.
SNMP_user_post_set( )
void SNMP_user_post_set ( SNMP_PKT_T * pkt )
This routine is called after all the setproc procedures have been called. It can
clean up after the previous SET processing routines if any resources are being
held, caches need flushing, or the like. If you do not want to examine and
manipulate the entire packet while processing a SET request, leave this macro
undefined.
SNMP_user_pre_set( )
int SNMP_user_pre_set ( SNMP_PKT_T * pkt )
This routine is called after the testproc routines have been called and all of the
VarBinds have passed the tests but before any of the setproc routines have
been started. A return of 0 indicates that the PDU is good and processing can
proceed. A return code of 1 indicates that the PDU is good and the called
128
11 User-Supplied Code
11.5 Configuration Macros
routine has already performed all the SET operations. A return code of -1
indicates that the PDU is bad and should be rejected with a general error.
If you do not want to examine and manipulate the entire packet while
processing a SET request, leave this macro undefined.
SNMP_user_set_failed( )
void SNMP_user_set_failed ( SNMP_PKT_T * pkt )
This routine is called in two places: after all of the testproc routines have
returned if some of them failed, and after all of the undoproc routines have
returned if a setproc failed. It can clean up after the previous SET processing
routines by, for example, release any resources that are being held. If you do
not want to examine and manipulate the entire packet while processing a SET
request, leave this macro undefined.
SNMP_validate_set_pdu( )
int SNMP_validate_set_pdu ( SNMP_PKT_T * pkt )
This routine is called before any processing of a SET request PDU has taken
place. It can provide global validation of the SET request. A return of 0
indicates that the PDU is good and processing can proceed. A return code of 1
indicates that the PDU is good and the called routine has already performed
all the SET operations. A return code of -1 indicates that the PDU is bad and
should be rejected with a general error.
If you do not want to examine and manipulate the entire packet while
processing a SET request, leave this macro undefined.
SNMP_validate_address( )
int SNMP_validate_address(
SNMP_PKT_T * pkt,
SNMPADDR_T * src,
SNMPADDR_T * dst )
This routine validates the source and destination address. You must fill in
some fields in pkt. This macro is similar to the SNMP_validate_community( )
routine but it is for use with the SNMPv3 code. The routine is called with the
decoded packet and the source and destination addresses passed into the
Process_Rcvd_SNMP_Packet_Async( ) routine. If the addresses are
acceptable, this routine should return 0 and 1 if not. Wind River SNMP may
call this routine either from the main processing code or, due to certain errors,
from code that attempts to send an error report to the originator of the request.
When called from the report code, the packet will not have been completely
parsed and empty fields should be expected.
After accepting, the packet this routine should do the following:
■
It must save the src and dst addresses into pkt for later use. If you use the
Process_Rcvd_SNMP_Packet_Async( ) routine, the arguments for the
completion routines are supplied from pkt and the addresses are needed.
■
This routine may attach additional information to the packet by using the
packet’s user_private field. Any resources thus reserved may be released
with the macro SNMP_release_private( ).
■ It may assign the MIB tree that will be used for this packet by setting the
mib_root field to point to the root of the tree. If no root is chosen the default
is used.
■ It may assign a value to the lcl_ident field for local use.
129
Wind River SNMP
Programmer's Guide, 10.5
SNMP_validate_community( )
int SNMP_validate_community(
SNMP_PKT_T * pkt,
SNMPADDR_T * src,
SNMPADDR_T * dst )
This routine is for use with the SNMPv1 or SNMPv2 code. It validates the
community string of a received SNMP packet and fills in some fields in pkt. The
routine is called with the decoded packet and the source and destination
addresses passed into the Process_Rcvd_SNMP_Packet_Async( ) routine. If
the community string is acceptable, this routine should return 0 and 1 if not.
After finding a good community string, this routine should do the following.
■
It must set the MIB view mask, view index or view name field. While routines
using the view mask scheme may want to check that the community string
allows the type of access requested by the PDU (field pdu_type in pkt),
routines using the view index or view name scheme must do this check.
■ It must save the src and dst addresses for later. If you are using the
Process_Rcvd_SNMP_Packet_Async( ) routine, the arguments for the
completion routines will be supplied from pkt and the addresses are
needed.
■ It may attach additional information to the packet by using the packet’s
user_private field. Any resources thus reserved may be released with the
macro SNMP_release_private( ).
■ It may assign the MIB tree that will be used for this packet by setting the
mib_root field to point to the root of the tree. If no root is chosen the default
will be used.
■ It may assign a value to the lcl_ident field for local use.
Handler Description
130
11 User-Supplied Code
11.7 User-Exits
Handler Description
NOTE: If you do not use AgentX, you do not need to write any of the AgentX
handlers.
11.7 User-Exits
At various points during SNMP packet processing, Wind River SNMP needs to
call customer-supplied code to determine its course of action. The user-exits listed
in Table 11-3 are usually defined as macros in the file envoy.h. If your user-exits
reference any routines, declare them in the envoy.h file as well.
131
Wind River SNMP
Programmer's Guide, 10.5
If you do not need a particular function, for example AgentX, you can leave the
associated user-exits defined as blank or undefined. The AgentX MIB, which
shipped with Envoy 8.0, was based on an Internet draft. This has been superseded
by the AgentX MIB defined in RFC 2742 and is now obsolete. The following
user-exits, which supported the AgentX MIB, are obsolete and should not be used
for new applications:
■ ENVOY_AX_TRANSPORT_STRING( )
■ ENVOY_AX_TRANSPORT_TYPE( )
■ ENVOY_AX_TRANSPORTS_SUPPORTED( )
132
11 User-Supplied Code
11.8 SNMPv3 Method Routine Macros
Specifically, method routines must call these macros to implement SET REQUESTs
for the access, group, notify, notify filter, notify filter profile, target address, target
params, and user table MIB objects. If you want to use nonvolatile storage for any
of these tables, you need to define these macros. If they are defined, the Wind River
SNMP method routines will call them. If you do not use nonvolatile storage, you
do not need to define these macros.
You can also use these macros to implement policies for creation, modification, or
deletion of table entries.
NOTE: There are so many similar macros that you may find it more convenient to
write a few routines that implement a specific function for all the tables.
SNMP_V3_ACCESS_DESTROY_TEST( )
SNMP_V3_ACCESS_CREATE_TEST( )
SNMP_V3_ACCESS_UPDATE_TEST( )
SNMP_V3_GROUP_DESTROY_TEST( )
SNMP_V3_COMM_CREATE_TEST( )
SNMP_V3_COMM_UPDATE_TEST( )
SNMP_V3_COMM_DESTROY_TEST( )
SNMP_V3_GROUP_CREATE_TEST( )
SNMP_V3_GROUP_UPDATE_TEST( )
SNMP_V3_NOTIFY_DESTROY_TEST( )
SNMP_V3_NOTIFY_CREATE_TEST( )
SNMP_V3_NOTIFY_UPDATE_TEST( )
SNMP_V3_NFILT_DESTROY_TEST( )
SNMP_V3_NFILT_CREATE_TEST( )
SNMP_V3_NFILT_UPDATE_TEST( )
SNMP_V3_NPROF_DESTROY_TEST( )
SNMP_V3_NPROF_CREATE_TEST( )
SNMP_V3_NPROF_UPDATE_TEST( )
SNMP_V3_PROXY_DESTROY_TEST( )
SNMP_V3_PROXY_CREATE_TEST( )
SNMP_V3_PROXY_UPDATE_TEST( )
SNMP_V3_TADDR_DESTROY_TEST( )
SNMP_V3_TADDR_CREATE_TEST( )
SNMP_V3_TADDR_UPDATE_TEST( )
SNMP_V3_TPARAM_DESTROY_TEST( )
SNMP_V3_TPARAM_CREATE_TEST( )
SNMP_V3_TPARAM_UPDATE_TEST( )
SNMP_V3_USER_DESTROY_TEST( )
133
Wind River SNMP
Programmer's Guide, 10.5
SNMP_V3_USER_CREATE_TEST( )
SNMP_V3_USER_UPDATE_TEST( )
SNMP_V3_ACCESS_DESTROY_BACKOUT( )
SNMP_V3_ACCESS_CREATE_BACKOUT( )
SNMP_V3_ACCESS_UPDATE_BACKOUT( )
SNMP_V3_COMM_DESTROY_BACKOUT( )
SNMP_V3_COMM_CREATE_BACKOUT( )
SNMP_V3_COMM_UPDATE_BACKOUT( )
SNMP_V3_GROUP_DESTROY_BACKOUT( )
SNMP_V3_GROUP_CREATE_BACKOUT( )
SNMP_V3_GROUP_UPDATE_BACKOUT( )
SNMP_V3_NOTIFY_DESTROY_BACKOUT( )
SNMP_V3_NOTIFY_CREATE_BACKOUT( )
SNMP_V3_NOTIFY_UPDATE_BACKOUT( )
SNMP_V3_NFILT_DESTROY_BACKOUT( )
SNMP_V3_NFILT_CREATE_BACKOUT( )
SNMP_V3_NFILT_UPDATE_BACKOUT( )
SNMP_V3_NPROF_DESTROY_BACKOUT( )
SNMP_V3_NPROF_CREATE_BACKOUT( )
SNMP_V3_NPROF_UPDATE_BACKOUT( )
SNMP_V3_PROXY_DESTROY_BACKOUT( )
SNMP_V3_PROXY_CREATE_BACKOUT( )
SNMP_V3_PROXY_UPDATE_BACKOUT( )
SNMP_V3_TADDR_DESTROY_BACKOUT( )
SNMP_V3_TADDR_CREATE_BACKOUT( )
SNMP_V3_TADDR_UPDATE_BACKOUT( )
SNMP_V3_TPARAM_DESTROY_BACKOUT( )
SNMP_V3_TPARAM_CREATE_BACKOUT( )
SNMP_V3_TPARAM_UPDATE_BACKOUT( )
SNMP_V3_USER_DESTROY_BACKOUT( )
SNMP_V3_USER_CREATE_BACKOUT( )
SNMP_V3_USER_UPDATE_BACKOUT( )
SNMP_V3_ACCESS_DESTROY_SET( )
SNMP_V3_ACCESS_CREATE_SET( )
SNMP_V3_ACCESS_UPDATE_SET( )
SNMP_V3_COMM_DESTROY_SET( )
SNMP_V3_COMM_CREATE_SET( )
SNMP_V3_COMM_UPDATE_SET( )
SNMP_V3_GROUP_DESTROY_SET( )
SNMP_V3_GROUP_CREATE_SET( )
SNMP_V3_GROUP_UPDATE_SET( )
SNMP_V3_NOTIFY_DESTROY_SET( )
SNMP_V3_NOTIFY_CREATE_SET( )
SNMP_V3_NOTIFY_UPDATE_SET( )
SNMP_V3_NFILT_DESTROY_SET( )
SNMP_V3_NFILT_CREATE_SET( )
SNMP_V3_NFILT_UPDATE_SET( )
SNMP_V3_NPROF_DESTROY_SET( )
134
11 User-Supplied Code
11.8 SNMPv3 Method Routine Macros
SNMP_V3_NPROF_CREATE_SET( )
SNMP_V3_NPROF_UPDATE_SET( )
SNMP_V3_PROXY_DESTROY_SET( )
SNMP_V3_PROXY_CREATE_SET( )
SNMP_V3_PROXY_UPDATE_SET( )
SNMP_V3_TADDR_DESTROY_SET( )
SNMP_V3_TADDR_CREATE_SET( )
SNMP_V3_TADDR_UPDATE_SET( )
SNMP_V3_TPARAM_DESTROY_SET( )
SNMP_V3_TPARAM_CREATE_SET( )
SNMP_V3_TPARAM_UPDATE_SET( )
SNMP_V3_USER_DESTROY_SET( )
SNMP_V3_USER_CREATE_SET( )
SNMP_V3_USER_UPDATE_SET( )
SNMP_V3_ACCESS_DESTROY_UNDO( )
SNMP_V3_ACCESS_CREATE_UNDO( )
SNMP_V3_ACCESS_UPDATE_UNDO( )
SNMP_V3_COMM_DESTROY_UNDO( )
SNMP_V3_COMM_CREATE_UNDO( )
SNMP_V3_COMM_UPDATE_UNDO( )
SNMP_V3_GROUP_DESTROY_UNDO( )
SNMP_V3_GROUP_CREATE_UNDO( )
SNMP_V3_GROUP_UPDATE_UNDO( )
SNMP_V3_NOTIFY_DESTROY_UNDO( )
SNMP_V3_NOTIFY_CREATE_UNDO( )
SNMP_V3_NOTIFY_UPDATE_UNDO( )
SNMP_V3_NFILT_DESTROY_UNDO( )
SNMP_V3_NFILT_CREATE_UNDO( )
SNMP_V3_NFILT_UPDATE_UNDO( )
SNMP_V3_NPROF_DESTROY_UNDO( )
SNMP_V3_NPROF_CREATE_UNDO( )
SNMP_V3_NPROF_UPDATE_UNDO( )
SNMP_V3_PROXY_DESTROY_UNDO( )
SNMP_V3_PROXY_CREATE_UNDO( )
SNMP_V3_PROXY_UPDATE_UNDO( )
SNMP_V3_GROUP_DESTROY_UNDO( )
SNMP_V3_TADDR_DESTROY_UNDO( )
SNMP_V3_TADDR_CREATE_UNDO( )
SNMP_V3_TADDR_UPDATE_UNDO( )
SNMP_V3_TPARAM_PROFILE_DESTROY_UNDO( )
SNMP_V3_TPARAM_PROFILE_CREATE_UNDO( )
SNMP_V3_TPARAM_PROFILEUPDATE_UNDO( )
SNMP_V3_USER_DESTROY_UNDO( )
SNMP_V3_USER_CREATE_UNDO( )
SNMP_V3_USER_UPDATE_UNDO( )
SNMP_V3_ACCESS_FINISHED( )
SNMP_V3_COMM_FINISHED( )
SNMP_V3_GROUP_FINISHED( )
135
Wind River SNMP
Programmer's Guide, 10.5
SNMP_V3_NOTIFY_FINISHED( )
SNMP_V3_NFILT_FINISHED( )
SNMP_V3_NPROF_FINISHED( )
SNMP_V3_PROXY_FINISHED( )
SNMP_V3_TADDR_FINISHED( )
SNMP_V3_TPARAM_FINISHED( )
SNMP_V3_USER_FINISHED( )
NOTE: The RFC 3415 view scheme was originally defined in RFC 2275 and
modified in RFC 2575.
Specifically, method routines must call these macros to implement RFC 3415 view
SET REQUESTs for the RFC 3415 view table MIB objects. If you want to use
nonvolatile storage for any of these tables, you need to define these macros. If they
are defined, Wind River SNMP’s method routines will call them. If you do not use
nonvolatile storage, you do not need to define these macros.
You can also use these macros to implement policies for creation, modification, or
deletion of table entries.
Use the following procedure to make a multi-stage RFC 3415 view SET REQUEST:
1. The method routine calls a RFC 3415 view TEST macro to collect information,
reserve resources, and pre validate your RFC 3415 view SET REQUEST.
2. If the RFC 3415 view testproc is successful, set the corresponding BACKOUT
macro to allow pre-staged info to be released in the case of a later failure.
3. If the RFC 3415 view setproc is successful, you should set the corresponding
RFC 3415 view FINISHED macro to be set in the vb_free_priv( ) routine, and
then set the RFC 3415 view undoproc. If the RFC 3415 view SET REQUEST
fails, do not call the UNDO macro.
NOTE: Although RFC 2275 has been upgraded to RFC 3415, the view method
routine names still include a reference to RFC 2275 for backward compatibility.
Prototypes for RFC 3415 View method routines fall into the following categories:
SNMP_VIEW_2275_CREATE_TEST( )
SNMP_VIEW_2275_DESTROY_TEST( )
SNMP_VIEW_2275_UPDATE_TEST( )
136
11 User-Supplied Code
11.9 RFC 3415 View Method Routine Macros
SNMP_VIEW_2275_CREATE_BACKOUT( )
SNMP_VIEW_2275_DESTROY_BACKOUT( )
SNMP_VIEW_2275_UPDATE_BACKOUT( )
SNMP_VIEW_2275_CREATE_SET( )
SNMP_VIEW_2275_DESTROY_SET( )
SNMP_VIEW_2275_UPDATE_SET( )
SNMP_VIEW_2275_CREATE_UNDO( )
SNMP_VIEW_2275_DESTROY_UNDO( )
SNMP_VIEW_2275_UPDATE_UNDO( )
SNMP_VIEW_2275_FINISHED( )
137
Wind River SNMP
Programmer's Guide, 10.5
138
12
Compiler Issues
12.2 C Compiler
Wind River SNMP is compatible with the ISO C language definition.
Wind River SNMP works on systems where the size of an integer is either 32 or 16
bits.
Wind River SNMP is strongly typed. There is one area in which type conversion
problems can arise.
139
Wind River SNMP
Programmer's Guide, 10.5
In the MIBLEAF_T structure (defined in mib.h and used in mib.c), there is a 32-bit
quantity that Wind River SNMP passes unchanged to the various user-provided
data access routines. On machines where a pointer to a character is different than
a pointer to a word, casting can corrupt the pointer.
Wind River SNMP is insensitive to the order in which bytes are stored in memory.
In other words, Wind River SNMP works equally well on little-endian and
big-endian machines. All conversions between network and internal byte ordering
are performed by the ASN.1 encoding and decoding logic.
140
A
Row Creation Code
/***************************************************************
NAME: viewtable_destroy_cleanup
PARAMETERS:
PTR_T A pointer to the View to delete or
A pointer to the vb that points to the view to
delete cast as a PTR_T
RETURNS: Nothing
***************************************************************/
void
viewtable_destroy_cleanup(PTR_T viewptr)
{
SNMP_VIEW_2275_DESTROY_BACKOUT(((VB_T *)viewptr)->vb_priv, 0);
}
/***************************************************************
NAME: viewtable_create_cleanup
141
Wind River SNMP
Programmer's Guide, 10.5
PARAMETERS:
PTR_T A pointer to the vb that points to the view
to delete cast as a PTR_T
RETURNS: Nothing
***************************************************************/
void
viewtable_create_cleanup(PTR_T viewptr)
{
VIEWLEAF_T *view;
view = (VIEWLEAF_T *)(((VB_T *)viewptr)->vb_priv);
SNMP_VIEW_2275_CREATE_BACKOUT(0, view);
SNMP_View_2275_Deinstall(view);
SNMP_View_Delete(view);
}
/***************************************************************
NAME: viewtable_update_cleanup
PARAMETERS:
PTR_T A pointer to the vb that points to the view
to delete cast as a PTR_T
RETURNS: Nothing
***************************************************************/
void
viewtable_update_cleanup(PTR_T viewptr)
{
VIEWLEAF_T *view;
view = (VIEWLEAF_T *)(((VB_T *)viewptr)->vb_priv);
SNMP_VIEW_2275_UPDATE_BACKOUT(view->lexinext, view);
SNMP_View_Delete(view);
}
/***************************************************************
NAME: viewtable_destroy_undo
PARAMETERS:
OIDC_T Last component of the object id leading to
the leaf node in the MIB. This is usually
the identifier for the particular attribute
in the table.
int Number of components in the unused part
of the object identifier
OIDC_T * Unused part of the object identifier
SNMP_PKT_T * SNMP packet currently being processed.
VB_T * Variable being processed.
RETURNS: void
***************************************************************/
/*ARGSUSED*/
void viewtable_destroy_undo(OIDC_T last_match,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
142
A Row Creation Code
A.1 Row Creation Code Example
{
VIEWLEAF_T *view;
ALENGTH_T namelen = ETC_VIEW_NAME_MAX;
bits8_t name[ETC_VIEW_NAME_MAX];
/* find the state block we saved and then reset the vb_priv
info so we don’t have any accidents later */
view = (VIEWLEAF_T *)vbp->vb_priv;
vbp->vb_priv = 0;
/***************************************************************
NAME: viewtable_create_undo
PARAMETERS:
OIDC_T Last component of the object id leading to
the leaf node in the MIB. This is usually
the identifier for the particular attribute
in the table.
int Number of components in the unused part of
the object identifier
OIDC_T * Unused part of the object identifier
SNMP_PKT_T * SNMP packet currently being processed.
VB_T * Variable being processed.
RETURNS: void
***************************************************************/
/*ARGSUSED*/
void
viewtable_create_undo(OIDC_T last_match,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
VIEWLEAF_T *view;
/* assume things will go well */
undoproc_good(pktp, vbp);
/* find the state block we saved and then reset the vb_priv info
so we don’t have any accidents later */
view = (VIEWLEAF_T *)vbp->vb_priv;
vbp->vb_priv = 0;
vbp->vb_free_priv = 0;
#if defined(SNMP_VIEW_2275_CREATE_UNDO)
143
Wind River SNMP
Programmer's Guide, 10.5
/***************************************************************
NAME: viewtable_update_undo
PURPOSE: This routine attempts to undo a previous update set.
It expects the struct pointed to by vb_priv to contain
the old information and a pointer to the new
(installed) struct.
PARAMETERS:
OIDC_T Last component of the object id leading to
the leaf node in the MIB. This is usually
the identifier for the particular attribute
in the table.
int Number of components in the unused part of
the object identifier
OIDC_T * Unused part of the object identifier
SNMP_PKT_T * SNMP packet currently being processed.
VB_T * Variable being processed.
RETURNS: void
***************************************************************/
/*ARGSUSED*/
void
viewtable_update_undo(OIDC_T last_match,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
VIEWLEAF_T *cur_view, *sav_view;
/* assume things will go well */
undoproc_good(pktp, vbp);
/* find the state block we saved and then reset the vb_priv info
so we don’t have any accidents later */
/* swap the info from saved view back into current view,
we only need to move strings if the names are different
finally free the saved block */
SNMP_View_Set_Type(cur_view, SNMP_View_Get_Type(sav_view));
SNMP_View_Set_Status(cur_view, SNMP_View_Get_Status(sav_view));
SNMP_View_Set_StorageType(cur_view,
SNMP_View_Get_StorageType(sav_view));
if (EBufferStart(&cur_view->mask) !=
EBufferStart(&sav_view->mask)) {
EBufferClean(&cur_view->mask);
MEMCPY(&cur_view->mask, &sav_view->mask, sizeof(EBUFFER_T));
EBufferInitialize(&sav_view->mask);
144
A Row Creation Code
A.1 Row Creation Code Example
}
SNMP_View_Delete(sav_view);
return;
}
/***************************************************************
NAME: viewtable_set_cleanup
PURPOSE: Free the saved view and indicate that we are finished.
PARAMETERS:
PTR_T A pointer to the vb that points to the view to
delete cast as a PTR_T
RETURNS: Nothing
***************************************************************/
void
viewtable_set_cleanup(PTR_T viewptr)
{
if (((VB_T *)viewptr)->vb_priv) {
if (((VB_T *)viewptr)->undoproc == viewtable_create_undo)
((VB_T *)viewptr)->vb_priv = 0;
else
SNMP_View_Delete((VIEWLEAF_T *)(((VB_T *)viewptr)->vb_priv));
}
SNMP_VIEW_2275_FINISHED();
}
/***************************************************************
NAME: viewtable_test
PURPOSE: This routine collects all of the var binds that want
to be set in a row and does value and consistency
checking on those varbinds before trying to allocate
any space.
PARAMETERS:
OIDC_T Last component of the object id leading to
the leaf node in the MIB. This is usually
the identifier for the particular attribute
in the table.
int Number of components in the unused part of
the object identifier
OIDC_T * Unused part of the object identifier
SNMP_PKT_T * SNMP packet currently being processed.
VB_T * Variable being processed.
RETURNS: void
***************************************************************/
/*ARGSUSED*/
void viewtable_test(OIDC_T last_match,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp) {
VIEWLEAF_T *view, tempview, *newview;
sbits32_t value, ptret;
int cago = 0, create_row = 0, mask_chg = 0, oidclen;
ALENGTH_T nlen = 0, namelen = ETC_VIEW_NAME_MAX;
VB_T *tvbp;
bits8_t name[ETC_VIEW_NAME_MAX];
OIDC_T *oidc;
/* get the list of var binds that may go into this structure
then mark all the vbs except the first one as having been
tested, set and done. This means that vbp is taking
responsibility for all of the other vbs in the row. Then
mark vbp as having it’s test started & done so we don’t
have to worry about it later. We can do this because
the routine will run to completion */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
for(tvbp = vbp->vb_link; tvbp; tvbp = tvbp->vb_link)
setproc_all_bits(pktp, tvbp);
testproc_good(pktp, vbp);
145
Wind River SNMP
Programmer's Guide, 10.5
146
A Row Creation Code
A.1 Row Creation Code Example
testproc_error(pktp, tvbp,
INCONSISTENT_VALUE);
return;
}
break;
case ETC_RS_CAGO:
if (create_row == 0) {
testproc_error(pktp, tvbp,
INCONSISTENT_VALUE);
return;
}
value = ETC_RS_ACTIVE;
cago = 1;
break;
case ETC_RS_CAWAIT:
if (create_row == 0) {
testproc_error(pktp, tvbp,
INCONSISTENT_VALUE);
return;
}
value = ETC_RS_NIS;
break;
case ETC_RS_DESTROY:
break;
default:
testproc_error(pktp, tvbp, WRONG_VALUE);
return;
}
if (SNMP_View_Get_Status(&tempview) !=
ETC_RS_DESTROY)
SNMP_View_Set_Status(&tempview, (int)value);
break;
}
}
147
Wind River SNMP
Programmer's Guide, 10.5
(SNMP_View_Get_StorageType(view) ==
SNMP_View_Get_StorageType(&tempview))) {
setproc_all_bits(pktp, vbp);
return;
}
}
else
mask_chg = 1;
}
else {
mask_chg = 1;
}
/* Because of how we do the backout stuff we always allocate
a new viewleaf and set it up */
newview = SNMP_View_Create(oidc, oidclen);
if (newview == 0) {
testproc_error(pktp, vbp, RESOURCE_UNAVAILABLE);
return;
}
SNMP_View_Set_Type(newview, SNMP_View_Get_Type(&tempview));
SNMP_View_Set_Status(newview, SNMP_View_Get_Status(&tempview));
SNMP_View_Set_StorageType(newview,
SNMP_View_Get_StorageType(&tempview));
if (mask_chg) {
if (EBufferClone(&tempview.mask, &newview->mask) != 0) {
SNMP_View_Delete(newview);
testproc_error(pktp, vbp, RESOURCE_UNAVAILABLE);
return;
}
}
else {
EBufferPreLoad(BFL_IS_STATIC, &newview->mask,
SNMP_View_Get_Mask(view),
SNMP_View_Get_MaskLen(view));
}
/* if we are creating a new viewleaf we need to install it in
the tree and run the create test, if we are updating an old
viewleaf we just run the update test */
if (view == 0) {
if (SNMP_View_2275_Install(newview, name, namelen)) {
SNMP_View_Delete(newview);
testproc_error(pktp, vbp, RESOURCE_UNAVAILABLE);
return;
}
ptret = SNMP_VIEW_2275_CREATE_TEST(pktp, vbp, 0, newview);
if (ptret != NO_ERROR) {
SNMP_View_2275_Deinstall(newview);
SNMP_View_Delete(newview);
testproc_error(pktp, vbp, ptret);
return;
}
vbp->vb_free_priv = viewtable_create_cleanup;
}
else {
ptret = SNMP_VIEW_2275_UPDATE_TEST(pktp, vbp, view, newview);
if (ptret != NO_ERROR) {
SNMP_View_Delete(newview);
testproc_error(pktp, vbp, ptret);
return;
}
newview->lexinext = view;
vbp->vb_free_priv = viewtable_update_cleanup;
}
if (cago)
SNMP_View_Set_Status(newview, ETC_RS_CAGO);
vbp->vb_priv = (PTR_T)newview;
return;
}
148
A Row Creation Code
A.1 Row Creation Code Example
/***************************************************************
NAME: viewtable_set
PURPOSE: Perform the set of the view, by the time we get here
the viewleaf has been built and filled in by the test
function. If the tree node points to the viewleaf
then, this was a creation request and we already
installed the leaf. We do need to reset the vb_priv
and vb_free_priv pointers so we won’t free the data
later. Otherwise we need to install the new leaf
and save a pointer to the old leaf in case an undo
is required.
PARAMETERS:
OIDC_T Last component of the object id leading to
the leaf node in the MIB. This is usually
the identifier for the particular attribute
in the table.
int Number of components in the unused part of
the object identifier
OIDC_T * Unused part of the object identifier
SNMP_PKT_T * SNMP packet currently being processed.
VB_T * Variable being processed.
RETURNS: void
***************************************************************/
void
viewtable_set(OIDC_T last_match,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
VIEWLEAF_T *old_view, *new_view;
bits16_t temp_value;
EBUFFER_T temp_ebuf;
new_view = (VIEWLEAF_T *)vbp->vb_priv;
if (vbp->vb_free_priv == viewtable_destroy_cleanup) {
SNMP_VIEW_2275_DESTROY_SET(pktp, vbp, new_view, 0);
SNMP_View_2275_Deinstall(new_view);
vbp->vb_free_priv = viewtable_set_cleanup;
undoproc_set(pktp, vbp, viewtable_destroy_undo);
}
else if (vbp->vb_free_priv == viewtable_create_cleanup) {
if (SNMP_View_Get_Status(new_view) == ETC_RS_CAGO)
SNMP_View_Set_Status(new_view, ETC_RS_ACTIVE);
SNMP_VIEW_2275_CREATE_SET(pktp, vbp, 0, new_view);
undoproc_set(pktp, vbp, viewtable_create_undo);
}
else {
old_view = new_view->lexinext;
SNMP_VIEW_2275_UPDATE_SET(pktp, vbp, old_view,
new_view);
/* deal with type, status and storage information */
temp_value = SNMP_View_Get_Type(old_view);
SNMP_View_Set_Type(old_view,
SNMP_View_Get_Type(new_view));
SNMP_View_Set_Type(new_view, temp_value);
temp_value = SNMP_View_Get_Status(old_view);
SNMP_View_Set_Status(old_view,
SNMP_View_Get_Status(new_view));
SNMP_View_Set_Status(new_view, temp_value);
temp_value = SNMP_View_Get_StorageType(old_view);
SNMP_View_Set_StorageType(old_view,
SNMP_View_Get_StorageType(new_view));
SNMP_View_Set_StorageType(new_view, temp_value);
/* deal with the string info, if the two pointers are
equal we don’t need to do anything, otherwise we need
to copy the buffer info around */
if (EBufferStart(&old_view->mask) !=
EBufferStart(&new_view->mask)) {
MEMCPY(&temp_ebuf, &old_view->mask, sizeof(EBUFFER_T));
149
Wind River SNMP
Programmer's Guide, 10.5
MEMCPY(&old_view->mask, &new_view->mask,
sizeof(EBUFFER_T));
MEMCPY(&new_view->mask, &temp_ebuf, sizeof(EBUFFER_T));
}
undoproc_set(pktp, vbp, viewtable_update_undo);
}
vbp->vb_free_priv = viewtable_set_cleanup;
setproc_good(pktp, vbp);
return;
}
150
B
User-Supplied Code Reference
Entries
151
Wind River SNMP
Programmer's Guide, 10.5
AX_RESPONSE_PREPROCESS( )
NAME AX_RESPONSE_PREPROCESS( ) – process subagent response packets
DESCRIPTION This user-exit provides an application-specific way for programmers to perform processing
within the Master Agent for sub-agent response packets using field values found in the
SNMP_PKT_T structure. By default this user-exit is defined to NULL.
PARAMETERS pktp
Point to an SNMP_PKT_T structure.
RETURNS None.
ENVOY_AX_ADD_T( )
NAME ENVOY_AX_ADD_T( ) – indicate when an AgentX packet handler was called
DESCRIPTION This is a prototype for a routine that the envoy_ax_chunk_handler( ) routine calls to
indicate to you when a packet handler has been called. Use this function to maintain a
reference count on the cookie information in conjunction with calls to the error handler,
ENVOY_AX_ERROR_T( ), to determine when it is safe to free resources associated with
cookie.
Depending on how the other side of the connection chooses to send its messages, a single
call to the stream-to-packet routines may result in 0, 1, or several calls to this routine.
PARAMETERS cookie
Specify the information block that was passed to envoy_ax_chunk_handler( ).
RETURNS None.
ENVOY_AX_ADMIN_T( )
NAME ENVOY_AX_ADMIN_T( ) – pass an AgentX packet to customer code
152
B User-Supplied Code Reference Entries
ENVOY_AX_ERROR_T( )
DESCRIPTION This is a prototype for a routine that you can use to pass an AgentX packet to your code.
Wind River SNMP calls this routine when a subagent receives a response or close packet.
Wind River SNMP can also call ENVOY_AX_ADMIN_T( ) when a master agent receives a
notify. Since a notify is an attempt by a subagent to cause a trap to be sent, it is your
responsibility to create and send the trap. When the subagent receives a response, check the
response to see if it is an error.
Wind River SNMP can call this routine before the handler routine returns.
PARAMETERS ax_pkt
Specify an AgentX packet.
cookie
Specify the information block that you passed to the handler routine.
RETURNS None.
ENVOY_AX_ERROR_T( )
NAME ENVOY_AX_ERROR_T( ) – AgentX error handler
DESCRIPTION This is a prototype for a routine that an error handler calls to indicate that the handler is
finished with cookie and that your code may free any resources associated with it.
Wind River SNMP calls it once for each cookie that is passed to the handler routine.
Wind River SNMP can call this macro either before or after the handler function returns.
PARAMETERS cookie
Specify the information block that you passed to the handler routine.
error_stat
If an error occurs, indicate the error condition as either AgentX session loss
(ENVOY_AX_SESS_LOSS) or illegal operation (ENVOY_AX_BAD_OPERATION).
RETURNS None.
ENVOY_AX_SEND_T( )
NAME ENVOY_AX_SEND_T( ) – AgentX send handler
153
Wind River SNMP
Programmer's Guide, 10.5
ptr_t vblist,
ALENGTH_T need
)
DESCRIPTION This is a prototype for a routine that the handler calls to sends a response message. This
routine should allocate enough space for the size specified in need, place that space into an
EBUFFER_T structure, and call envoy_ax_pkt_encode( ) to create the message. If the
encoding is successful, the message should be sent to the destination indicated by cookie. You
should pass all variables to the encode routine without changing them.
Wind River SNMP can call this macro either before or after the handler function returns.
PARAMETERS ax_pkt
Specify an AgentX packet.
cookie
Specify the information block that you passed to the handler routine.
need
Specify the length of the message in bytes.
vblist
Specify an extra list of VarBinds.
ERR_COMPLETE_T( )
NAME ERR_COMPLETE_T( ) – error completion routine
DESCRIPTION This is a prototype for an error completion routine that allows you the opportunity to release
any memory associated with this packet; for example addresses or the cookie. A routine of
this type is passed to Process_Rcvd_SNMP_Packet_Async( ) and
SNMP_Send_Notify_Name( ). It is called when Wind River SNMP has finished
processing a packet and there is no response packet. It can be called either before or after the
main processing routine returns.
PARAMETERS *for_addr
Specify the destination of the packet.
*loc_addr
Specify the source of the packet.
154
B User-Supplied Code Reference Entries
IO_COMPLETE_T( )
error_code
Indicate what happened. 0 indicates that, even though we do not have a response
packet, no errors have occurred. Responses from proxy targets can cause this condition.
Non-zero indicates some sort of error, currently no specific errors are defined.
cookie
Can be used to pass information, for example, the packet’s source address, to a
completion or cleanup routine. It passes unchanged from the
Process_Rcvd_SNMP_Packet_Async( ) routine to the call to the completion routine.
RETURNS None.
IO_COMPLETE_T( )
NAME IO_COMPLETE_T( ) – I/O completion routine
PARAMETERS *for_addr
Specify the destination of the packet.
*loc_addr
Specify the source of the packet.
*pktp
Contain the address of the received packet buffer to encode and transmit.
need
Specify the length of the buffer needed to encode pktp.
155
Wind River SNMP
Programmer's Guide, 10.5
cookie
Can be used to pass information, for example, the packet’s source address, to a
completion or cleanup routine. The cookie argument is passed unchanged from the
Process_Rcvd_SNMP_Packet_Async( ) call to the completion routine.
RETURNS None.
PROXY_ROUTINE_T( )
NAME PROXY_ROUTINE_T( ) – translation routine for proxy packets
DESCRIPTION This is a prototype for a translation routine attached to the proxy_routine field in the
SNMP_PKT_T structure. It should translate the packet from its current format to the format
appropriate for the selected proxy target. Wind River SNMP-supplied conversion
routines change the version number and community string.
Use the standard encode routines to encode the packet. They will call the transport routine
specified in the PROXY_BLOCK_T structure attached to the SNMP_PKT_T structure to send
the packet over the selected transport layer.
NOTE: This handler is used by the code installed through both the ENVOY_SNMP_PROXY
and ENVOY_SNMP_PROXY_V3 options. The behavior of this routine is the same under
both proxy regimes.
RETURNS This routine should return a value less than 0 for failure, or a time-out period (in
milliseconds) for success.
RETRANS_CLEANUP_T( )
NAME RETRANS_CLEANUP_T( ) – notify retransmit cleanup completion routine
DESCRIPTION This is a prototype for a routine that is called when Wind River SNMP has finished
processing a Notify or, as in the case of an Inform, the targets have either responded or
completely timed out. When called, a routine of this type should dispose of the cookie by
freeing any resources associated with it.
PARAMETERS cookie
Can be used to pass information, for example, the packet’s source address, to a
completion or cleanup routine. It passes unchanged.
RETURNS None.
156
B User-Supplied Code Reference Entries
TRANSPORT_ROUTINE_T( )
TRANSPORT_ROUTINE_T( )
NAME TRANSPORT_ROUTINE_T( ) – transport routine for proxy packets
DESCRIPTION This is a prototype for the transport (or send) routine attached to the PROXY_BLOCK_T
structure. Use this handler to send proxy packets. Attach any addressing information for
this handler to the transport_block field of the PROXY_BLOCK_T structure that is passed to
the send routine as the cookie argument. This routine should transmit the buffer from ebuffp
to the specified address.
NOTE: This handler is available for use when you install the ENVOY_SNMP_PROXY
option.
PARAMETERS cookie
Can be used to pass information, for example, the packet’s source address, to a
completion or cleanup routine. It passes unchanged.
*ebuffp
Point to the buffer.
RETURNS If successful, this routine returns the value of eflag, the time-out period which specifies how
long the transport routine should wait before returning. In this case, 0 is a valid response.
However, any value less than 0 indicates failure.
ENVOY_ADD_ENGINE_ADDRESS( )
NAME ENVOY_ADD_ENGINE_ADDRESS( ) – add an engine ID to the engine table
DESCRIPTION This user-exit adds the engine ID to the engine table. It converts the SNMPADDR_T to a
TDomain and TAddress pair and calls SNMP_Engine_Set_Address( ) to add it to the
engine.
This is a function that customers must write. This default Wind River SNMP
implementation of this function is available only when the ENVOY_SNMP_V3_TARGET
installation option is installed. If you haven’t installed ENVOY_SNMP_V3_TARGET, the
157
Wind River SNMP
Programmer's Guide, 10.5
PARAMETERS *rp
Point to the packet.
*address
Point to the engine’s address.
create
If this value is 0, create the engine leaf. If this value is 1, just associate the address with
an existing engine.
ENVOY_ADD_ENGINE_ID( )
NAME ENVOY_ADD_ENGINE_ID( ) – add an engine ID to the engine table
DESCRIPTION If this user-exit is defined, when Wind River SNMP encounters an unknown engine ID
while processing a packet, it calls ENVOY_ADD_ENGINE_ID( ) to discover the given engine.
It adds the engine ID of the new engine found in the msg_sec_id field of pkt to the engine
table. This user-exit is maintained for backward compatibility. Use
ENVOY_ADD_ENGINE_ADDRESS( ) instead.
PARAMETERS *pkt
Point to the SMNP packet.
RETURNS None.
ENVOY_AX_CONN_ENTRY( )
NAME ENVOY_AX_CONN_ENTRY( ) – return the time, domain and addr for a specified connID
DESCRIPTION This user-exit returns a pointer to a specific connection entry via the AX_CONNENT_T
connection entry structure. This structure contains the time that the connection was
established (in the field agentxConnOpenTime), the transport protocol used by the
158
B User-Supplied Code Reference Entries
ENVOY_AX_COOKIE_CMP( )
connection (in the field agentxConnTransportDomain), and the transport address of the
remote subagent (in the field agentxConnTransportAddress).
PARAMETERS axConnId
Specify the connection identifier.
matchFlag
Specify whether the caller is looking for an exact match (AX_MATCH_GET) or wants
the lexicographic next object (AX_MATCH_NEXT).
pConnEntry
Specify a pointer to a connection entry structure supplied by the caller, and filled in if
the connection entry is found.
ENVOY_AX_COOKIE_CMP( )
NAME ENVOY_AX_COOKIE_CMP( ) – compare two AgentX information blocks
DESCRIPTION This is a prototype for a handler that compares two information blocks passed to the
handler.
Wind River SNMP contains a default version of this macro, which performs a simple test.
If you define your own version, it will be used.
PARAMETERS cookie_1
Specify the first information block that was passed to the handler routine.
cookie_2
Specify the second information block that was passed to the handler routine.
RETURNS This handler should return 1 for when the blocks are good and 0 for if not.
ENVOY_AX_FIND_MIB( )
NAME ENVOY_AX_FIND_MIB( ) – find a MIB to use with a given context
DESCRIPTION This is a prototype for a routine the master agent calls to receive the context information
from a subagent request message.
159
Wind River SNMP
Programmer's Guide, 10.5
PARAMETERS *context
Specify the context string.
RETURNS If the context is a valid context name, this routine should return the root of the MIB tree for
that context. Otherwise, it should return 0.
ENVOY_AX_GET_CONNID( )
NAME ENVOY_AX_GET_CONNID( ) – return the connection ID for a specific session
DESCRIPTION This user-exit returns the connection ID associated with a specific session ID.
PARAMETERS cookie
A pointer to the send_cookie. The x function can use this cookie to retrieve connection
information.
ENVOY_AX_MA_AC_ADD( )
NAME ENVOY_AX_MA_AC_ADD( ) – register a VarBindList in the agent capabilities table
DESCRIPTION This is a prototype for a routine the master agent calls to register the VarBindList contained
in ax_pkt in its agent capabilities table. This function should update the agent-capability
information in the sysUpTable (if supported).
PARAMETERS *ax_pkt
Specify an AgentX packet structure.
*mibroot
Specify the root of the MIB tree that was identified by ENVOY_AX_FIND_MIB( ).
RETURNS If successful, this routine should return 0. Otherwise, it should set the return code to the
error status for the response message as defined by the AgentX specification.
160
B User-Supplied Code Reference Entries
ENVOY_AX_MA_AC_CLEAN( )
ENVOY_AX_MA_AC_CLEAN( )
NAME ENVOY_AX_MA_AC_CLEAN( ) – request subagent to remove session from agent table
DESCRIPTION This is a prototype for a routine the master agent calls to request a subagent to remove any
agent capabilities the subagent has registered for a session. The master agent calls this
routine when it attempts to close a session and clean up any resources associated with the
session.
PARAMETERS session_id
Specify a session.
RETURNS None.
ENVOY_AX_MA_AC_REMOVE( )
NAME ENVOY_AX_MA_AC_REMOVE( ) – request subagent to remove VarBindList from agent
table
DESCRIPTION This is a prototype for a routine the master agent calls to request a subagent to remove a
VarBindList from its agent capabilities table.
PARAMETERS *ax_pkt
Specify an AgentX packet structure.
*mibroot
Specify the root of the MIB tree that was identified by ENVOY_AX_FIND_MIB( ).
RETURNS If successful, this routine should return 0. Otherwise, it should set the return code to the
error status for the response message as defined by the AgentX specification.
161
Wind River SNMP
Programmer's Guide, 10.5
ENVOY_AX_TRANSLATE_CONTEXT( )
NAME ENVOY_AX_TRANSLATE_CONTEXT( ) – extract context information from
SNMP_PKT_T
DESCRIPTION This is a prototype for a routine the master agent calls to extract the context and community
information from an SNMP_PKT_T structure and place it into an AgentX request. This
allows you to convert an SNMP context to an AgentX context, which isn’t explicitly handled
in the standards.
PARAMETERS Point to the SNMP packet structure from that is source of the context information.
Point to the AgentX packet structure that is the target for the context information.
RETURNS None.
ENVOY_AX_SA_MIB_ROOT_NODE( )
NAME ENVOY_AX_SA_MIB_ROOT_NODE( ) – determine the appropriate MIB tree
DESCRIPTION This is a prototype for a routine the subagent calls to determine which MIB tree to install in
the SNMP packet structure.
PARAMETERS cookie
Specify the cookie that was passed to the subagent handler routine.
*pktp
Specify an AgentX packet.
RETURNS If this routine is successful, it should return 0. Otherwise, it should return any other value.
162
B User-Supplied Code Reference Entries
ENVOY_GET_SYSUPTIME( )
ENVOY_GET_SYSUPTIME( )
NAME ENVOY_GET_SYSUPTIME( ) – return the value for the sysUptime object
DESCRIPTION This is a prototype for a routine the master agent calls to determine the value for the
sysUptime object for the specified context.
PARAMETERS *context
Specify the context string.
RETURNS If successful, this routine should return the value for the sysUptime object for the specified
context. Otherwise, it should return 0.
ENVOY_SET_RETRANS_ID( )
NAME ENVOY_SET_RETRANS_ID( ) – customize outgoing notify numbering scheme
DESCRIPTION This user-exit chooses the request ID and message ID of outgoing notifies, allowing you to
use your own numbering scheme for notifies. By default, notify request IDs are integer
values that start from 0 and increase monotonically. If you would like to write your own
version, see the default implementation in the file
target/h/wrn/wm/snmp/engine/sendntfy.h.
PARAMETERS *retrans
Specify the RETRANS_BLOCK_T that needs a new request id.
RETURNS None.
ENVOY_SNMPADDR_TO_TADDRESS( )
NAME ENVOY_SNMPADDR_TO_TADDRESS( ) – convert SNMPADDR_T into TAddress and
TDomain
DESCRIPTION This user-exit converts an SNMPADDR_T structure into a TAddress and TDomain pair.
163
Wind River SNMP
Programmer's Guide, 10.5
NOTE: Wind River SNMP supplies a default version of this routine. If you write your
own version, your version will override the default Wind River SNMP version.
PARAMETERS *addr
Specify the address of the SNMPADDR_T structure.
*tdomain
Specify the TDomain. The format of the TAddress depends on the value of the
corresponding instance of TDomain, which is defined in RFC 3417.
*taddress
Specify the TAddress.
ENVOY_TADDRESS_TO_SNMPADDR( )
NAME ENVOY_TADDRESS_TO_SNMPADDR( ) – convert a TAddress to an SNMPADDR_T
DESCRIPTION This user-exit converts a TAddress and TDomain pair into an SNMPADDR_T structure.
NOTE: Wind River SNMP supplies a default version of this routine. If you write your
own version, your version will override the default Wind River SNMP version.
PARAMETERS *addr
Specify the address of the SNMPADDR_T structure.
*tdomain
Specify the TDomain. The format of the TAddress depends on the value of the
corresponding instance of TDomain, which is defined in RFC 3417.
*taddress
Specify the TAddress.
164
B User-Supplied Code Reference Entries
SNMP_DH_RAND( )
SNMP_DH_RAND( )
NAME SNMP_DH_RAND( ) – set the pseudo-random number generator seed
DESCRIPTION This user-exit sets the pseudo-random number generator (PRNG) seed, which is mixed with
the existing PRNG state. You must call the user-exit with no less than 128 bits of random
data prior to using any of the OpenSSL crypto or Wind River Common Crypto Interface
(CCI) Diffie-Hellman routines.
PARAMETERS *seedBuff
A pointer to a series of bytes.
buffSize
The size of the buffer.
RETURNS None.
SNMP_user_get_encode_buffer( )
NAME SNMP_user_get_encode_buffer( ) – allocate memory for an encoded packet
DESCRIPTION If this user-exit is defined, you can call it to allocate memory to encode the contents of an
SNMP packet.
PARAMETERS *pktp
Specify the packet.
need
Indicate how many bytes are required in the encode buffer.
*ebuffp
Point to an EBUFFER_T structure to be used to define the buffer in which the resulting
PDU, if any, is to be placed.
RETURNS There are three possible actions you can take when this user-exit is called:
■
Return 0 and leave ebuffp unmodified. This is effectively a no-op because Wind River
SNMP will allocate the memory later.
■ Return 0 and set ebuffp to point to an appropriately-sized buffer.
■ Return 1 to indicate that an error occurred. This causes Wind River SNMP to abort
the encode procedure and no packet will be sent.
165
Wind River SNMP
Programmer's Guide, 10.5
DESCRIPTION Whenever a SET REQUEST creates, modifies (updates) or deletes (destroys) a table entry, one
of the following TEST macros is called. The underlying routine must reserve any resources
that the SET operation requires unless the entry is deleted.
Method routines that call CREATE TEST macros must supply a pointer to the structure to be
installed in the database. During normal processing, the value of some fields can change.
Undo these changes before the structure is installed in the database.
PARAMETERS *current
Specify this entry’s current information and indices for DESTROY TEST and
UPDATE TEST macros. If this is a new entry, this value is 0.
*new
Specify the new information to install or 0 for existing entries. If current is 0,
CREATE TEST and UPDATE TEST macros also include indexing information.
*pkt
Specify the packet that is requesting the SET operation.
*vbp
Specify the VarBind that caused the method routine to run.
RETURNS If the TEST operation was successful and processing should continue, TEST macros return
the value NO_ERROR as defined in h/snmpdefs.h. Any other return is considered a failure
and is used as the error argument to testproc_error( ).
If the TEST operation succeeds, set the BACKOUT routine to be called by the vb_free_priv( )
routine.
PROTOTYPES SNMP_V3_ACCESS_DESTROY_TEST( )
sbits32_t SNMP_V3_ACCESS_DESTROY_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_ACCESS_T * current,
SNMP_ACCESS_T * new
)
SNMP_V3_ACCESS_CREATE_TEST( )
sbits32_t SNMP_V3_ACCESS_CREATE_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_ACCESS_T * current,
SNMP_ACCESS_T * new
)
SNMP_V3_ACCESS_UPDATE_TEST( )(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_ACCESS_T * current,
SNMP_ACCESS_T * new
)
SNMP_V3_COMM_DESTROY_TEST( )
166
B User-Supplied Code Reference Entries
SNMP V3 TEST Macros
sbits32_t SNMP_V3_COMM_DESTROY_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_COMMUNITY_T * current,
SNMP_COMMUNITY_T * new
)
SNMP_V3_COMM_CREATE_TEST( )
sbits32_t SNMP_V3_COMM_CREATE_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_COMMUNITY_T * current,
SNMP_COMMUNITY_T * new
)
SNMP_V3_COMM_UPDATE_TEST( )
sbits32_t SNMP_V3_COMM_UPDATE_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_COMMUNITY_T * current,
SNMP_COMMUNITY_T * new
)
SNMP_V3_GROUP_DESTROY_TEST( )
sbits32_t SNMP_V3_GROUP_DESTROY_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_GROUP_T * current,
SNMP_GROUP_T * new
)
SNMP_V3_GROUP_CREATE_TEST( )
sbits32_t SNMP_V3_GROUP_CREATE_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_GROUP_T * current,
SNMP_GROUP_T * new
)
SNMP_V3_GROUP_UPDATE_TEST( )
sbits32_t SNMP_V3_GROUP_UPDATE_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_GROUP_T * current,
SNMP_GROUP_T * new
)
SNMP_V3_NOTIFY_DESTROY_TEST( )
sbits32_t SNMP_V3_NOTIFY_DESTROY_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_T * current,
SNMP_NOTIFY_T * new
)
SNMP_V3_NOTIFY_CREATE_TEST( )
sbits32_t SNMP_V3_NOTIFY_CREATE_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_T * current,
SNMP_NOTIFY_T * new
)
SNMP_V3_NOTIFY_UPDATE_TEST( )
167
Wind River SNMP
Programmer's Guide, 10.5
sbits32_t SNMP_V3_NOTIFY_UPDATE_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_T * current,
SNMP_NOTIFY_T * new
}
SNMP_V3_NFILT_DESTROY_TEST( )
sbits32_t SNMP_V3_NFILT_DESTROY_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_FILTER_T * current,
SNMP_NOTIFY_FILTER_T * new
)
SNMP_V3_NFILT_CREATE_TEST( )
sbits32_t SNMP_V3_NFILT_CREATE_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_FILTER_T * current,
SNMP_NOTIFY_FILTER_T * new
)
SNMP_V3_NFILT_UPDATE_TEST( )
sbits32_t SNMP_V3_NFILT_UPDATE_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_FILTER_T * current,
SNMP_NOTIFY_FILTER_T * new
)
SNMP_V3_NPROF_DESTROY_TEST( )
sbits32_t SNMP_V3_NPROF_DESTROY_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_FILTER_PROFILE_T * current,
SNMP_NOTIFY_FILTER_PROFILE_T * new
)
SNMP_V3_NPROF_CREATE_TEST( )
sbits32_t SNMP_V3_NPROF_CREATE_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_FILTER_PROFILE_T * current,
SNMP_NOTIFY_FILTER_PROFILE_T * new
)
SNMP_V3_NPROF_UPDATE_TEST( )
sbits32_t SNMP_V3_NPROF_UPDATE_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_FILTER_PROFILE_T * current,
SNMP_NOTIFY_FILTER_PROFILE_T * new
)
SNMP_V3_PROXY_DESTROY_TEST( )
sbits32_t SNMP_V3_PROXY_DESTROY_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_PROXY_T * current,
SNMP_PROXY_T * new
)
SNMP_V3_PROXY_CREATE_TEST( )
168
B User-Supplied Code Reference Entries
SNMP V3 TEST Macros
sbits32_t SNMP_V3_PROXY_CREATE_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_PROXY_T * current,
SNMP_PROXY_T * new
)
SNMP_V3_PROXY_UPDATE_TEST( )
sbits32_t SNMP_V3_PROXY_UPDATE_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_PROXY_T * current,
SNMP_PROXY_T * new
)
SNMP_V3_TADDR_DESTROY_TEST( )
sbits32_t SNMP_V3_TADDR_DESTROY_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_TARGET_ADDR_T * current,
SNMP_TARGET_ADDR_T * new
)
SNMP_V3_TADDR_CREATE_TEST( )
sbits32_t SNMP_V3_TADDR_CREATE_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_TARGET_ADDR_T * current,
SNMP_TARGET_ADDR_T * new
)
SNMP_V3_TADDR_UPDATE_TEST( )
sbits32_t SNMP_V3_TADDR_UPDATE_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_TARGET_ADDR_T * current,
SNMP_TARGET_ADDR_T * new
)
SNMP_V3_TPARAM_DESTROY_TEST( )
sbits32_t SNMP_V3_TPARAM_DESTROY_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_TARGET_PARAMS_T * current,
SNMP_TARGET_PARAMS_T * new
)
SNMP_V3_TPARAM_CREATE_TEST( )
sbits32_t SNMP_V3_TPARAM_CREATE_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_TARGET_PARAMS_T * current,
SNMP_TARGET_PARAMS_T * new
)
SNMP_V3_TPARAM_UPDATE_TEST( )
sbits32_t SNMP_V3_TPARAM_UPDATE_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_TARGET_PARAMS_T * current,
SNMP_TARGET_PARAMS_T * new
)
SNMP_V3_USER_DESTROY_TEST( )
169
Wind River SNMP
Programmer's Guide, 10.5
sbits32_t SNMP_V3_USER_DESTROY_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_USER_T * current,
SNMP_USER_T * new
)
SNMP_V3_USER_CREATE_TEST( )
sbits32_t SNMP_V3_USER_CREATE_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_USER_T * current,
SNMP_USER_T * new
)
SNMP_V3_USER_UPDATE_TEST( )
sbits32_t SNMP_V3_USER_UPDATE_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_USER_T * current,
SNMP_USER_T * new
)
DESCRIPTION When a TEST macro succeeds, Wind River SNMP sets up the BACKOUT macro to allow
pre-staged info to be released in the case of a later failure.
PARAMETERS *current
Specify this entry’s current information and indices for DESTROY TEST and
UPDATE TEST macros. If this is a new entry, this value is 0.
*new
Specify the new information to install, or 0 for existing entries. This value is set for
CREATE and UPDATE calls. If current is 0, CREATE and UPDATE macros also include
indexing information.
RETURNS None.
PROTOTYPES SNMP_V3_ACCESS_DESTROY_BACKOUT( )
void SNMP_V3_ACCESS_DESTROY_BACKOUT(
SNMP_ACCESS_T * current,
SNMP_ACCESS_T * new
)
SNMP_V3_ACCESS_CREATE_BACKOUT( )
void SNMP_V3_ACCESS_CREATE_BACKOUT(
SNMP_ACCESS_T * current,
SNMP_ACCESS_T * new
)
SNMP_V3_ACCESS_UPDATE_BACKOUT( )
void SNMP_V3_ACCESS_UPDATE_BACKOUT (
SNMP_ACCESS_T * current,
SNMP_ACCESS_T * new
)
SNMP_V3_COMM_DESTROY_BACKOUT( )
170
B User-Supplied Code Reference Entries
SNMP V3 BACKOUT Macros
void SNMP_V3_COMM_DESTROY_BACKOUT(
SNMP_COMMUNITY_T * current,
SNMP_COMMUNITY_T * new
)
SNMP_V3_COMM_CREATE_BACKOUT( )
void SNMP_V3_COMM_CREATE_BACKOUT(
SNMP_COMMUNITY_T * current,
SNMP_COMMUNITY_T * new
)
SNMP_V3_COMM_UPDATE_BACKOUT( )
void SNMP_V3_COMM_UPDATE_BACKOUT(
SNMP_COMMUNITY_T * current,
SNMP_COMMUNITY_T * new
)
SNMP_V3_GROUP_DESTROY_BACKOUT( )
void SNMP_V3_GROUP_DESTROY_BACKOUT(
SNMP_GROUP_T * current,
SNMP_GROUP_T * new
)
SNMP_V3_GROUP_CREATE_BACKOUT( )
void SNMP_V3_GROUP_CREATE_BACKOUT(
SNMP_GROUP_T * current,
SNMP_GROUP_T * new
)
SNMP_V3_GROUP_UPDATE_BACKOUT( )
void SNMP_V3_GROUP_UPDATE_BACKOUT(
SNMP_GROUP_T * current,
SNMP_GROUP_T * new
)
SNMP_V3_NOTIFY_DESTROY_BACKOUT( )
void SNMP_V3_NOTIFY_DESTROY_BACKOUT(
SNMP_NOTIFY_T * current,
SNMP_NOTIFY_T * new
)
SNMP_V3_NOTIFY_CREATE_BACKOUT( )
void SNMP_V3_NOTIFY_CREATE_BACKOUT(
SNMP_NOTIFY_T * current,
SNMP_NOTIFY_T * new
)
SNMP_V3_NOTIFY_UPDATE_BACKOUT( )
void SNMP_V3_NOTIFY_UPDATE_BACKOUT(
SNMP_NOTIFY_T * current,
SNMP_NOTIFY_T * new
)
SNMP_V3_NFILT_DESTROY_BACKOUT( )
void SNMP_V3_NFILT_DESTROY_BACKOUT(
SNMP_NOTIFY_FILTER_T * current,
SNMP_NOTIFY_FILTER_T * new
)
SNMP_V3_NFILT_CREATE_BACKOUT( )
void SNMP_V3_NFILT_CREATE_BACKOUT(
SNMP_NOTIFY_FILTER_T * current,
SNMP_NOTIFY_FILTER_T * new
)
SNMP_V3_NFILT_UPDATE_BACKOUT( )
171
Wind River SNMP
Programmer's Guide, 10.5
void SNMP_V3_NFILT_UPDATE_BACKOUT(
SNMP_NOTIFY_FILTER_T * current,
SNMP_NOTIFY_FILTER_T * new
)
SNMP_V3_NPROF_DESTROY_BACKOUT( )
void SNMP_V3_NPROF_DESTROY_BACKOUT(
SNMP_NOTIFY_FILTER_PROFILE_T * current,
SNMP_NOTIFY_FILTER_PROFILE_T * new
)
SNMP_V3_NPROF_CREATE_BACKOUT( )
void SNMP_V3_NPROF_CREATE_BACKOUT(
SNMP_NOTIFY_FILTER_PROFILE_T * current,
SNMP_NOTIFY_FILTER_PROFILE_T * new
)
SNMP_V3_NPROF_UPDATE_BACKOUT( )
void SNMP_V3_NPROF_UPDATE_BACKOUT(
SNMP_NOTIFY_FILTER_PROFILE_T * current,
SNMP_NOTIFY_FILTER_PROFILE_T * new
)
SNMP_V3_PROXY_DESTROY_BACKOUT( )
void SNMP_V3_PROXY_DESTROY_BACKOUT(
SNMP_PROXY_T * current,
SNMP_PROXY_T * new
)
SNMP_V3_PROXY_CREATE_BACKOUT( )
void SNMP_V3_PROXY_CREATE_BACKOUT(
SNMP_PROXY_T * current,
SNMP_PROXY_T * new
)
SNMP_V3_PROXY_UPDATE_BACKOUT( )
void SNMP_V3_PROXY_UPDATE_BACKOUT(
SNMP_PROXY_T * current,
SNMP_PROXY_T * new
)
SNMP_V3_TADDR_DESTROY_BACKOUT( )
void SNMP_V3_TADDR_DESTROY_BACKOUT(
SNMP_TARGET_ADDR_T * current,
SNMP_TARGET_ADDR_T * new
)
SNMP_V3_TADDR_CREATE_BACKOUT( )
void SNMP_V3_TADDR_CREATE_BACKOUT(
SNMP_TARGET_ADDR_T * current,
SNMP_TARGET_ADDR_T * new
)
SNMP_V3_TADDR_UPDATE_BACKOUT( )
void SNMP_V3_TADDR_UPDATE_BACKOUT(
SNMP_TARGET_ADDR_T * current,
SNMP_TARGET_ADDR_T * new
)
SNMP_V3_TPARAM_DESTROY_BACKOUT( )
void SNMP_V3_TPARAM_DESTROY_BACKOUT(
SNMP_TARGET_PARAMS_T * current,
SNMP_TARGET_PARAMS_T * new
)
SNMP_V3_TPARAM_CREATE_BACKOUT( )
172
B User-Supplied Code Reference Entries
SNMP V3 SET Macros
void SNMP_V3_TPARAM_CREATE_BACKOUT(
SNMP_TARGET_PARAMS_T * current,
SNMP_TARGET_PARAMS_T * new
)
SNMP_V3_TPARAM_UPDATE_BACKOUT( )
void SNMP_V3_TPARAM_UPDATE_BACKOUT(
SNMP_TARGET_PARAMS_T * current,
SNMP_TARGET_PARAMS_T * new
)
SNMP_V3_USER_DESTROY_BACKOUT( )
void SNMP_V3_USER_DESTROY_BACKOUT(
SNMP_USER_T * current,
SNMP_USER_T * new
)
SNMP_V3_USER_CREATE_BACKOUT( )
void SNMP_V3_USER_CREATE_BACKOUT(
SNMP_USER_T * current,
SNMP_USER_T * new
)
SNMP_V3_USER_UPDATE_BACKOUT( )
void SNMP_V3_USER_UPDATE_BACKOUT(
SNMP_USER_T * current,
SNMP_USER_T * new
)
DESCRIPTION After a method routine has successfully called a TEST macro to reserve resources and pre
validated your SET REQUEST, the setproc( ) calls the corresponding SET macro to create,
change, or delete the table entry.
PARAMETERS *new
Specify the new information to install, or 0 for existing entries. This value is set for
CREATE and UPDATE calls. If current is 0, CREATE and UPDATE macros also include
indexing information.
*current
Specify this entry’s previous information and indices.This value is set for DESTROY and
UPDATE calls. If this is a new entry, this value is 0.
*pkt
Specify the packet that is requesting the SET operation.
*vbp
Specify the VarBind that caused the method routine to run.
RETURNS If the SET REQUEST is successful and the SET macro returns 0, method routines should set
the corresponding FINISHED macro to be called in the vb_free_priv( ) routine, and then set
the undoproc.
PROTOTYPES SNMP_V3_ACCESS_DESTROY_SET( )
173
Wind River SNMP
Programmer's Guide, 10.5
void SNMP_V3_ACCESS_DESTROY_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_ACCESS_T * current,
SNMP_ACCESS_T * new
)
SNMP_V3_ACCESS_CREATE_SET( )
void SNMP_V3_ACCESS_CREATE_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_ACCESS_T * current,
SNMP_ACCESS_T * new
)
SNMP_V3_ACCESS_UPDATE_SET( )
void SNMP_V3_ACCESS_UPDATE_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_ACCESS_T * current,
SNMP_ACCESS_T * new
)
SNMP_V3_COMM_DESTROY_SET( )
void SNMP_V3_COMM_DESTROY_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_COMMUNITY_T * current,
SNMP_COMMUNITY_T * new
)
SNMP_V3_COMM_CREATE_SET( )
void SNMP_V3_COMM_CREATE_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_COMMUNITY_T * current,
SNMP_COMMUNITY_T * new
)
SNMP_V3_COMM_UPDATE_SET( )
void SNMP_V3_COMM_UPDATE_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_COMMUNITY_T * current,
SNMP_COMMUNITY_T * new
)
SNMP_V3_GROUP_DESTROY_SET( )
void SNMP_V3_GROUP_DESTROY_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_GROUP_T * current,
SNMP_GROUP_T * new
)
SNMP_V3_GROUP_CREATE_SET( )
void SNMP_V3_GROUP_CREATE_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_GROUP_T * current,
SNMP_GROUP_T * new
)
SNMP_V3_GROUP_UPDATE_SET( )
174
B User-Supplied Code Reference Entries
SNMP V3 SET Macros
void SNMP_V3_GROUP_UPDATE_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_GROUP_T * current,
SNMP_GROUP_T * new
)
SNMP_V3_NOTIFY_DESTROY_SET( )
void SNMP_V3_NOTIFY_DESTROY_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_T * current,
SNMP_NOTIFY_T * new
)
SNMP_V3_NOTIFY_CREATE_SET( )
void SNMP_V3_NOTIFY_CREATE_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_T * current,
SNMP_NOTIFY_T * new
)
SNMP_V3_NOTIFY_UPDATE_SET( )
void SNMP_V3_NOTIFY_UPDATE_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_T * current,
SNMP_NOTIFY_T * new
)
SNMP_V3_NFILT_DESTROY_SET( )
void SNMP_V3_NFILT_DESTROY_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_FILTER_T * current,
SNMP_NOTIFY_FILTER_T * new
)
SNMP_V3_NFILT_CREATE_SET( )
void SNMP_V3_NFILT_CREATE_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_FILTER_T * current,
SNMP_NOTIFY_FILTER_T * new
)
SNMP_V3_NFILT_UPDATE_SET( )
void SNMP_V3_NFILT_UPDATE_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_FILTER_T * current,
SNMP_NOTIFY_FILTER_T * new
)
SNMP_V3_NPROF_DESTROY_SET( )
void SNMP_V3_NPROF_DESTROY_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_FILTER_PROFILE_T * current,
SNMP_NOTIFY_FILTER_PROFILE_T * new
)
SNMP_V3_NPROF_CREATE_SET( )
175
Wind River SNMP
Programmer's Guide, 10.5
void SNMP_V3_NPROF_CREATE_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_FILTER_PROFILE_T * current,
SNMP_NOTIFY_FILTER_PROFILE_T * new
)
SNMP_V3_NPROF_UPDATE_SET( )
void SNMP_V3_NPROF_UPDATE_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_FILTER_PROFILE_T * current,
SNMP_NOTIFY_FILTER_PROFILE_T * new
)
SNMP_V3_PROXY_DESTROY_SET( )
void SNMP_V3_PROXY_DESTROY_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_PROXY_T * current,
SNMP_PROXY_T * new
)
SNMP_V3_PROXY_CREATE_SET( )
void SNMP_V3_PROXY_CREATE_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_PROXY_T * current,
SNMP_PROXY_T * new
)
SNMP_V3_PROXY_UPDATE_SET( )
void SNMP_V3_PROXY_UPDATE_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_PROXY_T * current,
SNMP_PROXY_T * new
)
SNMP_V3_TADDR_DESTROY_SET( )
void SNMP_V3_TADDR_DESTROY_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_TARGET_ADDR_T * current,
SNMP_TARGET_ADDR_T * new
)
SNMP_V3_TADDR_CREATE_SET( )
void SNMP_V3_TADDR_CREATE_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_TARGET_ADDR_T * current,
SNMP_TARGET_ADDR_T * new
)
SNMP_V3_TADDR_UPDATE_SET( )
void SNMP_V3_TADDR_UPDATE_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_TARGET_ADDR_T * current,
SNMP_TARGET_ADDR_T * new
)
SNMP_V3_TPARAM_DESTROY_SET( )
176
B User-Supplied Code Reference Entries
SNMP V3 UNDO Macros
void SNMP_V3_TPARAM_DESTROY_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_TARGET_PARAMS_T * current,
SNMP_TARGET_PARAMS_T * new
)
SNMP_V3_TPARAM_CREATE_SET( )
void SNMP_V3_TPARAM_CREATE_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_TARGET_PARAMS_T * current,
SNMP_TARGET_PARAMS_T * new
)
SNMP_V3_TPARAM_UPDATE_SET( )
void SNMP_V3_TPARAM_UPDATE_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_TARGET_PARAMS_T * current,
SNMP_TARGET_PARAMS_T * new
)
SNMP_V3_USER_DESTROY_SET( )
void SNMP_V3_USER_DESTROY_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_USER_T * current,
SNMP_USER_T * new
)
SNMP_V3_USER_CREATE_SET( )
void SNMP_V3_USER_CREATE_SET{
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_USER_T * current,
SNMP_USER_T * new
)
SNMP_V3_USER_UPDATE_SET( )
void SNMP_V3_USER_UPDATE_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_USER_T * current,
SNMP_USER_T * new
)
DESCRIPTION When Wind River SNMP calls a setproc, and the SET macro has completed, method
routines should set the undoproc and set the FINISHED macro to be called in the
vb_free_priv( ) routine.
PARAMETERS *current
Specify this entry’s newly installed information and indices. This value is set for
CREATE and UPDATE calls. If this is a new entry, this value is 0.
*pkt
Specify the packet that is requesting the SET operation.
177
Wind River SNMP
Programmer's Guide, 10.5
*save
Specify this entry’s previous information and indices to restore. This value is set for
DESTROY and UPDATE calls. When the value of current is 0, save includes indexing
information. If this is a new entry, this value is 0.
*vbp
Specify the VarBind that caused the method routine to run.
RETURNS If the restore operation is successful, UNDO macros return 0. Otherwise, they return -1.
PROTOTYPES SNMP_V3_ACCESS_DESTROY_UNDO( )
int SNMP_V3_ACCESS_DESTROY_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_ACCESS_T * current,
SNMP_ACCESS_T * save
)
SNMP_V3_ACCESS_CREATE_UNDO( )
int SNMP_V3_ACCESS_CREATE_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_ACCESS_T * current,
SNMP_ACCESS_T * save
)
SNMP_V3_ACCESS_UPDATE_UNDO( )
int SNMP_V3_ACCESS_UPDATE_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_ACCESS_T * current,
SNMP_ACCESS_T * save
)
SNMP_V3_COMM_DESTROY_UNDO( )
int SNMP_V3_COMM_DESTROY_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_COMMUNITY_T * current,
SNMP_COMMUNITY_T * save
)
SNMP_V3_COMM_CREATE_UNDO( )
int SNMP_V3_COMM_CREATE_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_COMMUNITY_T * current,
SNMP_COMMUNITY_T * save
)
SNMP_V3_COMM_UPDATE_UNDO( )
int SNMP_V3_COMM_UPDATE_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_COMMUNITY_T * current,
SNMP_COMMUNITY_T * save
)
SNMP_V3_GROUP_DESTROY_UNDO( )
int SNMP_V3_GROUP_DESTROY_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_GROUP_T * current,
SNMP_GROUP_T * save
)
SNMP_V3_GROUP_CREATE_UNDO( )
178
B User-Supplied Code Reference Entries
SNMP V3 UNDO Macros
int SNMP_V3_GROUP_CREATE_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_GROUP_T * current,
SNMP_GROUP_T * save
)
SNMP_V3_GROUP_UPDATE_UNDO( )
int SNMP_V3_GROUP_UPDATE_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_GROUP_T * current,
SNMP_GROUP_T * save
)
SNMP_V3_NOTIFY_DESTROY_UNDO( )
int SNMP_V3_NOTIFY_DESTROY_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_T * current,
SNMP_NOTIFY_T * save
)
SNMP_V3_NOTIFY_CREATE_UNDO( )
int SNMP_V3_NOTIFY_CREATE_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_T * current,
SNMP_NOTIFY_T * save
)
SNMP_V3_NOTIFY_UPDATE_UNDO( )
int SNMP_V3_NOTIFY_UPDATE_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_T * current,
SNMP_NOTIFY_T * save
)
SNMP_V3_NFILT_DESTROY_UNDO( )
int SNMP_V3_NFILT_DESTROY_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_FILTER_T * current,
SNMP_NOTIFY_FILTER_T * save
)
SNMP_V3_NFILT_CREATE_UNDO( )
int SNMP_V3_NFILT_CREATE_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_FILTER_T * current,
SNMP_NOTIFY_FILTER_T * save
)
SNMP_V3_NFILT_UPDATE_UNDO( )
int SNMP_V3_NFILT_UPDATE_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_FILTER_T * current,
SNMP_NOTIFY_FILTER_T * save
)
SNMP_V3_NPROF_DESTROY_UNDO( )
179
Wind River SNMP
Programmer's Guide, 10.5
int SNMP_V3_NPROF_DESTROY_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_FILTER_PROFILE_T * current,
SNMP_NOTIFY_FILTER_PROFILE_T * save
)
SNMP_V3_NPROF_CREATE_UNDO( )
int SNMP_V3_NPROF_CREATE_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_FILTER_PROFILE_T * current,
SNMP_NOTIFY_FILTER_PROFILE_T * save
)
SNMP_V3_NPROF_UPDATE_UNDO( )
int SNMP_V3_NPROF_UPDATE_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_NOTIFY_FILTER_PROFILE_T * current,
SNMP_NOTIFY_FILTER_PROFILE_T * save
)
SNMP_V3_PROXY_DESTROY_UNDO( )
int SNMP_V3_PROXY_DESTROY_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_PROXY_T * current,
SNMP_PROXY_T * save
)
SNMP_V3_PROXY_CREATE_UNDO( )
int SNMP_V3_PROXY_CREATE_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_PROXY_T * current,
SNMP_PROXY_T * save
)
SNMP_V3_PROXY_UPDATE_UNDO( )
int SNMP_V3_PROXY_UPDATE_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_PROXY_T * current,
SNMP_PROXY_T * save
)
SNMP_V3_TADDR_DESTROY_UNDO( )
int SNMP_V3_TADDR_DESTROY_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_TARGET_ADDR_T * current,
SNMP_TARGET_ADDR_T * save
)
SNMP_V3_TADDR_CREATE_UNDO( )
int SNMP_V3_TADDR_CREATE_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_TARGET_ADDR_T * current,
SNMP_TARGET_ADDR_T * save
)
SNMP_V3_TADDR_UPDATE_UNDO( )
180
B User-Supplied Code Reference Entries
SNMP V3 FINISHED Macros
int SNMP_V3_TADDR_UPDATE_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_TARGET_ADDR_T * current,
SNMP_TARGET_ADDR_T * save
)
SNMP_V3_TPARAM_PROFILE_DESTROY_UNDO( )
int SNMP_V3_TPARAM_PROFILE_DESTROY_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_TARGET_PARAMS_PROFILE_T * current,
SNMP_TARGET_PARAMS_PROFILE_T * save
)
SNMP_V3_TPARAM_PROFILE_CREATE_UNDO( )
int SNMP_V3_TPARAM_PROFILE_CREATE_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_TARGET_PARAMS_PROFILE_T * current,
SNMP_TARGET_PARAMS_PROFILE_T * save
)
SNMP_V3_TPARAM_PROFILEUPDATE_UNDO( )
int SNMP_V3_TPARAM_PROFILEUPDATE_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_TARGET_PARAMS_PROFILE_T * current,
SNMP_TARGET_PARAMS_PROFILE_T * save
)
SNMP_V3_USER_DESTROY_UNDO( )
int SNMP_V3_USER_DESTROY_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_USER_T * current,
SNMP_USER_T * save
)
SNMP_V3_USER_CREATE_UNDO( )
int SNMP_V3_USER_CREATE_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_USER_T * current,
SNMP_USER_T * save
)
SNMP_V3_USER_UPDATE_UNDO( )
int SNMP_V3_USER_UPDATE_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_USER_T * current,
SNMP_USER_T * save
)
DESCRIPTION When a SET REQUEST is successful, method routines should set the corresponding
FINISHED macro to be called as part of the clean up process using the vb_free_priv( )
routine.
181
Wind River SNMP
Programmer's Guide, 10.5
RETURNS None.
PROTOTYPES SNMP_V3_ACCESS_FINISHED( )
void SNMP_V3_ACCESS_FINISHED( )
SNMP_V3_COMM_FINISHED( )
void SNMP_V3_COMM_FINISHED( )
SNMP_V3_GROUP_FINISHED( )
void SNMP_V3_GROUP_FINISHED( )
SNMP_V3_NOTIFY_FINISHED( )
void SNMP_V3_NOTIFY_FINISHED( )
SNMP_V3_NFILT_FINISHED( )
void SNMP_V3_NFILT_FINISHED( )
SNMP_V3_NPROF_FINISHED( )
void SNMP_V3_NPROF_FINISHED( )
SNMP_V3_PROXY_FINISHED( )
void SNMP_V3_PROXY_FINISHED( )
SNMP_V3_TADDR_FINISHED( )
void SNMP_V3_TADDR_FINISHED( )
SNMP_V3_TPARAM_FINISHED( )
void SNMP_V3_TPARAM_FINISHED( )
SNMP_V3_USER_FINISHED( )
void SNMP_V3_USER_FINISHED( )
DESCRIPTION These macros allow you to service the RFC 3415 view table (VacmViewTreeFamilyTable). They
are the interface between the method routines and any nonvolatile storage code that you
supply.
NOTE: The RFC 3415 view scheme was originally defined in RFC 2275 and
modified in RFC 2575.
Specifically, method routines must call these macros to implement RFC 3415 view
SET REQUESTs for the RFC 3415 view table MIB objects. If you want to use nonvolatile
storage for any of these tables, you need to define these macros. If they are defined,
Wind River SNMP’s method routines will call them. If you do not use nonvolatile storage,
you do not need to define these macros.
You can also use these macros to implement policies for creation, modification, or deletion
of table entries.
NOTE: Although RFC 2275 has been upgraded to RFC 3415, the view method
routine names still include a reference to RFC 2275 for backward compatibility.
Use the following procedure to make a multi-stage RFC 3415 view SET REQUEST:
182
B User-Supplied Code Reference Entries
RFC 3415 View TEST Macros
1. The method routine calls a RFC 3415 view TEST macro to collect information, reserve
resources, and pre validate your RFC 3415 view SET REQUEST.
2. If the RFC 3415 view testproc is successful, set the corresponding BACKOUT macro to
allow pre-staged info to be released in the case of a later failure.
3. If the RFC 3415 view setproc is successful, you should set the corresponding RFC 3415
view FINISHED macro to be set in the vb_free_priv( ) routine, and then set the
RFC 3415 view undoproc. If the RFC 3415 view SET REQUEST fails, do not call the
UNDO macro.
DESCRIPTION Whenever a RFC 3415 view SET REQUEST creates, modifies (updates) or deletes (destroys)
a view structure, one of the following RFC 3415 view TEST macros is called. The underlying
routine must reserve any resources that the RFC 3415 view SET operation requires unless
the entry is deleted.
Method routines that call RFC 3415 view CREATE TEST macros must supply a pointer to the
structure that to be installed in the database. During normal processing, the value of some
fields can change. Undo these changes before the structure is installed in the database.
PARAMETERS *current
Specify this entry’s current information and indices for RFC 3415 view DESTROY TEST
and RFC 3415 view UPDATE TEST macros. If this is a new entry, this value is 0.
*new
Specify the new information to install or 0 for existing entries. If current is 0, RFC 3415
view CREATE TEST and RFC 3415 view UPDATE TEST macros also include indexing
information.
*pkt
Specify the packet that is requesting the RFC 3415 view SET operation.
*vbp
Specify the VarBind that caused the method routine to run.
RETURNS If the RFC 3415 view TEST operation was successful and processing should continue,
RFC 3415 view TEST macros return the value NO_ERROR as defined in h/snmpdefs.h. Any
other return is considered a failure and is used as the error argument to testproc_error( ).
If the RFC 3415 view TEST operation succeeds, set the RFC 3415 view BACKOUT routine to
be called by the vb_free_priv( ) routine.
PROTOTYPES NOTE: Although RFC 2275 has been upgraded to RFC 3415, the view method
routine names still include a reference to RFC 2275 for backward compatibility.
SNMP_VIEW_2275_CREATE_TEST( )
sbits32_t SNMP_VIEW_2275_CREATE_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
VIEWLEAF_T * current,
VIEWLEAF_T * new
)
SNMP_VIEW_2275_DESTROY_TEST( )
183
Wind River SNMP
Programmer's Guide, 10.5
sbits32_t SNMP_VIEW_2275_DESTROY_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
VIEWLEAF_T * current,
VIEWLEAF_T * new
)
SNMP_VIEW_2275_UPDATE_TEST( )
sbits32_t SNMP_VIEW_2275_UPDATE_TEST(
SNMP_PKT_T * pkt,
VB_T * vbp,
VIEWLEAF_T * current,
VIEWLEAF_T * new
)
DESCRIPTION When a RFC 3415 view TEST macro succeeds, Wind River SNMP sets up the RFC 3415
view BACKOUT macro to allow pre-staged info to be released in the case of a later failure.
PARAMETERS *current
Specify this entry’s current information and indices for RFC 3415 view DESTROY TEST
and RFC 3415 view UPDATE TEST macros. If this is a new entry, this value is 0.
*new
Specify the new information to install, or 0 for existing entries. This value is set for
RFC 3415 view CREATE and RFC 3415 view UPDATE calls. If current is 0, RFC 3415 view
CREATE and RFC 3415 view UPDATE macros also include indexing information.
RETURNS None.
PROTOTYPES NOTE: Although RFC 2275 has been upgraded to RFC 3415, the view method
routine names still include a reference to RFC 2275 for backward compatibility.
SNMP_VIEW_2275_CREATE_BACKOUT( )
void SNMP_VIEW_2275_CREATE_BACKOUT(
VIEWLEAF_T * current,
VIEWLEAF_T * new
)
SNMP_VIEW_2275_DESTROY_BACKOUT( )
void SNMP_VIEW_2275_DESTROY_BACKOUT(
VIEWLEAF_T * current,
VIEWLEAF_T * new
)
SNMP_VIEW_2275_UPDATE_BACKOUT( )
void SNMP_VIEW_2275_UPDATE_BACKOUT(
VIEWLEAF_T * current,
VIEWLEAF_T * new
)
184
B User-Supplied Code Reference Entries
RFC 3415 View SET Macros
DESCRIPTION After a method routine has successfully called a RFC 3415 view TEST macro to reserve
resources and pre-validated your RFC 3415 view SET REQUEST, the setproc calls the
RFC 3415 view SET macro to create, change, or delete the table entry.
PARAMETERS *new
Specify the new information to install, or 0 for existing entries. This value is set for
RFC 3415 view CREATE and RFC 3415 view UPDATE calls. If current is 0, RFC 3415 view
CREATE and RFC 3415 view UPDATE macros also include indexing information.
*current
Specify this entry’s previous information and indices.This value is set for RFC 3415
view DESTROY and RFC 3415 view UPDATE calls. If this is a new entry, this value is 0.
*pkt
Specify the packet that is requesting the RFC 3415 view SET operation.
*vbp
Specify the VarBind that caused the method routine to run.
RETURNS If the RFC 3415 view SET REQUEST is successful and the RFC 3415 view SET macro returns
0, method routines should set the RFC 3415 view FINISHED macro to be called in the
vb_free_priv( ) routine, and then set the undoproc.
PROTOTYPES NOTE: Although RFC 2275 has been upgraded to RFC 3415, the view method
routine names still include a reference to RFC 2275 for backward compatibility.
SNMP_VIEW_2275_CREATE_SET( )
void SNMP_VIEW_2275_CREATE_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
VIEWLEAF_T * current,
VIEWLEAF_T * new
)
SNMP_VIEW_2275_DESTROY_SET( )
void SNMP_VIEW_2275_DESTROY_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
VIEWLEAF_T * current,
VIEWLEAF_T * new
)
SNMP_VIEW_2275_UPDATE_SET( )
void SNMP_VIEW_2275_UPDATE_SET(
SNMP_PKT_T * pkt,
VB_T * vbp,
VIEWLEAF_T * current,
VIEWLEAF_T * new
)
185
Wind River SNMP
Programmer's Guide, 10.5
DESCRIPTION When Wind River SNMP calls a RFC 3415 view setproc, and the RFC 3415 view SET
macro has completed, method routines should set the RFC 3415 view undoproc and set the
RFC 3415 view FINISHED macro to be called in the vb_free_priv( ) routine.
NOTE: If Wind River SNMP indicates that it cannot complete a RFC 3415 view
SET REQUEST after a RFC 3415 view TEST macro, call the corresponding RFC 3415 view
BACKOUT macro.
PARAMETERS *current
Specify this entry’s newly installed information and indices. This value is set for
RFC 3415 view CREATE and RFC 3415 view UPDATE calls. If this is a new entry, this
value is 0.
*pkt
Specify the packet that is requesting the RFC 3415 view SET operation.
*save
Specify this entry’s previous information and indices to restore. This value is set for
RFC 3415 view DESTROY and RFC 3415 view UPDATE calls. When the value of current
is 0, save includes indexing information. If this is a new entry, this value is 0.
*vbp
Specify the VarBind that caused the method routine to run.
RETURNS If the restore operation is successful, RFC 3415 view UNDO macros return 0. Otherwise, they
return -1.
PROTOTYPES NOTE: Although RFC 2275 has been upgraded to RFC 3415, the view method
routine names still include a reference to RFC 2275 for backward compatibility.
SNMP_VIEW_2275_CREATE_UNDO( )
int SNMP_VIEW_2275_CREATE_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_ACCESS_T * current,
SNMP_ACCESS_T * save
)
SNMP_VIEW_2275_DESTROY_UNDO( )
int SNMP_VIEW_2275_DESTROY_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_ACCESS_T * current,
SNMP_ACCESS_T * save
)
SNMP_VIEW_2275_UPDATE_UNDO( )
int SNMP_VIEW_2275_UPDATE_UNDO(
SNMP_PKT_T * pkt,
VB_T * vbp,
SNMP_ACCESS_T * current,
SNMP_ACCESS_T * save
)
186
B User-Supplied Code Reference Entries
RFC 3415 View FINISHED Macro
DESCRIPTION When a RFC 3415 view SET REQUEST is successful, method routines should set the
RFC 3415 view FINISHED macro to be called as part of the clean up process using the
vb_free_priv( ) routine.
RETURNS None.
PROTOTYPES NOTE: Although RFC 2275 has been upgraded to RFC 3415, the view method
routine names still include a reference to RFC 2275 for backward compatibility.
SNMP_VIEW_2275_FINISHED( )
void SNMP_V3_ACCESS_FINISHED( )
187
Wind River SNMP
Programmer's Guide, 10.5
188
C
Wind River SNMP Macro Entries
189
Wind River SNMP
Programmer's Guide, 10.5
190
C Wind River SNMP Macro Entries
191
Wind River SNMP
Programmer's Guide, 10.5
192
C Wind River SNMP Macro Entries
Extended Buffer Management Routines
DESCRIPTION Wind River SNMP provides a number of routines and macros to manipulate extended
buffers. You might use such a buffer to for data containing embedded nulls (to maintain
length info for a field).
When you create an element of type EBUFFER_T, you must initialize, setup, or preload the
extended buffer to ensure that the control flags are in a consistent state.
NOTE: Initialized or newly created EBUFFER_T structures are not capable of holding data
until they are either setup or pre loaded.
PARAMETERS *datap
Specify the location of a buffer.
datal
Specify the length of *datap.
*dstp
Specify the location of the new buffer.
*ebuffp
Specify the extended buffer.
flags
Indicate whether the buffer was newly allocated memory (BFL_IS_ALLOC), allocated
from the dynamic pool (BFL_IS_DYNAMIC), or used directly and kept (BFL_IS_STATIC).
*srcp
Specify the location of the original buffer.
193
Wind River SNMP
Programmer's Guide, 10.5
194
C Wind River SNMP Macro Entries
Object Identifier Management Routines
DESCRIPTION In Wind River SNMP, object identifiers consist of an array of sub IDs and a length field.
These are stored and manipulated in OBJ_ID_T structures. Wind River SNMP commands
can pass pointers to OBJ_ID_T structures or pass the actual information. You can use these
routines to manage object identifiers.
PARAMETERS *new
Specify the new object identifier structure (the copy).
*objp
Specify a pointer to an OBJ_ID_T structure.
*old
Specify a pointer to the original object identifier.
oldc
Specify the number of components in the old structure.
*oldl
Specify the list of components in the old structure.
195
Wind River SNMP
Programmer's Guide, 10.5
DESCRIPTION Wind River SNMP provides the following routines and macros to manipulate the non-index
fields of the community object. These routines operate on fields located in the
snmpCommunityTable, which is defined in RFC 2576.
196
C Wind River SNMP Macro Entries
Community Field Access Routines
This routine returns a pointer to the security name of this community object, which
corresponds to the snmpCommunitySecurityName object.
SNMP_Community_Get_Sec_Name_Len( ) – get the length of the security name
ALENGTH_T SNMP_Community_Get_Sec_Name_Len(SNMP_COMMUNITY_T * community)
This routine returns the length in bytes of the security name.
SNMP_Community_Get_Status( ) – get the current row status
bits16_t SNMP_Community_Get_Status(SNMP_COMMUNITY_T * community)
This routine returns the current row status of this community object: ETC_RS_ACTIVE
(active), ETC_RS_NIS (not in service), or ETC_RS_NREADY (not ready).
SNMP_Community_Get_Storage( ) – get the type of storage
bits16_t SNMP_Community_Get_Storage(SNMP_COMMUNITY_T * community)
This routine returns the current value for storage for this community object:
ETC_STO_NONVOL (nonvolatile), ETC_STO_VOL (volatile), ETC_STO_PERM
(permanent), ETC_STO_RONLY (read only), or ETC_STO_OTHER (other).
SNMP_Community_Get_Tag( ) – get the current value of transport tag
bits8_t *SNMP_Community_Get_Tag(SNMP_COMMUNITY_T * community)
This routine returns a pointer to the transport tag of this community object, which
corresponds to the snmpCommunityTransportTag object. This value is not a tag list. It is a
simple tag that follows the rules for tags defined in RFC 3413.
SNMP_Community_Get_Tag_Len( ) – get the length of the transport tag
ALENGTH_T SNMP_Community_Get_Tag_Len(SNMP_COMMUNITY_T * community)
This routine returns the length in bytes of the transport tag.
SNMP_Community_Set_Con_ID( ) – set the context engine id
int SNMP_Community_Set_Con_ID(
SNMP_COMMUNITY_T * community,
bits8_t * engine_id,
ALENGTH_T engine_id_len
unsigned int flags
)
This routine sets the context engine id and length for this object to engine_id and
engine_id_len. The passed-in string is copied into the community object. If successful,
this routine returns ENVOY_ERR_NOERR. If there is a memory allocation error, it
returns ENVOY_ERR_INSUFFICIENT_MEMORY.
SNMP_Community_Set_Con_Name( ) – set the context name
int SNMP_Community_Set_Con_Name(
SNMP_COMMUNITY_T * community,
bits8_t * context_name,
ALENGTH_T context_name_len
unsigned int bflags
)
This routine sets the context name and length for this object to context_name and
context_name_len. The passed-in string is copied into the community object. If
successful, this routine returns ENVOY_ERR_NOERR. If there is a memory allocation
error, it returns ENVOY_ERR_INSUFFICIENT_MEMORY.
SNMP_Community_Set_Name( ) – set the community name
int SNMP_Community_Set_Name(
SNMP_COMMUNITY_T * community,
bits8_t * comm_name,
ALENGTH_T comm_name_len
unsigned int flags
)
197
Wind River SNMP
Programmer's Guide, 10.5
This routine sets the community name and length for this object to comm_name and
comm_name_len. The passed-in string is copied into the community object. If successful,
this routine returns ENVOY_ERR_NOERR. If there is a memory allocation error, it
returns ENVOY_ERR_INSUFFICIENT_MEMORY.
SNMP_Community_Set_Sec_Name( ) – set the security name
int SNMP_Community_Set_Sec_Name{
SNMP_COMMUNITY_T * community,
bits8_t * sec_name,
ALENGTH_T sec_name_len
unsigned int flags
)
This routine sets the security name and length for this object to sec_name and
sec_name_len. The passed-in string is copied into the community object. If successful,
this routine returns ENVOY_ERR_NOERR. If there is a memory allocation error, it
returns ENVOY_ERR_INSUFFICIENT_MEMORY.
SNMP_Community_Set_Status( ) – set the row status
void SNMP_Community_Set_Status(
SNMP_COMMUNITY_T * community,
bits16_t status
)
This routine sets the row status of this community object to status: ETC_RS_ACTIVE
(active), ETC_RS_NIS (not in service), or ETC_RS_NREADY (not ready).
SNMP_Community_Set_Storage( ) – set the storage type
void SNMP_Community_Set_Storage(
SNMP_COMMUNITY_T * community,
bits16_t storage
)
This routine sets the storage type of this community object to storage:
ETC_STO_NONVOL (nonvolatile), ETC_STO_VOL (volatile), ETC_STO_PERM
(permanent), ETC_STO_RONLY (read only), or ETC_STO_OTHER (other).
SNMP_Community_Set_Tag( ) – set the transport tag
int SNMP_Community_Set_Tag(
SNMP_COMMUNITY_T * community,
bits8_t * transport_tag,
ALENGTH_T transport_tag_len
unsigned int flags
)
This routine sets the transport tag and length for this object to transport_tag and
transport_tag_len. The passed-in string is copied into the community object. This value
is not a tag list. It is a simple tag that follows the rules for tags defined in RFC 3413. If
successful, this routine returns ENVOY_ERR_NOERR. If there is a memory allocation
error, it returns ENVOY_ERR_INSUFFICIENT_MEMORY.
DESCRIPTION The group table (VacmSecurityToGroupTable) uses the row status and storage type textual
conventions described in RFC 2579. The definitions for the options reside in the file smi.h.
198
C Wind River SNMP Macro Entries
SNMP Notify Table Field Routines
DESCRIPTION The SNMP Notify Table (snmpNotifyTable) contains entries that specify which entries to use
for generating notifications and the type of notifications to generate. The notify table uses
199
Wind River SNMP
Programmer's Guide, 10.5
the row status and storage type textual conventions described in RFC 2579. The definitions
for the options reside in the file smi.h.
SNMP_Notify_Get_Status( ) – get the current status
bits16_t SNMP_Notify_Get_Status( SNMP_NOTIFY_T * notify)
This routine gets the current value for status: ETC_RS_ACTIVE (active), ETC_RS_NIS
(not in service), or ETC_RS_NREADY (not ready).
SNMP_Notify_Get_Storage( ) – get the type of storage
bits16_t SNMP_Notify_Get_Storage( SNMP_NOTIFY_T * notify)
This routine gets the current value for storage: ETC_STO_NONVOL (nonvolatile),
ETC_STO_VOL (volatile), ETC_STO_PERM (permanent), ETC_STO_RONLY (read only)
or ETC_STO_OTHER (other).
SNMP_Notify_Get_Tag( ) – get the current value for tag
bits8_t * SNMP_Notify_Get_Tag( SNMP_NOTIFY_T * notify)
This routine gets the current value for the tag (snmpNotifyTag). This value is not a tag list.
It uses a simple tag that follows the rules for SnmpTagValue tags defined by RFC 3413.
SNMP_Notify_Get_Tag_Len( ) – get the length of tag
ALENGTH_T SNMP_Notify_Get_Tag_Len( SNMP_NOTIFY_T * notify)
This routine returns the length in bytes of the tag (snmpNotifyTag).
SNMP_Notify_Get_Type( ) – get the current MIB object type
bits16_t SNMP_Notify_Get_Type( SNMP_NOTIFY_T * notify)
This routine gets the current value for the type parameter that corresponds to the MIB
object snmpNotifyType: SNMP_NOTIFY_TRAP (TRAP) or SNMP_NOTIFY_INFORM
(INFORM).
SNMP_Notify_Set_Status( ) – set the status
void SNMP_Notify_Set_Status(
SNMP_NOTIFY_T * notify,
bits16_t status
)
This routine sets the current value for status: ETC_RS_ACTIVE (active), ETC_RS_NIS
(not in service), or ETC_RS_READY (not ready).
SNMP_Notify_Set_Storage( ) – set the type of storage
void SNMP_Notify_Set_Storage(
SNMP_NOTIFY_T * notify,
bits16_t storage
)
This routine sets the current value for storage parameter: ETC_STO_NONVOL
(nonvolatile), ETC_STO_VOL (volatile), ETC_STO_PERM (permanent),
ETC_STO_RONLY (read only) or ETC_STO_OTHER (other).
200
C Wind River SNMP Macro Entries
SNMP Notify Filter Table Field Routines
BFL_IS_STATIC, this routine points to the existing buffer and does not free the buffer
memory when the group object is destroyed.
SNMP_Notify_Set_Type( ) – get the value of the MIB object type
void SNMP_Notify_Set_Type(
SNMP_NOTIFY_T *notify,
bits16_t type
)
This routine sets the current value for the type parameter that corresponds to the MIB
object snmpNotifyType: SNMP_NOTIFY_TRAP (Trap) or SNMP_NOTIFY_INFORM
(Inform).
DESCRIPTION The snmpNotifyFilterTable contains filters that determine whether a particular management
target should receive particular notifications. When an agent generates a notification, you
must compare it with the filters associated with each management target that is configured
to receive notifications, in order to determine whether it may be sent to each such
management target. The notify filter table uses the row status and storage type textual
conventions described in RFC 3413. The definitions for the options reside in the file smi.h.
201
Wind River SNMP
Programmer's Guide, 10.5
DESCRIPTION The snmpNotifyFilterProfileTable contains filter profiles that are used to group entries in the
snmpNotifyFilterTable. The notify filter profile table uses the row status and storage type
textual conventions described in RFC 3413. The definitions for the options reside in the file
smi.h.
202
C Wind River SNMP Macro Entries
Proxy Field Access Routines
DESCRIPTION Wind River SNMP provides the following routines and macros to manipulate the non-index
fields of the proxy object. These routines operate on fields located in the snmpProxyTable,
which is defined in RFC 2576.
203
Wind River SNMP
Programmer's Guide, 10.5
204
C Wind River SNMP Macro Entries
Proxy Field Access Routines
205
Wind River SNMP
Programmer's Guide, 10.5
This routine sets the storage type of this proxy object to storage: ETC_STO_NONVOL
(nonvolatile), ETC_STO_VOL (volatile), ETC_STO_PERM (permanent),
ETC_STO_RONLY (read only), or ETC_STO_OTHER (other).
DESCRIPTION The snmpTargetAddrTable contains a list of possible destinations to which you can send
RFC 3413-compliant notifications and proxies. You can use the snmpTargetAddrTable to
provide transport addresses for generating SNMP messages.
206
C Wind River SNMP Macro Entries
SNMP Target_Addr Table Field Routines
The Target_Addr table uses the row status and storage type textual conventions described
in RFC 3413. The definitions for the options reside in the file smi.h. Use the
snmpTargetAddrTable to provide transport addresses for generating SNMP messages.
Several of these routines operate on the MMS and TMask fields that are located in the
augmentation to the snmpTargetAddrTable known as the snmpTargetAddrExtTable,
which is defined in RFC 2576.
207
Wind River SNMP
Programmer's Guide, 10.5
This routine returns the maximum message size for this Target_Addr object. You must
install ENVOY_SNMP_COEXISTENCE before you can use this routine.
SNMP_Target_Addr_Get_TDomain( ) – get the TDomain
OBJ_ID_T * SNMP_Target_Addr_Get_TDomain( SNMP_TARGET_ADDR_T * taddr )
This routine returns a pointer to the snmpTargetAddrTDomain object (an OBJ_ID_T
structure). It usually is set to the value of snmpUDPDomain (1.3.6.1.6.1.1). Other values
for TDomain are defined in RFC 3417.
SNMP_Target_Addr_Get_TMask( ) – get the target mask
bits8_t *SNMP_Target_Addr_Get_TMask(SNMP_TARGET_ADDR_T * taddr)
This routine returns a pointer to the target mask for this Target_Addr object, which
corresponds to the snmpTargetAddrTMask object. You must install coexistence before
you can use this routine.
SNMP_Target_Addr_Get_TMask_Len( ) – get the length of the target mask
ALENGTH_T SNMP_Target_Addr_Get_TMask_Len(SNMP_TARGET_ADDR_T * taddr)
This routine returns the length in bytes of the target mask. You must install
ENVOY_SNMP_COEXISTENCE before you can use this routine.
208
C Wind River SNMP Macro Entries
SNMP Target_Addr Table Field Routines
209
Wind River SNMP
Programmer's Guide, 10.5
DESCRIPTION The snmpTargetParamsTable contains SNMP version and security information to use when
sending messages to a particular transport domains and addresses. The target params table
uses the row status and storage type textual conventions described in RFC 2579. The
definitions for the options reside in the file smi.h.
210
C Wind River SNMP Macro Entries
SNMP Target Params Table Field Routines
211
Wind River SNMP
Programmer's Guide, 10.5
DESCRIPTION The user table (UsmUserTable) uses the row status and storage type textual conventions
described in RFC 2579. The definitions for the options reside in the file smi.h.
212
C Wind River SNMP Macro Entries
SNMPv3 User Table Key Routines
This routine gets the current value for storage: ETC_STO_NONVOL (nonvolatile),
ETC_STO_VOL (volatile), ETC_STO_PERM (permanent), ETC_STO_RONLY (read only)
or ETC_STO_OTHER (other).
SNMP_User_Set_Status( ) – set the status
void SNMP_User_Set_Status(
SNMP_USER_T * user,
sbits16_t value
)
This routine sets the current value for status: ETC_RS_ACTIVE (active), ETC_RS_NIS (not
in service), or ETC_RS_READY (not ready).
SNMP_User_Set_Storage( ) – set the type of storage
void SNMP_User_Set_Storage(
SNMP_USER_T * user,
sbits16_t value
)
This routine sets the current value for storage: ETC_STO_NONVOL (nonvolatile),
ETC_STO_VOL (volatile), ETC_STO_PERM (permanent), ETC_STO_RONLY (read only)
or ETC_STO_OTHER (other).
213
Wind River SNMP
Programmer's Guide, 10.5
DESCRIPTION The access table (VacmAccessTable) uses the row status and storage type textual conventions
described in RFC 2579. The definitions for the options reside in the file smi.h.
214
C Wind River SNMP Macro Entries
SNMPv3 Access Table View Routines
215
Wind River SNMP
Programmer's Guide, 10.5
DESCRIPTION Wind River SNMP provides a number of macros to manipulate the view structure
VIEWLEAF_T and access the view table (VacmViewTreeFamilyTable). type indicates whether
this entry should be an included or excluded view. You can call them during initialization
to reconstruct the view table from non-volatile memory or while the process is running to
add new or modify old views.
216
C Wind River SNMP Macro Entries
SNMP View Routines
NOTE: If you modify a view, the calling routine must ensure two things: no changes occur
when a packet is using a view and all view remain in a consistent state.
PARAMETERS *view
Specify a VIEWLEAF_T structure.
217
Wind River SNMP
Programmer's Guide, 10.5
DESCRIPTION Wind River SNMP provides a number of macros to manipulate the 64-bit unsigned integer
structure UINT_64_T.
218
C Wind River SNMP Macro Entries
Unsigned 64-bit Integer Routines
219
Wind River SNMP
Programmer's Guide, 10.5
220
Index
Symbols agentx 99
creating 73
221
Wind River SNMP
Programmer's Guide, 10.5
222
Index
223
Wind River SNMP
Programmer's Guide, 10.5
224
Index
225
Wind River SNMP
Programmer's Guide, 10.5
226
Index
SNMP_Target_Addr_Install( ) 62 SNMP_V3_ACCESS_DESTROY_BACKOUT( ) 65
SNMP_Target_Addr_Set_Params( ) 208 SNMP_V3_ACCESS_DESTROY_SET( ) 65
SNMP_Target_Addr_Set_Retry_Count( ) 208 SNMP_V3_ACCESS_DESTROY_TEST( ) 65
SNMP_Target_Addr_Set_Status( ) 209 SNMP_V3_ACCESS_DESTROY_UNDO( ) 65
SNMP_Target_Addr_Set_Storage( ) 209 SNMP_V3_ACCESS_FINISHED( ) 65
SNMP_Target_Addr_Set_TAddress( ) 209 SNMP_V3_Access_Get_Notify( ) 215
SNMP_Target_Addr_Set_Tag_List( ) 209 SNMP_V3_Access_Get_Notify_Len( ) 215
SNMP_Target_Addr_Set_TDomain( ) 210 SNMP_V3_Access_Get_Prefix_Match( ) 214
SNMP_Target_Addr_Set_Timeout( ) 210 SNMP_V3_Access_Get_Read( ) 215
SNMP_TARGET_ADDR_T data type 50 SNMP_V3_Access_Get_Read_Len( ) 215
SNMP_Target_Params_Create( ) 63 SNMP_V3_Access_Get_Status( ) 214
SNMP_Target_Params_Get_MP_Model( ) 210 SNMP_V3_Access_Get_Storage( ) 214
SNMP_Target_Params_Get_Sec_Level( ) 210 SNMP_V3_Access_Get_Write( ) 215
SNMP_Target_Params_Get_Sec_Model( ) 211 SNMP_V3_Access_Get_WriteLen( ) 215
SNMP_Target_Params_Get_Sec_Name( ) 211 SNMP_V3_Access_Install( ) 62
SNMP_Target_Params_Get_Sec_Name_Len( ) 211 SNMP_V3_Access_Set_Notify( ) 216
SNMP_Target_Params_Get_Status( ) 210 SNMP_V3_Access_Set_Prefix_Match( ) 214
SNMP_Target_Params_Get_Storage( ) 211 SNMP_V3_Access_Set_Read( ) 216
SNMP_Target_Params_Install( ) 63 SNMP_V3_Access_Set_Status( ) 214
SNMP_Target_Params_Set_MP_Model( ) 63 SNMP_V3_Access_Set_Storage( ) 215
SNMP_Target_Params_Set_MP_Model( ) 211 SNMP_V3_Access_Set_Write( ) 216
SNMP_Target_Params_Set_Sec_Level( ) 211 SNMP_V3_ACCESS_UPDATE_BACKOUT( ) 65
SNMP_Target_Params_Set_Sec_Model( ) 63 SNMP_V3_ACCESS_UPDATE_SET( ) 65
SNMP_Target_Params_Set_Sec_Model( ) 211 SNMP_V3_ACCESS_UPDATE_TEST( ) 65
SNMP_Target_Params_Set_Sec_Name( ) 63 SNMP_V3_ACCESS_UPDATE_UNDO( ) 65
SNMP_Target_Params_Set_Sec_Name( ) 212 SNMP_V3_COMM_CREATE_BACKOUT( ) 65
SNMP_Target_Params_Set_Status( ) 63 SNMP_V3_COMM_CREATE_SET( ) 65
SNMP_Target_Params_Set_Status( ) 211 SNMP_V3_COMM_CREATE_TEST( ) 65
SNMP_Target_Params_Set_Storage( ) 212 SNMP_V3_COMM_CREATE_UNDO( ) 65
SNMP_TARGET_PARAMS_T data type 50 SNMP_V3_COMM_DESTROY_BACKOUT( ) 65
SNMP_TRACE_INPUT( ) 43, 128 SNMP_V3_COMM_DESTROY_SET( ) 65
SNMP_TRACE_OUTPUT( ) 43 SNMP_V3_COMM_DESTROY_TEST( ) 65
SNMP_User_Create( ) 62 SNMP_V3_COMM_DESTROY_UNDO( ) 65
SNMP_USER_ENG_T data type 50 SNMP_V3_COMM_FINISHED( ) 65
SNMP_User_Get_Auth( ) 213 SNMP_V3_COMM_UPDATE_BACKOUT( ) 65
SNMP_User_Get_AuthKey( ) 213 SNMP_V3_COMM_UPDATE_SET( ) 65
SNMP_user_get_encode_buffer( ) 132 SNMP_V3_COMM_UPDATE_TEST( ) 65
SNMP_User_Get_Priv( ) 213 SNMP_V3_COMM_UPDATE_UNDO( ) 65
SNMP_User_Get_PrivKey( ) 213 SNMP_V3_Context_Add( ) 62
SNMP_User_Get_Public( ) 212 SNMP_V3_NFILT_CREATE_BACKOUT( ) 66
SNMP_User_Get_Public_Len( ) 212 SNMP_V3_NFILT_CREATE_SET( ) 66
SNMP_User_Get_Status( ) 212 SNMP_V3_NFILT_CREATE_TEST( ) 65
SNMP_User_Get_Storage( ) 212 SNMP_V3_NFILT_CREATE_UNDO( ) 66
SNMP_User_Install( ) 62 SNMP_V3_NFILT_DESTROY_BACKOUT( ) 66
SNMP_user_post_set( ) 43, 128 SNMP_V3_NFILT_DESTROY_SET( ) 66
SNMP_user_pre_set( ) 43, 128 SNMP_V3_NFILT_DESTROY_TEST( ) 65
SNMP_User_Set_AuthKey( ) 62 SNMP_V3_NFILT_DESTROY_UNDO( ) 66
SNMP_User_Set_AuthKey( ) 213 SNMP_V3_NFILT_FINISHED( ) 66
SNMP_user_set_failed( ) 43, 129 SNMP_V3_NFILT_UPDATE_BACKOUT( ) 66
SNMP_User_Set_PrivKey( ) 62 SNMP_V3_NFILT_UPDATE_SET( ) 66
SNMP_User_Set_PrivKey( ) 214 SNMP_V3_NFILT_UPDATE_TEST( ) 65
SNMP_User_Set_Status( ) 213 SNMP_V3_NFILT_UPDATE_UNDO( ) 66
SNMP_User_Set_Storage( ) 213 SNMP_V3_NOTIFY_CREATE_BACKOUT( ) 66
SNMP_USER_T data type 50 SNMP_V3_NOTIFY_CREATE_SET( ) 66
SNMP_V3_Access_Create( ) 62 SNMP_V3_NOTIFY_CREATE_TEST( ) 66
SNMP_V3_ACCESS_CREATE_BACKOUT( ) 65 SNMP_V3_NOTIFY_CREATE_UNDO( ) 66
SNMP_V3_ACCESS_CREATE_SET( ) 65 SNMP_V3_NOTIFY_DESTROY_BACKOUT( ) 66
SNMP_V3_ACCESS_CREATE_TEST( ) 65 SNMP_V3_NOTIFY_DESTROY_SET( ) 66
SNMP_V3_ACCESS_CREATE_UNDO( ) 65 SNMP_V3_NOTIFY_DESTROY_TEST( ) 66
227
Wind River SNMP
Programmer's Guide, 10.5
228
Index
229
Wind River SNMP
Programmer's Guide, 10.5
vb_link field
VarBinds aggregation 87
vb_priv field 88
VB_T data type 47
VB_TO_COOKIE( ) 87
VBL_T data type 47
VBPRIVPROC_T data type 47
view data types 48
view scheme 9
view tables 96
view_name 96
VIEWINDEX_T data type 48
VIEWLEAF_T data type 48
viewtable_test( ) 92
VT_BITS 81
VT_COUNTER64 82
VT_ENDOFMIB 89
VT_NOSUCHINS 88
VT_NOSUCHOBJ 88
vxprj commands 28
VxWorks source build 24
W
Wind River MIB Compiler, see MIB compiler
WRITE_ACCESS 82
writable objects and 96
230