You are on page 1of 240

Wind River SNMP Programmer's Guide, 10.

WIND RIVER SNMP


®

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

Wind River SNMP


Programmer's Guide
10.5

Edition 6
30 Sep 15
Contents

1 Overview ...................................................................................................... 1

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


Wind River Documentation ............................................................................. 4

1.6 Design Decisions ............................................................................................................. 5


1.6.1 Client or Server .................................................................................................. 5
1.6.2 AgentX ................................................................................................................ 5
Master Agent ..................................................................................................... 5
Subagent ............................................................................................................. 6

2 Technical Description ................................................................................. 7

2.1 Introduction ...................................................................................................................... 7

2.2 Functional Units .............................................................................................................. 7


2.2.1 Decoder ............................................................................................................... 8
2.2.2 Encoder ............................................................................................................... 8
2.2.3 MIB Interface ...................................................................................................... 8
2.2.4 Received Packet Manager ................................................................................ 8
2.2.5 Packet Generator ............................................................................................... 9
2.2.6 View Configuration ........................................................................................... 9
2.2.7 AgentX ................................................................................................................ 9
Subagent Handler ............................................................................................. 9
Master Agent Handler ...................................................................................... 9

iii
Wind River SNMP
Programmer's Guide, 10.5

2.3 Simple Manager and Agent .......................................................................................... 10

3 SNMP ........................................................................................................... 11

3.1 What is SNMP? ................................................................................................................ 11

3.2 How Did SNMPv2 and SNMPv3 Evolve? .................................................................. 12

3.3 Supported RFCs ............................................................................................................... 13

3.4 Related RFCs .................................................................................................................... 16

3.5 Obsoleted RFCs ............................................................................................................... 17

3.6 Supported MIBs in the Wind River Network Stack ................................................. 19

4 Building Wind River SNMP for VxWorks .................................................. 23

4.1 Introduction ...................................................................................................................... 23

4.2 VxWorks Source Build Project ...................................................................................... 24


4.2.1 Configuring FIPS 140-2 .................................................................................... 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.6.1 Viewing Wind River SNMP Components and Parameters ........................ 28
4.6.2 Adding Basic SNMP Components and Configuring SNMP Parameters . 29
4.6.3 Adding Basic SNMP and SNMPv3 Components ......................................... 30
4.6.4 Adding Basic SNMP and AgentX Components ........................................... 31

4.7 Customizing the Wind River SNMP Configuration ................................................ 32


4.7.1 Creating a makmak Configuration File ......................................................... 32
SNMP Version 1 ................................................................................................. 33
SNMP Version 2 ................................................................................................. 33
SNMP Version 3 ................................................................................................. 33
SNMPv2 Types in SNMPv1 Packets ............................................................... 34
SNMP Statistics .................................................................................................. 34
Macros or Routines ........................................................................................... 34
Stack or Heap ..................................................................................................... 34
SNMPv3 Authentication and Privacy Options ............................................. 34
SNMPv3 Target MIB ......................................................................................... 35
SNMPv3 Notification MIB ............................................................................... 35
Dynamic VxWorks Configuration .................................................................. 35
View Scheme ...................................................................................................... 36
Locking ............................................................................................................... 36
Serialization ........................................................................................................ 37

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

5 Data Types and Data Structures ................................................................ 45

5.1 General Types .................................................................................................................. 45

5.2 MIB Tree Types ................................................................................................................ 47

5.3 SNMP Packet Representation ....................................................................................... 47

5.4 Generic Tree Type ............................................................................................................ 48

5.5 View Type ......................................................................................................................... 48

5.6 SNMP Version 3 Types ................................................................................................... 49

6 SNMPv3 ....................................................................................................... 51

6.1 Description ....................................................................................................................... 51


6.1.1 Engine ID ............................................................................................................ 51
6.1.2 Contexts .............................................................................................................. 51
6.1.3 User Security Model ......................................................................................... 52
6.1.4 Diffie-Hellman Cryptographic Key Exchange .............................................. 52
6.1.5 Access Control Model ....................................................................................... 53
6.1.6 Notify Model ...................................................................................................... 53
6.1.7 Proxy Engine Operation ................................................................................... 53
6.1.8 SNMP Engine Operation with Coexistence .................................................. 56
Receiving and Processing SNMPv1/v2c PDUs ............................................ 56
Construction and Sending of Notifies ............................................................ 58
Proxy Forwarding ............................................................................................. 59
Translation of Incoming Responses ................................................................ 60

6.2 Database Initialization ................................................................................................... 60


6.2.1 Local Engine Information ................................................................................ 61

v
Wind River SNMP
Programmer's Guide, 10.5

6.2.2 Foreign Engine Information ............................................................................ 61


6.2.3 Context Table ..................................................................................................... 62
6.2.4 Access and Group Tables ................................................................................. 62
6.2.5 User Table ........................................................................................................... 62
6.2.6 Target Address Table ........................................................................................ 62
6.2.7 Target Params Table .......................................................................................... 63
6.2.8 Notify Table ........................................................................................................ 63
6.2.9 Notify Filter Profile Table ................................................................................. 63
6.2.10 Notify Filter Table ............................................................................................. 63
6.2.11 Proxy Table ......................................................................................................... 64
6.2.12 Community Table .............................................................................................. 64
6.2.13 Method Routine Macros ................................................................................... 64
6.2.14 Authentication and Privacy ............................................................................. 66
Advanced Encryption Standard (AES) .......................................................... 67

7 Using Wind River SNMP AgentX ............................................................... 69

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

8 Server ........................................................................................................... 77

8.1 User or System Level? .................................................................................................... 77

8.2 Outer Structure ................................................................................................................ 78

8.3 Completion Requirements ............................................................................................ 78

8.4 MIB Variables .................................................................................................................. 78


8.4.1 MIB Tree .............................................................................................................. 79
8.4.2 Interaction with the MIB Compiler ................................................................ 80
8.4.3 Hooking Up the MIB ........................................................................................ 80
Extending the MIB Tree .................................................................................... 80
Hooking Up the MIB Tree to System Variables ............................................ 81
MIB Leaf Example ............................................................................................. 83

8.5 Strategies for Building MIBs ........................................................................................ 83


8.5.1 Dynamically Adding MIB Tree Fragments ................................................... 83
8.5.2 Timing Issues in Adding MIB Tree Fragments ............................................. 85

vi
Contents

8.5.3 Adding Multiple MIB Tree Fragments ........................................................... 86

8.6 Method Routine Processing .......................................................................................... 86


8.6.1 Cookie Field ....................................................................................................... 87
8.6.2 Overall Validity Check and VarBind Aggregation ....................................... 87
8.6.3 VarBind Private Field ........................................................................................ 88
8.6.4 GET PDU Processing ........................................................................................ 88
8.6.5 GET NEXT and GET BULK PDU Processing ................................................ 89
8.6.6 SET PDU Processing ......................................................................................... 89
Undoing a Set ..................................................................................................... 90
8.6.7 Row Creation ..................................................................................................... 90

8.7 SNMPv1 and SNMPv2 Traps ........................................................................................ 93


8.7.1 Where to Send Traps ......................................................................................... 94
8.7.2 Disabling Authentication Traps ...................................................................... 95

8.8 SNMPv3 Notifications ................................................................................................... 95

8.9 View Requirements ........................................................................................................ 96


8.9.1 View Tables ........................................................................................................ 96
RFC 3415 View Macros ..................................................................................... 97

8.10 SNMPv1 and SNMPv2c Proxy Requirements ........................................................... 97

8.11 AgentX Requirements .................................................................................................... 98


8.11.1 Master Agent ..................................................................................................... 98
8.11.2 AgentX SubAgent ............................................................................................. 98
8.11.3 Examples ............................................................................................................ 99

9 Client ............................................................................................................ 101

9.1 Client Outer Structure .................................................................................................... 101


9.1.1 SNMP Manager for Unix and Windows ........................................................ 101
9.1.2 SNMP Manager for VxWorks .......................................................................... 102

9.2 Transport Model for the SNMP Manager ................................................................... 102

10 Method Routines ......................................................................................... 103

10.1 Introduction ...................................................................................................................... 103

10.2 Accessing MIB Variables ............................................................................................... 104

10.3 Writing Method Routines .............................................................................................. 104


Method Routine API ......................................................................................... 105

vii
Wind River SNMP
Programmer's Guide, 10.5

10.4 Wind River SNMP-Supplied Method Routines ....................................................... 106

10.5 getproc Method Routines .............................................................................................. 108


Parameters .......................................................................................................... 108
Prototypes .......................................................................................................... 109

10.6 nextproc Method Routines ............................................................................................ 111


Prototypes .......................................................................................................... 112

10.7 testproc Method Routines ............................................................................................. 112


Parameters .......................................................................................................... 113
Prototypes .......................................................................................................... 114

10.8 setproc Method Routines ............................................................................................... 114


Prototypes .......................................................................................................... 115

10.9 undoproc Method Routines .......................................................................................... 115


Prototypes .......................................................................................................... 116

10.10 Asynchronous Method Routines ................................................................................. 116


10.10.1 Locking ............................................................................................................... 118
10.10.2 Serialization ........................................................................................................ 119

11 User-Supplied Code ................................................................................... 121

11.1 Introduction ...................................................................................................................... 121

11.2 The envoy.h File ............................................................................................................... 122

11.3 Required Routines .......................................................................................................... 122

11.4 Required System Routines ............................................................................................ 124

11.5 Configuration Macros .................................................................................................... 124

11.6 User-Supplied Handlers ................................................................................................ 130

11.7 User-Exits .......................................................................................................................... 131

11.8 SNMPv3 Method Routine Macros ............................................................................... 132

11.9 RFC 3415 View Method Routine Macros .................................................................... 136

12 Compiler Issues .......................................................................................... 139

12.1 Compiler Warnings ......................................................................................................... 139

12.2 C Compiler ........................................................................................................................ 139


Sensitivity to Word Size .................................................................................... 139
Sensitivity to Type Casting .............................................................................. 139

viii
Contents

Sensitivity to Byte Order .................................................................................. 140

A Row Creation Code ..................................................................................... 141

A.1 Row Creation Code Example ........................................................................................ 141

B User-Supplied Code Reference Entries .................................................... 151

C Wind River SNMP Macro Entries ............................................................... 189

Index ..................................................................................................................... 221

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.

1.2 Processing Standard (FIPS) 140-2


Wind River SNMP provides support for the Federal Information Processing
Standard (FIPS) 140-2, Security Requirements for Cryptographic Modules. The set of
available cipher suites is reduced when building VxWorks in FIPS 140-2 mode.
This because not all security algorithms are FIPS-approved.
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.
For configuration information, see 4.2.1 Configuring FIPS 140-2, p.24.
For complete information about the FIPS 140-2 mode, see the Wind River
Cryptography Libraries Programmer’s Guide.

1.3 SNMP Network Management Model


In the SNMP model of network management, a management station (client)
accesses a set of variables known as a Management Information Base (MIB)
provided by the managed device (a server or an agent). The word MIB can indicate
the set of all variables provided by a particular device, or a set of variables grouped
together in a specification (for example, the Ethernet MIB). The MIB provided by a
particular device may consist of several sets of MIBs from specifications, as well as
private MIBs designed by the device’s manufacturer.
A MIB variable has several attributes:

A syntax, often referred to as a data type.

An access specification, indicating that the variable is readable or writable.

A description, which is some ASCII text describing the variable.

An object identifier, which is a sequence of numbers uniquely identifying the
variable.
There may be only one instance of a variable on the device that provides it, or there
may be many instances of a variable on the device, making up a column in a table.
The Wind River MIB Compiler is a tool that allows you to implement MIBs for
Wind River SNMP.

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.

1.5 Additional Documentation


The following sections describe additional documentation about the technologies
described in this book.

Wind River Documentation

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.

1.6 Design Decisions


Depending on your configuration, you can use Wind River SNMP to build an
SNMP client (or management station), an SNMP server (also known as an agent), an
AgentX master agent, or an AgentX subagent.

1.6.1 Client or Server

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

In a master agent, you need to integrate your calls to envoy_ax_ma_handler( )


with the calls to the main processing code for Wind River SNMP. For example, you
might have a select loop that waits for either an SNMP message or a message from

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.

2.2 Functional Units


The software contains five functional units, a set of routines for use with AgentX
subagents, and sets of routines for configuring and maintaining several databases.
The databases include the following:

a view database (RFC 3415)

SNMPv3 access, user and group databases (RFC 3414 and RFC 3415)

SNMPv3 target and notify databases (RFC 3413)

a proxy database (RFC 3413)

a AgentX database (RFC 2742)

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.

2.2.3 MIB Interface

The input to the MIB interface is a C data structure representing a


GET, GET NEXT, SET, or GET BULK REQUEST PDU. The MIB interface processes
the request, internally produces a C data structure representing the resulting
RESPONSE PDU, and calls upon the Encoder to build a buffer containing an image
of the response packet.
A customer-extensible data tree conforming to the structure of the Management
Information Base controls the MIB interface.
You may generate the data tree by hand or by using the Wind River MIB Compiler.
In Wind River SNMP, several routines have been added allowing you to modify
the data tree at run-time.
The Encoder contains a large number of user-exits to control the handling of
SET REQUEST PDUs.

2.2.4 Received Packet Manager

An SNMP agent/server application invokes the Received Packet Manager to


process a received SNMP packet. Generally this packet will have been received on
an SNMP port over the UDP transport layer. This functional unit calls upon the
services of the Decoder, MIB interface, and Encoder functional units to process the

8
2 Technical Description
2.2 Functional Units

packet. The output of the Received Packet Manager is a buffer containing a


response packet ready for transmission.

2.2.5 Packet Generator

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.

2.2.6 View Configuration

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

The subagent handler is a collection of routines which process SNMP messages


from the master agent to the subagent. Those messages destined for the subagent
engine are handled internally, with the engine calling the necessary method
routines and generating the response message.
Other messages are passed to a user-exit for processing by code that you supply.

Master Agent 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

2.3 Simple Manager and Agent


The software includes a simple SNMP manager and a simple SNMP agent.
Wind River SNMP includes these modules to demonstrate the basic structure of a
manager or agent. They are not intended as production software and may be found
in the target/src/wrn/wm/demo directory with other demonstration code.
The manager provides a simple command line interface to GET and SET MIB
variables. It can use the GET NEXT PDU to walk sub trees of an agent’s MIB, and,
except for SNMPv1, it can use the GET BULK PDU to request multiple repetitions
in a single packet. It also has some simple commands to format tabular information
from the target’s ARP table or IP routing table. Finally, there are commands to
configure the manager, such as setting the version to use SNMPv1, SNMPv2, or
SNMPv3. The manager requires a 4.3BSD-compatible socket interface or the
Attaché Plus TCP/IP protocol stack.
There are two simple agent examples:
■ The UNIX example opens /dev/kmem and reads variables.
■ The Windows example implements the system group from MIB-II and a
toaster MIB.

NOTE: Neither example addresses the issues of atomicity.

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

3.1 What is SNMP? 11


3.2 How Did SNMPv2 and SNMPv3 Evolve? 12
3.3 Supported RFCs 13
3.4 Related RFCs 16
3.5 Obsoleted RFCs 17
3.6 Supported MIBs in the Wind River Network Stack 19

3.1 What is SNMP?


The Internet community has adopted SNMP as the standard for network
management. The SNMP protocol is based on a client-server query-response
model.

A manager is the client or the entity generating the queries.

An agent is the server or the entity generating the responses.
SNMPv3 introduced another set of terms with more specific definitions. These
terms allow SNMPv3 to use more specific compliance statements within
specifications:

A command generator creates queries and handles responses.

A command responder services the queries from a command generator and
returns responses or reports.

A notification originator generates notifications (traps or informs) and sends
them.

A notification receiver receives notifications and, if necessary, returns responses
or reports.

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.

3.2 How Did SNMPv2 and SNMPv3 Evolve?


SNMP provides management stations with the means to read and write
parameters within devices adhering to the SNMP standard. In addition, SNMP
gives devices a means to notify management stations when important events
occur.
SNMP itself is defined by RFC 1157. RFC 1155 and RFC 1213, known respectively
as the Structure and Identification of Management Information (SMI) and
Management Information Base, second version (MIB-II), define the fundamental
set of parameters for use within TCP/IP devices.
SNMPv2 includes many features designed to increase the utility of SNMP. It is
defined by RFC 1901, RFC 2578 through RFC 2580, and RFC 3416 through
RFC 3418. The major documents in the group are: RFC 1901, which defines the
administrative model used by SNMPv2, and RFC 3416, which describes SNMPv2
protocol operations.
SNMPv3 uses the same basic protocol as SNMPv2. As defined in RFC 3411 through
RFC 3415, SNMPv3 adds authentication and privacy to SNMP. 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. Several MIBs were added to provide for
remote configuration of an SNMP engine’s database information. The SNMPv3
add-on for Wind River SNMP also supports the command responder, proxy
forwarder, and notification origination sections of RFC 3413. RFC 3826 defines the
AES encryption services.
SNMP is not limited to the base MIB; it readily accommodates proprietary
extensions. There have been many proposals covering common media, such as
Ethernet, IEEE 802.3, token rings, FDDI, T-1; and the MIB need not be limited to
TCP/IP based equipment.
Most often, SNMP uses UDP as a transport, but it is not limited to that protocol.
Alternate transport methods that have been discussed include direct
encapsulation in Ethernet frames (RFC 1089), use over OSI transport protocols
(RFC 1283), SNMP over IPX (RFC 1298), and X.25 encapsulation.
For bibliographic information, see 3.3 Supported RFCs, p.13 and 3.5 Obsoleted RFCs,
p.17.

12
3 SNMP
3.3 Supported RFCs

3.3 Supported RFCs


Wind River SNMP complies with the ETF RFCs listed in this section which define
the requirements for SNMP protocols and services. The RFCs are accessible from
the following Web site:
http://www.ietf.org

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

includes MIBs for specifying the targets of management operations


(SNMP-TARGET-MIB), notification filtering (SNMP-NOTIFICATION-MIB),
and proxy forwarding (SNMP-PROXY-MIB). This RFC obsoletes RFC 2573
and is also defined as STD0062.
■ RFC 3414: User-based Security Model (USM) for version 3 of the Simple Network
Management Protocol (SNMPv3)
– Describes the User-based Security Model (USM) for SNMP version 3 for
use in the SNMP architecture, and includes a MIB
(SNMP-USER-BASED-SM-MIB) for the configuration parameters of this
model. This RFC obsoletes RFC 2574 and is also defined as STD0062.

RFC 3415: View-based Access Control Model (VACM) for the Simple Network
Management Protocol (SNMP)
– Describes the View-based Access Control Model (VACM) for use in the
SNMP architecture and defines the Elements of Procedure for controlling
access to management information, and includes a MIB
(SNMP-VIEW-BASED-ACM-MIB) for the configuration parameters of this
model. This RFC obsoletes RFC 2575 and is also defined as STD0062.
■ RFC 3416: Version 2 of the Protocol Operations for the Simple Network Management
Protocol (SNMP)
– Describes the protocol operations (for example, get, get next, and get bulk)
for SNMPv2. This RFC obsoletes RFC 1905 and is also defined as STD0062.
■ RFC 3417: Transport Mappings for the Simple Network Management Protocol
(SNMP)
– Defines transport mappings, their serializations, and any associated
well-known values. This RFC obsoletes RFC 1906 and is also defined as
STD0062.
■ RFC 3418: Management Information Base (MIB) for the Simple Network
Management Protocol (SNMP)
– Defines managed objects which describe the behavior of a Management
Information Base for Version 2 for SNMP entities. This RFC obsoletes
RFC 1907 and is also defined as STD0062.
■ RFC 3419: Textual Conventions for Transport Addresses
– Introduces a MIB module that defines textual conventions to represent
commonly used transport-layer addressing information. The definitions
are compatible with the concept of TAddress/TDomain pairs introduced
by SMIv2 and support the Internet transport protocols over IPv4 and IPv6.

RFC 3584: Coexistence between Version 1, Version 2, and Version 3 of the
Internet-standard Network Management Framework
– Describes coexistence between SNMPv3, SNMPv2, and the original
SNMPv1, and how to convert MIB modules from SMIv1 format to SMIv2
format. This RFC obsoletes RFC 2576.
■ RFC 3595: Textual Conventions for IPv6 Flow Label
– A MIB module that defines textual conventions to represent the commonly
used IPv6 Flow Label.

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.

3.4 Related RFCs


This section lists IETF RFCs relevant to Wind River SNMP. The RFCs are accessible
from the following Web site:
http://www.ietf.org
■ RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1

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

3.5 Obsoleted RFCs


This section lists IETF RFCs relevant to Wind River SNMP yet relegated to obsolete
status by newer RFCs. The RFCs are accessible from the following Web site:
http://www.ietf.org
■ RFC 1067: Simple Network Management Protocol
– Obsoleted by RFC 1098.
■ RFC 1098: Simple Network Management Protocol (SNMP)
– Obsoletes RFC 1067 and is obsoleted by RFC 1157.
■ RFC 1158: Management Information Base for Network Management of TCP/IP-based
internets: MIB-II
– Obsoleted by RFC 1213.
■ RFC 1442: Structure of Management Information for version 2 of the Simple Network
Management Protocol (SNMPv2)
– Obsoleted by RFC 1902.
■ RFC 1443: Textual Conventions for version 2 of the Simple Network Management
Protocol (SNMPv2)
– Obsoleted by RFC 1903.
■ RFC 1444: Conformance Statements for version 2 of the Simple Network
Management Protocol (SNMPv2)
– Obsoleted by RFC 1904.

RFC 1448: Protocol Operations for version 2 of the Simple Network Management
Protocol (SNMPv2)
– Obsoleted by RFC 1905.

RFC 1449: Transport Mappings for version 2 of the Simple Network Management
Protocol (SNMPv2)
– Obsoleted by RFC 1906.
■ RFC 1450: Management Information Base for version 2 of the Simple Network
Management Protocol (SNMPv2)
– Obsoleted by RFC 1907.
■ RFC 1452: Coexistence between version 1 and version 2 of the Internet-standard
Network Management Framework

17
Wind River SNMP
Programmer's Guide, 10.5

– Obsoleted by RFC 1908.



RFC 1902: Structure of Management Information for Version 2 of the Simple Network
Management Protocol (SNMPv2)
– Obsoletes RFC 1442 and is obsoleted by RFC 2578.

RFC 1903: Textual Conventions for Version 2 of the Simple Network Management
Protocol (SNMPv2)
– Obsoletes RFC 1443 and is obsoleted by RFC 2579.

RFC 1904: Conformance Statements for Version 2 of the Simple Network
Management Protocol (SNMPv2)
– Obsoletes RFC 1444 and is obsoleted by RFC 2580.
■ RFC 1905: Protocol Operations for Version 2 of the Simple Network Management
Protocol (SNMPv2)
– Obsoletes RFC 1448 and is obsoleted by RFC 3416.
■ RFC 1906: Transport Mappings for Version 2 of the Simple Network Management
Protocol (SNMPv2)
– Obsoletes RFC 1449 and is obsoleted by RFC 3417.
■ RFC 1907: Management Information Base for Version 2 of the Simple Network
Management Protocol (SNMPv2)
– Obsoletes RFC 1450 and is obsoleted by RFC 3418.
■ RFC 1908: Coexistence between Version 1 and Version 2 of the Internet-standard
Network Management Framework
– Obsoletes RFC 1452 and is obsoleted by RFC 2576.
■ RFC 2257: Agent Extensibility (AgentX) Protocol Version 1
– Obsoleted by RFC 2741.
■ RFC 2261: An Architecture for Describing SNMP Management Frameworks.
(Obsoleted by RFC 2271)
■ RFC 2262: Message Processing and Dispatching for the Simple Network
Management Protocol (SNMP)
– Obsoleted by RFC 2272.

RFC 2263: SNMPv3 Applications
– Obsoleted by RFC 2273.

RFC 2264: User-based Security Model (USM) for version 3 of the Simple Network
Management Protocol (SNMPv3)
– Obsoleted by RFC 2274.

RFC 2265: View-based Access Control Model (VACM) for the Simple Network
Management Protocol (SNMP)
– Obsoleted by RFC 2275.
■ RFC 2271: An Architecture for Describing SNMP Management Frameworks
– Obsoletes RFC 2261 and is obsoleted by RFC 2571.

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.

3.6 Supported MIBs in the Wind River Network Stack


Wind River SNMP supports the following RFC-compliant MIBs for the
Wind River Network Stack:

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

4.2 VxWorks Source Build Project


To create a VSB project for Wind River SNMP, include the SNMP components that
you want. Table 4-1 lists the Wind River SNMP components.

Table 4-1 Wind River SNMP Components in the VSB

SNMP Component Description

Enable SNMP Set to y to include the core


(COMPONENT_SNMP) Wind River SNMP component.
This component includes the basic
SNMP engine, MIB interface,
packet encoder/decoder and
received packet manager which
have SNMPv1 and SNMPv2c
capabilities.

Enable SNMP_AGENTX Set to y to include the SNMP


(FEATURE_SNMP_AGENTX) AgentX component. The
component includes support for
Agent Extensibility, master and
subagents conforming to
RFC 2742.

Enable SNMP_V3 Set to y to include the SNMP


(FEATURE_SNMP_V3) Version 3 component. This
component includes the extended
SNMP engine, SNMPv3 proxy
support, VACM and SNMPv3
database support conforming to
SNMPv3 standards.

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 SSH Transport Support For SNMPv3, set to y to enable


(SNMP_USE_SSH_TRANSPORT) SSH transport for SNMP.

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.

4.2.1 Configuring FIPS 140-2

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.

4.3 Creating a VIP


A VxWorks image project (VIP) is used to create a version of VxWorks using
components based on the precompiled libraries provided in the VxWorks
installation. A VIP can use the standard components that are delivered with binary
libraries, or it can be based on a BSP, an existing VIP, or a VSB project.
The user’s guide for your Platform contains general instructions for creating VIPs
and configuring VxWorks with components.

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.

4.4 SNMP Integration in an Image Project


To include Wind River SNMP in an image project, add SNMP components and
configure the component parameters. Rebuild the image to include the newly
added components and parameter values in an image file.
To configure SNMP using Workbench, see 4.5 Configuring SNMP Using Workbench,
p.26. To configure SNMP using vxprj, see 4.6 Configuring Wind River SNMP Using
vxprj, p.28.

25
Wind River SNMP
Programmer's Guide, 10.5

4.5 Configuring SNMP Using Workbench


This section describes how to use Workbench to include SNMP components and
configure SNMP parameters.

Step 1: Include the SNMP components.


1. From the Kernel Configuration Editor, navigate to: Network Components >
Layer 5 (Applications) Components > Wind River SNMP libraries.
2. Select the desired SNMP components and include them in your project.
To have basic SNMP capability (SNMP engine, MIB interface, packet
encoder/decoder and received packet manager which have SNMPv1 and
SNMPv2c capabilities), you must include these components:

Wind River SNMP Core Library
(INCLUDE_WINDMANAGE_SNMP_CORE)
This is the main SNMP component and must be included for all SNMP
builds.

SNMP Static Initialization (INCLUDE_SNMP_STATIC_INIT)
For 32-bit and 64-bit platforms, this causes the SNMP agent to initialize
inside the network stack upon boot.
To provide SNMP management for a network management station, include
the SNMP Manager (INCLUDE_SNMP_MANAGER) component. For more
information on SNMP management, see 9. Client.
To provide SNMPv3 functionality in the SNMP engine, include the following
additional components along with the above:

Wind River SNMP V3 core support component
(INCLUDE_WINDMANAGE_SNMP_V3CORE)
The component includes support for SNMPv3 proxy transfers, VACM and
SNMPv3 database operations conforming to SNMPv3 standards.
To provide transport functionality for SNMP, include one of more of the
following components:

SNMP udp transport model
(INCLUDE_SNMP_UDP_TRANSPORT)
The component includes support for UDP transport in SNMP conforming
to RFC 5590.

SNMP ssh transport model
(INCLUDE_SNMP_SSH_TRANSPORT)
The component includes support for SSH transport in SNMP conforming
to RFC 5592.

SNMP tls or dtls common configurations for SNMPD
(INCLUDE_SNMP_TLS_COMMON)
The component includes support for DTLS and TLS transport in SNMP
conforming to RFC 6353.

SNMP tls transport model
(INCLUDE_SNMP_TLS_TRANSPORT)

26
4 Building Wind River SNMP for VxWorks
4.5 Configuring SNMP Using Workbench

The component includes support for TLS transport in SNMP conforming


to RFC 6353.
■ SNMP dtls transport model
(INCLUDE_SNMP_DTLS_TRANSPORT)
The component includes support for DTLS transport in SNMP conforming
to RFC 6353.
To provide AgentX functionality in the SNMP engine, include the following
additional components along with the basic SNMP components listed at the
top:

Wind River SNMP AgentX Common Core
(INCLUDE_WINDMANAGE_SNMP_AGENTX_COMMONCORE)
The component includes support for Agent Extensibility and registration
conforming to RFC 2742.
■ Wind River SNMP AgentX Master Agent Core
(INCLUDE_WINDMANAGE_SNMP_AGENTX_MASTERCORE)
The component includes support for AgentX master agent operations
conforming to RFC 2742.
■ Wind River SNMP AgentX Subgent Core
(INCLUDE_WINDMANAGE_SNMP_AGENTX_SUBAGENTCORE)
The component includes support for AgentX subagent operations
conforming to RFC 2742.

Step 2: Set the SNMP configuration parameters.


Once the SNMP components are included, double-click the component name to
display the component configuration parameters. Refer to Table 4-2 for a
description of the configuration parameters. Set the parameter values to suit your
installation. The parameters are only visible if the corresponding components are
included in the VSB.

Step 3: Build the project


Access the Project Explorer and click the project to highlight the project item.
Right-click the project item and select Build Project to build the project. Observe
the build progress from the Build Console tab. For complete build information,
see Wind River Workbench By Example.

Table 4-2 SNMP Components and Parameters

Component, Parameter, and Description Default

Wind River SNMP libraries (FOLDER_SNMPD)

SNMP Initialization (SELECT_SNMP_INIT)

SNMP Static Initialization (INCLUDE_SNMP_STATIC_INIT) On

SNMP Manager (INCLUDE_SNMP_MANAGER)

Wind River SNMP Core Library (INCLUDE_WINDMANAGE_SNMP_CORE)

SNMP uses m2Lib (SNMP_USE_M2LIB) FALSE

27
Wind River SNMP
Programmer's Guide, 10.5

Table 4-2 SNMP Components and Parameters (cont’d)

Component, Parameter, and Description Default

Wind River SNMP V3 core support component


(INCLUDE_WINDMANAGE_SNMP_V3CORE)

SNMP dtls transport model (INCLUDE_SNMP_DTLS_TRANSPORT)

SNMP tls or dtls common configurations for SNMPD


(INCLUDE_SNMP_TLS_COMMON)

TLS CA certificate file (SNMP_TLS_CA_CERT_FILE) char *

TLS certificate file (SNMP_TLS_CERT_FILE) char *

TLS key file (SNMP_TLS_KEY_FILE) char *

Configure a map for snmp username (SNMP_TLS_CERT_SECNAME) char *

SNMP key privacy support (INCLUDE_SNMP_PRIVACY)

SNMP TLS key id (SNMP_TLS_KEY_ID) “snmpserver”

SNMP ssh transport model (INCLUDE_SNMP_SSH_TRANSPORT)

SNMP tls transport model (INCLUDE_SNMP_TLS_TRANSPORT)

SNMP udp transport model (INCLUDE_SNMP_UDP_TRANSPORT)

Wind River SNMP AgentX Common Core


(INCLUDE_WINDMANAGE_SNMP_AGENTX_COMMONCORE)

Wind River SNMP AgentX Master Agent Core


(INCLUDE_WINDMANAGE_SNMP_AGENTX _MASTERAGENTCORE)

Wind River SNMP AgentX Subagent Core


(INCLUDE_WINDMANAGE_SNMP_AGENTX_SUBAGENTCORE)

4.6 Configuring Wind River SNMP Using vxprj


This section describes how to use Workbench to include Wind River SNMP
components and configure Wind River SNMP parameters.

4.6.1 Viewing Wind River SNMP Components and Parameters

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

4.6.2 Adding Basic SNMP Components and Configuring SNMP Parameters

Step 1: Locate the project file.


Access the project directory where the project file (*.wpj) is located. Execute all
configuration commands from this directory.

Step 2: Include the basic SNMP components.


To have basic SNMP capability (SNMP engine, MIB interface, packet
encoder/decoder and received packet manager which have SNMPv1 and
SNMPv2c capabilities), you must include these components:
Add the INCLUDE_WINDMANAGE_ SNMP_CORE component to support
Wind River SNMP.
> vxprj component add INCLUDE_WINDMANAGE_SNMP_CORE
adding INCLUDE_WINDMANAGE_SNMP_CORE

NOTE: the following default components have been included


INCLUDE_SNMP_STATIC_INIT

NOTE: the following components have been included for convenience


INCLUDE_WM_SNMP_INIT

NOTE: the following component have been added as required to complete


configuration
INCLUDE_MIB2_ALL INCLUDE_MIB2_ICMP INCLUDE_MIB2_IF INCLUDE_MIB2_IFMGT
INCLUDE_MIB2_IP INCLUDE_MIB2_SYSTEM INCLUDE_MIB2_TCP INCLUDE_MIB2_UDP

Step 3: View the component updates.


To view the newly added component to the project, use the following command:
> vxprj component list SNMP
INCLUDE_SNMP_STATIC_INIT
INCLUDE_WINDMANAGE_SNMP_CORE
INCLUDE_WM_SNMP_INIT

To view the settings for SNMP-related parameters, use the following command:

> vxprj parameter value SNMP


SNMP_USE_M2LIB = FALSE

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

Step 4: Build the executable.


To build VxWorks source from command-line, execute the vxprj build command
from the project directory. See the VxWorks Command-Line Tools User's Guide for
details.

4.6.3 Adding Basic SNMP and SNMPv3 Components

Step 1: Locate the project file.


Access the project directory where the project file (*.wpj) is located. Execute all
configuration commands from this directory.

Step 2: Include the basic SNMP components.


Add the INCLUDE_WINDMANAGE_ SNMP_CORE component to support
Wind River SNMP.
> vxprj component add INCLUDE_WINDMANAGE_SNMP_CORE
adding INCLUDE_WINDMANAGE_SNMP_CORE

NOTE: the following default components have been included


INCLUDE_SNMP_STATIC_INIT

NOTE: the following components have been included for convenience


INCLUDE_WM_SNMP_INIT

NOTE: the following component have been added as required to complete


configuration
INCLUDE_MIB2_ALL INCLUDE_MIB2_ICMP INCLUDE_MIB2_IF INCLUDE_MIB2_IFMGT
INCLUDE_MIB2_IP INCLUDE_MIB2_SYSTEM INCLUDE_MIB2_TCP INCLUDE_MIB2_UDP

Step 3: Include the SNMPv3 component.


Add the INCLUDE_WINDMANAGE_ SNMP_V3CORE component to provide
SNMPv3 support.
> vxprj component add INCLUDE_WINDMANAGE_SNMP_V3CORE
adding INCLUDE_WINDMANAGE_SNMP_V3CORE

Step 4: View the component updates.


To view the newly added component to the project, use the following command:
> vxprj component list SNMP
INCLUDE_SNMP_STATIC_INIT
INCLUDE_WINDMANAGE_SNMP_CORE
INCLUDE_WINDMANAGE_SNMP_V3CORE
INCLUDE_WM_SNMP_INIT

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.

Step 5: Build the executable.


To build VxWorks source from command-line, execute the vxprj build command
from the project directory. See the VxWorks Command-Line Tools User's Guide for
details.

30
4 Building Wind River SNMP for VxWorks
4.6 Configuring Wind River SNMP Using vxprj

4.6.4 Adding Basic SNMP and AgentX Components

Step 1: Locate the project file.


Access the project directory where the project file (*.wpj) is located. Execute all
configuration commands from this directory.

Step 2: Include the basic SNMP components.


Add the INCLUDE_WINDMANAGE_ SNMP_CORE component to support
Wind River SNMP.
> vxprj component add INCLUDE_WINDMANAGE_SNMP_CORE
adding INCLUDE_WINDMANAGE_SNMP_CORE

NOTE: the following default components have been included


INCLUDE_SNMP_STATIC_INIT

NOTE: the following components have been included for convenience


INCLUDE_WM_SNMP_INIT

NOTE: the following components have been added as required to complete


configuration
INCLUDE_MIB2_ALL INCLUDE_MIB2_ICMP INCLUDE_MIB2_IF INCLUDE_MIB2_IFMGT
INCLUDE_MIB2_IP INCLUDE_MIB2_SYSTEM INCLUDE_MIB2_TCP INCLUDE_MIB2_UDP

Step 3: Include the AgentX core component.


Add the INCLUDE_WINDMANAGE_ SNMP_AGENTX_COMMONCORE component
to provide Agent Extensibilty support.
> vxprj component add INCLUDE_WINDMANAGE_SNMP_AGENTX_COMMONCORE
adding INCLUDE_WINDMANAGE_SNMP_AGENTX_COMMONCORE

Step 4: Include the AgentX master agent component.


Add the INCLUDE_WINDMANAGE_ SNMP_AGENTX_MASTERCORE component to
provide AgentX master agent support.
> vxprj component add INCLUDE_WINDMANAGE_SNMP_AGENTX_MASTERCORE
adding INCLUDE_WINDMANAGE_SNMP_AGENTX_MASTERCORE

Step 5: Include the AgentX subagent component.


Add the INCLUDE_WINDMANAGE_ SNMP_AGENTX_SUBAGENTCORE
component to provide AgentX subagent support.
> vxprj component add INCLUDE_WINDMANAGE_SNMP_AGENTX_SUBAGENTCORE
adding INCLUDE_WINDMANAGE_SNMP_AGENTX_SUBAGENTCORE

Step 6: View the component updates.


To view the newly added component to the project, use the following command:
> vxprj component list SNMP
INCLUDE_WINDMANAGE_SNMP_AGENTX_COMMONCORE
INCLUDE_WINDMANAGE_SNMP_AGENTX_MASTERCORE
INCLUDE_WINDMANAGE_SNMP_AGENTX_SUBAGENTCORE
INCLUDE_SNMP_STATIC_INIT
INCLUDE_WINDMANAGE_SNMP_CORE
INCLUDE_WM_SNMP_INIT

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.

Step 7: Build the executable.


To build VxWorks source from command-line, execute the vxprj build command
from the project directory. See the VxWorks Command-Line Tools User's Guide for
details.

4.7 Customizing the Wind River SNMP Configuration


Use the information in these sections to port Wind River SNMP for target
operating systems other than those supported by the standard Wind River
platforms.
There are three main steps to customizing the configuration of Wind River SNMP:
1. Modify or create a configuration file describing the options you choose to
install.
2. Use this configuration file as input to the makmak program to generate a set
of makefiles and an install.h file describing the options you have selected.
3. Edit the header definition files as required for the target environment. These
header files allow you to define specific items, such as macros, or to redefine
existing items, such as C data types.

4.7.1 Creating a makmak Configuration File

The makmak utility handles compile-time configuration. The makmak program


takes your configuration file as an argument. You can use the file config.cfg
located in the top-level of the Wind River SNMP source tree as a template.
This configuration file specifies the type of the compiler, what products are being
built, any changes to the default configuration for those products, and the location
of the directory containing porting header files. For VxWorks this file is located in
the following directory:
installDir/vxworks-6.x/target/h/wrn/wm/util/port

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

The default configuration includes code to implement version 1 of the SNMP


protocol. To compile without SNMPv1, include the following line in your
configuration file:
uninstall ENVOY_SNMP_VERSION_1

SNMP Version 2

The default configuration includes code to implement version 2 of the SNMP


protocol. To compile without SNMPv2, include the following line in your
configuration file:
uninstall ENVOY_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

SNMPv2 Types in SNMPv1 Packets

Since a strict SNMPv1 implementation does not understand 64-bit counters,


Wind River SNMP rejects this type in incoming packets and, as an agent, skips
over objects of that type. To allow this type to be used in SNMPv1 packets, install
the following option. By default, it is uninstalled. This option is not recommended:
install ENVOY_SNMP_USE_V2_TYPES

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

SNMPv3 Authentication and Privacy Options

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

SNMPv3 Target MIB

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( ).

SNMPv3 Notification MIB

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.

Dynamic VxWorks Configuration

In order to build Wind River SNMP to allow dynamic configuration under


VxWorks, you must use the COMMON_DYNAMIC_COMP_CONFIG option. This
option also requires that you install the ENVOY_SNMP_VERSION_3 and
ENVOY_AGENTX options as well. To use common dynamic reconfiguration,
include the following lines in your configuration file:
install ENVOY_SNMP_VERSION_3
install ENVOY_AGENTX
install COMMON_DYNAMIC_COMP_CONFIG

If you are not using VxWorks, do not include this option.

35
Wind River SNMP
Programmer's Guide, 10.5

Custom User-Exit for Community Validation

You can provide a custom user-exit when INSTALL_ENVOY_SNMP_COEXISTENCE


is set to 1.
To implement the custom user-exit functionality, add the following to your project:
#include <wrn/wm/common/install.h>
#include <wrn/wm/common/dyncfg.h>

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

In a reentrant environment, it can be necessary to ensure that sections of the


database do not change during the execution of certain pieces of code. In the
original SNMPv1 code, locking was only an issue during gets and sets; an object
needed to be stable from the time it was found until it was read or written. With
the addition of asynchronous method routines, proxies, subagents and, in
SNMPv3, security and authentication, the locking problem is much larger.
Wind River SNMP includes code to request locks during packet processing. The
system used is a simple one. During the processing of any packet, the routine that
creates a packet structure requests a general read lock. Conceptually, this lock
covers the entire database. If the packet is not a SET REQUEST, the routine that
frees the packet releases the lock as Wind River SNMP finishes processing the
packet. If the packet is a SET REQUEST, the read lock is released and Wind River
SNMP requests a write lock. Again, the packet freeing routine releases the write
lock when Wind River SNMP has finished processing the packet. Other areas of
code that require locks are proxies, timers, and AgentX master agents. You must
supply the code to implement the locks, as defined in Locking, p.43. Wind River
SNMP assumes that read locks can be shared and that write locks are exclusive. By
default, the simple locking scheme is not installed.

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

serialization. You cannot install locking and serialization together. By default,


serialization is not installed. To install serialization, add the following line in your
configuration file:
install ENVOY_SNMP_SERIALIZE

Proxies

The ENVOY_SNMP_PROXY option permits SNMPv1 and SNMPv2 proxy code to


be compiled. You must indicate whether the current packet is a proxy packet as
part of the community string validation routine and specify information, including
how to process that packet and where to send the output packet. The proxy code
includes routines that do the following:
■ Save a state block when a packet is passed to the proxy.
■ Restore a packet from the state block when the proxy response is received.
■ Encode outgoing packets for SNMP v1 or SNMP v2 over UDP.
This option does not include code to encode packets for other management
schemes or transports, transport the packets, or configure the proxies. By default
this option is uninstalled. To install it, include the following line in your
configuration file:
install ENVOY_SNMP_PROXY

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

Diffie-Hellman Cryptographic Key Exchange

Wind River SNMP implements support for Diffie-Hellman cryptographic key


exchange operations, as defined in RFC 2786 Diffie-Helman USM Key Management
Information Base and Textual Convention.
To make use of the Diffie-Hellman support in Wind River SNMP, include the
following line in your configuration file:
install SNMP_V3_DIFFIE_HELLMAN

NOTE: To use the SNMP_V3_DIFFIE_HELLMAN option, you must have also


installed SNMPv3 and a product that supports Diffie-Hellman libraries such as
Wind River SSL or Open SSL.

By default, the SNMP_V3_DIFFIE_HELLMAN configuration option is set as


uninstalled.

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

NOTE: If you install the ENVOY_SNMP_COEXISTENCE option, you must also


install the ENVOY_SNMP_VERSION_3 and ENVOY_SNMP_V3_TARGET options.

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

4.7.2 Header Configuration Files

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.

NOTE: If you installed the ENVOY_SNMP_VERSION_3 and


ENVOY_SNMP_COEXISTENCE options, you must validate community names
using the SNMP_community_coexistence_lookup( ) routine.

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.

Other System Routines

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

Multiple MIB Trees

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( )

Set Processing User Exits

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( )

Cleanup of Packet Private Field

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.

AgentX Configuration Macros

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

5.1 General Types 45


5.2 MIB Tree Types 47
5.3 SNMP Packet Representation 47
5.4 Generic Tree Type 48
5.5 View Type 48
5.6 SNMP Version 3 Types 49

5.1 General Types


In Wind River SNMP, general data types are defined as typedefs in the header file
asn1conf.h and sizes, which are appropriate for most cases, are defined in types.h.
Do not modify either file. If you need to make changes, modify oemtypes.h. For
VxWorks, this file is located in the following directory:
installDir/vxworks-6.x/target/h/wrn/util/port/platform

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

5.2 MIB Tree Types


MIBLEAF_T
Each instance of type MIBLEAF_T represents a scalar (non-tabular)
management variable, or an attribute (column) in a table of management
variables. The MIBLEAF_T instance points to procedures and other
information needed to access the associated management variable.
MIBNODE_T
Each instance of type MIBNODE_T represents an internal node of the
management information base tree. Each MIBNODE_T is associated with a list
of elements of type MIBARC_T. This list indicates the MIBNODE_Ts and
MIBLEAF_Ts at the next lower level of the MIB tree.
MIBARC_T
Instances of MIBARC_T are used to designate the nodes and leaves of the
management information tree which descend from a particular internal node
of the tree.

5.3 SNMP Packet Representation


VBPRIVPROC_T
A typedef for routines used to free private space in VB_T. The VB_T is the
argument to the VBPRIVPROC_T routine.
VB_T
Each VarBind in an SNMP PDU’s VarBindList is held in an item of type VB_T.
This type contains a tagged union capable of holding all of the data types
defined by the RFC 1155 and RFC 2578 SMIs.
The VB_T structure contains additional fields for processing incoming PDUs.
One of these fields is a linked-list pointer giving the agent writer the means to
generate a relationship between items in a VarBindList. Two other fields are
provided to associate space with a VB_T that will be freed when the VB_T is
freed. These are useful for test routines that must acquire some resources to
determine if a SET can be accomplished. The vb_priv field in the VB_T can be
used to point to these resources while the vb_free_priv field is used to point to
a VBPRIVPROC_T routine. If a VB_T has a non-null vb_free_priv when the
packet is freed, the vb_free_priv is called and may free up any resources that
the VB_T specifies.
In general, the VarBindList found in SNMP PDUs is represented as an array of
elements of type VB_T. The location and size of such an array is held in an item
of type VBL_T. While processing a GET BULK request, where the number of
VB_Ts is not known when the packet is created, additional VBL_Ts can be
chained in a list using a pointer in the VBL_T structure.
VBL_T
Each VarBindList is held in an item of type VBL_T. This is a list of VBL_Ts that
can be chained in a list using a pointer in the VBL_T structure. See VB_T.

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.

5.4 Generic Tree Type


TREENODE_T
This structure provides a general purpose tree indexed by OIDC_Ts. The tree
is structured as a series of linked lists with each node pointing to its successor
(if any exist under its parent) on this level and to the first of any children it may
have. The child pointer is a PTR_T to allow its children to be either other
TREENODE_Ts or a leaf node of some type containing other information. There
are a set of routines to manipulate the tree structures and you are encouraged
to use them rather than accessing the structures directly.

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.

5.5 View Type


For these structures you are encouraged to use the routines provided to
manipulate these structures rather than manipulating the structures directly.
VIEWLEAF_T
The implementation of the view table from RFC 3415. The VIEWLEAF_T
handles the specific information about a view and has pointers to allow for a
linked list of views.
VIEWINDEX_T
The VIEWINDEX_T groups the views by an index allowing for a family to be
comprised of multiple separate views. The RFC 3415 scheme uses a string for
the index.

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.

5.6 SNMP Version 3 Types


The types described in this section have been added to support the SNMP v3 code.
You should manipulate them using the provided routines rather than by direct
accesses.
ETC_STATUS_T
This type corresponds to the row status textual convention.
ETC_STORAGE_T
This type corresponds to the storage textual convention.
ENGINE_LEAF_T
Variables of this type hold information about any engines that this entity
knows about, including itself.
SNMP_ACC_GRP_T
SNMP_ACCESS_T
These types are used to build the access table from RFC 3415. This table allows
an engine to determine what view to use when processing a packet.
SNMP_AUTH_T
The generic authentication code uses structures of this type to contain the
knowledge of a particular authentication algorithm. You will only need to
manipulate structures of this form if you plan to add your own authentication
algorithms.
SNMP_COMMUNITY_T
This type is used to build the Community table from RFC 3584.
SNMP_CONTEXT_T
This type is used to maintain a list of all the contexts that this entity may use.
SNMP_GROUP_T
Instances of SNMP_GROUP_T are used to hold the mapping information from
the security name to group table as defined in RFC 3415.
SNMP_NOTIFY_T
This type is used to build the Notify table from RFC 3413.
SNMP_NOTIFY_FILTER_PROFILE_T
This type is used to build the NotifyFilterProfile table from RFC 3413.
SNMP_NOTIFY_FILTER_T
This type is used to build the NotifyFilter table from RFC 3413.
SNMP_PROXY_T
This type is used to build the Proxy table from RFC 3413.

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.

6.1.3 User Security Model

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.

6.1.4 Diffie-Hellman Cryptographic Key Exchange

Wind River SNMP supports the use of Diffie-Hellman key exchange in


communications between SNMP agents. The Diffie-Hellman cryptographic key
exchange algorithm allows two parties to exchange a secret key over an insecure
medium, according to the methods described in RFC 2631 Diffie-Hellman Key

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.

6.1.5 Access Control 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.

6.1.6 Notify Model

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.

6.1.7 Proxy Engine Operation

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

Read-Class and Write-Class PDUs Processing

When Wind River SNMP receives a Read-Class or a Write-Class PDU, it performs


proxy forwarding processing as follows:
1. Wind River SNMP checks the context of the PDU.
If the context engine id of the PDU matches the local entity's engine id, then
the command responder component of Wind River SNMP processes this PDU.
If the context engine id of the PDU does not match the local engine id, then
Wind River SNMP checks to see if this PDU should be forwarded. Wind River
SNMP reads through the snmpProxyTable, seeking the first row in which:
a. snmpProxyType matches the PDU-Type (read (1) for Read-Class or write
(2) for Write-Class).
b. snmpProxyContextEngineID matches the contextEngineID
c. snmpProxyContextName matches the context string
d. snmpProxyTargetParamsIn indicates an entry in the
snmpTargetParamsTable for which the appropriate parameters match,
(messageProcessingModel, securityLevel, security model, and
securityName)

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

When Wind River SNMP receives a Notification-Class PDU, it performs proxy


forwarding processing as follows:
1. Wind River SNMP checks the context of the PDU.
If the context engine id of the PDU has an entry in the snmpProxyTable, then
this PDU may need to be forwarded. If not, Wind River SNMP can process it
locally (although Wind River SNMP does no automatic local processing of
incoming notifications).
Wind River SNMP seeks the first row in the snmpProxyTable in which:
a. snmpProxyType matches the PDU-Type (trap (3) or inform (4)).
b. snmpProxyContextEngineID matches the contextEngineID
c. snmpProxyContextName (if supported) matches the context string
d. snmpProxyTargetParamsIn indicates an entry in the
snmpTargetParamsTable for which the appropriate parameters match
(messageProcessingModel, securityLevel, security model, and
securityName).
2. From the chosen row in the snmpProxyTable, Wind River SNMP looks up
snmpProxyMultipleTargetOut, which is a TagValue.
Wind River SNMP uses this TagValue to construct a list of valid targets to
receive this notification by considering any active row in the
snmpTargetAddrTable which contains the TagValue in
snmpTargetAddrTagList to be a valid target for the forwarded notification.
If Wind River SNMP does not have at least one valid target, the proxy
forwarding engine behaves differently depending on whether the notification
was an Unconfirmed-Class PDU (Trap) or a Confirmed-Class PDU (Inform):

In the case of an Unconfirmed-Class PDU, Wind River SNMP halts
processing of the notification.

For a Confirmed-Class PDU, Wind River SNMP increments the
snmpProxyDrops field and sends a snmpProxyDrops Report-PDU back
to the originator.
3. If Wind River SNMP has at least one valid target, the proxy forwarding code
constructs a new PDU for each target.

55
Wind River SNMP
Programmer's Guide, 10.5

NOTE: There are differences between forwarding a notification and sending a


notification directly. When forwarding, Wind River SNMP ignores the Notify MIB,
and performs no filtering of any kind, nor any view or access checking. When
sending a notification directly, Wind River SNMP may perform all of these checks
and filters.

If the PDU being forwarded is an Unconfirmed-Class PDU (Trap), then


Wind River SNMP sends the notifications to their appropriate targets and halts
processing of the packet.
If the PDU being forwarded is a Confirmed-Class PDU (Inform), then
Wind River SNMP keeps track of the details of the received PDU in the same
fashion as it does for forwarded Read-Class and Write-Class PDUs.
Although forwarded notifications are not retransmitted automatically by the
proxy forwarder, they are still subject to time-outs. If the longest time-out on
any of the targets expires without a response being received for this
notification, then the proxy control block is cleaned and removed. If at least
one response is received, then the response is forwarded back to the originator.

Response-Class and Internal-Class PDUs

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.

6.1.8 SNMP Engine Operation with Coexistence

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

Receiving and Processing SNMPv1/v2c PDUs

The Community table creates a mapping between a community string (optionally


coming from a particular address or set of addresses) and a minimal set of
SNMPv3 attributes: context engine id, context name, and security name.
With this mapping, it's possible to fully process an incoming SNMPv1 or v2c
Request PDU using only information contained in the MIBs.
Instead of calling validate_SNMP_community( ) user-exit, you can call the
SNMP_community_coexistence_lookup( ) function which performs a lookup

56
6 SNMPv3
6.1 Description

into the Community table and does view selection automatically. You must, of
course, populate the Community table.

NOTE: If you installed the ENVOY_SNMP_VERSION_3 and


ENVOY_SNMP_COEXISTENCE options, you must validate community names
using the SNMP_community_coexistence_lookup( ) routine.

The procedure for receiving and processing SNMPv1/v2c PDUs is as follows:


1. Upon receipt of an incoming Read-Class or Write-Class PDU, Wind River
SNMP attempts to find the first entry in the snmpCommunityTable for which:
a. The snmpCommunityName matches which matches the community
string for the PDU.
b. snmpCommunityTransportTag is an empty string, or the
transportDomain and transportAddress from which the message was
received matches one of the entries selected by the
snmpCommunityTransportTag. In this case, Wind River SNMP also uses
the snmpTargetAddrTMask for purposes of endpoint checking, if that
field is set.
If Wind River SNMP does not find an entry, the coexistence code increments
the snmpInBadCommunityNames counter and stops processing the packet.
2. If Wind River SNMP does find an entry, the coexistence code determines all of
the information necessary to process the PDU:

The securityEngineID come from the local value snmpEngineID.0.

The securityName comes from snmpCommunitySecurityName.

The contextSnmpEngineID comes from
snmpCommunityContextEngineID.

The contextName comes from snmpCommunityContextName.

The PDU is the decoded PDU.
3. Wind River SNMP uses this information to determine the view to use for this
request by looking up the user in the vacmSecurityToGroupTable, using a
securityModel of 1 for SNMPv1 or 2 for SNMPv2c, and the securityName from
snmpCommunitySecurityName.
4. This provides a group name, which Wind River SNMP uses to look up the
correct access entry:

vacmGroupName comes from the lookup into the
vacmSecurityToGroupTable.

vacmAccessContextPrefix matches the context name, either exactly (if
vacmAccessContextMatch is exact or as a prefix if
vacmAccessContextMatch is prefix).

vacmAccessSecurityModel is 1 for an SNMPv1 request or 2 for an SNMPv2
request.

vacmAccessSecurityLevel is always set to noAuthNoPriv.
5. From this access entry, Wind River SNMP assigns the appropriate view to the
PDU, as follows:

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.

Construction and Sending of Notifies

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).

NOTE: MPModel 2 is reserved for SNMPv2u (usec) and SNMPv2*.

When a notification must be generated for SNMPv1 or SNMPv2c, Wind River


SNMP looks up the appropriate additional information in the
snmpCommunityTable, as follows:
1. Wind River SNMP scans the snmpCommunityTable for the first entry in
which:
a. snmpCommunitySecurityName is equal to the sec_name used for this
target.
b. snmpCommunityContextEngineID is equal to the context engine id.
c. snmpCommunityContextName is equal to the context_name.
d. snmpCommunityTransportTag is an empty string, or the TDomain and
TAddress matches an entry in the snmpTargetAddrTable selected by
snmpCommunityTransportTag.
2. Wind River SNMP operates differently, depending upon whether the
Notification to be sent is an SNMPv1 or SNMPv2c notification:

For SNMPv2c, no additional steps need to be taken.

For SNMPv1, Wind River SNMP always sends a notification of type Trap,
regardless of whether the value of snmpNotifyType is trap or inform.
3. Wind River SNMP determines:

The SNMPv1 enterprise parameter from the value of the snmpTrapOID.

The SNMPv1 agent-addr parameter as either the local IP address (if it can
be determined) or 0.0.0.0 (if not).

The generic-trap and specific-trap parameters from the value of
snmpTrapOID.

The SNMPv1 time-stamp parameter from the sysUpTime parameter.

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));

You invoke the timeout_rtn callback through the retrans_timer_exp( ) routine.


You invoke the ack_rtn callback through the SNMP_Check_Retrans_List( )
routine.
You use these new callbacks by passing the cookie to the SNMP engine
through the cookie parameter in the SNMP_Send_Notify_Name_Ack( )
routine, as defined in snmpntfy.c.

Proxy Forwarding

The Wind River SNMP coexistence code has to handle two cases:
■ Receiving SNMPv1 or SNMPv2c PDUs
■ Sending out SNMPv1 and SNMPv2c PDUs.

Translation of Incoming PDUs

Depending on the SNMP versions supported by the targets intended to receive


forwarded PDUs, the Wind River SNMP proxy forwarder must perform certain
translations prior to the forwarding of the packets.
Wind River SNMP performs a lookup in the snmpCommunityTable in order to
determine the appropriate SNMPv3 information to use, obtaining all required
information from this table except for the securityEngineID and the msg_id.
Wind River SNMP obtains the values for the securityEngineID and the msg_id
using the same operations as for standard SNMPv3 proxy operations—there is
nothing new that coexistence adds in this regard.

59
Wind River SNMP
Programmer's Guide, 10.5

GetBulkRequest-PDUs

If Wind River SNMP receives a GetBulkRequest-PDU which must be forwarded


using SNMPv1, Wind River SNMP translates the PDU into a GetNext-PDU with
max-reps and non-reps of 0.

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

If Wind River SNMP receives an SNMPv2-Trap-PDU which needs to be forwarded


using SNMPv1, Wind River SNMP translates the PDU into a Trap-PDU. This
operation fails if the varbind list includes a Counter64 object.

InformRequest-PDUs

If Wind River SNMP receives an InformRequest-PDU which needs to be


forwarded using SNMPv1, Wind River SNMP drops the PDU, since RFC 2576
specifies that Informs can not be forwarded using SNMPv1.

Translation of Incoming Responses

Depending on the SNMP versions supported by the originators of forwarded


PDUs, certain translations must be performed by the proxy forwarder when
responses are received.
When Wind River SNMP must translate a PDU from SNMPv3 to SNMPv2c or
SNMPv1, the coexistence code uses the original PDU to determine the outgoing
community string and any other required data.

6.2 Database Initialization


Your major task to enable SNMPv3 on your system is to initialize the database that
SNMPv3 requires. You will probably store the information in some sort of
non-volatile storage and then read and install it when your system boots. How and
where you store the information is up to you and depends on what resources your
system provides. The file nvutils.c contains an example of how to store database
initialization information in a file. In VxWorks, this file is located in the directory:
installDir/vxworks-6.x/target/src/wrn/wm/demo/lib

If NVRAM is not available, nvhard.c is useful for testing, because it allows


database information to be part of the executable. However, nvhard.c violates the
RFC because it does not update timers— specifically, the engine ID boot counter
must be stored in non-volatile memory.
The path to nvhard.c is

60
6 SNMPv3
6.2 Database Initialization

installDir/vxworks-6.x/target/src/wrn/wm/snmp/vxagent/base

6.2.1 Local Engine Information

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( )

6.2.2 Foreign Engine Information

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

6.2.3 Context Table

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( )

6.2.4 Access and Group Tables

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( )

6.2.5 User Table

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( )

6.2.6 Target Address Table

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

6.2.7 Target Params Table

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( )

6.2.8 Notify Table

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( )

6.2.9 Notify Filter Profile Table

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( )

6.2.10 Notify Filter Table

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

6.2.11 Proxy Table

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( )

6.2.12 Community Table

The Community table is required for SNMP version coexistence operations. It


contains objects for mapping between community strings and version-
independent SNMP message parameters, and provides a mechanism for
performing source address validation on incoming requests, and for selecting
community strings based on target addresses for outgoing notifications. This table
can be populated from non-volatile memory, or you can add entries dynamically:
SNMP_Community_Create( )
SNMP_Community_Set_Name( )
SNMP_Community_Set_Sec_Name( )
SNMP_Community_Set_Status( )
SNMP_Community_Install( )

6.2.13 Method Routine Macros

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

undo routine. For a complete description of these macros including functional


prototypes, see C. Wind River SNMP Macro Entries.

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( )

6.2.14 Authentication and Privacy

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( )

Advanced Encryption Standard (AES)

The Advanced Encryption Standard (AES), as defined in RFC3826, provides an


alternative to the privacy protocol defined in RFC 3411.
Wind River SNMP processes AES privacy data through the User-based Security
Model, as follows:

Processing an Outgoing Message

The procedure followed by an SNMP engine whenever it must encrypt part of an


outgoing message using the usmAesCfb128PrivProtocol.
1. The SNMP security subsystem uses the secret encryptKey to construct the AES
encryption key.
2. The SNMP security subsystem sets the privParameters field to the
serialization according to the rules in RFC 3417 of an OCTET STRING
representing the 64-bit integer that will be used in the IV.
3. The SNMP message processing system encrypts the scopedPDU and serializes
the encrypted data according to the rules in RFC 3417 as an OCTET STRING.
4. The SNMP engine returns the serialized OCTET STRING representing the
encrypted scopedPDU together with the privParameters and
statusInformation indicating success to the calling module.

Processing an Incoming Message

The procedure followed by an SNMP engine whenever it must decrypt part of an


incoming message using the usmAesCfb128PrivProtocol.
1. If the privParameters field is not an 8-octet OCTET STRING, then The SNMP
security subsystem returns an error (decryptionError) to the calling module.
2. The SNMP security subsystem extracts the 64-bit integer from the
privParameters field.
3. The SNMP security subsystem uses the secret decryptKey and the 64-bit
integer to construct the AES decryption key and the IV that is computed.
4. The SNMP message processing subsystem decrypts the encrypted PDU.
5. If the encrypted PDU cannot be decrypted, then an error indication
(decryptionError) is returned to the calling module.
6. The SNMP engine returns the decrypted scopedPDU and statusInformation
indicating success to the calling module.

67
Wind River SNMP
Programmer's Guide, 10.5

Calling AES Routines

Use the SNMP_Priv_Add_AESCFB128( ) routine to add the CFB128-AES-128


privacy related routines.
Use the v3_priv_aescfb128_decode( ) routine to decrypt a scopedPDU. In CFB
decryption, the IV is the first input block, the first ciphertext is used for the second
input block, the second ciphertext is used for the third input block, etc. The
forward cipher function is applied to each input block to produce the output
blocks. The output blocks are exclusive-ORed with the corresponding ciphertext
blocks to recover the plaintext blocks. The last ciphertext block (whose size r is less
than or equal to 128) is exclusive-ORed with the segment of the r most significant
bits of the last output block to recover the last plaintext block of r bits.
Use the v3_priv_aescfb128_encode( ) routine to employ the CFB128-AES-128
Symmetric Encryption Protocol to encrypt a scopedPDU. A scopedPDU is a block
of data containing a contextEngineID, a contextName, and a PDU. The data to be
encrypted is treated as a sequence of octets. The data is encrypted in Cipher
Feedback mode with the parameter s set to 128 according to the definition of CFB
mode. The plaintext is divided into 128-bit blocks. The last block may have fewer
than 128 bits, and no padding is required. The first input block is the IV, and the
forward cipher operation is applied to the IV to produce the first output block. The
first ciphertext block is produced by exclusive-ORing the first plaintext block with
the first output block. The ciphertext block is also used as the input block for the
subsequent forward cipher operation. The process is repeated with the successive
input blocks until a ciphertext segment is produced from every plaintext segment.
The last ciphertext block is produced by exclusive-ORing the last plaintext
segment of r bits (r is less than or equal to 128) with the segment of the r most
significant bits of the last output block.

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

An AgentX master agent is an SNMP agent that handles registration requests


from one or more subagents and adds any registered MIB sub trees to its own
MIB tree according to the rules presented in the AgentX protocol. Thereafter,
when an SNMP request, which refers to an OID in the registered sub tree,
arrives from a manager the AgentX master agent can interact with the
subagent to fulfill the request. The master agent multiplexes the SNMP request
to as many subagents as needed.

AgentX Subagents

An AgentX subagent is a separate agent that extends the SNMP agent by


adding MIB variables through a process known as registration. The subagent
is a stripped-down master agent in the sense that it does not have an SNMP
interface and may support a small set of MIB variables, although that is not
necessarily the case. After registration is complete, the subagent acts as a
server for its registered MIB sub tree by responding to get and set requests for
those variables through the AgentX protocol.

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.

7.2 Wind River SNMP and User-Supplied AgentX Routines


The Wind River SNMP AgentX API allows you to build a master agent and
subagents. It provides routines to create, encode, and decode AgentX PDUs, in
addition to routines that handle sessions, registrations, and requests. In most cases,
the API calls described in this document are sufficient to build and administer your
agents. However, the customer must write the following functions, which are used
by both master agents and subagents:
ENVOY_NOW( )
bits32_t ENVOY_NOW (void)

Returns the relative time in milliseconds.


ENVOY_CALL_TIMER( )
void ENVOY_CALL_TIMER (bites32_t when, void (*what)(void))

Waits a specified number of milliseconds before it calls the function pointer


provided.

NOTE: While AgentX requires that the ENVOY_NOW( ) and


ENVOY_CALL_TIME( ) routines be defined, they may also be required by other
Wind River SNMP code modules.

ENVOY_AX_ADMINT_T( )
void ENVOY_AX_ADMIN_T (ptr_t cookie, ptr_t ax_pkt)

Called when the master agent receives a Notify.


ENVOY_AX_SEND_T( )
void ENVOY_AX_SEND_T (
ptr_t cookie,
ptr_t ax_pkt,
ptr_t vblist,
ALENGTH_T read
)

Called to send a response to a subagent.


ENVOY_AX_ERROR_T( )
void ENVOY_AX_ERROR_T (ptr_t cookie, int error_stat)

Called to handle errors and free any resources associated with the cookie.
ENVOY_AX_ADD_T( )
void ENVOY_AX_ADD_T (ptr_t cookie)

Called when an AgentX packet arrives.


The first two functions allow the master agent to keep track of time in order to
determine when a time-out has occurred. The remaining four functions are known
as completion routines. They provide a way for the AgentX handler routines to

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.

7.3 Constructing a Master Agent


This section describes how to create an AgentX master agent using the Wind River
SNMP API. It describes one way, but by no means the only way, to construct a
master agent. To simplify the discussion, this procedure describes only the basic
functions and omits the error handling that would be required for robust
embedded software. The Wind River SNMP API includes other functions
providing complete AgentX functionality described in the Wind River Workbench
online help.
Figure 7-1 shows a sample master agent architecture, which represents the
architecture of the sample code included with Wind River SNMP. The flow of
operations depicted in Figure 7-1 is in addition to the master agent's role as an
SNMP agent; all details regarding SNMP agent operation have been omitted,
including calling the envoy_init( ) routine.
1. Establish a communication channel. Since the sample agent uses sockets, the
representative calls required when using a sockets-type communication
between a master agent and subagents are shown in Figure 7-1. The sample
agent uses connection-based (stream) sockets. The master agent needs to
establish a server-type communication interface. If you use sockets, you must
call the listen( ) routine to establish a communication channel.
2. The master agent waits for a subagent to request a connection.
3. When a subagent request arrives the master agent establishes a connection. If
you use sockets, you call the accept( ) routine to establish this connection. The
function envoy_ax_chunk_init( ) is called to create a memory area to buffer
received data into AgentX packets. If the communication is packet-based, this
step can be omitted. The chunk handling layer is necessary because sockets
provide a streams-oriented communication in which a packet may need to be
assembled from several pieces.
4. The master agent then waits for data to be received on the connection. If you
use sockets, call the select( ) routine.
5. As data is received, it is processed by calling envoy_ax_chunk_handler( ). If
you use a packet-based communication channel, call the
envoy_ax_ma_handler( ) routine directly instead. The arguments to
envoy_ax_chunk_handler( ) include your four completion routines, a pointer
to the received data, the number of bytes received, and a pointer to the chunk
(the data area initialized by envoy_ax_chunk_init( )). The third argument is a
pointer to the function which should be called when enough data has been

71
Wind River SNMP
Programmer's Guide, 10.5

received to constitute an ax packet. For a master agent, this should always be


envoy_ax_ma_handler( ). If an error occurs while receiving data or calling
envoy_ax_chunk_handler( ), close the connection (for sockets, close( )) and
call the envoy_ax_ma_cleanup_sessions( ) and envoy_ax_chunk_clean( )
routines to clean up the connection and release resources.

Figure 7-1 AgentX Master Agent Processing

Create communication channel: socket( ), bind( ), listen( )

Wait for communication request: select( )

If this is the first request:


Open the channel: accept( )
Call envoy_ax_chunk_init( )

Read data: recv( )

If there is no READ error,


call envoy_ax_chunk_handler( )
with the following arguments:
ENVOY_AX_ADMIN_T( )
ENVOY_AX_SEND_T( )
ENVOY_AX_ERROR_T( )
ENVOY_AX_ADD_T( )

If there is a READ error,


close the channel:
close( )
envoy_ax_ma_cleanup_sessions( )
envoy_ax_chunk_clean( )

No more data

6. After envoy_ax_chunk_handler( ) returns, the task returns to waiting for data.


The task continues to function as an AgentX master agent as long as data is
read and passed to envoy_ax_chunk_handler( ). (For sockets, select( )
facilitates the servicing of multiple subagents.) You need to keep track of every
new connection made in the lower loop, checking each connection for
available data, and passing it to envoy_ax_chunk_handler( ). For a source
code example, see the function snmpAgentXMonitor( ) in ax_mast.c.

72
7 Using Wind River SNMP AgentX
7.4 Constructing a Subagent

7.4 Constructing a Subagent


This section describes how to create an AgentX subagent using the Wind River
SNMP API. To simplify the discussion, this procedure describes only the basic
functions and omits the error handling that would be required for robust
embedded software. The Wind River SNMP API includes other functions
providing complete AgentX functionality described in the Wind River Workbench
online help.
Before you begin to write your subagent, you need to create the following data
structures that are referenced by the master agent. You can declare them as local,
global, file global, or any combination that is convenient providing that they are in
scope at the time they are referenced. The variable names given in these
declarations are arbitrary; you can use any legal variable name.
ENVOY_AX_CHUNK_T chunk
This variable is used to keep track of streams-oriented data while it is
aggregated into packets.
ENVOY_AX_SASB_T sasb
This variable is used to keep track of the present state of the subagent.
EBUFFER_T ebuff
This variable is used by the packet creation routines to point to an AgentX
packet.
OBJ_ID_T obj
This variable is used to store the OID of the sub tree that the subagent would
like to register with the master agent.
Subagents call the ADMIN completion routine described in 7.2 Wind River SNMP
and User-Supplied AgentX Routines, p.70 when a response is received from the
master agent. When a subagent receives a close or a response packet, you can use
this to verify that an operation initiated by the subagent has completed
successfully.
Subagents require a MIB in the mib.c format produced by the Wind River
CLI, Web, MIBway MIB Compiler. The MIB must contain the sub tree the subagent
would like to register with the master agent. The subagent also must provide the
method routines necessary to resolve all references in the MIB. For more
information on the Wind River SNMP MIB compiler and the mib.c output mode,
see the Wind River MIB Compiler User’s Guide. For more information on method
routines, see 10. Method Routines.
Figure 7-2 shows a sample subagent architecture, which represents the architecture
of the Wind River SNMP sample code. The flow of operations depicted in this
figure is in addition to whatever else your subagent does.
1. Establish a communication channel with the master agent. The subagent uses
a client-type communication interface. If you use sockets, you call the
connect( ) routine. If the master agent accepts, the connection is established.
2. To initialize Wind River SNMP, you must call the envoy_init( ) routine before
you call any other Wind River SNMP functions. Afterward, call the
envoy_ax_sa_state_init( ) and envoy_ax_chunk_init( ) routines to prepare the
subagent. The function envoy_ax_sa_state_init( ) initializes the
ENVOY_AX_SASB_T data structure that Wind River SNMP uses internally to
keep track of the subagent's state. The envoy_ax_chunk_init( ) routine

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( ).

Figure 7-2 AgentX Subagent Processing

Create communication channel: socket( ), connect( )

Initialize the subagent by calling:


envoy_init( )
envoy_ax_sa_state_init( )
envoy_ax_chunk_init( )

OPEN procedure

REGISTER procedure

Wait for data: select( )

Read data: recv( )

If there is no READ error,


call envoy_ax_chunk_handler( ) If there is a READ error,
with the following arguments: close the channel:
ENVOY_AX_ADMIN_T( ) close( )
ENVOY_AX_SEND_T( ) envoy_ax_chunk_clean( )
ENVOY_AX_ERROR_T( )
ENVOY_AX_ADD_T( )

No more data Exit

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

Figure 7-3 Common Subagent Procedures

Create packet:
OPEN: Call envoy_ax_pkt_create_open( )
REGISTER: Call envoy_ax_pkt_create_registrations( )
CLOSE: Call envoy_ax_pkt_create_close( )

Send packet to master agent: send( )

Wait for response: select( )

Read data: recv( )

If there is no READ error,


call envoy_ax_chunk_handler( )
with the following arguments: If there is a READ error,
envoy_ax_sa_handler( ) close the channel:
ENVOY_AX_ADMIN_T( ) close( )
ENVOY_AX_SEND_T( ) envoy_ax_chunk_clean( )
ENVOY_AX_ERROR_T( )
ENVOY_AX_ADD_T( )

No more data Return error

Return OK

76
8
Server

8.1 User or System Level? 77


8.2 Outer Structure 78
8.3 Completion Requirements 78
8.4 MIB Variables 78
8.5 Strategies for Building MIBs 83
8.6 Method Routine Processing 86
8.7 SNMPv1 and SNMPv2 Traps 93
8.8 SNMPv3 Notifications 95
8.9 View Requirements 96
8.10 SNMPv1 and SNMPv2c Proxy Requirements 97
8.11 AgentX Requirements 98

8.1 User or System Level?


An SNMP agent can be embedded into a system, or can exist as a normal
application, perhaps with some special privilege with respect to the network
facility. For efficiency and timing reasons, it is preferable to place SNMP code in
close proximity to the network software. Ideally, the SNMP code could reach the
network variables through direct memory references (as opposed to access via a
memory device driver or I/O control system calls.) Further, because there are
critical sections in the code, it is desirable that the network and SNMP code be able
to interlock access to the management variables.

77
Wind River SNMP
Programmer's Guide, 10.5

8.2 Outer Structure


Conceptually, the outer structure of an SNMP agent is an infinite loop. Each
iteration of the loop is triggered by the receipt of an SNMP request packet:
initialize system;
/* completion routines called by Envoy: */
/* iocomp transmits the packet encoded by calling SNMP_Process_Finish */
/* errcmp indicates when there is no packet to be transmitted */
extern void iocomp();
extern void errcomp();
do forever {
wait for incoming SNMP request packet;
Process_Rcvd_SNMP_Packet_Async(msglen, msgbuf, addr, addr,
mtu, iocomp, errcomp, cookie);
}

8.3 Completion Requirements


You must write two completion routines, which Wind River SNMP uses to indicate
that it has completed processing of a packet. One of the routines is used if there is
a response packet to be sent. The other is used if no response is required and will
indicate if this is due to an internal error condition. These routines allow the packet
processing routine to return before Wind River SNMP has finished with the
packet. The completion routines are attached to the packet structure and called
when the last method routine indicates it has performed its task.
The completion routines are passed the source and destination address
information from the packet structure. It is the responsibility of the validation
routines, SNMP_validate_community( ), SNMP_validate_address( ), or
SNMP_community_coexistence_lookup( ), which you must write, to copy this
information into the packet structure.

8.4 MIB Variables


MIB variables reside in the code being monitored with SNMP. Optionally,
Wind River SNMP contains those counters and variables necessary to implement
the SNMP group from MIB-II and the SNMPv2 MIB, as well as code to implement
a view scheme based on RFC 3415 and the context, access, group, user, target,
notification, proxy, and community tables from SNMPv3. In an SNMP agent, you
must provide both the remaining variables for MIB-II (or any other MIB) and the
software to update those variables according to network activity.
On some systems, some variables already exist in the main TCP/IP code. One must
be careful, however, that any pre-existing variables are in accord with the
requirements of RFC 1155 and RFC 1213. For example, RFC 1155 requires that most
variables have 32 bits of precision. Some variables are signed, others are not. Some
types of variables roll over to zero once the maximum value is reached.

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.

8.4.1 MIB Tree

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

The NODE( ), ARC( ), and END_OF_ARC_LIST( ) macros define each node. A


LEAF_NT_ASY( ) or LEAF_NT_ASYS( ) macro defines each leaf. The ASY macros
are used when the method routines use the asynchronous API directly.
The name of the root of the default MIB tree is mib_root_node. Use the macro
ENVOY_DEFAULT_MIB_ROOT_NODE( ) to make changes. These macros are

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.

8.4.2 Interaction with the MIB Compiler

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.

8.4.3 Hooking Up the MIB

The management information exists outside of the SNMP software itself. It is


necessary to provide the mechanisms by which Wind River SNMP can reach the
actual information.
The standard SNMP code contains a MIB tree with an internal structure and
prototype leaf nodes corresponding to the full RFC 1213 set of variables. The task
of hooking up the MIB involves extending the MIB tree where necessary to
accommodate private or special variables, pruning the tree to eliminate
unnecessary parts, and filling in the leaves.

Extending the MIB Tree

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

NOTE: Although the obsolete macros LEAF_ASYS, LEAF_ASY, LEAF_COMS,


LEAF_COM, LEAF, and LEAFM are available for backward-compatibility, do not
use them for new applications.

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

Hooking Up the MIB Tree to System Variables

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)

The parameters to the macro are:


LN
The variable’s name. For example, icmpOutAddrMasks_leaf.
CN
The compatibility block’s name. For example, icmpOutAddrMasks_leaf_crs.
NT
Any extra flags that should be set in the type field of the node.
NM
The ASN.1 name of the node or variable. For example, the ICMP node is
named icmp, and the name of the counter of ICMP address mask requests sent
is icmpOutAddrMasks.
VT
Indicates one of the manifest constants defined in h/snmpdefs.h:
VT_NUMBER
VT_STRING
VT_BITS, VT_OBJECT
VT_EMPTY
VT_IPADDRESS
VT_COUNTER

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.

MIB Leaf Example

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.

8.5 Strategies for Building MIBs


There are two ways to add a MIB to the Wind River SNMP agent image.
The first method involves changing the makefiles that generate the main MIB tree
(named by default v12mib.c) to build the additional MIB tree into a monolithic
MIB tree structure and all linked together.
This method has been the recommended way of building MIB tree structures for
most of the product lifetime of Envoy through this version of Wind River SNMP.
It is not easy to do correctly. It requires that you change makefiles and ensure that
you don't interfere with anything that anyone else may have already done to add
their MIB to the mix.
With WindManage SNMP 9.3, we started recommending the second method:
creating MIB tree fragments and dynamically adding them to the smaller main
MIB tree.
Due to reasons of complexity in integration, we are now recommending that you
dynamically add MIB tree fragments to the main MIB tree.

8.5.1 Dynamically Adding MIB Tree Fragments

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

In this command, the file v3mib.ctl is the control file.

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
)

The Add_Node_From_Root( ) routine has the following parameters:


root
The name of the root node of the main MIB tree (mib_root_node by default)
objp
The OID of the top node of the MIB tree fragment.
anode
The name of the top node of the MIB tree fragment, which is the name we gave
it in our call to mibcomp, and is found at the bottom of our generated MIB tree
fragment file.
rnode
A MIBNODE_T * that is filled in if the adding of this tree to the main MIB tree
results in the displacement of an existing removable MIB node.

NOTE: If your call to the Add_Node_From_Root( ) routine displaces an existing


nonremovable MIB node, the Add_Node_From_Root( ) call fails.

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

** 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
};

**/

extern OBJ_ID_T objid_v3snmp_engine_node;


extern MIBNODE_T v3snmp_engine_node;

void v3_add_v3_mibs (void){


MIBNODE_T *rnode;
int status;

/* RFC2571.MIB */
status = Add_Node_From_Root(&mib_root_node,
&objid_v3snmp_engine_node,
&v3snmp_engine_node,
&rnode);
}

-----------------end code fragment-----------------

8.5.2 Timing Issues in Adding MIB Tree Fragments

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);

Once your call to the Add_Node_From_Root( ) routine has completed, release


the lock by using the following macro:
ENVOY_SNMP_RELEASE_WRITE_LOCK(SNMP_CoarseLock);

NOTE: Since this is a locking procedure, your code should do as little as


possible while the lock is held. We recommend that you only make call(s) to
Add_Node_From_Root( ) while you hold this lock.

85
Wind River SNMP
Programmer's Guide, 10.5

8.5.3 Adding Multiple MIB Tree Fragments

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.

8.6 Method Routine Processing


Wind River SNMP accesses each object via the set of method routines specified in
that object’s MIB leaf. As mentioned previously, some objects, mostly scalars, can
make use of some standard routines that are supplied with Wind River SNMP. For
descriptions of those objects, see 10. Method Routines. For other objects, it is
necessary to write special access functions. Example functions for the tables
defined in MIB-II are provided in the sample Sun agent. If you have Attaché Plus,
the table functions provided with it are a second example of how those functions
can be written in a single address space environment.
In order to write the access functions, it is important that you have a complete
understanding of how SNMP identifies specific table entries and of the SNMP
notion of lexicographic ordering.
In SNMP, each variable in a table is identified by an object identifier with two parts,
each of which is itself an object identifier. The high order part is the object identifier
assigned by RFC 1213. The low order part is the object instance. The form of the
object instance depends on the particular table. For the interface table (ifTable), the
instance object identifier contains a single component, the value of which is the
number of the interface. For the TCP connection table (tcpConnTable), the instance
object identifier contains ten components. Four of the components give the local IP
address for the TCP connection, one for the local port, four for the remote IP
address, and one for the remote port.
The testproc, getproc, and setproc for tabular variables must search the table for
an entry that matches the specified object instance. The instance is presented to the
access procedure with the tcount and tlist parameters.

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.

8.6.1 Cookie Field

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.

8.6.2 Overall Validity Check and VarBind Aggregation

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

8.6.3 VarBind Private Field

During processing, it can be useful to save a pointer to some information on a


per-variable basis. For example, it can be useful to reserve resources during a
testproc for use during a setproc.
The vb_priv and vb_free_priv fields are available to the application for linking
reserved resources to a VB_T and releasing those resources when Wind River
SNMP is finished processing the packet. The vb_priv field is a PTR_T and an
application can fill this field during the first user-exit or during the calls to the
testprocs. The vb_free_priv field is a pointer to a routine that is called when the
packet is cleaned at the end of processing and provides a way to clean up resources
if a set fails. This routine takes a single argument of type *VB_T. For example,
during the testproc routine, the application could reserve a block of memory that
it will need for the set to complete. The testproc routine would then put a pointer
to that memory block into the vb_priv field of the VB_T being tested. It would also
put a pointer to a routine to free the memory into the vb_free_priv field. If the set
completes normally, the setproc would remove both pointers from the VB_T. If the
set fails for some reason (perhaps another variable is inconsistent or has an
incorrect value), the pointers are not reset. At the end of processing the packet,
routines are called to release the packet resources. One of these routines checks the
vb_free_priv field and, if the field is not 0, calls vb_free_priv with a pointer to the
VB_T as the argument. The free routine can now free up the memory block and any
other resources it knows about.

8.6.4 GET PDU Processing

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

8.6.5 GET NEXT and GET BULK PDU 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.

8.6.6 SET PDU Processing

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

As described in the section on SET PDU processing, if a setproc indicates an error,


it is necessary to undo any sets that have already been started. The undoproc field
in a VB_T is available to the application to hold a pointer to a routine to undo the
effects of a setproc. You can place a value there during the testproc or setproc.
Wind River SNMP runs the routine as soon as possible after an error is noticed,
even if the set task has not completed. If this presents a problem, you should install
the routine at the end of the set task. You may find the vb_priv field to be a
convenient place to store old information that the undo routine might need to
restore the previous state. If you use vb_priv, you should also update vb_free_priv
to free the information correctly.

8.6.7 Row Creation

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

trying to set ifAdminStatus.3 to up on an agent that has only two network


interfaces.
However, in other cases the agent can choose to create the necessary data
structures on the fly such that this instance of the variable does exist. This is row
creation. It makes no sense in the case of variables in the interfaces table from
MIB-II; the agent that can create new interfaces at run-time is rather rare. But
creating new entries in the ipNetToMediaTable or the ipRoutingTable can be
quite useful.
There are various methods of implementing this row creation capability. The
variations come about from different solutions to the problem of what the agent
should do when it’s not given enough information to create the data structures.
One possibility is to stash the set information away and wait for more sets to come
in that have the rest. This is easily done with the testprocs and setprocs as they are.
Your testproc routine should run testproc_good( ) for a set to any instance it is
willing to create, and the setproc routines will save the data until enough is present
to actually complete the creation.
Another possibility is that the agent requires the set PDU to contain enough
information for the agent to complete the row creation. To do this requires a
testproc routine to scan the packet to make sure all the required information is
present. The utility routines group_by_getproc_and_instance( ),
vb_extract_row( ), and vb_extract_row_loose( ) are supplied to make this easier.
They scan the packet looking for variables listed in a parameter that have the same
instance. They should be asked to search for all variables in a table, even though
not all are necessary to do a row creation.
The RowStatus textual convention is used to manage the creation and deletion of
conceptual rows, and is used as the value of the SYNTAX clause for the status
column of a conceptual row.
The status column has six possible values:
active
Indicates that the conceptual row is available for use by the managed device.
notInService
Indicates that the conceptual row exists in the agent, but is unavailable for use
by the managed device.
notReady
Indicates that the conceptual row exists in the agent, but is missing
information necessary in order to be available for use by the managed device.
createAndGo
Supplied by a management station wishing to create a new instance of a
conceptual row and to have its status automatically set to active, making it
available for use by the managed device.
createAndWait
Supplied by a management station wishing to create a new instance of a
conceptual row, but not make it available for use by the managed device
destroy
Supplied by a management station wishing to delete all of the instances
associated with an existing conceptual row.
Whereas Wind River SNMP can specify all of the values except notReady in a
management protocol set operation, Wind River SNMP returns only the values

91
Wind River SNMP
Programmer's Guide, 10.5

notReady, notInService or active in response to a management protocol retrieval


operation.
The following routines are useful in row creation:
vb_extract_row( )
This routine allows you to mark some variables as required and returns an
error if any of the required variables are not found. It then links together all the
VarBinds found and marks them as already tested and (except for the first one)
set. This testproc should then value check all the VarBinds found because
Wind River SNMP does not call the testproc again on them. If all the testprocs
succeed, then eventually Wind River SNMP calls the setproc for the first
VarBind in the linked list for row creation. It is this setproc’s job to create
whatever data structures are needed and to scan the linked list of VarBinds to
find the values to set into these data structures.
vb_extract_row_loose( )
This routine does not have the notion of required variables. It attempts to find
the variables in the list. If it cannot find any of them, it returns 0 as an error
indication. This routine does not set any of the flags in the VarBinds; that
operation is left to the calling routine.
group_by_getproc_and_instance( )
This routine looks for variables that have the same getproc routine and
instance as the variable that called it. This routine also does not set any of the
flags in the VarBinds; that operation is left to the calling routine.
A. Row Creation Code contains a simple example of an RFC 3415 view table using
group_by_getproc_and_instance( ). It uses viewtable_*_cleanup( ) and
viewtable_*_undo( ) to free resources that are used during the set process. The
viewtable_set_cleanup( ) routine is used if the set completes to free resources that
were saved for the undo routine. The other cleanup routines are used if the setproc
is not run after the testproc succeeds. The undo routines are used to undo the set
after the setproc has succeeded but some other setproc has failed. The cleanup
routines are attached to and removed from the vb_free_priv field. The undo
routine is attached to the undoproc field.
The next routine is viewtable_test( ). The agent using this code specifies this
routine as the testproc for all variables in the view table. There are two cases this
routine must handle: a set for an existing entry (check the values and return
depending on them), and a set for a non-existent entry (see if there is enough
information to create the entry and check the values being set).
The viewtable_test( ) routine starts by trying to find the specified entry and then
fills in a working entry. If it finds the entry, it copies the information from it;
otherwise it uses the set of defaults specified in the MIB for view tables. It uses
group_by_getproc_and_instance( ) to find any other VarBinds that should be
included in the set.
After the test routine has acquired a list of all leaves for this entry, it walks through
the list testing the values. If any values are out of range or inconsistent, it uses
testproc_error( ) to note that fact. Otherwise, the values are integrated into the
working copy.
If all of the values are acceptable, the routine marks all but one of the variables as
being tested, set, and undone. Doing this means that only the routines associated
with the one unmarked variable will be run.

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.

8.7 SNMPv1 and SNMPv2 Traps


An SNMP agent must gain control whenever a situation occurs that requires the
generation of an SNMP TRAP. A list of required traps is found in RFC 1213; other
standard MIBs can define their own traps; and you can define enterprise-specific
traps in your own MIBs.
The trap generation procedures are closed subroutines, with calls to the dynamic
memory manager and time-since-last-reboot function. As traps might occur at
times when it is not possible to send packets, it can be necessary to schedule
transmission of the packet buffer for a more convenient time. For example, one
SNMP trap is used to report the startup or shutdown of a network interface. The
trap generation logic can receive control in a hardware interrupt context in which
the transmission of packets is not possible.
When generating an SNMPv1 trap, the enterprise field defines the management
enterprise under whose registration authority this trap is defined (from RFC 1215).
The RFC specifies that for generic traps the value of sysObjectID is used,
otherwise the enterprise ID defining the trap should be used.
Typical code to generate a cold start trap packet in SNMPv1 would look as follows:
#include <snmp.h>
#include <buildpkt.h>
extern unsigned long tstmp(void);
char community[] = "public";
unsigned char ipaddr[] = {128, 224, 10, 5};
OIDC_T enterprz[] = {1, 3, 6, 1, 4, 1, 12, 10, 1, 2, 3, 4};
SNMP_PKT_T *rp;
EBUFFER_T ebuff;
rp = SNMP_Create_Trap(VERSION_RFC1067,
sizeof(community) - 1, community,
sizeof(enterprz)/sizeof(OIDC_T), enterprz,
ipaddr, /* My IP address */

93
Wind River SNMP
Programmer's Guide, 10.5

COLD_START, /* Generic trap type */


(INT_32_T)0, /* Specific trap type */
(UINT_32_T)tstmp(), /* Time since boot in */
/* 1/100 second ticks */
0); /* # of varBinds */
EBufferInitialize(&ebuff);
if (SNMP_Encode_Packet(rp, &ebuff) != -1)
{
/* Add user code here to send the packet found in the extended buffer */
EBufferClean(&ebuff); /* Release the buffer memory */
}
SNMP_Free(rp); /* Release dynamic memory associated with the SNMP packet */

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 (SNMP_Encode_Packet(rp, &ebuff) != -1)


{
/* Add user code here to send the packet found in the extended buffer */
EBufferClean(&ebuff); /* Release the buffer memory */
}
SNMP_Free(rp); /* Release dynamic memory associated with the SNMP packet */

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.

8.7.1 Where to Send Traps

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

8.7.2 Disabling Authentication Traps

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.

8.8 SNMPv3 Notifications


The SNMPv3 specification expands on the concept of SNMP traps (see
8.7 SNMPv1 and SNMPv2 Traps, p.93). Specifically, it provides a target MIB and a
notification MIB. These MIBS are used for determining where traps and informs
should be sent. In the case of informs, it also includes information on how many
times an inform should be retransmitted and the time-out interval.
The procedure for creating and sending an SNMPv3 notify using the target and
notification MIBs is substantially different from the procedure used for SNMPv1
and SNMPv2 notifies.
In an SNMPv3 packet, data is contained in the VarBind list. You are required to
build a VarBind list (separate from a packet structure) using the
VBList_Allocate( ) routine. To bind the information onto the VBL_T structure, call
one of the VBL_Bind_*( ) routines. To send the notification, call the
SNMP_Send_Notify_Name( ) routine.
If you attempt to generate an SNMPv3 notification while processing an SNMP
PDU, your code may cause a deadlock, by grabbing the coarse lock while it's
already held. To properly send an SNMPv3 notification in this case, you must call
the SNMP_Send_Notify_Name( ) routine from a separate task. You should spawn
a task that will make the appropriate calls and then delete itself. The task grabs the
lock as soon as it's available and then sends the notification.
The following example shows how to generate a cold start trap in SNMPv3. (You
must provide the notify_complete, notify_err_complete, and notify_cleanup
handlers).
#include <snmp.h>
#include <auxfuncs.h>
#include <wkobj.h>
#include <v3_eng.h>
#include <v3_ntfy.h>
#include <sendntfy.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_NOTIFY_T *notify;
VBL_T *vblp;
bits8_t context[] = ‘‘’’;
SNMPADDR_T loc_addr;
notify = SNMP_Notify_Lookup(‘‘coldstart’’, 9);
MEMSET(&loc_addr, 0, sizeof(SNMPADDR_T));
loc_addr.snmp_port = 162;
/* allocate the varbind list */
if ((vblp = VBList_Allocate(2)) == 0)
return 1;
/* install the varbinds into the packet */
VBL_Bind_Timeticks(vblp, 0, sizeof(sysupoidc)/sizeof(OIDC_T),

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);

8.9 View Requirements


SNMPv3 requires a view scheme based on RFC 3415.

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.

8.9.1 View Tables

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.

RFC 3415 View Macros

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( )

8.10 SNMPv1 and SNMPv2c Proxy Requirements


This section describes the routines needed to write if you include the SNMPv1 and
SNMPv2 proxy code in an SNMP agent. You can ignore them if you are not using
the proxy functionality.
Proxy processing has been broken into several distinct steps. In Wind River SNMP
the sequence is: save some state, translate the packet, encode the packet and send
the output buffer. Wind River SNMP includes code to handle saving the state of a
packet until a time-out occurs or a response packet arrives. It also includes
translation routines for use with SNMPv1 and SNMPv2.
You must supply transport routines for each transport layer in which you wish to
use proxy operations. You can use the SNMPv1 and SNMPv2 translation routines
provided by Wind River SNMP or write your own if necessary.
To use the proxy mechanism you should have the routine used to validate the
community string (SNMP_validate_community( )) determine which translation
and transport routines to use by consulting the community string. The validation

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.

8.11 AgentX Requirements


The AgentX add-on is a standardized version of subagent protocols. These
protocols, also known as per VarBind multiplexing, allow a subagent to register
items with a master agent. The master agent then distributes VarBinds from one
SNMP message between different subagents according to the registration and the
protocol, and reassembles the replies into a single response.
If you have purchased the AgentX add-on, you must configure AgentX macros and
write the routines required for the master agent and subagent.

8.11.1 Master Agent

In a master agent, you need to integrate your calls to the envoy_ax_ma_handler( )


routine with the calls to the main processing code for Wind River SNMP. For
example, you might have a select loop that waits for either an SNMP message or a
message from a subagent and calls the proper handler when a message arrives.
You should also arrange to call the envoy_ax_ma_cleanup_sessions( ) routine 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.

8.11.2 AgentX SubAgent

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

9.1 Client Outer Structure 101


9.2 Transport Model for the SNMP Manager 102

9.1 Client Outer Structure


The outer structure of clients is quite different from that of servers and is more
varied. Clients (network management stations) are largely driven by user input, so
the type of user interface chosen sets the style of program. Even without
considering the complexity of the user interface, the code is more complicated. A
network management station has to deal with the networking issues of lost or
duplicated packets and retransmissions.
On the other hand, configuring Wind River SNMP is likely to be much simpler:
managers often run as user-level programs on larger machines, so SNMP memory
allocation is simply a matter of calling malloc( ) and free( ). The various user-exits
do not need to be written because they apply only to agents. And there are no MIB
variables, so all the MIB variable access routines are unnecessary.

9.1.1 SNMP Manager for Unix and Windows

There is code to implement a simple SNMP manager, called snmptalk, in the


snmptalk directory at:
installDir/vxworks-6.x/target/src/wrn/wm/demo
The snmptalk 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.
The snmptalk software compiles either as a UNIX program on top of Berkeley
sockets, as an MS-DOS program using Attaché Plus as the networking code, or as
a WIN32 console application. This ability results in somewhat contorted code, as
the Berkeley sockets interface is a synchronous programming interface, while
Attaché Plus is asynchronous. Someone looking to see how to use Wind River

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.

9.1.2 SNMP Manager for VxWorks

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.

9.2 Transport Model for the SNMP Manager


The SNMP manager supports UDP, TLS, DTLS and SSH transport models. The
transport models conform to RFCs 5590, 5591, 5592, and 6353.
For VIP configuration information, see Table 4-2.

102
10
Method Routines

10.1 Introduction 103


10.2 Accessing MIB Variables 104
10.3 Writing Method Routines 104
10.4 Wind River SNMP-Supplied Method Routines 106
10.5 getproc Method Routines 108
10.6 nextproc Method Routines 111
10.7 testproc Method Routines 112
10.8 setproc Method Routines 114
10.9 undoproc Method Routines 115
10.10 Asynchronous Method Routines 116

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.

10.2 Accessing MIB Variables


The mechanisms to deal with management variables are very flexible. In general,
all access is mediated by the method routines provided by the MIB developer.
Access to any management variable is controlled by the leaf node in the MIB tree
corresponding to that variable. It is important to recognize that the term variable
includes scalar data as well as columns (also known as attributes) in tables. For
example, the RFC 1213 scalar variable sysUpTime is represented by a leaf of the MIB
tree. The column of variables known as ipRouteAge in the IP routing table are also
represented by a single leaf of the MIB tree.
The access functions for scalar variables are fairly straight forward since there is
only one instance of the variable. Access functions that operate on a set of variables
in a table have to select which specific instance to use. The choice is made using
information provided to the access functions as parameters.

10.3 Writing Method Routines


Each leaf on the MIB tree is represented by an instance of the MIBLEAF_T structure.
This structure contains pointers to four user-defined procedures. The specific
procedures referenced are often different from one leaf to the next. In other words,
there may be a different set of access procedures for the variable sysUpTime than
for the variable ifNumber.
The four procedures for each leaf are:
getproc
The getproc operation is activated when processing an SNMP GET PDU to
find the specified instance of the object and to install the value of the variable
using the getproc_got_*( ) routines.
nextproc
The nextproc operation is activated when processing an SNMP GET NEXT or
GET BULK PDU. This procedure locates a variable whose instance is the SNMP
lexicographic successor for the input object identifier, which may or may not
actually exist within this object. This procedure should only examine instances
of the given object (the SNMP agent steps to the next object if necessary). It

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.

Method Routine API

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.

10.4 Wind River SNMP-Supplied Method Routines


When your SNMP agent and your MIB occupy the same address space, you can
use the following Wind River SNMP-supplied getproc, nextproc, testproc, and
setproc routines to obtain or change values. These routines use the standard
Wind River SNMP API. For VxWorks, these files are located in the following
directory:
installDir/vxworks-6.x/target/src/wrn/wm/snmp/engine

NOTE: If a variable is not directly addressable or is a tabular MIB variable, you


must write your own routines, but you can use the routines described here as
prototypes.

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

Setting a TestAndIncr object


The routine set_TestAndIncr_async( ) uses the cookie field as a pointer to the
32-bit integer to increment.
Setting an unsigned integer
The routine set_uint_async( ) uses the cookie field as a pointer to the 32-bit
unsigned integer to set.
Setting a 64-bit unsigned integer
The routine ui64_async_set( ) uses the cookie field as a pointer to a UINT_64_T
structure to set.
Setting nothing
During development it is often useful to remove the setproc. This may be done
by using the procedure null_set_async( ).

10.5 getproc Method Routines


The getproc routine is called to find the specified instance of the object and, if the
instance exists, to install the value into vbp using the getproc_got_*( ) routines.
Each getproc is responsible for performing the GET operation on the vbp it received
as input. It must call one of these routines to indicate that the vbp has been
processed.

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.

A getproc may assume responsibility for other vbps by calling getproc_started( )


for each vbp it plans to process. It must call one of the getproc_got_*( ) functions,
getproc_error( ) or getproc_nosuchins( ) for each VB_T for which it accepted
responsibility.
To defer some of the GET processing, you would return from the getproc before
calling one of the getproc_got_*( ) functions. At some future time, you would be
responsible for calling one of the getproc_got_*( ) or error functions and calling the
SNMP_Continue( ) routine to notify the Wind River SNMP engine that the packet
had been modified.

Parameters

The following routines use the following parameters:


dynamic
If set, indicate that Wind River SNMP treats the buffer space for the given
value as having been allocated dynamically with SNMP_memory_alloc( ) or
SNMP_memory_free( ) and will free it accordingly.

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
)

Used if any error occurs.


getproc_got_empty( )
void getproc_got_empty(
SNMP_PKT_T * pktp,
VB_T * vbp
)

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
)

NOTE: The getproc_got_octet_string( ) routine obsoletes the getproc_got_string( )


routine in Wind River SNMP 10.0.

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
)

Used when the instance does not exist.


getproc_started( )
void getproc_started(
SNMP_PKT_T * pktp,
VB_T * vbp
}

110
10 Method Routines
10.6 nextproc Method Routines

10.6 nextproc Method Routines


The nextproc routine is called when processing an SNMP GET NEXT or GET BULK
PDU. This procedure is used to locate a variable whose instance is the SNMP
“lexicographical” successor for the input object identifier, which may or may not
actually exist within this object. This procedure should only examine instances of
the given object (Wind River SNMP steps to the next object if necessary). It should
install the value and instance of the variable using the getproc_got_* and
nextproc_next_instance( ) routines.
To find the successor, the nextproc must search a table according to the
lexicographic ordering. Since few systems hold tables in the order SNMP expects,
the search may require the creation of an ordered view of the table each time
nextproc is called. Alternatively, an implementation could maintain an ordered
thread through the table.
The notion of lexicographic ordering requires that if the instance is NULL, the
successor is the first entry in the table. If the instance is too short to form a full
object instance for that table, logically extend the target to full size with values that
precede zero. In other words, in a situation where the object instance for the table
requires four components, logically extend a target containing a single value, say
5, to become 5.x.x.x in such a way that 5.0.0.0 would be a valid successor.
Each nextproc is responsible for performing the next operation on the vbp it
received as input. It must call one of the following routines to indicate that the vbp
has been processed.
The nextproc_next_instance( ) function is used to indicate the instance value of
vbps object ID. It will concatenate the instance specified by rlistc and rlistl onto the
object ID for vbp allocating more space if necessary.
nextproc_next_instance_string( ) is used to indicate the instance value of vbp’s
object ID when the instance is a string. The string specified by str_len and str_buf
will be expanded (one byte per one sub id) and concatenated onto the object ID for
vbp also allocating more space if necessary. If imp_flag is zero, the index is not an
implied string and the routine inserts the length as a sub-id before the string in the
object ID.
If a nextproc calls one of the nextproc_next_instance routines it must also call one
of the getproc_got_ * functions to insert the value into vbp The two functions may
be called in either order. nextproc_no_next( ) is used when there is no successor to
the requested instance within the given object and nextproc_error( ) is used if some
error occurred. The only error that makes sense during next processing is
GEN_ERR.
A nextproc may assume responsibility for other vbps by calling nextproc_started( )
for each vbp it plans to process. It must call nextproc_next_instance( ),
nextproc_error( ), nextproc_next_instance_string( ), or nextproc_no_next( ) for
each VB_T 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. Again the order is immaterial.
To defer some of the NEXT processing, you would return from the nextproc before
calling one of the getproc_got_*( ) functions. At some future time, you would be
responsible for calling one of the getproc_got_*( ) or error functions and calling the
SNMP_Continue( ) routine to notify the Wind River SNMP engine that the packet
had been modified.

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
)

10.7 testproc Method Routines


The testproc routine is called before setting a variable to determine whether the
proposed set will succeed. Wind River SNMP does not guarantee that the leaf’s
setproc routine is called after a call to a leaf’s testproc. The testproc routine should
examine the instance and determine if that instance of the variable exists or if it can
be created (see A.1 Row Creation Code Example, p.141). This routine must also
validate the value being set and generally acquire any resources that the set may
require.
Each testproc is responsible for performing the test operation on the vbp it received
as input, it must call one of the following routines to indicate that the vbp has been
processed. testproc_good( ) is used to indicate that the test was successful, while
testproc_error( ) indicates a failure. testproc_error( ) sets the SNMP error index to
the index of vbp and the error status to error.

112
10 Method Routines
10.7 testproc Method Routines

A testproc may assume responsibility for other vbps by calling testproc_started( )


for each vbp it plans to process. It must call testproc_good( ) or testproc_error( ) for
each VB_T for which it accepted responsibility.
Another function testproc may wish to use is setproc_good( ). When a testproc
gathers several VB_Ts together it may be simplest to mark all but one of the VB_Ts
as being both tested and set. The setproc for the unmarked VB_T will then be
responsible for performing the set requested by the other VB_Ts.
To defer some of the TEST processing, you would return from the testproc 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
SNMP_Continue( ) routine to notify the Wind River SNMP engine that the packet
had been modified.

Parameters

The following are possible values for the error parameter:


BAD_VALUE
The value being set is not allowed. A SNMPv1 code that is included in
SNMPv2 and SNMPv3.
GEN_ERR
A general error code that is returned if the error was not one of the defined
errors. It is used by SNMPv1, SNMPv2 and SNMPv3.
NO_ACCESS
The variable is not accessible. A SNMPv2 and SNMPv3 code.
WRONG_TYPE
The type of the variable binding’s value field is inconsistent with that required
for the variable. A SNMPv2 and SNMPv3 code.
WRONG_LENGTH
The variable binding’s value field specifies a length, which is inconsistent with
that required for the variable. A SNMPv2 and SNMPv3 code.
WRONG_ENCODING
The encoding of the value field is inconsistent with the field’s tag. A SNMPv2
and SNMPv3 code.
WRONG_VALUE
The specified value could never be assigned to the variable. A SNMPv2 and
SNMPv3 code.
NO_CREATION
The variable does not exist and cannot be created. A SNMPv2 and SNMPv3
code.
INCONSISTENT_VALUE
The specified value is currently inconsistent, though under other
circumstances it would be acceptable. A SNMPv2 and SNMPv3 code.
RESOURCE_UNAVAILABLE
The assignment of the specified value to the given variable requires the
allocation a resource, which is presently unavailable. A SNMPv2 and SNMPv3
code.

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
)

10.8 setproc Method Routines


The setproc routine performs the write or create operation on the given variable.
Each setproc is responsible for performing the set operation on the vbp it received
as input, it must call one of the following routines to indicate that the vbp has been
processed. setproc_good( ) is used to indicate that the vbp has been set, while

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
)

10.9 undoproc Method Routines


The undoproc operation is called to back out a committed change when another
part of the same SET request fails. When an error occurs during the SET phase of
processing a SET request, processing stops and the engine calls an undoproc
routine for each VarBind in the SNMP request that has been started
(setproc_started( ) was called for that VarBind.) Both testproc and setproc
routines can call undoproc_set( ) to setup an undoproc routine.
Unlike other standard method routines, there are no default undoproc routines
defined for specific objects. You can use different undoproc routines depending on
whether the failed SET request occurred during row creation, row deletion, or
modification.

115
Wind River SNMP
Programmer's Guide, 10.5

If the SET request has completed successfully on a VarBind (setproc_good( ) has


been called), you must setup an undoproc routine using undoproc_set( ).
Otherwise, the engine automatically sets the error status in the response to
UNDO_FAILED.
An undoproc can take responsibility for other VB_Ts by calling
undoproc_started( ) for every vbp it plans to process. When an undoproc is
successful, call undoproc_good( ) to indicate that it has completed. If an undoproc
is unsuccessful, it should return an error status of UNDO_FAILED.

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
)

10.10 Asynchronous Method Routines


Method routines can be written to behave in an asynchronous way with respect to
the SNMP agent. An asynchronous method routine usually spawns a task to
complete the requested activities, and the method routine returns before the
spawned task completes. By spawning a task, in effect, a deferred process is
created.
In order to utilize more than one task for performing SNMP functions with
deferred processing for your method routines you must install the
ENVOY_SNMP_LOCK and ENVOY_CONTINUE_REENTRANT options in your top
level config.cfg file.
The asynchronous method routines must first make the appropriate initialization
calls before spawning a task. Depending on the method routine type, a
getproc_started( ), nextproc_started( ), testproc_started( ), or setproc_started( )

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.

Example 10-1 An Asynchronous Method Routine

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;
}

/* At this stage we are ready to spawn an asynchronous task that will


continue withe the job of getting the vars and installing those
values in the response pkt. However we must first indicate to the
agent that the getproc for all these varbinds has been started,
else the agent could start them again */

for ( pVbpSaved = vbp; pVbpSaved != NULL; pVbpSaved = pVbpSaved->vb_link)


{
getproc_started (pktp, pVbpSaved);
}

/* Now spawn the asynch routine */

status = taskSpawn (asyncRtn, ...);


if (status != OK)
{
for (pVbpSaved = vbp ; pVbpSaved != NULL; pVbpSaved =
pVbpSaved->vb_link)

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;

/* time consuming tasks done here */

...

/* after doing all the time consuming tasks we are now ready to
install the values in the pkt. */

ENVOY_SNMP_GET_WRITE_LOCK (pktp -> continue_lock)

for ( pVbpSaved = vbp; pVbpSaved != NULL; pVbpSaved =

pVbpSaved->vb_link)

/* Do whatever steps are reqd to install the var bind value


as in the synchronous method routines */

...

}
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

1. Acquire the coarse lock (SNMP_CoarseLock).


2. Acquire the packet’s continue lock (pktp -> continue_lock).
3. Call the method routine (for example, deferredObject_get( )).
Since this example involves a deferred object, the method routine calls
getproc_started( ) on the VarBind and exits without binding a value. (It also should
establish whatever information retrieval systems are necessary to learn the value
of the object.)
The deferred process, not the method routine, would need to acquire the write lock
and proceed as follows:
1. Acquire the continue lock by calling ENVOY_SNMP_GET_WRITE_LOCK
(pktp -> continue_lock)
2. Bind the appropriate information using the appropriate getproc_got_*( )
routine or, if an error occurred, mark the VarBind with an error.
3. Call SNMP_Continue(pktp) to release the continue lock and to verify that all
VarBinds in the packet have successfully completed. If so,
SNMP_Continue(pktp) sends a response, cleans up the packet, and releases
the coarse lock. Otherwise, it assumes that there is another deferred process
waiting to complete and exits. No response can be sent until all deferred
processes complete.
If you choose to implement a similar scheme, there are several things to consider:
■ The current lock scheme Wind River SNMP uses on VxWorks consists of a
simple binary semaphore. This essentially means that no more than one
request can be processed at a time. However, you can implement another
scheme. In any scheme, do not allow more than one SET request at a time.
■ The current packet processing scheme for VxWorks processes all incoming
packets within a single task. If a new packet is begun while an old packet is still
pending (due to deferred processing), the main task (tSnmpd) can block while
attempting to acquire the coarse lock until the first request completes. To avoid
deadlocking the agent, handle deferred processing in separate tasks.
■ There are advantages to having one task that receives SNMP requests and
dispatches them to a series of processing tasks, which call the
Process_Rcvd_SNMP_Packet_Async( ) routine. This allows other read-class
PDUs to complete when another deferred read-class PDU is pending.

10.10.2 Serialization

Serialization is an alternative to locking, but it requires all packet processing to be


done in a single task. This includes timers, so you need to exercise some care in
making sure that your code does not block and prevent timers from firing.
Serialization is not compatible with the current VxWorks agent code. (This is not
to say that a VxWorks agent using serialization could not be written- just that we
do not provide one.)

119
Wind River SNMP
Programmer's Guide, 10.5

120
11
User-Supplied Code

11.1 Introduction 121


11.2 The envoy.h File 122
11.3 Required Routines 122
11.4 Required System Routines 124
11.5 Configuration Macros 124
11.6 User-Supplied Handlers 130
11.7 User-Exits 131
11.8 SNMPv3 Method Routine Macros 132
11.9 RFC 3415 View Method Routine Macros 136

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.

11.2 The envoy.h File


The envoy.h file contains the definitions for customer-specific items including
macros, handlers, completion routines, and other user-exits. If you reference other
routines in these macros, you also need to declare them in your envoy.h file. If you
do not need a particular function, leave the user-exit or macro either undefined or
defined as a blank.
The envoy.h file is split by an #ifdef into two sections: the first part (formerly
referred to as the preamble) and second part, the main section. Unless noted
differently, the items in this chapter belong in the main section of the file.
Although the sample envoy.h file is split into two files, you should use a single
envoy.h file for your application. The sample file was split into two files to make it
easier to build the Wind River SNMP code samples for different platforms. For
VxWorks, one part contains global information that is the same for most of our
code samples. This envoy.h is located in the following directory:
installDir/vxworks-6.x/target/h/wrn/wm/util/port/generic
The other part of the envoy.h file contains operating system-specific information.
This envoy.h is located in the following directory:
installDir/vxworks-6.x/target/h/wrn/wm/util/port

11.3 Required Routines


You must define the routines in Table 11-1. Put the definitions and any header files
they require in the first section of the envoy.h file:

Table 11-1 Required Routines

Routine

max( )

MAX_OID_COUNT( )

MEMCPY( )

MEMSET( )

MEMCMP( )

122
11 User-Supplied Code
11.3 Required Routines

Table 11-1 Required Routines (cont’d)

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( )

Format Conversion Routines

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

11.4 Required System Routines


The macros MEMCPY( ), MEMSET( ), MEMCMP( ) are defined in the envoy.h file
and roughly map to the system routines memcpy( ), memset( ), and memcmp( )
which are required.
The MEMCMP_NULLOK( ) macro is used when one, or both, of the strings could be
a null pointer or the length is zero. The default Wind River SNMP definition of this
macro, is based on the MEMCMP( ) macro and contains a check for zero lengths. If
your system’s version of the memcmp( ) command can handle null pointers when
the length is zero, add your own definition of MEMCMP_NULLOK( ) to your
envoy.h file. If you do not supply your own definition, Wind River SNMP uses the
default macro.
Wind River SNMP also uses the system routines min( ) and max( ). These system
routines are typically declared (or defined) in system header files. If these macros
are not defined, Wind River SNMP uses default macros. If you choose to use your
own system routines, include the appropriate header file. If your system does not
provide these header files, you can define these macros explicitly in the envoy.h
file. This would overwrite the Wind River SNMP default versions.

11.5 Configuration Macros


Unless noted, define the following configuration macros in the main section of the
envoy.h file. In general, if you do not use the options associated with a specific
macro, you can leave it undefined or defined as blank.
ENVOY_DEFAULT_MIB_ROOT_NODE( )
#define ENVOY_DEFAULT_MIB_ROOT_NODE

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)

If you use the default version of ENVOY_SNMP_INIT_LOCK_TAG( ), it calls


this macro to perform any initialization required by lock, which was declared
using ENVOY_LOCK_T. If you need to ensure that various databases are
modified by only one process at a time, you must define the locking macros.
ENVOY_SNMP_INIT_LOCK_TAG( )
void ENVOY_SNMP_INIT_LOCK_TAG ( ENVOY_LOCK_T *lock, char *tag )

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 routine is called to clean up the lock structure (ENVOY_LOCK_T) in


individual packets. This macro is only available if you install the
ENVOY_CONTINUE_REENTRANT installation option.
ENVOY_SNMP_GET_READ_LOCK( )
int ENVOY_SNMP_GET_READ_LOCK( ENVOY_LOCK_T * lock )

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.

NOTE: Wind River SNMP includes a default version of the


SNMP_community_coexistence_lookup( ) routine. In many cases, there is no
need to re-write the function.

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.

11.6 User-Supplied Handlers


Table 11-2 lists user-defined handler routines that you must write. Several of these
are known as completion routines, because they are called when Wind River SNMP
has finished processing a packet. You can call them before or after the main
processing routine returns to release resources.

Table 11-2 User-Supplied Handler Routines

Handler Description

ENVOY_AX_ADD_T( )a Indicate when an AgentX packet handler was


called.

ENVOY_AX_ADMIN_T( )a Pass an AgentX packet to customer code.

ENVOY_AX_ERROR_T( )a AgentX error handler.

ENVOY_AX_SEND_T( )a AgentX send handler.

ERROR_COMPLETE_T( ) Error completion routine.

130
11 User-Supplied Code
11.7 User-Exits

Table 11-2 User-Supplied Handler Routines (cont’d)

Handler Description

IO_COMPLETE_T( ) I/O completion routine.

PROXY_ROUTINE_T( ) Translation routine for proxy packets.

RETRANS_CLEANUP_T( ) Notify retransmit cleanup completion routine.

TRANSPORT_ROUTINE_T( )a Transport routine for proxy packets.


a. Used with Agent X.

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.

Table 11-3 User Exit Routines

User Exit Description

ENVOY_ADD_ENGINE_ADDRESS( ) Add an engine ID to the engine


table.

ENVOY_ADD_ENGINE_ID( ) Add an engine ID to the engine


table.

ENVOY_AX_CONN_ENTRY( )a Return the time, domain and


address for a given connection ID.

ENVOY_AX_COOKIE_CMP( )a Compare two AgentX information


blocks.

ENVOY_AX_FIND_MIB( )a Find a MIB to use with a given


context.

ENVOY_AX_GET_CONNID( )a Return the connection ID for a


specific session.

ENVOY_AX_MA_AC_ADD( )a Register a VarBindList in the agent


capabilities table.

ENVOY_AX_MA_AC_CLEAN( )a Request the subagent to remove a


session from its agent capabilities
table.

131
Wind River SNMP
Programmer's Guide, 10.5

Table 11-3 User Exit Routines (cont’d)

User Exit Description

ENVOY_AX_MA_AC_REMOVE( )a Request a subagent to remove a


VarBindList from its agent
capabilities table.

ENVOY_AX_TRANSLATE_CONTEXT( )a Extract the context and community


information from an SNMP_PKT_T
structure for an AgentX request.

ENVOY_AX_SA_MIB_ROOT_NODE( )a Determine the appropriate MIB


tree.

ENVOY_GET_SYSUPTIME( )a Return the value for the sysUptime


object.

ENVOY_SET_RETRANS_ID( ) Customize outgoing notify


numbering scheme.

ENVOY_SNMPADDR_TO_TADDRESS( ) Convert an SNMPADDR_T


structure into a TAddress and
TDomain pair.

ENVOY_TADDRESS_TO_SNMPADDR( ) Convert a TAddress to an


SNMPADDR_T.

SNMP_DH_RAND( ) Set the Diffie-Hellman


pseudo-random number generator
seed.

SNMP_user_get_encode_buffer( ) Allocate memory for an encoded


packet.
a. Used with Agent X.

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( )

11.8 SNMPv3 Method Routine Macros


The macros described in this section are called by method routines. They are the
interface between the method routines and any nonvolatile storage code that you
supply.

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.

Use the following procedure to make a multi-stage SET REQUEST:


1. The method routine calls a TEST macro to collect information, reserve
resources, and pre validate your SET REQUEST.
2. If the 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 setproc is successful, you should set the corresponding FINISHED macro
to be set in the vb_free_priv( ) routine, and then set the undoproc. If the
SET REQUEST fails, do not call the UNDO macro.
Prototypes for SNMPv3 method routines fall into the following categories:

SNMPv3 TEST Macros

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( )

SNMPv3 BACKOUT Macros

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( )

SNMPv3 SET Macros

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( )

SNMPv3 UNDO Macros

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( )

SNMPv3 FINISHED Macros

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( )

11.9 RFC 3415 View Method Routine Macros


The macros described in this section 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.
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:

RFC 3415 View TEST Macros

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

RFC 3415 View BACKOUT Macros

SNMP_VIEW_2275_CREATE_BACKOUT( )
SNMP_VIEW_2275_DESTROY_BACKOUT( )
SNMP_VIEW_2275_UPDATE_BACKOUT( )

RFC 3415 View SET Macros

SNMP_VIEW_2275_CREATE_SET( )
SNMP_VIEW_2275_DESTROY_SET( )
SNMP_VIEW_2275_UPDATE_SET( )

RFC 3415 View UNDO Macros

SNMP_VIEW_2275_CREATE_UNDO( )
SNMP_VIEW_2275_DESTROY_UNDO( )
SNMP_VIEW_2275_UPDATE_UNDO( )

RFC 3415 View FINISHED Macro

SNMP_VIEW_2275_FINISHED( )

137
Wind River SNMP
Programmer's Guide, 10.5

138
12
Compiler Issues

12.1 Compiler Warnings 139


12.2 C Compiler 139

12.1 Compiler Warnings


In general you should not get warnings when compiling the core Wind River
SNMP code. The known exceptions follow:
■ If you choose not to install SNMPv2, your compiler can generate a warning
about oldvbp being assigned a value that is never used in nextpdu.c. The
oldvbp is an SNMPv2 VarBind pointer, which is assigned but not used in
SNMPv1 code.
■ If you install the SNMPv2 code, but don’t install the SNMPv2 statistics group,
you can get a warning that a line of code has no effect in rpktasy.c.

12.2 C Compiler
Wind River SNMP is compatible with the ISO C language definition.

Sensitivity to Word Size

Wind River SNMP works on systems where the size of an integer is either 32 or 16
bits.

Sensitivity to Type Casting

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.

Sensitivity to Byte Order

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

A.1 Row Creation Code Example 141

A.1 Row Creation Code Example


This is an example of code that performs a row create set. It is described in
8.6.7 Row Creation, p.90. This code is contained in the file
target/src/wrn/wm/snmp/engine/vmth2275.c.
/* view table lastmatch values */
#define LM_viewName1
#define LM_viewSubtree2
#define LM_viewMask3
#define LM_viewType4
#define LM_viewStorageType5
#define LM_viewStatus6

/***************************************************************
NAME: viewtable_destroy_cleanup

PURPOSE: Cleanup after a view test (delete) succeeded but some


other test failed. We merely call the DESTROY_BACKOUT
macro to allow the customer to restore any changed
state.
Expects a PTR_T or VB_T rather than a VIEWLEAF_T

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

PURPOSE: Cleanup after a view test (create) succeeded but some


other test failed. As this is a create the state
pointer points to a structure that is installed, we

141
Wind River SNMP
Programmer's Guide, 10.5

need to deinstall it, call the backout routine and


cleanup the state.

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

PURPOSE: Cleanup after a view test (update) succeeded but some


other test failed. As this is an update the state
pointer points to a structure that isn’t installed.
The next pointer of that structure points to the
installed copy. We call the backout routine and
cleanup the state.

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

PURPOSE: This routine attempts to undo a previous destroy set.


It expects the old information to be pointed to by
vb_priv and tries to reinstall it. If we can’t
reinstall the access we leave the cleanup routine
alone in order to get the FINISHED macro to run.

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];

/* assume things will go well and mark the vbp as done */


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;

/* Reacquire the naming information, we don’t need to test


it as it was validated during the testproc */
(void) oid_to_string(tcount, tlist, &namelen, name, 0);
if (SNMP_View_2275_Install(view, name, namelen) == 0) {
#if defined(SNMP_VIEW_DESTROY_UNDO_2275)
if (SNMP_VIEW_2275_DESTROY_UNDO(pktp, vbp, 0, view) == 0) {
vbp->vb_free_priv = 0;
return;
}
else
SNMP_View_2275_Deinstall(view);
#else
vbp->vb_free_priv = 0;
return;
#endif
}
SNMP_View_Delete(view);
undoproc_error(pktp, vbp, UNDO_FAILED);
return;
}

/***************************************************************
NAME: viewtable_create_undo

PURPOSE: This routine attempts to undo a previous create set.


It expects the new information to be pointed to by
vb_priv and tries to deinstall and destroy the entry.

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

if (SNMP_VIEW_2275_CREATE_UNDO(pktp, vbp, view, 0)) {


undoproc_error(pktp, vbp, UNDO_FAILED);
return;
}
#endif
SNMP_View_2275_Deinstall(view);
SNMP_View_Delete(view);
return;
}

/***************************************************************
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 */

sav_view = (VIEWLEAF_T *)vbp->vb_priv;


vbp->vb_priv = 0;
vbp->vb_free_priv = 0;
cur_view = sav_view->lexinext;
#if defined(SNMP_VIEW_2275_UPDATE_UNDO)
if (SNMP_VIEW_2275_UPDATE_UNDO(pktp, vbp, cur_view, sav_view)) {
/* we had an undo failure indicate that to our
caller and get rid of the old view */
undoproc_error(pktp, vbp, UNDO_FAILED);
SNMP_View_Delete(sav_view);
return;
}
#endif

/* 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

/* The index will be of the form <len> <name> <len> <subtree>


first we see if the name will work then we try and
find the view */
if ((tcount < 1) ||
(oid_to_string(tcount, tlist, &namelen, name, 0)) ||
(tcount != (2 + namelen + tlist[namelen+1])) ||
(tlist[namelen+1] > MAX_SUBIDS)) {
testproc_error(pktp, vbp, NO_CREATION);
return;
}
oidc = tlist + namelen + 2;
oidclen = (int)(tlist[namelen+1]);
view = SNMP_View_2275_Lookup(name, namelen, oidc, oidclen);
/* Note that the check for status is simpler than the general
case as this table has few objects and all but status have
defvals. This means that several conditions can’t occur.
So create and go is always acceptable and is almost the
same as create and wait, active and not in service are
also similar. */
/* is the leaf writable, (if it’s read only it isn’t writable) */
if (view != 0) {
if (SNMP_View_Get_StorageType(view) == ETC_STO_PERM) {
testproc_error(pktp, vbp, NOT_WRITABLE);
return;
}
MEMCPY(&tempview, view, sizeof(VIEWLEAF_T));
}
else {
SNMP_View_Set_Defaults(&tempview);
create_row = 1;
}

for (tvbp = vbp; tvbp; tvbp = tvbp->vb_link) {


switch (tvbp->vb_ml.ml_last_match) {
case LM_viewMask:
nlen = EBufferUsed(&tvbp->value_u.v_string);
if (nlen > VIEW_MAXMASKLEN) {
testproc_error(pktp, tvbp, WRONG_LENGTH);
return;
}
EBufferPreLoad(BFL_IS_STATIC, &tempview.mask,
EBufferStart(&tvbp->value_u.v_string),
nlen);
break;
case LM_viewType:
value = tvbp->value_u.v_number;
if ((value != VIEW_INCLUDED) &&
(value != VIEW_EXCLUDED)) {
testproc_error(pktp, tvbp, WRONG_VALUE);
return;
}
SNMP_View_Set_Type(&tempview, value);
break;
case LM_viewStorageType:
value = tvbp->value_u.v_number;
if ((value < ETC_STO_OTHER) ||
(value > ETC_STO_NONVOL) ||
(SNMP_View_Get_StorageType(&tempview) >=
ETC_STO_PERM)) {
testproc_error(pktp, tvbp, WRONG_VALUE);
return;
}
SNMP_View_Set_StorageType(&tempview, (int)value);
break;
case LM_viewStatus:
value = tvbp->value_u.v_number;
switch (value) {
case ETC_RS_ACTIVE:
case ETC_RS_NIS:
if (create_row) {

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;
}
}

/* The values are ok */


if (SNMP_View_Get_Status(&tempview) == ETC_RS_DESTROY) {
if (view != 0) {
ptret = SNMP_VIEW_2275_DESTROY_TEST(pktp, vbp, view, 0);
if (ptret != NO_ERROR) {
testproc_error(pktp, vbp, ptret);
}
else {
vbp->vb_priv = (PTR_T)view;
vbp->vb_free_priv = viewtable_destroy_cleanup;
}
}
else {
/* We have a destroy request, but no view so we don’t
have to do anything during the set and, if necessary,
the undo phases so we mark the setvbp as set and
undone */
setproc_all_bits(pktp, vbp);
}
return;
}
/* See if anything actually changed, if it didn’t we can mark
the vbp as done and not have to do any more work. If we are
creating an entry mark the mask as having changed so they will
get copied */
if (view) {
if ((SNMP_View_Get_Mask(view) ==
SNMP_View_Get_Mask(&tempview)) ||
((SNMP_View_Get_MaskLen(view) ==
SNMP_View_Get_MaskLen(&tempview)) &&
(MEMCMP_NULLOK(SNMP_View_Get_Mask(view),
SNMP_View_Get_Mask(&tempview),
SNMP_View_Get_MaskLen(view)) == 0))) {
if ((SNMP_View_Get_Type(view) ==
SNMP_View_Get_Type(&tempview)) &&
(SNMP_View_Get_Status(view) ==
SNMP_View_Get_Status(&tempview)) &&

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

AX_RESPONSE_PREPROCESS( ) – process subagent response packets 152


ENVOY_AX_ADD_T( ) – indicate when an AgentX packet handler was called 152
ENVOY_AX_ADMIN_T( ) – pass an AgentX packet to customer code 152
ENVOY_AX_ERROR_T( ) – AgentX error handler 153
ENVOY_AX_SEND_T( ) – AgentX send handler 153
ERR_COMPLETE_T( ) – error completion routine 154
IO_COMPLETE_T( ) – I/O completion routine 155
PROXY_ROUTINE_T( ) – translation routine for proxy packets 156
RETRANS_CLEANUP_T( ) – notify retransmit cleanup completion routine 156
TRANSPORT_ROUTINE_T( ) – transport routine for proxy packets 157
ENVOY_ADD_ENGINE_ADDRESS( ) – add an engine ID to the engine table 157
ENVOY_ADD_ENGINE_ID( ) – add an engine ID to the engine table 158
ENVOY_AX_CONN_ENTRY( ) – return the time, domain and addr for a specified connID 158
ENVOY_AX_COOKIE_CMP( ) – compare two AgentX information blocks 159
ENVOY_AX_FIND_MIB( ) – find a MIB to use with a given context 159
ENVOY_AX_GET_CONNID( ) – return the connection ID for a specific session 160
ENVOY_AX_MA_AC_ADD( ) – register a VarBindList in the agent capabilities table 160
ENVOY_AX_MA_AC_CLEAN( ) – request subagent to remove session from agent table 161
ENVOY_AX_MA_AC_REMOVE( ) – request subagent to remove VarBindList from agent table 161
ENVOY_AX_TRANSLATE_CONTEXT( ) – extract context information from SNMP_PKT_T 162
ENVOY_AX_SA_MIB_ROOT_NODE( ) – determine the appropriate MIB tree 162
ENVOY_GET_SYSUPTIME( ) – return the value for the sysUptime object 163
ENVOY_SET_RETRANS_ID( ) – customize outgoing notify numbering scheme 163
ENVOY_SNMPADDR_TO_TADDRESS( ) – convert SNMPADDR_T into TAddress and TDomain 163
ENVOY_TADDRESS_TO_SNMPADDR( ) – convert a TAddress to an SNMPADDR_T 164
SNMP_DH_RAND( ) – set the pseudo-random number generator seed 165
SNMP_user_get_encode_buffer( ) – allocate memory for an encoded packet 165
SNMP V3 TEST Macros – reserve resources requested for a SET operation 166
SNMP V3 BACKOUT Macros – free pre-staged information and resources from a failed TEST 170
SNMP V3 SET Macros – create, change, or delete a table entry 173
SNMP V3 UNDO Macros – undo a SET error 177
SNMP V3 FINISHED Macros – free a packet structure and resources after a SET REQUEST 181
RFC 3415 View Method Routine Macros – service the RFC 3415 view table 182
RFC 3415 View TEST Macros – reserve resources required for a SET operation 183
RFC 3415 View BACKOUT Macros – free pre-staged information and resources from a failed TEST 184
RFC 3415 View SET Macros – create, change, or delete a table entry 185
RFC 3415 View UNDO Macros – undo a SET error 186
RFC 3415 View FINISHED Macros – free a packet structure and resources after a SET REQUEST 187

151
Wind River SNMP
Programmer's Guide, 10.5

AX_RESPONSE_PREPROCESS( )
NAME AX_RESPONSE_PREPROCESS( ) – process subagent response packets

SYNOPSIS bits32_t AX_RESPONSE_PREPROCESS


(
SNMP_PKT_T *pktp
)

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.

SEE ALSO ENVOY_AX_CONN_ENTRY( ), ENVOY_AX_GET_CONNID( )

ENVOY_AX_ADD_T( )
NAME ENVOY_AX_ADD_T( ) – indicate when an AgentX packet handler was called

SYNOPSIS void ENVOY_AX_ADD_T (ptr_t cookie)

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.

SEE ALSO ENVOY_AX_ADMIN_T( ), envoy_ax_chunk_handler( ), ENVOY_AX_ERROR_T( ),


ENVOY_AX_SEND_T( )

ENVOY_AX_ADMIN_T( )
NAME ENVOY_AX_ADMIN_T( ) – pass an AgentX packet to customer code

SYNOPSIS void ENVOY_AX_ADMIN_T


(
ptr_t cookie,
ptr_t ax_pkt
)

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.

SEE ALSO ENVOY_AX_ADD_T( ), envoy_ax_chunk_handler( ), ENVOY_AX_ERROR_T( ),


ENVOY_AX_SEND_T( )

ENVOY_AX_ERROR_T( )
NAME ENVOY_AX_ERROR_T( ) – AgentX error handler

SYNOPSIS void ENVOY_AX_ERROR_T


(
ptr_t cookie,
int error_stat
)

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.

SEE ALSO ENVOY_AX_ADD_T( ), ENVOY_AX_ADMIN_T( ), ENVOY_AX_SEND_T( )

ENVOY_AX_SEND_T( )
NAME ENVOY_AX_SEND_T( ) – AgentX send handler

SYNOPSIS int ENVOY_AX_SEND_T


(
ptr_t cookie,
ptr_t ax_pkt,

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.

RETURNS This routine should return 0 if it is successful and 1 for failure.

SEE ALSO ENVOY_AX_ADD_T( ), ENVOY_AX_ADMIN_T( ), envoy_ax_chunk_handler( ),


ENVOY_AX_ERROR_T( ),envoy_ax_pkt_encode( )

ERR_COMPLETE_T( )
NAME ERR_COMPLETE_T( ) – error completion routine

SYNOPSIS void ERR_COMPLETE_T


(
SNMPADDR_T * for_addr,
SNMPADDR_T * loc_addr,
int error_code,
PTR_T cookie
)

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.

NOTE: If this completion routine is called as a result of a call to


SNMP_Send_Notify_Name( ), do not free the cookie.

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.

SEE ALSO IO_COMPLETE_T( ), Process_Rcvd_SNMP_Packet_Async( ), PROXY_ROUTINE_T( ),


RETRANS_CLEANUP_T( ), SNMP_Send_Notify_Name( ), TRANSPORT_ROUTINE_T( )

IO_COMPLETE_T( )
NAME IO_COMPLETE_T( ) – I/O completion routine

SYNOPSIS void IO_COMPLETE_T


(
SNMPADDR_T * for_addr,
SNMPADDR_T * loc_addr,
PTR_T pktp,
ALENGTH_T need,
PTR_T cookie
)

DESCRIPTION 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 a response packet. This routine can be called before or after
the main processing routine returns.
Generally, the completion routine attempts to send the packet to for_addr though you can
determine the address by other methods. The completion routine should call
SNMP_Process_Finish( ) to encode the packet into a byte string. If you choose, the routine
can allocate a buffer for SNMP_Process_Finish( ) to use. You can also leave the buffer
empty and let the encoding routines attempt to allocate space using the
SNMP_memory_alloc( ) or SNMP_memory_free( ) routines. The routine should send the
buffer and, if appropriate, free the buffer space.

NOTE: If this completion routine is called as a result of a call to


SNMP_Send_Notify_Name( ), do not free the cookie.

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.

SEE ALSO ERR_COMPLETE_T( ), Process_Rcvd_SNMP_Packet_Async( ), PROXY_ROUTINE_T( ),


RETRANS_CLEANUP_T( ), TRANSPORT_ROUTINE_T( ), SNMP_memory_alloc( ),
SNMP_memory_free( ), SNMP_Process_Finish( ), SNMP_Send_Notify_Name( )

PROXY_ROUTINE_T( )
NAME PROXY_ROUTINE_T( ) – translation routine for proxy packets

SYNOPSIS INT_32_T PROXY_ROUTINE_T( SNMP_PKT_T * pktp )

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.

SEE ALSO ERR_COMPLETE_T( ), IO_COMPLETE_T( ), Process_Rcvd_SNMP_Packet_Async( ),


RETRANS_CLEANUP_T( ), TRANSPORT_ROUTINE_T( ), SNMP_Send_Notify( )

RETRANS_CLEANUP_T( )
NAME RETRANS_CLEANUP_T( ) – notify retransmit cleanup completion routine

SYNOPSIS void RETRANS_CLEANUP_T( ptr_t cookie )

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( )

SEE ALSO ERR_COMPLETE_T( ), IO_COMPLETE_T( ), Process_Rcvd_SNMP_Packet_Async( ),


PROXY_ROUTINE_T( ), TRANSPORT_ROUTINE_T( ), SNMP_Send_Notify( )

TRANSPORT_ROUTINE_T( )
NAME TRANSPORT_ROUTINE_T( ) – transport routine for proxy packets

SYNOPSIS INT_32_T TRANSPORT_ROUTINE_T


(
EBUFFER_T * ebuffp,
PTR_T cookie
)

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.

SEE ALSO ERR_COMPLETE_T( ), IO_COMPLETE_T( ), Process_Rcvd_SNMP_Packet_Async( ),


PROXY_ROUTINE_T( )

ENVOY_ADD_ENGINE_ADDRESS( )
NAME ENVOY_ADD_ENGINE_ADDRESS( ) – add an engine ID to the engine table

SYNOPSIS int ENVOY_ADD_ENGINE_ADDRESS


(
SNMP_PKT_T * rp,
SNMPADDR_T * address,
int create
)

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

default is to define it to ENVOY_ADD_ENGINE_ID( ). If you write your own version, your


version will override the default Wind River SNMP implementation.

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.

RETURNS If successful, this routine returns 1. Otherwise, it returns 0.

SEE ALSO ENVOY_TADDRESS_TO_SNMPADDR( ), ENVOY_SET_RETRANS_ID( ),


ENVOY_SNMPADDR_TO_TADDRESS( ), ENVOY_ADD_ENGINE_ID( ),
SNMP_Engine_Set_Address( )

ENVOY_ADD_ENGINE_ID( )
NAME ENVOY_ADD_ENGINE_ID( ) – add an engine ID to the engine table

SYNOPSIS void ENVOY_ADD_ENGINE_ID( SNMP_PKT_T * pkt )

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.

SEE ALSO ENVOY_TADDRESS_TO_SNMPADDR( ), ENVOY_SET_RETRANS_ID( ),


ENVOY_SNMPADDR_TO_TADDRESS( ), ENVOY_ADD_ENGINE_ADDRESS( ),
SNMP_Engine_Set_Address( )

ENVOY_AX_CONN_ENTRY( )
NAME ENVOY_AX_CONN_ENTRY( ) – return the time, domain and addr for a specified connID

SYNOPSIS bits32_t ENVOY_AX_CONN_ENTRY


(
bits32_t axConnID,
int matchFlag,
AX_CONNENT_T * pConnEntry
)

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.

RETURNS If successful, this routine returns 1. Otherwise, it returns 0.

SEE ALSO ENVOY_AX_GET_CONNID( )

ENVOY_AX_COOKIE_CMP( )
NAME ENVOY_AX_COOKIE_CMP( ) – compare two AgentX information blocks

SYNOPSIS int ENVOY_AX_COOKIE_CMP


(
ptr_t cookie_1,
ptr_t cookie_2
)

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.

SEE ALSO ENVOY_AX_FIND_MIB( ), ENVOY_AX_MA_AC_ADD( ), ENVOY_AX_MA_AC_CLEAN( ),


ENVOY_AX_MA_AC_REMOVE( ), ENVOY_AX_TRANSLATE_CONTEXT( ),
ENVOY_AX_SA_MIB_ROOT_NODE( )

ENVOY_AX_FIND_MIB( )
NAME ENVOY_AX_FIND_MIB( ) – find a MIB to use with a given context

SYNOPSIS MIBNODE_T * ENVOY_AX_FIND_MIB( EBUFFER_T * 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.

SEE ALSO ENVOY_AX_MA_AC_ADD( ), ENVOY_AX_COOKIE_CMP( ), ENVOY_AX_MA_AC_CLEAN( ),


ENVOY_AX_MA_AC_REMOVE( ), ENVOY_AX_TRANSLATE_CONTEXT( ),
ENVOY_AX_SA_MIB_ROOT_NODE( )

ENVOY_AX_GET_CONNID( )
NAME ENVOY_AX_GET_CONNID( ) – return the connection ID for a specific session

SYNOPSIS bits32_t ENVOY_AX_GET_CONNID


(
ptr_t * cookie
)

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.

RETURNS If successful, this routine returns a Connection ID. Otherwise, it returns 0.

SEE ALSO ENVOY_AX_CONN_ENTRY( )

ENVOY_AX_MA_AC_ADD( )
NAME ENVOY_AX_MA_AC_ADD( ) – register a VarBindList in the agent capabilities table

SYNOPSIS bits16_t ENVOY_AX_MA_AC_ADD


(
ENVOY_AX_PKT_T * ax_pkt,
MIBNODE_T * mibroot
)

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( )

SEE ALSO ENVOY_AX_FIND_MIB( ), ENVOY_AX_COOKIE_CMP( ), ENVOY_AX_MA_AC_CLEAN( ),


ENVOY_AX_MA_AC_REMOVE( ), ENVOY_AX_TRANSLATE_CONTEXT( ),
ENVOY_AX_SA_MIB_ROOT_NODE( )

ENVOY_AX_MA_AC_CLEAN( )
NAME ENVOY_AX_MA_AC_CLEAN( ) – request subagent to remove session from agent table

SYNOPSIS void ENVOY_AX_MA_AC_CLEAN( bits32_t session_id )

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.

SEE ALSO ENVOY_AX_FIND_MIB( ), ENVOY_AX_COOKIE_CMP( ), ENVOY_AX_COOKIE_CMP( ),


ENVOY_AX_MA_AC_REMOVE( ), ENVOY_AX_TRANSLATE_CONTEXT( ),
ENVOY_AX_SA_MIB_ROOT_NODE( )

ENVOY_AX_MA_AC_REMOVE( )
NAME ENVOY_AX_MA_AC_REMOVE( ) – request subagent to remove VarBindList from agent
table

SYNOPSIS bits16_t ENVOY_AX_MA_AC_REMOVE


(
ENVOY_AX_PKT_T * ax_pkt,
MIBNODE_T * mibroot
)

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.

SEE ALSO ENVOY_AX_FIND_MIB( ), ENVOY_AX_COOKIE_CMP( ), ENVOY_AX_COOKIE_CMP( ),


ENVOY_AX_MA_AC_CLEAN( ), ENVOY_AX_TRANSLATE_CONTEXT( ),
ENVOY_AX_SA_MIB_ROOT_NODE( )

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

SYNOPSIS void ENVOY_AX_TRANSLATE_CONTEXT


(
SNMP_PKT_T *,
ENVOY_AX_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.

SEE ALSO ENVOY_AX_FIND_MIB( ), ENVOY_AX_COOKIE_CMP( ), ENVOY_AX_COOKIE_CMP( ),


ENVOY_AX_MA_AC_CLEAN( ), ENVOY_AX_MA_AC_REMOVE( ),
ENVOY_AX_SA_MIB_ROOT_NODE( )

ENVOY_AX_SA_MIB_ROOT_NODE( )
NAME ENVOY_AX_SA_MIB_ROOT_NODE( ) – determine the appropriate MIB tree

SYNOPSIS int ENVOY_AX_SA_MIB_ROOT_NODE


(
ptr_t cookie,
SNMP_PKT_T * pktp
)

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.

SEE ALSO ENVOY_AX_FIND_MIB( ), ENVOY_AX_COOKIE_CMP( ), ENVOY_AX_COOKIE_CMP( ),


ENVOY_AX_MA_AC_CLEAN( ), ENVOY_AX_MA_AC_REMOVE( ),
envoy_ax_sa_state_create( ), envoy_ax_sa_handler( ), envoy_ax_sa_state_init( ),
envoy_ax_sa_session_loss( )

162
B User-Supplied Code Reference Entries
ENVOY_GET_SYSUPTIME( )

ENVOY_GET_SYSUPTIME( )
NAME ENVOY_GET_SYSUPTIME( ) – return the value for the sysUptime object

SYNOPSIS bits32_t ENVOY_GET_SYSUPTIME( EBUFFER_T * context )

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.

SEE ALSO ENVOY_NOW( )

ENVOY_SET_RETRANS_ID( )
NAME ENVOY_SET_RETRANS_ID( ) – customize outgoing notify numbering scheme

SYNOPSIS void ENVOY_SET_RETRANS_ID( SNMP_RETRANS_T * retrans )

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.

SEE ALSO ENVOY_TADDRESS_TO_SNMPADDR( ), ENVOY_SNMPADDR_TO_TADDRESS( ),


ENVOY_ADD_ENGINE_ADDRESS( ), ENVOY_ADD_ENGINE_ID( ), SNMP Notify
Commands

ENVOY_SNMPADDR_TO_TADDRESS( )
NAME ENVOY_SNMPADDR_TO_TADDRESS( ) – convert SNMPADDR_T into TAddress and
TDomain

SYNOPSIS int ENVOY_SNMPADDR_TO_TADDRESS


(
SNMPADDR_T * addr,
OBJ_ID_T * tdomain,
EBUFFER_T * taddress
)

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.

RETURNS If successful, this routine returns 0. Otherwise, it returns -1.

SEE ALSO ENVOY_TADDRESS_TO_SNMPADDR( ), ENVOY_SET_RETRANS_ID( ),


ENVOY_ADD_ENGINE_ADDRESS( ), ENVOY_ADD_ENGINE_ID( ),

ENVOY_TADDRESS_TO_SNMPADDR( )
NAME ENVOY_TADDRESS_TO_SNMPADDR( ) – convert a TAddress to an SNMPADDR_T

SYNOPSIS int ENVOY_TADDRESS_TO_SNMPADDR


(
SNMPADDR_T * addr,
OBJ_ID_T * tdomain,
EBUFFER_T * taddress
)

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.

RETURNS If successful, this routine returns 0. Otherwise, it returns -1.

SEE ALSO ENVOY_SET_RETRANS_ID( ), ENVOY_SNMPADDR_TO_TADDRESS( ),


ENVOY_ADD_ENGINE_ADDRESS( ), ENVOY_ADD_ENGINE_ID( )

164
B User-Supplied Code Reference Entries
SNMP_DH_RAND( )

SNMP_DH_RAND( )
NAME SNMP_DH_RAND( ) – set the pseudo-random number generator seed

SYNOPSIS void SNMP_DH_RAND


(
const void * seedBuff,
int buffSize
)

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.

SEE ALSO SNMP_DH_decodeParams( ), SNMP_DH_encodeParams( ), SNMP_get_DH_params( ),


SNMP_set_DH_params( )

SNMP_user_get_encode_buffer( )
NAME SNMP_user_get_encode_buffer( ) – allocate memory for an encoded packet

SYNOPSIS int SNMP_user_get_encode_buffer


(
SNMP_PKT_T * pktp,
unsigned int need,
EBUFFER_T * ebuffp
)

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

SEE ALSO EbufferAllocateLoad( ), EbufferPreLoad( ), SNMP_Encode_Packet( )

SNMP V3 TEST Macros


NAME SNMP V3 TEST Macros – reserve resources requested for a SET operation

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
)

SNMP V3 BACKOUT Macros


NAME SNMP V3 BACKOUT Macros – free pre-staged information and resources from a failed
TEST

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
)

SNMP V3 SET Macros


NAME SNMP V3 SET Macros – create, change, or delete a table entry

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
)

SNMP V3 UNDO Macros


NAME SNMP V3 UNDO Macros – undo a SET error

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
)

SNMP V3 FINISHED Macros


NAME SNMP V3 FINISHED Macros – free a packet structure and resources after a SET REQUEST

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( )

RFC 3415 View Method Routine Macros


NAME RFC 3415 View Method Routine Macros – service the RFC 3415 view table

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.

RFC 3415 View TEST Macros


NAME RFC 3415 View TEST Macros – reserve resources required for a SET operation

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
)

RFC 3415 View BACKOUT Macros


NAME RFC 3415 View BACKOUT Macros – free pre-staged information and resources from a
failed TEST

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

RFC 3415 View SET Macros


NAME RFC 3415 View SET Macros – create, change, or delete a table entry

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

RFC 3415 View UNDO Macros


NAME RFC 3415 View UNDO Macros – undo a SET error

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

RFC 3415 View FINISHED Macro


NAME RFC 3415 View FINISHED Macros – free a packet structure and resources after a
SET REQUEST

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

Extended Buffer Management Routines – manage extended buffers 193


EBufferAllocateLoad( ) – attach memory to a buffer 193
EBufferClean( ) – release memory attached to a buffer 193
EBufferClone( ) – copy a buffer 193
EBufferInitialize( ) – initialize the control block 194
EBufferNext( ) – return a pointer to the next buffer 194
EBufferPreLoad( ) – attach a full memory buffer to a control block 194
EBufferRemaining( ) – return the number of unused bytes 194
EBufferReset( ) – reset a buffer’s pointers and counters 194
EBufferSetup( ) – attach an empty buffer to a control block 194
EBufferStart( ) – return a pointer to the first byte 194
EBufferUsed( ) – return the number of used bytes 194
Object Identifier Management Routines – manage object identifiers 195
build_object_id( ) – fill in an empty OID 195
Clean_Obj_ID( ) – release memory allocated to an OID 195
clone_object_id( ) – copy an OID with a new component list 195
copy_object_id( ) – copy an OID with the same component list 195
init_object_id( ) – initialize an OID 196
Community Field Access Routines – manage fields in the community object table 196
SNMP_Community_Get_Con_ID( ) – get the context engine id 196
SNMP_Community_Get_Con_ID_Len( ) – get the length of the context engine id 196
SNMP_Community_Get_Con_Name( ) – get the context name 196
SNMP_Community_Get_Con_Name_Len( ) – get the length of the context name 196
SNMP_Community_Get_Index( ) – get the index 196
SNMP_Community_Get_Index_Len( ) – get the length of the index 196
SNMP_Community_Get_Name( ) – get the community name 196
SNMP_Community_Get_Name_Len( ) – get the length of the community name 196
SNMP_Community_Get_Sec_Name( ) – get the security name 196
SNMP_Community_Get_Sec_Name_Len( ) – get the length of the security name 197
SNMP_Community_Get_Status( ) – get the current row status 197
SNMP_Community_Get_Storage( ) – get the type of storage 197
SNMP_Community_Get_Tag( ) – get the current value of transport tag 197
SNMP_Community_Get_Tag_Len( ) – get the length of the transport tag 197
SNMP_Community_Set_Con_ID( ) – set the context engine id 197
SNMP_Community_Set_Con_Name( ) – set the context name 197
SNMP_Community_Set_Name( ) – set the community name 197
SNMP_Community_Set_Sec_Name( ) – set the security name 198
SNMP_Community_Set_Status( ) – set the row status 198
SNMP_Community_Set_Storage( ) – set the storage type 198
SNMP_Community_Set_Tag( ) – set the transport tag 198
SNMP Group Table Field Routines – get and set values in the group table 198
SNMP_Group_Get_Group( ) – get the group name 198
SNMP_Group_Get_Group_Len( ) – get the length of the group name 199

189
Wind River SNMP
Programmer's Guide, 10.5

SNMP_Group_Get_Status( ) – get the current status 199


SNMP_Group_Get_Storage( ) – get the type of storage 199
SNMP_Group_Set_Group( ) – set the group name 199
SNMP_Group_Set_Status( ) – set the status 199
SNMP_Group_Set_Storage( ) – set the type of storage 199
SNMP Notify Table Field Routines – get and set values in the notify table 199
SNMP_Notify_Get_Status( ) – get the current status 200
SNMP_Notify_Get_Storage( ) – get the type of storage 200
SNMP_Notify_Get_Tag( ) – get the current value for tag 200
SNMP_Notify_Get_Tag_Len( ) – get the length of tag 200
SNMP_Notify_Get_Type( ) – get the current MIB object type 200
SNMP_Notify_Set_Status( ) – set the status 200
SNMP_Notify_Set_Storage( ) – set the type of storage 200
SNMP_Notify_Set_Tag( ) – get the value of tag 200
SNMP_Notify_Set_Type( ) – get the value of the MIB object type 201
SNMP Notify Filter Table Field Routines – get and set values in the notify filter table 201
SNMP_Notify_Filter_Get_Mask( ) – get the current value of mask 201
SNMP_Notify_Filter_Get_Mask_Len( ) – get the length of mask 201
SNMP_Notify_Filter_Get_Status( ) – get the current status 201
SNMP_Notify_Filter_Get_Storage( ) – get the current type of storage 201
SNMP_Notify_Filter_Get_Type( ) – get the current value of type 201
SNMP_Notify_Filter_Set_Mask( ) – set the mask 202
SNMP_Notify_Filter_Set_Status( ) – set the status 202
SNMP_Notify_Filter_Set_Storage( ) – set the type of storage 202
SNMP_Notify_Filter_Set_Type( ) – set the value of type 202
SNMP Notify Filter Profile Table Field Routines – manage notify filter profile table values 202
SNMP_Notify_Profile_Get_Profile( ) – get the notify filter profile 202
SNMP_Notify_Profile_Get_Profile_Len( ) – get the length of the notify filter profile 202
SNMP_Notify_Profile_Get_Status( ) – get the status 203
SNMP_Notify_Profile_Get_Storage( ) – get the type of storage 203
SNMP_Notify_Profile_Set_Profile( ) – set the notify filter profile 203
SNMP_Notify_Profile_Set_Status( ) – set the status 203
SNMP_Notify_Profile_Set_Storage( ) – set the type of storage 203
Proxy Field Access Routines – manage fields in the proxy object table 203
SNMP_Proxy_Get_Context_Engine_ID( ) – get the context engine id 204
SNMP_Proxy_Get_Context_Engine_ID_Len( ) – get the length of the context engine id 204
SNMP_Proxy_Get_Context_Name( ) – get the context name 204
SNMP_Proxy_Get_Context_Name_Len( ) – get the length of the context name 204
SNMP_Proxy_Get_Multiple_Target_Out( ) – get the snmpProxyMultipleTargetOut string 204
SNMP_Proxy_Get_Multiple_Target_Out_Len( ) – get length of snmpProxyMultipleTargetOut string 204
SNMP_Proxy_Get_Proxy_Name( ) – get the context name 204
SNMP_Proxy_Get_Proxy_Name_Len( ) – get the length of the proxy name 204
SNMP_Proxy_Get_Single_Target_Out( ) – get the snmpProxySingleTargetOut string 204
SNMP_Proxy_Get_Single_Target_Out_Len( ) – get length of the snmpProxySingleTarget Out string 204
SNMP_Proxy_Get_Status( ) – get the current row status 204
SNMP_Proxy_Get_Storage( ) – get the type of storage 205
SNMP_Proxy_Get_Target_Params_In( ) – get the snmpProxyTargetParamsIn string 205
SNMP_Proxy_Get_Target_Params_In_Len( ) – get length of the snmpProxyTargetParamsIn string 205
SNMP_Proxy_Get_Proxy_Type( ) – get the type of proxy 205
SNMP_Proxy_Set_Context_Engine_ID( ) – set the context engine id 205
SNMP_Proxy_Set_Context_Name( ) – set the context name 205
SNMP_Proxy_Set_Status( ) – set the row status 205
SNMP_Proxy_Set_Storage( ) – set the storage type 205
SNMP_Proxy_Set_Proxy_Type( ) – set the type of proxy 206
SNMP_Proxy_Set_Multiple_Target_Out( ) – set length of the snmpProxyMultipleTargetOut string 206
SNMP_Proxy_Set_Single_Target_Out( ) – set the length of the snmpProxySingleTargetOut string 206
SNMP_Proxy_Set_Target_Params_In( ) – set the snmpProxyTargetParamsIn string 206
SNMP Target_Addr Table Field Routines – get and set values in the Target_Addr table 206
SNMP_Target_Addr_Get_Params( ) – get the params entry name 207

190
C Wind River SNMP Macro Entries

SNMP_Target_Addr_Get_Params_Len( ) - get the length of the params entry name 207


SNMP_Target_Addr_Get_Retry_Count( ) – get the retry count 207
SNMP_Target_Addr_Get_Status( ) – get the current status 207
SNMP_Target_Addr_Get_Storage( ) – get the type of storage 207
SNMP_Target_Addr_Get_TAddress( ) – get the TAddress 207
SNMP_Target_Addr_Get_TAddress_Len( ) – get the length of the TAddress 207
SNMP_Target_Addr_Get_Tag_List( ) – get the current tag list 207
SNMP_Target_Addr_Get_Tag_List_Len( ) – get the length of the tag list 207
SNMP_Target_Addr_Get_Target_MMS( ) – get the maximum message size 207
SNMP_Target_Addr_Get_TDomain( ) – get the TDomain 208
SNMP_Target_Addr_Get_TMask( ) – get the target mask 208
SNMP_Target_Addr_Get_TMask_Len( ) – get the length of the target mask 208
SNMP_Target_Addr_Get_Timeout( ) – get the time-out value 208
SNMP_Target_Addr_Set_Target_MMS( ) – set the maximum message size 208
SNMP_Target_Addr_Set_Params( ) – set the params entry name 208
SNMP_Target_Addr_Set_Retry_Count( ) – set the retry count 208
SNMP_Target_Addr_Set_Status( ) – set the status 209
SNMP_Target_Addr_Set_Storage( ) – get the type of storage 209
SNMP_Target_Addr_Set_TAddress( ) – set the TAddress 209
SNMP_Target_Addr_Set_Tag_List( ) – set the tag list 209
SNMP_Target_Addr_Set_TDomain( ) – set the TDomain 210
SNMP_Target_Addr_Set_TMask( ) – set the target mask 210
SNMP_Target_Addr_Set_Timeout( ) – set the time-out value 210
SNMP Target Params Table Field Routines – get and set values in the target params table 210
SNMP_Target_Params_Get_MP_Model( ) – get the SNMP version number 210
SNMP_Target_Params_Get_Status( ) – get the current status 210
SNMP_Target_Params_Get_Sec_Level( ) – get the current security level 210
SNMP_Target_Params_Get_Sec_Model( ) – get the current security model 211
SNMP_Target_Params_Get_Sec_Name( ) – get the current security name 211
SNMP_Target_Params_Get_Sec_Name_Len( ) – get the length of the security name 211
SNMP_Target_Params_Get_Storage( ) – get the type of storage 211
SNMP_Target_Params_Set_MP_Model( ) – set the SNMP version number 211
SNMP_Target_Params_Set_Status( ) – set the status 211
SNMP_Target_Params_Set_Sec_Level( ) – set the security level 211
SNMP_Target_Params_Set_Sec_Model( ) – set the security model 211
SNMP_Target_Params_Set_Sec_Name( ) – set the security name 212
SNMP_Target_Params_Set_Storage( ) – set the type of storage 212
SNMPv3 User Table Field Routines – get and set values in the user table 212
SNMP_User_Get_Public( ) – get the public string 212
SNMP_User_Get_Public_Len( ) – get the length of the public string 212
SNMP_User_Get_Status( ) – get the current status 212
SNMP_User_Get_Storage( ) – get the type of storage 212
SNMP_User_Set_Status( ) – set the status 213
SNMP_User_Set_Storage( ) – set the type of storage 213
SNMPv3 User Table Key Routines – allow you to manage access key information 213
SNMP_User_Get_Auth( ) – get the authentication structure 213
SNMP_User_Get_AuthKey( ) – get the authentication key 213
SNMP_User_Get_Priv( ) – get the privacy structure 213
SNMP_User_Get_PrivKey( ) – get the privacy key 213
SNMP_User_Set_AuthKey( ) – set the authentication key 213
SNMP_User_Set_PrivKey( ) – set the privacy key 214
SNMPv3 Access Table Field Routines – get and set values in the access table 214
SNMP_V3_Access_Get_Prefix_Match( ) – get the current value of match 214
SNMP_V3_Access_Get_Status( ) – get the current status 214
SNMP_V3_Access_Get_Storage( ) – get the type of storage 214
SNMP_V3_Access_Set_Prefix_Match( ) – set the value of match 214
SNMP_V3_Access_Set_Status( ) – set the status 214
SNMP_V3_Access_Set_Storage( ) – set the type of storage 215
SNMPv3 Access Table View Routines – allow you to manage view strings 215

191
Wind River SNMP
Programmer's Guide, 10.5

SNMP_V3_Access_Get_Notify( ) – get the NOTIFY string 215


SNMP_V3_Access_Get_Notify_Len( ) – get the length of the NOTIFY string 215
SNMP_V3_Access_Get_Read( ) – get the READ string 215
SNMP_V3_Access_Get_Read_Len( ) – get the length of the READ string 215
SNMP_V3_Access_Get_Write( ) – get the WRITE string 215
SNMP_V3_Access_Get_WriteLen( ) – get the length of the WRITE string 215
SNMP_V3_Access_Set_Notify( ) – set the NOTIFY string 216
SNMP_V3_Access_Set_Read( ) – set the READ string 216
SNMP_V3_Access_Set_Write( ) – set the WRITE string 216
SNMP View Routines – manipulate views and access the view table 216
SNMP_View_Get_Mask( ) – get the mask 217
SNMP_View_Get_MaskLen( ) – get the length of the mask 217
SNMP_View_Get_Status( ) – get the current status 217
SNMP_View_Get_StorageType( ) – get the type of storage 217
SNMP_View_Get_Subtree( ) – get the subtree 217
SNMP_View_Get_Subtree_Len( ) – get the length of the subtree 217
SNMP_View_Get_Type( ) – get the type 217
SNMP_View_Set_Status( ) – set the status 217
SNMP_View_Set_StorageType( ) – set the type of storage 217
SNMP_View_Set_Type( ) – set the type 217
Unsigned 64-bit Integer Routines – manipulate 64-bit integers 218
UI64_Add32( ) – add two numbers 218
UI64_Add64( ) – add two 64-bit numbers 218
UI64_Compare( ) – compare two number 218
UI64_Copy( ) – copy a number 218
UI64_High( ) – return the high half of a number 218
UI64_Increment( ) – increment a number by 1 218
UI64_Low( ) – return the low half of a number 218
UI64_Set( ) – set a number 218
UI64_Sub64( ) – subtract one number from another 219
UI64_Zero( ) – set both halves of a number to 0 219

192
C Wind River SNMP Macro Entries
Extended Buffer Management Routines

Extended Buffer Management Routines


NAME Extended Buffer Management Routines – manage extended buffers

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.

ROUTINES EBufferAllocateLoad( ) – attach memory to a buffer


int EBufferAllocateLoad
(
unsigned int flags,
EBUFFER_T * ebuffp,
bits8_t * datap,
ALENGTH_T datal
)
This routine attaches a memory buffer to a buffer control block. If flags is
BFL_IS_ALLOC, this routine allocates the memory and tags the buffer
BFL_IS_DYNAMIC. Otherwise, it calls EBufferClean( ) – release memory attached to a
buffer and EBufferPreLoad( ) – attach a full memory buffer to a control block. If
successful, this routine returns 0.
EBufferClean( ) – release memory attached to a buffer
void EBufferClean( EBUFFER_T * ebuffp )
This routine releases any dynamic memory attached to buffers tagged
BFL_IS_DYNAMIC.

EBufferClone( ) – copy a buffer


int EBufferClone
(
EBUFFER_T * srcp,
EBUFFER_T * dstp
)
This routine creates a copy of an extended buffer allocating space from the dynamic
pool. If successful, this routine returns 0. Otherwise, it returns -1.

193
Wind River SNMP
Programmer's Guide, 10.5

EBufferInitialize( ) – initialize the control block


void EBufferInitialize( EBUFFER_T * ebuffp )
This routine places the buffer control block into a known state. Although the buffer is
not ready to accept data, it may be safely handled by the extended buffer routines.
EBufferNext( ) – return a pointer to the next buffer
OCTET_T * EBufferNext( EBUFFER_T * ebuffp )
This routine returns a pointer to the next unused byte in the buffer memory. This
pointer is valid only if there are unused bytes remaining in the buffer. You do not know
if the results are valid unless you call EBufferRemaining( ) – return the number of
unused bytes.
EBufferPreLoad( ) – attach a full memory buffer to a control block
void EBufferPreLoad
(
unsigned int flags,
EBUFFER_T * ebuffp,
OCTET_T * datap,
ALENGTH_T datal
)
This routine attaches a full memory buffer to a buffer control block. This function is
useful when constructing a parameter for a procedure that requires buffers in extended
buffer format. If the buffer has been allocated from the dynamic pool, the value of flags
is BFL_IS_DYNAMIC. Otherwise, the value of flags is BFL_IS_STATIC. See also
SNMP_user_get_encode_buffer( ).
EBufferRemaining( ) – return the number of unused bytes
ALENGTH_T EBufferRemaining( EBUFFER_T * ebuffp )
This routine returns the number of unused bytes remaining in the buffer.
EBufferReset( ) – reset a buffer’s pointers and counters
void EBufferReset( EBUFFER_T * ebuffp )
This routine preserves the memory buffer but resets the various pointers and counters
so that the buffer is exactly as it would be after a call to EBufferSetup( ) – attach an
empty buffer to a control block.
EBufferSetup( ) – attach an empty buffer to a control block
void EBufferSetup
(
unsigned int flags,
EBUFFER_T * ebuffp,
OCTET_T * datap,
ALENGTH_T datal
)
This routine attaches an empty memory buffer to a buffer control block.
EBufferStart( ) – return a pointer to the first byte
OCTET_T * EBufferStart( EBUFFER_T * ebuffp )
This routine returns a pointer to the first byte in the buffer memory.
EBufferUsed( ) – return the number of used bytes
ALENGTH_T EBufferUsed( EBUFFER_T * ebuffp )
This routine returns the number of used bytes in the buffer.

194
C Wind River SNMP Macro Entries
Object Identifier Management Routines

Object Identifier Management Routines


NAME Object Identifier Management Routines – manage object identifiers

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.

ROUTINES build_object_id( ) – fill in an empty OID


int build_object_id
(
int oldc,
OIDC_T * oldl,
OBJ_ID_T * new
)
This routine takes an empty structure of type OBJ_ID_T and fills in the data received
from oldc and oldl. If successful, this routine returns 0. Otherwise, it returns -1.
Clean_Obj_ID( ) – release memory allocated to an OID
void Clean_Obj_ID( OBJ_ID_T * objp )
This routine releases the memory dynamically allocated to hold the components of the
object identifier and resets the object identifier structure.
clone_object_id( ) – copy an OID with a new component list
int clone_object_id
(
OBJ_ID_T * old,
OBJ_ID_T * new
)
This routine builds a duplicate object identifier and copies the component list into a
new area of dynamic storage. If successful, this routine returns 0. Otherwise, it returns
-1.
copy_object_id( ) – copy an OID with the same component list
void copy_object_id
(
OBJ_ID_T * old,
OBJ_ID_T * new
)
This routine copies an object identifier by pointing the component list of the new object
identifier to the original object’s identifier list. Since there is only one list, do not free the
list while the other object identifier is using it.

195
Wind River SNMP
Programmer's Guide, 10.5

init_object_id( ) – initialize an OID


void init_object_id( OBJ_ID_T * old )
This routine initializes an object identifier to have 0 identifiers and a 0 pointer.

Community Field Access Routines


NAME Community Field Access Routines – manage fields in the community object table

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.

ROUTINES SNMP_Community_Get_Con_ID( ) – get the context engine id


bits8_t *SNMP_Community_Get_Con_ID(SNMP_COMMUNITY_T * community)
This routine returns a pointer to the context engine id of this community object, which
corresponds to the snmpCommunityContextEngineId object.
SNMP_Community_Get_Con_ID_Len( ) – get the length of the context engine id
ALENGTH_T SNMP_Community_Get_Con_ID_Len(SNMP_COMMUNITY_T * community)
This routine returns the length in bytes of the context engine id.
SNMP_Community_Get_Con_Name( ) – get the context name
bits8_t *SNMP_Community_Get_Con_Name(SNMP_COMMUNITY_T * community)
This routine returns a pointer to the context name of this community object, which
corresponds to the snmpCommunityContextName object.
SNMP_Community_Get_Con_Name_Len( ) – get the length of the context name
ALENGTH_T SNMP_Community_Get_Con_Name_Len(SNMP_COMMUNITY_T * community)
This routine returns the length in bytes of the context name.
SNMP_Community_Get_Index( ) – get the index
bits8_t *SNMP_Community_Get_Index(SNMP_COMMUNITY_T * community)
This routine returns a pointer to the index of this community object, which corresponds
to the snmpCommunityIndex object.
SNMP_Community_Get_Index_Len( ) – get the length of the index
ALENGTH_T SNMP_Community_Get_Index_Len(SNMP_COMMUNITY_T * community)
This routine returns the length in bytes of the index.
SNMP_Community_Get_Name( ) – get the community name
bits8_t *SNMP_Community_Get_Name(SNMP_COMMUNITY_T * community)
This routine returns a pointer to the community name of this community object, which
corresponds to the snmpCommunityName object.
SNMP_Community_Get_Name_Len( ) – get the length of the community name
ALENGTH_T SNMP_Community_Get_Name_Len(SNMP_COMMUNITY_T * community)
This routine returns the length in bytes of the community name.
SNMP_Community_Get_Sec_Name( ) – get the security name
bits8_t *SNMP_Community_Get_Sec_Name(SNMP_COMMUNITY_T * community)

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.

SNMP Group Table Field Routines


NAME SNMP Group Table Field Routines – get and set values in the group table

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.

ROUTINES SNMP_Group_Get_Group( ) – get the group name


bits8_t * SNMP_Group_Get_Group( SNMP_GROUP_T * group )

198
C Wind River SNMP Macro Entries
SNMP Notify Table Field Routines

This routine returns a pointer to the group name.


SNMP_Group_Get_Group_Len( ) – get the length of the group name
ALENGTH_T SNMP_Group_Get_Group_Len( SNMP_GROUP_T * group )
This routine returns the length of the group name.
SNMP_Group_Get_Status( ) – get the current status
bits16_t SNMP_Group_Get_Status( SNMP_GROUP_T * group )
This routine returns one of the following values for status: ETC_RS_ACTIVE (active),
ETC_RS_NIS (not in service), or ETC_RS_READY (not ready).

SNMP_Group_Get_Storage( ) – get the type of storage


bits16_t SNMP_Group_Get_Storage( SNMP_GROUP_T * group )
This routine returns one of the following values 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_Group_Set_Group( ) – set the group name


int SNMP_Group_Set_Group(
SNMP_GROUP_T * group,
bits8_t * group_name,
ALENGTH_T length,
unsigned int flags
)
This routine changes the group name to the specified name (group_name) and length
(length). If the value of flags is BFL_IS_ALLOC, this routine allocates new memory and
copies group_name into it. If the value of flags is BFL_IS_DYNAMIC, this routine points
to the existing buffer, and frees that memory when the group object is destroyed. If the
value of flags is BFL_IS_STATIC, this routine points to the existing buffer and does not
free the buffer memory when the group object is destroyed.
SNMP_Group_Set_Status( ) – set the status
void SNMP_Group_Set_Status(
SNMP_GROUP_T * group,
bits16_t value
)
This routine sets one of the following values for status: ETC_RS_ACTIVE (active),
ETC_RS_NIS (not in service), or ETC_RS_READY (not ready).

SNMP_Group_Set_Storage( ) – set the type of storage


void SNMP_Group_Set_Storage(
SNMP_GROUP_T * group,
bits16_t value
)
This routine sets one of the following values 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 Table Field Routines


NAME SNMP Notify Table Field Routines – get and set values in the notify table

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).

SNMP_Notify_Set_Tag( ) – get the value of tag


int SNMP_Notify_Set_Tag(
SNMP_NOTIFY_T * notify,
bits8_t * tag,
ALENGTH_T tag_len,
unsigned int flags
)
This routine sets the current value for the tag parameter (snmpNotifyTag). This value is
not a tag list. It a simple tag that follows the rules for tags defined by RFC 3413. If the
value of flags is BFL_IS_ALLOC, this routine allocates new memory and copies tag into
it. If the value of flags is BFL_IS_DYNAMIC, this routine points to the existing buffer, and
frees that memory when the group object is destroyed. If the value of flags is

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).

SNMP Notify Filter Table Field Routines


NAME SNMP Notify Filter Table Field Routines – get and set values in the notify filter table

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.

ROUTINES SNMP_Notify_Filter_Get_Mask( ) – get the current value of mask


bits8_t * SNMP_Notify_Filter_Get_Mask( SNMP_NOTIFY_FILTER_T * nfilt )
This routine gets the current value of the mask field, which corresponds to the MIB
object snmpNotifyFilterMask.
SNMP_Notify_Filter_Get_Mask_Len( ) – get the length of mask
ALENGTH_T SNMP_Notify_Filter_Get_Mask_Len( SNMP_NOTIFY_FILTER_T * nfilt )
This routine gets the current value in bytes of the mask field.
SNMP_Notify_Filter_Get_Status( ) – get the current status
bits16_t SNMP_Notify_Filter_Get_Status( SNMP_NOTIFY_FILTER_T * nfilt )
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_Filter_Get_Storage( ) – get the current type of storage
bits16_t SNMP_Notify_Filter_Get_Storage( SNMP_NOTIFY_FILTER_T * nfilt )
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_Filter_Get_Type( ) – get the current value of type
bits16_t SNMP_Notify_Filter_Get_Type( SNMP_NOTIFY_FILTER_T * nfilt )
This routine gets the current value of type: SNMP_NOTIFY_FILTER_INCLUDED
(included) or SNMP_NOTIFY_FILTER_EXCLUDED (excluded).

201
Wind River SNMP
Programmer's Guide, 10.5

SNMP_Notify_Filter_Set_Mask( ) – set the mask


int SNMP_Notify_Filter_Set_Mask(
SNMP_NOTIFY_FILTER_T * nfilt,
bits8_t * mask,
ALENGTH_T mask_len,
unsigned int flags
)
This routine sets the current value of the mask field, which corresponds to the MIB
object snmpNotifyFilterMask. If the value of flags is BFL_IS_ALLOC, this routine allocates
new memory and copies nfilt into it. If the value of flags is BFL_IS_DYNAMIC, this
routine points to the existing buffer, and frees that memory when the group object is
destroyed. If the value of flags is 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_Filter_Set_Status( ) – set the status
void SNMP_Notify_Filter_Set_Status(
SNMP_NOTIFY_FILTER_T * nfilt,
bits16_t status
)
This routine sets the current value for status: ETC_RS_ACTIVE (active), ETC_RS_NIS
(not in service), or ETC_RS_NREADY (not ready).
SNMP_Notify_Filter_Set_Storage( ) – set the type of storage
void SNMP_Notify_Filter_Set_Storage(
SNMP_NOTIFY_FILTER_T * nfilt,
bits16_t storage
)
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).
SNMP_Notify_Filter_Set_Type( ) – set the value of type
void SNMP_Notify_Filter_Set_Type(
SNMP_NOTIFY_FILTER_T * nfilt,
bits16_t type
)
This routine sets the current value of type: SNMP_NOTIFY_FILTER_INCLUDED
(included) or SNMP_NOTIFY_FILTER_EXCLUDED (excluded).

SNMP Notify Filter Profile Table Field Routines


NAME SNMP Notify Filter Profile Table Field Routines – manage notify filter profile table values

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.

ROUTINES SNMP_Notify_Profile_Get_Profile( ) – get the notify filter profile


bits8_t * SNMP_Notify_Profile_Get_Profile( SNMP_NOTIFY_T * nprof )
This routine gets the current value of notify filter profile.
SNMP_Notify_Profile_Get_Profile_Len( ) – get the length of the notify filter profile
ALENGTH_T SNMP_Notify_Profile_Get_Profile_Len( SNMP_NOTIFY_T * nprof )
This routine gets the length in bytes of notify filter profile.

202
C Wind River SNMP Macro Entries
Proxy Field Access Routines

SNMP_Notify_Profile_Get_Status( ) – get the status


bits16_t SNMP_Notify_Profile_Get_Status
(
SNMP_NOTIFY_FILTER_PROFILE_T * nprof
)
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_Profile_Get_Storage( ) – get the type of storage
bits16_t SNMP_Notify_Profile_Get_Storage(
SNMP_NOTIFY_FILTER_PROFILE_T * nprof
)
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_Profile_Set_Profile( ) – set the notify filter profile
int SNMP_Notify_Profile_Set_Profile(
SNMP_NOTIFY_FILTER_PROFILE_T * nprof,
bits8_t * profile,
ALENGTH_T length,
unsigned int bflags
)
This routine sets the current value of the notify filter profile’s profile field, which
corresponds to the MIB object snmpNotifyFilterProfileName. length is the length of the
profile name. If the value of flags is BFL_IS_ALLOC, this routine allocates new memory
and copies profile into it. If the value of flags is BFL_IS_DYNAMIC, this routine points to
the existing buffer, and frees that memory when the group object is destroyed. If the
value of flags is 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_Profile_Set_Status( ) – set the status
void SNMP_Notify_Profile_Set_Status(
SNMP_NOTIFY_FILTER_PROFILE_T * nprof,
bits16_t status
)
This routine sets the current value for status: ETC_RS_ACTIVE (active), ETC_RS_NIS (not
in service), or ETC_RS_NREADY (not ready).
SNMP_Notify_Profile_Set_Storage( ) – set the type of storage
void SNMP_Notify_Profile_Set_Storage(
SNMP_NOTIFY_FILTER_PROFILE_T * nprof,
bits16_t storage
)
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).

Proxy Field Access Routines


NAME Proxy Field Access Routines – manage fields in the proxy object table

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

Routines SNMP_Proxy_Get_Context_Engine_ID( ) – get the context engine id


bits8_t *SNMP_Proxy_Get_Context_Engine_ID(SNMP_PROXY_T * proxy)
This routine returns a pointer to the context engine id of this proxy object, which
corresponds to the snmpProxyContextEngineId object.
SNMP_Proxy_Get_Context_Engine_ID_Len( ) – get the length of the context engine id
ALENGTH_T SNMP_Proxy_Get_Context_Engine_ID_Len(SNMP_PROXY_T * proxy)
This routine returns the length in bytes of the context engine id.
SNMP_Proxy_Get_Context_Name( ) – get the context name
bits8_t *SNMP_Proxy_Get_Context_Name(SNMP_PROXY_T * proxy)
This routine returns a pointer to the context name of this proxy object, which
corresponds to the snmpProxyContextName object.
SNMP_Proxy_Get_Context_Name_Len( ) – get the length of the context name
ALENGTH_T SNMP_Proxy_Get_Context_Name_Len(SNMP_PROXY_T * proxy)
This routine returns the length in bytes of the context name.
SNMP_Proxy_Get_Multiple_Target_Out( ) – get the snmpProxyMultipleTargetOut string
bits8_t * SNMP_Proxy_Get_Multiple_Target_Out(SNMP_PROXY_T *proxy)
This routine returns the a pointer to the snmpProxyMultipleTargetOut string for this
proxy object.
SNMP_Proxy_Get_Multiple_Target_Out_Len( ) – get length of
snmpProxyMultipleTargetOut string
ALENGTH_T SNMP_Proxy_Get_Multiple_Target_Out_Len(SNMP_PROXY_T * proxy)
This routine returns the length in bytes of the snmpProxyMultipleTargetOut string for
this proxy object.
SNMP_Proxy_Get_Proxy_Name( ) – get the context name
bits8_t *SNMP_Proxy_Get_Proxy_Name(SNMP_PROXY_T * proxy)
This routine returns a pointer to the proxy name of this proxy object, which corresponds
to the snmpProxyName object.
SNMP_Proxy_Get_Proxy_Name_Len( ) – get the length of the proxy name
ALENGTH_T SNMP_Proxy_Get_Proxy_Name_Len(SNMP_PROXY_T * proxy)
This routine returns the length in bytes of the proxy name.
SNMP_Proxy_Get_Single_Target_Out( ) – get the snmpProxySingleTargetOut string
bits8_t * SNMP_Proxy_Get_Single_Target_Out(SNMP_PROXY_T *proxy)
This routine returns the a pointer to the snmpProxySingleTargetOut string for this proxy
object.
SNMP_Proxy_Get_Single_Target_Out_Len( ) – get length of the snmpProxySingleTarget
Out string
ALENGTH_T SNMP_Proxy_Get_Single_Target_Out_Len(SNMP_PROXY_T * proxy)
This routine returns the length in bytes of the snmpProxySingleTargetOut string for this
proxy object.
SNMP_Proxy_Get_Status( ) – get the current row status
etc_status_t SNMP_Proxy_Get_Status(SNMP_PROXY_T * proxy)
This routine returns the current row status of this proxy object: ETC_RS_ACTIVE
(active), ETC_RS_NIS (not in service), or ETC_RS_NREADY (not ready).

204
C Wind River SNMP Macro Entries
Proxy Field Access Routines

SNMP_Proxy_Get_Storage( ) – get the type of storage


etc_storage_t SNMP_Proxy_Get_Storage(SNMP_PROXY_T * proxy)
This routine returns the current value for storage for this proxy object:
ETC_STO_NONVOL (nonvolatile), ETC_STO_VOL (volatile), ETC_STO_PERM
(permanent), ETC_STO_RONLY (read only), or ETC_STO_OTHER (other).
SNMP_Proxy_Get_Target_Params_In( ) – get the snmpProxyTargetParamsIn string
bits8_t * SNMP_Proxy_Get_Target_Params_In(SNMP_PROXY_T *proxy)
This routine returns the a pointer to the snmpProxyTargetParamsIn string for this proxy
object.
SNMP_Proxy_Get_Target_Params_In_Len( ) – get length of the snmpProxyTargetParamsIn
string
ALENGTH_T SNMP_Proxy_Get_Target_Params_In_Len(SNMP_PROXY_T * proxy)
This routine returns the length in bytes of the snmpProxyTargetParamsIn string for this
proxy object.
SNMP_Proxy_Get_Proxy_Type( ) – get the type of proxy
bits8_t SNMP_Proxy_Get_Proxy_Type(SNMP_PROXY_T *proxy)
This routine returns the proxy type of this proxy object: read (1), write (2), trap (3), or
inform (4). This value corresponds to the snmpProxyType object.
SNMP_Proxy_Set_Context_Engine_ID( ) – set the context engine id
int SNMP_Proxy_Set_Context_Engine_ID(
SNMP_PROXY_T * proxy,
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 proxy object. If successful, this
routine returns ENVOY_ERR_NOERR. If there is a memory allocation error, it returns
ENVOY_ERR_INSUFFICIENT_MEMORY.

SNMP_Proxy_Set_Context_Name( ) – set the context name


int SNMP_Proxy_Set_Context_Name(
SNMP_PROXY_T * proxy,
bits8_t * context_name,
ALENGTH_T context_name_len
unsigned int flags
)
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 proxy object. If successful, this
routine returns ENVOY_ERR_NOERR. If there is a memory allocation error, it returns
ENVOY_ERR_INSUFFICIENT_MEMORY.

SNMP_Proxy_Set_Status( ) – set the row status


void SNMP_Proxy_Set_Status(
SNMP_PROXY_T * proxy,
etc_status_t status
)
This routine sets the row status of this proxy object to status: ETC_RS_ACTIVE (active),
ETC_RS_NIS (not in service), or ETC_RS_NREADY (not ready).

SNMP_Proxy_Set_Storage( ) – set the storage type


void SNMP_Proxy_Set_Storage(
SNMP_PROXY_T * proxy,
etc_storage_t storage
)

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).

SNMP_Proxy_Set_Proxy_Type( ) – set the type of proxy


void SNMP_Proxy_Set_Proxy_Type(
SNMP_PROXY_T * proxy,
bits8_t proxy_type
)
This routine sets the proxy type of this proxy object: read (1), write (2), trap (3), or inform
(4). This value corresponds to the snmpProxyType object.
SNMP_Proxy_Set_Multiple_Target_Out( ) – set length of the snmpProxyMultipleTargetOut
string
int SNMP_Proxy_Set_Multiple_Target_Out(
SNMP_PROXY_T * proxy,
bits8_t * multiple_target_out,
ALENGTH_T multiple_target_out_len
unsigned int flags
)
This routine sets the snmpProxyMultipleTargetOut string and length for this proxy object
to multiple_target_out and multiple_target_out_len. The passed-in string is copied into the
proxy object. If successful, this routine returns ENVOY_ERR_NOERR. If there is a
memory allocation error, it returns ENVOY_ERR_INSUFFICIENT_MEMORY.
SNMP_Proxy_Set_Single_Target_Out( ) – set the length of the snmpProxySingleTargetOut
string
int SNMP_Proxy_Set_Single_Target_Out(
SNMP_PROXY_T * proxy,
bits8_ * single_target_out,
ALENGTH_T single_target_out_len
unsigned int flags
)
This routine sets the snmpProxySingleTargetOut string and length for this proxy object to
single_target_out and single_target_out_len. The passed-in string is copied into the proxy
object. If successful, this routine returns ENVOY_ERR_NOERR. If there is a memory
allocation error, it returns ENVOY_ERR_INSUFFICIENT_MEMORY.
SNMP_Proxy_Set_Target_Params_In( ) – set the snmpProxyTargetParamsIn string
int SNMP_Proxy_Set_Target_Params_In(
SNMP_PROXY_T * proxy,
bits8_t * target_params_in,
ALENGTH_T target_params_in_len
unsigned int flags
)
This routine sets the snmpProxyTargetParamsIn and length for this object to
target_params_in and target_params_in_len. The passed-in string is copied into the proxy
object. If successful, this routine returns ENVOY_ERR_NOERR. If there is a memory
allocation error, it returns ENVOY_ERR_INSUFFICIENT_MEMORY.

SNMP Target_Addr Table Field Routines


NAME SNMP Target_Addr Table Field Routines – get and set values in the Target_Addr table

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.

ROUTINES SNMP_Target_Addr_Get_Params( ) – get the params entry name


bits8_t * SNMP_Target_Addr_Get_Params( SNMP_TARGET_ADDR_T * taddr )
This routine returns the name of the params entry for this Target_Addr.
SNMP_Target_Addr_Get_Params_Len( ) - get the length of the params entry name
ALENGTH_T SNMP_Target_Addr_Get_Params_Len( SNMP_TARGET_ADDR_T * taddr )
This routine returns the length of the params string.
SNMP_Target_Addr_Get_Retry_Count( ) – get the retry count
bits16_t SNMP_Target_Addr_Get_Retry_Count( SNMP_TARGET_ADDR_T * taddr )
This routine returns the number of times to retransmit a packet sent to this target
should be before timing the packet out. This value is a number from 0 through 255. The
default is 3.
SNMP_Target_Addr_Get_Status( ) – get the current status
bits16_t SNMP_Target_Addr_Get_Status( SNMP_TARGET_ADDR_T * taddr )
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_Target_Addr_Get_Storage( ) – get the type of storage
bits16_t SNMP_Target_Addr_Get_Storage( SNMP_TARGET_ADDR_T * taddr )
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_Target_Addr_Get_TAddress( ) – get the TAddress
bits8_t * SNMP_Target_Addr_Get_TAddress( SNMP_TARGET_ADDR_T * taddr )
This routine returns the TAddress. The TAddress is the actual address of the target, in
whatever form is appropriate for the domain. The format of the TAddress depends on
the value of the corresponding instance of TDomain, which is defined in RFC 3417. For
example, when TDomain is snmpUDPDomain, then the format of this string is:
4 bytes of IP address (network order) + 2 bytes of port (network order)

SNMP_Target_Addr_Get_TAddress_Len( ) – get the length of the TAddress


ALENGTH_T * SNMP_Target_Addr_Get_TAddress_Len( SNMP_TARGET_ADDR_T * taddr)
This routine gets the length of the TAddress.
SNMP_Target_Addr_Get_Tag_List( ) – get the current tag list
bits8_t SNMP_Target_Addr_Get_Tag_List( SNMP_TARGET_ADDR_T * taddr)
This routine returns the current tag list associated with this Target_Addr.
SNMP_Target_Addr_Get_Tag_List_Len( ) – get the length of the tag list
ALENGTH_T SNMP_Target_Addr_Get_Tag_List_Len( SNMP_TARGET_ADDR_T * taddr )
This routine returns the length in bytes of the current tag list.
SNMP_Target_Addr_Get_Target_MMS( ) – get the maximum message size
bits32_t SNMP_Target_Addr_Get_Target_MMS(SNMP_TARGET_ADDR_T * taddr)

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.

SNMP_Target_Addr_Get_Timeout( ) – get the time-out value


sbits32_t SNMP_Target_Addr_Get_Timeout( SNMP_TARGET_ADDR_T * taddr )
This routine returns the current value of snmpTargetAddrTimeout. It is measured in
100ths of a second. The default value is 1500.
SNMP_Target_Addr_Set_Target_MMS( ) – set the maximum message size
void SNMP_Target_Addr_Set_Target_MMS(
SNMP_TARGET_ADDR_T * taddr,
bits32_t target_mms
)
This routine sets the maximum message size for this Target_Addr object to target_mms.
You must install ENVOY_SNMP_COEXISTENCE before you can use this routine.
SNMP_Target_Addr_Set_Params( ) – set the params entry name
void SNMP_Target_Addr_Set_Params(
SNMP_TARGET_ADDR_T * taddr,
bits8_t * string,
ALENGTH_T string_len,
unsigned int bflags
)
This routine sets a pointer into the target params table that corresponds to the index. If
the value of flags is BFL_IS_ALLOC, this routine allocates new memory and copies
group_name into it. If the value of flags is BFL_IS_DYNAMIC, this routine points to the
existing buffer, and frees that memory when the group object is destroyed. If the value
of flags is BFL_IS_STATIC, this routine points to the existing buffer and does not free the
buffer memory when the group object is destroyed.
SNMP_Target_Addr_Set_Retry_Count( ) – set the retry count
void SNMP_Target_Addr_Set_Retry_Count(
SNMP_TARGET_ADDR_T * taddr,
bits16_t retry_count
)
This routine sets the number of times to retransmit a packet sent to this target should
be before timing the packet out. This value is a number from 0 through 255. The default
is 3.

208
C Wind River SNMP Macro Entries
SNMP Target_Addr Table Field Routines

SNMP_Target_Addr_Set_Status( ) – set the status


void SNMP_Target_Addr_Set_Status(
SNMP_TARGET_ADDR_T * taddr,
bits16_t status
)
This routine sets the current value for status: ETC_RS_ACTIVE (active), ETC_RS_NIS (not
in service), or ETC_RS_NREADY (not ready).
SNMP_Target_Addr_Set_Storage( ) – get the type of storage
void1 SNMP_Target_Addr_Set_Storage(
SNMP_TARGET_ADDR_T * taddr,
bits16_t storage
)
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).
SNMP_Target_Addr_Set_TAddress( ) – set the TAddress
int SNMP_Target_Addr_Set_TAddress(
SNMP_TARGET_ADDR_T * taddr,
bits8_t * string,
ALENGTH_T string_len,
unsigned int flags
)
This routine changes the TAddress to the specified name (string) and length (string_len).
Returns the TAddress. The TAddress is the actual address of the target, in whatever
form is appropriate for the domain. The format of the TAddress depends on the value
of the corresponding instance of TDomain, which is defined in RFC 3417. For example,
when TDomain is snmpUDPDomain, then the format of this string is:
4 bytes of IP address (network order) + 2 bytes of port (network order)
If the value of flags is BFL_IS_ALLOC, this routine allocates new memory and copies
string into it. If the value of flags is BFL_IS_DYNAMIC, this routine points to the existing
buffer, and frees that memory when the group object is destroyed. If the value of flags
is BFL_IS_STATIC, this routine points to the existing buffer and does not free the buffer
memory when the group object is destroyed.
SNMP_Target_Addr_Set_Tag_List( ) – set the tag list
void SNMP_Target_Addr_Set_Tag_List(
SNMP_TARGET_ADDR_T * taddr,
bits8_t * string,
ALENGTH_T string_len,
unsigned int flags
)
This routine sets the tag list for the specified TAddress to string. If the value of flags is
BFL_IS_ALLOC, this routine allocates new memory and copies string into it. If the value
of flags is BFL_IS_DYNAMIC, this routine points to the existing buffer, and frees that
memory when the group object is destroyed. If the value of flags is BFL_IS_STATIC, this
routine points to the existing buffer and does not free the buffer memory when the
group object is destroyed.
A tag list is a list of tags that has no leading whitespace, no trailing whitespace, and that
tags are separated by exactly one of the following whitespace characters:
■ An ASCII space character
■ An ASCII TAB character
■ An ASCII carriage return (CR) character
■ An ASCII line feed (LF) character
A tag is an octet string, preferably in human-readable form, between 1 and 255
characters long and that does not contain a whitespace character.

209
Wind River SNMP
Programmer's Guide, 10.5

SNMP_Target_Addr_Set_TDomain( ) – set the TDomain


int SNMP_Target_Addr_Set_TDomain(
SNMP_TARGET_ADDR_T * taddr,
OIDC_T * oldl,
int oldc
)
This routine sets the current value of 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. If successful, this macro returns 0. Otherwise, it
returns a non-zero number for failure.
SNMP_Target_Addr_Set_TMask( ) – set the target mask
int SNMP_Target_Addr_Set_TMask(
SNMP_TARGET_ADDR_T * taddr,
bits8_t * tmask,
ALENGTH_T tmask_len
unsigned int flags
)
This routine sets the target mask and length for this object to tmask and tmask_len. The
passed-in string is copied into the Target_Addr object. You must install
ENVOY_SNMP_COEXISTENCE before you can use this routine.

SNMP_Target_Addr_Set_Timeout( ) – set the time-out value


void SNMP_Target_Addr_Set_Timeout(
SNMP_TARGET_ADDR_T * taddr,
sbits32_t timeout
)
This routine sets the current value of snmpTargetAddrTimeout. It is measured in 100ths
of a second. The default value is 1500.

SNMP Target Params Table Field Routines


NAME SNMP Target Params Table Field Routines – get and set values in the target params table

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.

ROUTINES SNMP_Target_Params_Get_MP_Model( ) – get the SNMP version number


sbits32_t SNMP_Target_Params_Get_MP_Model( SNMP_TARGET_PARAMS_T * tparam )
This routine returns the current value of the SNMP version, which corresponds to the
MIB object snmpTargetParamsMPModel. The only supported value is
SNMP_VERSION_3.

SNMP_Target_Params_Get_Status( ) – get the current status


bits16_t SNMP_Target_Params_Get_Status( SNMP_TARGET_PARAMS_T * tparam )
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_Target_Params_Get_Sec_Level( ) – get the current security level
bits16_t SNMP_Target_Params_Get_Sec_Level( SNMP_TARGET_PARAMS_T * tparam )
This routine returns the current value of the security level as one of the following
values: ETC_SEC_LEVEL_NONE (none), ETC_SEC_LEVEL_AUTH (authentication) or

210
C Wind River SNMP Macro Entries
SNMP Target Params Table Field Routines

ETC_SEC_LEVEL_PRIV (authentication and privacy). Definitions for these tags are


contained in the file snmpdefs.h.
SNMP_Target_Params_Get_Sec_Model( ) – get the current security model
sbits32_t SNMP_Target_Params_Get_Sec_Model( SNMP_TARGET_PARAMS_T * tparam )
This routine returns the current value of the security model, which indicates the type of
security that the target uses. This corresponds to the MIB object
snmpTargetParamsSecModel. The only supported value is ETC_SEC_MODEL_USM,
which is defined in RFC 2574 User-Based Security Model.
SNMP_Target_Params_Get_Sec_Name( ) – get the current security name
bits8_t * SNMP_Target_Params_Get_Sec_Name( SNMP_TARGET_PARAMS_T * tparam )
This routine returns the current value of the security user name.
SNMP_Target_Params_Get_Sec_Name_Len( ) – get the length of the security name
ALENGTH_T SNMP_Target_Params_Get_Sec_Name_Len( SNMP_TARGET_PARAMS_T * tparam)
This routine returns the length in bytes of the security user name.
SNMP_Target_Params_Get_Storage( ) – get the type of storage
bits16_t SNMP_Target_Params_Get_Storage( SNMP_TARGET_PARAMS_T * tparam )
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_Target_Params_Set_MP_Model( ) – set the SNMP version number
void SNMP_Target_Params_Set_MP_Model(
SNMP_TARGET_PARAMS_T * tparam,
sbits32_t mpmodel
)
This routine sets the current value of the SNMP version, which corresponds to the MIB
object snmpTargetParamsMPModel. The only supported value is SNMP_VERSION_3.
SNMP_Target_Params_Set_Status( ) – set the status
void SNMP_Target_Params_Set_Status(
SNMP_TARGET_PARAMS_T * tparam,
bits16_t status
)
This routine sets the current value for status: ETC_RS_ACTIVE (active), ETC_RS_NIS (not
in service), or ETC_RS_NREADY (not ready).
SNMP_Target_Params_Set_Sec_Level( ) – set the security level
void SNMP_Target_Params_Set_Sec_Level(
SNMP_TARGET_PARAMS_T * tparam,
bits16_t sec_level
)
This routine sets the current value of the security level as one of the following values:
ETC_SEC_LEVEL_NONE (none), ETC_SEC_LEVEL_AUTH (authentication) or
ETC_SEC_LEVEL_PRIV (authentication and privacy). Definitions for these tags are
contained in the file snmpdefs.h.
SNMP_Target_Params_Set_Sec_Model( ) – set the security model
void SNMP_Target_Params_Set_Sec_Model(
SNMP_TARGET_PARAMS_T * tparam,
sbits32_t sec_model
)
This routine sets the current value of the security model, which indicates the type of
security that the target uses. This corresponds to the MIB object

211
Wind River SNMP
Programmer's Guide, 10.5

snmpTargetParamsSecModel. The only supported value is ETC_SEC_MODEL_USM,


which is defined in RFC 2574 User-Based Security Model.
SNMP_Target_Params_Set_Sec_Name( ) – set the security name
int SNMP_Target_Params_Set_Sec_Name(
SNMP_TARGET_PARAMS_T * tparam,
bits8_t * sec_name,
ALENGTH_T sec_name_len,
unsigned int bflags
)
This routine sets the current value of the security user name. If the value of flags is
BFL_IS_ALLOC, this routine allocates new memory and copies sec_name and sec_id into
it. If the value of flags is BFL_IS_DYNAMIC, this routine points to the existing buffer, and
frees that memory when the group object is destroyed. If the value of flags is
BFL_IS_STATIC, this routine points to the existing buffer and does not free the buffer
memory when the group object is destroyed.
If authentication and encryption are selected, the values of sec_name and sec_id are used
directly in the packet as an index. The value of bflags indicates whether the tparam can
be used directly and deleted (BFL_IS_DYNAMIC), used directly and kept
(BFL_IS_STATIC), or must be copied into newly allocated memory (BFL_IS_ALLOC). If
successful, this macro returns 0. Otherwise, it returns a non-zero number for failure.
SNMP_Target_Params_Set_Storage( ) – set the type of storage
void1 SNMP_Target_Params_Set_Storage(
SNMP_TARGET_PARAMS_T * tparam,
bits16_t storage
)
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).

SNMPv3 User Table Field Routines


NAME SNMPv3 User Table Field Routines – get and set values in the user table

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.

ROUTINES SNMP_User_Get_Public( ) – get the public string


bits8_t * SNMP_User_Get_Public( SNMP_USER_T * user )
This routine gets a pointer to the public string.
SNMP_User_Get_Public_Len( ) – get the length of the public string
ALENGTH_T SNMP_User_Get_Public_Len( SNMP_USER_T * user )
This routine gets the length of the public string.
SNMP_User_Get_Status( ) – get the current status
sbits16_t SNMP_User_Get_Status( SNMP_USER_T * user )
This routine gets the current value for status: ETC_RS_ACTIVE (active), ETC_RS_NIS
(not in service), or ETC_RS_READY (not ready).
SNMP_User_Get_Storage( ) – get the type of storage
sbits16_t SNMP_User_Get_Storage( SNMP_USER_T * user )

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).

SNMPv3 User Table Key Routines


DESCRIPTION SNMPv3 User Table Key Routines – allow you to manage access key information

ROUTINES SNMP_User_Get_Auth( ) – get the authentication structure


SNMP_AUTH_T * SNMP_User_Get_Auth( SNMP_USER_T * user )
This routine returns a pointer to the authentication structure with this user entry.
SNMP_User_Get_AuthKey( ) – get the authentication key
bits8_t * SNMP_User_Get_AuthKey( SNMP_USER_T * user )
This routine returns a pointer to the authentication key associated with this user entry.
SNMP_User_Get_Priv( ) – get the privacy structure
SNMP_PRIV_T * SNMP_User_Get_Priv( SNMP_USER_T * user )
This routine returns a pointer to the privacy structure with this user entry.
SNMP_User_Get_PrivKey( ) – get the privacy key
bits8_t * SNMP_User_Get_PrivKey( SNMP_USER_T * user )
This routine returns a pointer to the privacy key associated with this user entry.
SNMP_User_Set_AuthKey( ) – set the authentication key
int SNMP_User_Set_AuthKey(
SNMP_USER_T * user,
bits8_t * key,
ALENGTH_T key_length
)
This routine sets the authentication key associated with this user entry. You can obtain
the key_length from the authentication structure. If key_length exactly matches the length
found in the authentication structure, this macro overwrites the current key with key
and returns 0. If the user entry does not have an authentication structure or key_length
is incorrect, this macro fails with a return code of 1.

213
Wind River SNMP
Programmer's Guide, 10.5

SNMP_User_Set_PrivKey( ) – set the privacy key


int SNMP_User_Set_PrivKey(
SNMP_USER_T * user,
bits8_t * key,
ALENGTH_T key_length
)
This routine sets the privacy key associated with this user entry. You can obtain the
key_length from the privacy structure. If key_length exactly matches the length found in
the privacy structure, this macro overwrites the current key with key and returns 0. If
the user entry does not have an privacy structure or key_length is incorrect, this macro
fails with a return code of 1.

SNMPv3 Access Table Field Routines


NAME SNMPv3 Access Table Field Routines – get and set values in the access table

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.

ROUTINES SNMP_V3_Access_Get_Prefix_Match( ) – get the current value of match


int SNMP_V3_Access_Get_Prefix_Match( SNMP_ACCESS_T * access )
This routine gets the current value for the field that determines whether the context
must match exactly (ETC_ACCESS_EXACT) or if a prefix (ETC_ACCESS_PREFIX) is
acceptable.
SNMP_V3_Access_Get_Status( ) – get the current status
int SNMP_V3_Access_Get_Status( SNMP_ACCESS_T * access )
This routine gets the current value for status: ETC_RS_ACTIVE (active), ETC_RS_NIS
(not in service), or ETC_RS_READY (not ready).
SNMP_V3_Access_Get_Storage( ) – get the type of storage
int SNMP_V3_Access_Get_Storage( SNMP_ACCESS_T * access )
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_V3_Access_Set_Prefix_Match( ) – set the value of match
void SNMP_V3_Access_Set_Prefix_Match(
SNMP_ACCESS_T * access,
int value
)
This routine sets the current value for the field that determines whether the context
must match exactly (ETC_ACCESS_EXACT) or if a prefix (ETC_ACCESS_PREFIX) is
acceptable.
SNMP_V3_Access_Set_Status( ) – set the status
void SNMP_V3_Access_Set_Status(
SNMP_ACCESS_T * access,
int 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).

214
C Wind River SNMP Macro Entries
SNMPv3 Access Table View Routines

SNMP_V3_Access_Set_Storage( ) – set the type of storage


void SNMP_V3_Access_Set_Storage(
SNMP_ACCESS_T * access,
int 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).

SNMPv3 Access Table View Routines


DESCRIPTION SNMPv3 Access Table View Routines – allow you to manage view strings
These routines allow you to set or get view strings in the access table. There are three views
to choose from:
READ
Use to process GET, GET NEXT, and GET BULK requests
WRITE
Use to process SET requests
NOTIFY
Use to process TRAP2 and INFORM requests

ROUTINES SNMP_V3_Access_Get_Notify( ) – get the NOTIFY string


bits8_t * SNMP_V3_Access_Get_Notify( SNMP_ACCESS_T * access )
This routine returns a pointer to the NOTIFY view string in the access table.
SNMP_V3_Access_Get_Notify_Len( ) – get the length of the NOTIFY string
ALENGTH_T SNMP_V3_Access_Get_Notify_Len( SNMP_ACCESS_T * access )
This routine returns the length of the NOTIFY view string in the access table.
SNMP_V3_Access_Get_Read( ) – get the READ string
bits8_t * SNMP_V3_Access_Get_Read( SNMP_ACCESS_T * access )
This routine returns a pointer to the READ view string in the access table.
SNMP_V3_Access_Get_Read_Len( ) – get the length of the READ string
ALENGTH_T SNMP_V3_Access_Get_Read_Len( SNMP_ACCESS_T * access )
This routine returns the length of the READ view string in the access table.
SNMP_V3_Access_Get_Write( ) – get the WRITE string
bits8_t * SNMP_V3_Access_Get_Write( SNMP_ACCESS_T * access )
This routine returns a pointer to the WRITE view string in the access table.
SNMP_V3_Access_Get_WriteLen( ) – get the length of the WRITE string
ALENGTH_T SNMP_V3_Access_Get_WriteLen( SNMP_ACCESS_T * access )
This routine returns the length of the WRITE view string in the access table.

215
Wind River SNMP
Programmer's Guide, 10.5

SNMP_V3_Access_Set_Notify( ) – set the NOTIFY string


int SNMP_V3_Access_Set_Notify(
SNMP_ACCESS_T * access,
bits8_t * view,
ALENGTH_T view_length,
unsigned int flags
)
This routine changes the NOTIFY view string in the access table. *view points to the new
view string, which is view_length bytes long. If the value of flags is BFL_IS_ALLOC, this
routine allocates new memory and copies view_name into it. If the value of flags is
BFL_IS_DYNAMIC, this routine points to the existing buffer, and frees that memory
when the group object is destroyed. If the value of flags is BFL_IS_STATIC, this routine
points to the existing buffer and does not free the buffer memory when the group object
is destroyed.
SNMP_V3_Access_Set_Read( ) – set the READ string
int SNMP_V3_Access_Set_Read(
SNMP_ACCESS_T * access,
bits8_t * view,
ALENGTH_T view_length,
unsigned int flags
)
This routine changes the READ view string in the access table. *view points to the new
view string, which is view_length bytes long. If the value of flags is BFL_IS_ALLOC, this
routine allocates new memory and copies view_name into it. If the value of flags is
BFL_IS_DYNAMIC, this routine points to the existing buffer, and frees that memory
when the group object is destroyed. If the value of flags is BFL_IS_STATIC, this routine
points to the existing buffer and does not free the buffer memory when the group object
is destroyed.
SNMP_V3_Access_Set_Write( ) – set the WRITE string
int SNMP_V3_Access_Set_Write(
SNMP_ACCESS_T * access,
bits8_t * view,
ALENGTH_T view_length,
unsigned int flags
)
This routine changes the WRITE view string in the access table. *view points to the new
view string, which is view_length bytes long. If the value of flags is BFL_IS_ALLOC, this
routine allocates new memory and copies view_name into it. If the value of flags is
BFL_IS_DYNAMIC, this routine points to the existing buffer, and frees that memory
when the group object is destroyed. If the value of flags is BFL_IS_STATIC, this routine
points to the existing buffer and does not free the buffer memory when the group object
is destroyed.

SNMP View Routines


NAME SNMP View Routines – manipulate views and access the view table

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.

ROUTINES SNMP_View_Get_Mask( ) – get the mask


OCTET_T * SNMP_View_Get_Mask( VIEWLEAF_T * view )
This routine returns the mask.
SNMP_View_Get_MaskLen( ) – get the length of the mask
ALENGTH_T SNMP_View_Get_MaskLen( VIEWLEAF_T * view )
This routine returns the length in bytes of the mask.
SNMP_View_Get_Status( ) – get the current status
int SNMP_View_Get_Status( VIEWLEAF_T * view )
This routine returns the status.
SNMP_View_Get_StorageType( ) – get the type of storage
int SNMP_View_Get_StorageType( VIEWLEAF_T * view )
This routine returns the storage type.
SNMP_View_Get_Subtree( ) – get the subtree
OIDC_T * SNMP_View_Get_Subtree( VIEWLEAF_T * view )
This routine returns the subtree.
SNMP_View_Get_Subtree_Len( ) – get the length of the subtree
int SNMP_View_Get_Subtree_Len( VIEWLEAF_T * view )
This routine returns the length in bytes of the subtree.
SNMP_View_Get_Type( ) – get the type
int SNMP_View_Get_Type( VIEWLEAF_T * view )
This routine returns the type.
SNMP_View_Set_Status( ) – set the status
SNMP_View_Set_Status(
VIEWLEAF_T * view ,
int value
)
This routine sets the status.
SNMP_View_Set_StorageType( ) – set the type of storage
SNMP_View_Set_StorageType(
VIEWLEAF_T * view ,
int value
)
This routine sets the storage type.
SNMP_View_Set_Type( ) – set the type
SNMP_View_Set_Type(
VIEWLEAF_T * view ,
int value
)
This routine sets the type.

217
Wind River SNMP
Programmer's Guide, 10.5

Unsigned 64-bit Integer Routines


NAME Unsigned 64-bit Integer Routines – manipulate 64-bit integers

DESCRIPTION Wind River SNMP provides a number of macros to manipulate the 64-bit unsigned integer
structure UINT_64_T.

ROUTINES UI64_Add32( ) – add two numbers


void UI64_Add32(
UINT_64_T * number,
UINT_32_T addend
)
This routine adds addend to number and, if necessary, wraps.
UI64_Add64( ) – add two 64-bit numbers
void UI64_Add64(
UINT_64_T * number1,
UINT_64_T * number2
)
This routine adds two 64-bit numbers together, stores the result in number1, and, if
necessary, wraps.
UI64_Compare( ) – compare two number
int UI64_Compare(
UINT_64_T * X,
UINT_64_T * Y
)
This routine compares two 64-bit unsigned integers. The return value is 1 if
X > Y, 0 if X = Y, and -1 if X < Y.
UI64_Copy( ) – copy a number
void UI64_Copy(
UINT_64_T * destination,
UINT_64_T * source
)
This routine copies the values from source to destination.
UI64_High( ) – return the high half of a number
UINT_32_T UI64_High( UINT_64_T * number )
This routine returns the high half of number.
UI64_Increment( ) – increment a number by 1
void UI64_Increment( UINT_64_T * number )
This routine increments number by 1 and, if necessary, wraps.
UI64_Low( ) – return the low half of a number
UINT_32_T UI64_Low( UINT_64_T * number )
This routine returns the low half of number.
UI64_Set( ) – set a number
void UI64_Set(
UINT_64_T * number,
INT_32_T high,
INT_32_T low
)
This routine sets the 64-bit number pointed to by number to have a high half of high and
a low half of low.

218
C Wind River SNMP Macro Entries
Unsigned 64-bit Integer Routines

UI64_Sub64( ) – subtract one number from another


void UI64_Sub64(
UINT_64_T * result,
UINT_64_T * X,
UINT_64_T * Y
)
This routine subtracts Y from X and stores the result in result and, if necessary, wraps.
UI64_Zero( ) – set both halves of a number to 0
void UI64_Zero( UINT_64_T * number )
This routine sets both halves of number to zero.

219
Wind River SNMP
Programmer's Guide, 10.5

220
Index

Symbols agentx 99
creating 73

/dev/kmem 83 ALENGTH_T data type 45


ARC( ) 79
asn1conf.h file 45
ATVALUE_T data type 45
A authentication
SNMPv3 66
access tables 62 configuring 34
Add_Node_From_Root( ) 81 authentication traps 95
Advanced Encryption Standard, see AES 67 AX_RESPONSE_PREPROCESS( ) 44, 152
AES 12, 67
agent 77–99
completion routines, writing 78
context tables and 62 B
cookie field 87
definition 11 big-endian 140
method routines, processing 86 bits16_t data type 45
MIB compiler interactions 80 bits32_t data type 45
MIB variables 78 bits8_t data type 45
outer structure 78 build_object_id( ) 195
proxy code, including 97
row creation and 90
simple 10 C
examples 10
view scheme, using the RFC 2575 96 char* 41
AgentX 69–75 Clean_Obj_ID( ) 195
code examples 99 client 2, 101
completion routines 70 outer structure 101
configuration macros 43 clone_object_id( ) 195
configuring options 39 code examples
definition 1 AgentX 99
EBUFFER_T 73 row creation 141
ENVOY_AX_CHUNK_T 73 coexistence 40
ENVOY_AX_SASB_T 73 SNMPv3 56
master agent 69, 98 command generator 11
creating 71 command responder 11
mib.c output mode 73 COMMON_DYNAMIC_COMP_CONFIG 35
OBJ_ID_T 73 community field access routines 196
requirements 98 community table 64
RFC2741 70 compiler, see MIB compiler
RFC2742 70 completion routines 130
subagent 69, 98 AgentX 70

221
Wind River SNMP
Programmer's Guide, 10.5

configuration macros 124 engine ID


configuring 32–44 contexts 51
dynamically 35 foreign information 61
routines, required 41 local information 61
SNMPv1 33 SNMPv3 51
SNMPv2 33 ENGINE_LEAF_T data type 49
SNMPv3 33 entry points 121
contexts 51 envoy.cfg 32, 33
table, adding to 62 envoy.h 41
conversion routines 123 AgentX macros, defining 43
cookie field 87 locking and 43
copy_object_id( ) 195 method routine macros, defining 64
COUNTER packet tracing routines, defining 43
bits32_t data type 45 private field, using 43
SET REQUEST user exits, defining 43
view table macros, defining 97
envoy.h file
D user-supplied code 121
ENVOY_ADD_ENGINE_ADDRESS( ) 61, 131
data types 45–50
ENVOY_ADD_ENGINE_ID( ) 61, 131
see also individual data types
ENVOY_AGENTX 35
general 45
ENVOY_AX_ADD_T( ) 130
generic tree 48
AgentX 70
location 45
ENVOY_AX_ADMIN_T( ) 130
MIB tree 47
AgentX 70
obsolete 46
ENVOY_AX_CHUNK_T variable 73
RFC1155 47
ENVOY_AX_CONN_ENTRY( ) 44, 131
RFC2275 48
ENVOY_AX_COOKIE_CMP( ) 44, 131
RFC2578 47
ENVOY_AX_DEFAULT_TIMEOUT( ) 44
RFC3413 50
ENVOY_AX_ERROR_T( ) 130
RFC3414 50
AgentX 70
RFC3415 48, 49
ENVOY_AX_FIND_MIB( ) 44, 131
RFC3594 49
ENVOY_AX_GET_CONNID( ) 44, 131
SNMP packet representation 47
ENVOY_AX_MA_AC_ADD( ) 44, 131
SNMPv3 49
ENVOY_AX_MA_AC_CLEAN( ) 44, 131
typedefs 45
ENVOY_AX_MA_AC_REMOVE( ) 44, 132
view 48
envoy_ax_ma_cleanup_sessions( ) 98
decoder 8
envoy_ax_ma_handler( ) 98
demo directory 121
envoy_ax_sa_handler( ) 99
ENVOY_AX_SA_MIB_ROOT_NODE( ) 44, 132
envoy_ax_sa_state_create( ) 98
E envoy_ax_sa_state_init( ) 98
ENVOY_AX_SA_TIMEOUT( ) 44
EBUFFER_T data type 46 ENVOY_AX_SASB_T variable 73
EBUFFER_T variable 73 ENVOY_AX_SEND_T( )
EBufferAllocateLoad( ) 193 AgentX 70
EBufferClean( ) 193 ENVOY_AX_TRANSLATE_CONTEXT( ) 44, 132
EBufferClone( ) 193 ENVOY_AX_TRANSPORTS_SUPPORTED( ) 44
EBufferInitialize( ) 194 ENVOY_CALL_TIMER( ) 42, 125
EBufferNext( ) 194 AgentX 70
EBufferPreLoad( ) 194 ENVOY_DEFAULT_MIB_ROOT_NODE( ) 43, 124
EBufferRemaining( ) 194 default MIB tree root, changing 79
EBufferReset( ) 194 envoy_err_t data type 46
EBufferSetup( ) 194 ENVOY_GET_SYSUPTIME( ) 44, 132
EBufferStart( ) 194 ENVOY_LOCK_T 43
EBufferUsed( ) 194 ENVOY_NOW( ) 42, 124
encoder 8 ENVOY_SEND_SNMP_PROXY( ) 54
END_OF_ARC_LIST( ) 79 ENVOY_SET_RETRANS_ID( ) 42, 132
ENVOY_SNMP_FREE_LOCK_TAG( ) 43, 126

222
Index

ENVOY_SNMP_GET_READ_LOCK( ) 43, 126 getproc_got_uint64( ) 110


ENVOY_SNMP_GET_WRITE_LOCK( ) 43, 126 getproc_got_uint64_high_low( ) 110
ENVOY_SNMP_INIT_LOCK( ) 43, 125 getproc_nosuchins( ) 110
ENVOY_SNMP_INIT_LOCK_TAG( ) 43, 125 getproc_started( ) 110
tag parameter values 125 group tables 62
ENVOY_SNMP_LOCK( ) 43, 126 group_by_getproc_and_instance( )
ENVOY_SNMP_LOCK_EXTERN( ) 43 row creation 92
ENVOY_SNMP_PROXY 38 VarBinds, grouping 87
ENVOY_SNMP_RELEASE_READ_LOCK( ) 43, 126
ENVOY_SNMP_RELEASE_WRITE_LOCK( ) 43, 126
ENVOY_SNMPADDR_TO_TADDRESS( ) 42, 132
ENVOY_TADDRESS_TO_SNMPADDR( ) 42, 123 H
ENVOY_TIME( ) 42, 124
handlers, user-supplied 130
ERROR_COMPLETE_T( ) 130
heap 34
ETC_STATUS_T data type 49
ETC_STORAGE_T data type 49
extended buffers management routines 193
I
index_to_vbp( ) 87
F init_object_id( ) 196
install.h 33
files
IO_COMPLETE_T( ) 131
asn1conf.h 45
it_exists_async( ) 82, 107
oemtypes.h 45
types.h 45
free( ) 101
L
last match 106
G LCL_FILE data type 46
LEAF 81
GAUGE
leaf 83
bits32_t data type 45
LEAF_ASY 81
GEN_ERR 89
LEAF_ASYS 81
generic tree data types 48
example 83
GET BULK PDUs 89
LEAF_COM 81
GET NEXT PDUs 89
LEAF_COMS 81
GET PDUs 88
LEAF_NT_ASYS( ) 79
get_int_async( ) 107
LEAF_NT_COMS( ) 79
get_ip_address_async( ) 107
LEAFM 81
get_object_identifier_async( ) 107
little-endian 140
get_string_async( ) 107
locator 87
get_TestAndIncr_async( ) 107
locking 36
get_ui64_async( ) 107
ENVOY_SNMP_INIT_LOCK_TAG( ) tags 125
get_uint_async( ) 107
routines for 43, 125
getpdu.c 88
getproc 79
getproc operation 104
getproc routine 108 M
getproc_error( ) 109
getproc_got_* 89 macros
getproc_got_empty( ) 109 RFC2275 view 136
getproc_got_int32( ) 109 SNMPv3 method routine 132
getproc_got_ip_address( ) 109 makefile.cfg 32
getproc_got_object_id( ) 109 makmak utility 32–40
getproc_got_octet_string( ) 109 header configuration files, including 40
getproc_got_string( ) 110 malloc( ) 101
getproc_got_uint32( ) 110 Management Information Base, see MIB

223
Wind River SNMP
Programmer's Guide, 10.5

management station 5 min( ) 42, 123


manager
simple 10
master agent 98
max( ) 42, 122 N
MAX_OID_COUNT( ) 41, 127
network management
MEMCMP( ) 41, 122
SNMP model 2
memcmp( ) 124
nextpdu.c 89
MEMCMP_NULLOK( ) 124
nextproc 79
MEMCPY( ) 41, 122
nextproc operation 104
memcpy( ) 124
nextproc routine 111
MEMSET( ) 122
nextproc_error( ) 112
memset( ) 124
nextproc_next_instance( ) 89, 112
method routines 103–118
nextproc_next_instance_string( ) 112
last match 106
nextproc_no_next( ) 89, 112
MIB variables, accessing 104
nextproc_started( ) 112
objects, accessing 86
NODE( ) 79
processing 103
notifications 95
prototype API 105
originator 11
RFC2275 view macros 136
receiver 11
scalar variables 105
SNMPv3 53
SNMPv3 macros 64
notify filter profile table 63
standard, SNMP-supplied 106
notify filter table 63
SVMPv3 macros 132
notify table 63
tabular variables 105
notify_cleanup 95
writing 104
notify_complete 95
MIB compiler, using 103
notify_err_complete 95
MIB
null_set_async( ) 108
attributes 2
nvutils.c 60
definition 2
variables
accessing 104
setting 103 O
MIB compiler
agent interactions 80 OBJ_ID_T data type 46
troubleshooting 139–140 OBJ_ID_T variable 73
warnings 139 object identifier management routines 195
MIB leaf 83 object instance 86
MIB tree 79 obsolete data types 46
extending 80 OCTET_T data type 46
multiple 43 oemtypes.h 40
root 79 oemtypes.h file 45
variables, connecting to system 81 OIDC_T data type 46
MIB tree data types 47 operations
mib.c 79 getproc 104
MIB root 80 nextproc 104
mib.c output mode setproc 105
AgentX 73 testproc 105
mib.h undoproc 105
MIB tree, creating 79
mib_root_node 79
MIBARC_T data type 47, 79
MIBLEAF_T P
troubleshooting 140
VarBind aggregation 87 Packet Generator 9
MIBLEAF_T data type 47 per VarBind multiplexing 98
method routines, writing 104 private field 88
MIBLEAF_T leaves, defining 79 Process_Rcvd_SNMP_Packet_Async( ) 78
MIBNODE_T data type 47, 79 proxies 38

224
Index

forwarding 59 required 41, 122


SNMPv3 53 setproc 114
configuring 38 SNMP group table field 198
proxy field access routines 203 SNMP Notify Filter Profile Table field 202
proxy forwarder 12 SNMP Notify Filter Table field 201
proxy table 64 SNMP Notify Table field 199
PROXY_BLOCK_T data type 98 SNMP Target Params Table field 210
PROXY_ROUTINE_T( ) 131 SNMP Target_Addr Table field 206
PTR_T data type 41, 46 SNMP view 216
SNMPv3 Access Table field 214
SNMPv3 Access Table view 215
SNMPv3 User Table field 212
R SNMPv3 User Table key 213
system, required 124
READ_ACCESS 82
testproc 112
READ_CREATE_ACCESS 96
timer 123
READ_WRITE_ACCESS 82
undoproc 115
writable objects and 96
unsigned 64-bit integer 218
Received Packet Manager 8
row creation 90
Remove_Node_From_Root( ) 81
code example 141
RETRANS_CLEANUP_T( ) 131
RowStatus 91
RFC 2575
view scheme 96
RFC1155
data types 47 S
RFC1157
tabular variables 105 sbits16_t data type 46
RFC1213 sbits32_t data type 46
tabular variables 105 sbits8_t data type 46
RFC2275 SCALAR 82
data types 48 scalar variables
view method routine macros 136 method routines, in 105
RFC2578 scan_vb_for_locator( ) 87
data types 47 serialization 37
instances 105 server 2
RFC2741 server, see agent
AgentX 70 SET
RFC2742 multi-stage requests 133
AgentX 70 SET REQUEST PDUs 89
RFC3413 undoing 90
data types 50 set_int_async( ) 107
RFC3414 set_TestAndIncr_async( ) 108
data types 50 set_uint_async( ) 108
RFC3415 setpdu.c 89
data types 48, 49 setproc 79
RFC3584 setproc operation 105
data types 49 setproc routine 114
RFCs setproc_error( ) 115
SNMP-related 17 setproc_good( ) 115
routines setproc_started( ) 115
see also method routines and individual routines SNMP 11
community field access 196 client 2
conversion 123 network management 2
extended buffers, for managing 193 server 2
getproc 108 statistics 34
method 103–118 SNMP group table field routines 198
nextproc 111 SNMP Notify Filter Profile Table field routines 202
object identifiers, for managing 195 SNMP Notify Filter Table field routines 201
proxy field access 203 SNMP Notify Table field routines 199

225
Wind River SNMP
Programmer's Guide, 10.5

SNMP Target Params Table field routines 210 SNMP_Notify_Filter_Get_Mask( ) 201


SNMP Target_Addr Table field routines 206 SNMP_Notify_Filter_Get_Mask_Len( ) 201
SNMP TRAP 93 SNMP_Notify_Filter_Get_Status( ) 201
SNMP view routines 216 SNMP_Notify_Filter_Get_Storage( ) 201
SNMP_ACC_GRP_T data type 49 SNMP_Notify_Filter_Get_Type( ) 201
SNMP_ACCESS_T data type 49 SNMP_Notify_Filter_Install( ) 63
SNMP_Auth_Add( ) 67 SNMP_NOTIFY_FILTER_PROFILE_T data type 49
SNMP_AUTH_T data type 49 SNMP_Notify_Filter_Set_Mask( ) 202
SNMP_community_coexistence_lookup( ) 42 SNMP_Notify_Filter_Set_Status( ) 63
SNMP_Community_Create( ) 64 SNMP_Notify_Filter_Set_Status( ) 202
SNMP_Community_Get_Con_ID( ) 196 SNMP_Notify_Filter_Set_Storage( ) 202
SNMP_Community_Get_Con_ID_Len( ) 196 SNMP_Notify_Filter_Set_Type( ) 202
SNMP_Community_Get_Con_Name( ) 196 SNMP_NOTIFY_FILTER_T data type 49
SNMP_Community_Get_Con_Name_Len( ) 196 SNMP_Notify_Get_Status( ) 200
SNMP_Community_Get_Index( ) 196 SNMP_Notify_Get_Storage( ) 200
SNMP_Community_Get_Index_Len( ) 196 SNMP_Notify_Get_Tag( ) 200
SNMP_Community_Get_Name( ) 196 SNMP_Notify_Get_Tag_Len( ) 200
SNMP_Community_Get_Name_Len( ) 196 SNMP_Notify_Get_Type( ) 200
SNMP_Community_Get_Sec_Name( ) 196 SNMP_Notify_Install( ) 63
SNMP_Community_Get_Sec_Name_Len( ) 197 SNMP_Notify_Profile_Create( ) 63
SNMP_Community_Get_Status( ) 197 SNMP_Notify_Profile_Get_Profile( ) 202
SNMP_Community_Get_Storage( ) 197 SNMP_Notify_Profile_Get_Profile_Len( ) 202
SNMP_Community_Get_Tag( ) 197 SNMP_Notify_Profile_Get_Status( ) 203
SNMP_Community_Get_Tag_Len( ) 197 SNMP_Notify_Profile_Get_Storage( ) 203
SNMP_Community_Install( ) 64 SNMP_Notify_Profile_Install( ) 63
SNMP_Community_Set_Con_ID( ) 197 SNMP_Notify_Profile_Set_Profile( ) 63
SNMP_Community_Set_Con_Name( ) 197 SNMP_Notify_Profile_Set_Profile( ) 203
SNMP_Community_Set_Name( ) 64 SNMP_Notify_Profile_Set_Status( ) 63
SNMP_Community_Set_Name( ) 197 SNMP_Notify_Profile_Set_Status( ) 203
SNMP_Community_Set_Sec_Name( ) 64 SNMP_Notify_Profile_Set_Storage( ) 203
SNMP_Community_Set_Sec_Name( ) 198 SNMP_Notify_Set_Status( ) 200
SNMP_Community_Set_Status( ) 64 SNMP_Notify_Set_Storage( ) 200
SNMP_Community_Set_Status( ) 198 SNMP_Notify_Set_Tag( ) 200
SNMP_Community_Set_Storage( ) 198 SNMP_Notify_Set_Type( ) 201
SNMP_Community_Set_Tag( ) 198 SNMP_NOTIFY_T data type 49
SNMP_COMMUNITY_T data type 49 SNMP_PKT_T 96
SNMP_CONTEXT_T data type 49 SNMP_PKT_T data type 48, 98
SNMP_Continue( ) 37 SNMP_Priv_Add( ) 67
SNMP_Create_Request2( ) 94 SNMP_Priv_Add_AESCFB128( ) 68
SNMP_DH_RAND( ) 132 SNMP_PRIV_T data type 50
SNMP_Engine_Install( ) 61 SNMP_Proxy_Create( ) 64
SNMP_Engine_Set_Address( ) 61 SNMP_Proxy_Install( ) 64
SNMP_Engine_Set_My_Info( ) 61 SNMP_Proxy_Set_Status( ) 64
SNMP_Group_Create( ) 62 SNMP_PROXY_T data type 49
SNMP_Group_Get_Group( ) 198 SNMP_release_private( ) 43, 128
SNMP_Group_Get_Group_Len( ) 199 SNMP_Send_Notify( ) 95
SNMP_Group_Get_Status( ) 199 SNMP_Send_Notify_Name( ) 58
SNMP_Group_Get_Storage( ) 199 SNMP_Target_Addr_Create( ) 62
SNMP_Group_Install( ) 62 SNMP_Target_Addr_Get_Params( ) 207
SNMP_Group_Set_Group( ) 199 SNMP_Target_Addr_Get_Params_Len( ) 207
SNMP_Group_Set_Status( ) 199 SNMP_Target_Addr_Get_Retry_Count( ) 207
SNMP_Group_Set_Storage( ) 199 SNMP_Target_Addr_Get_Status( ) 207
SNMP_GROUP_T data type 49 SNMP_Target_Addr_Get_Storage( ) 207
SNMP_MAX_PACKET_SIZE( ) 42, 127 SNMP_Target_Addr_Get_TAddress( ) 207
SNMP_memory_alloc( ) 42, 128 SNMP_Target_Addr_Get_TAddress_Len( ) 207
heap, allocating from 34 SNMP_Target_Addr_Get_Tag_List( ) 207
SNMP_memory_free( ) 42, 128 SNMP_Target_Addr_Get_Tag_List_Len( ) 207
SNMP_Notify_Create( ) 63 SNMP_Target_Addr_Get_TDomain( ) 208
SNMP_Notify_Filter_Create( ) 63 SNMP_Target_Addr_Get_Timeout( ) 208

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

SNMP_V3_NOTIFY_DESTROY_UNDO( ) 66 SNMP_validate_address( ) 42, 129


SNMP_V3_NOTIFY_FINISHED( ) 66 SNMP_validate_community( ) 42, 127, 130
SNMP_V3_NOTIFY_UPDATE_BACKOUT( ) 66 proxy mechanism, using 97
SNMP_V3_NOTIFY_UPDATE_SET( ) 66 SNMP_validate_set_pdu( ) 43, 129
SNMP_V3_NOTIFY_UPDATE_TEST( ) 66 SNMP_VIEW_2275_CREATE_BACKOUT( ) 97
SNMP_V3_NOTIFY_UPDATE_UNDO( ) 66 SNMP_VIEW_2275_CREATE_SET( ) 97
SNMP_V3_NPROF_CREATE_BACKOUT( ) 65 SNMP_VIEW_2275_CREATE_TEST( ) 97
SNMP_V3_NPROF_CREATE_SET( ) 65 SNMP_VIEW_2275_CREATE_UNDO( ) 97
SNMP_V3_NPROF_CREATE_TEST( ) 65 SNMP_VIEW_2275_DESTROY_BACKOUT( ) 97
SNMP_V3_NPROF_CREATE_UNDO( ) 65 SNMP_VIEW_2275_DESTROY_SET( ) 97
SNMP_V3_NPROF_DESTROY_BACKOUT( ) 65 SNMP_VIEW_2275_DESTROY_TEST( ) 97
SNMP_V3_NPROF_DESTROY_SET( ) 65 SNMP_VIEW_2275_DESTROY_UNDO( ) 97
SNMP_V3_NPROF_DESTROY_TEST( ) 65 SNMP_VIEW_2275_FINISHED( ) 97
SNMP_V3_NPROF_DESTROY_UNDO( ) 65 SNMP_View_2275_Install( ) 96
SNMP_V3_NPROF_FINISHED( ) 65 SNMP_VIEW_2275_UPDATE_BACKOUT( ) 97
SNMP_V3_NPROF_UPDATE_BACKOUT( ) 65 SNMP_VIEW_2275_UPDATE_SET( ) 97
SNMP_V3_NPROF_UPDATE_SET( ) 65 SNMP_VIEW_2275_UPDATE_TEST( ) 97
SNMP_V3_NPROF_UPDATE_TEST( ) 65 SNMP_VIEW_2275_UPDATE_UNDO( ) 97
SNMP_V3_NPROF_UPDATE_UNDO( ) 65 SNMP_View_Create( ) 96
SNMP_V3_Pass2Key( ) 67 SNMP_View_Get_Mask( ) 217
SNMP_V3_PROXY_CREATE_BACKOUT( ) 65 SNMP_View_Get_MaskLen( ) 217
SNMP_V3_PROXY_CREATE_SET( ) 65 SNMP_View_Get_Status( ) 217
SNMP_V3_PROXY_CREATE_TEST( ) 65 SNMP_View_Get_StorageType( ) 217
SNMP_V3_PROXY_CREATE_UNDO( ) 65 SNMP_View_Get_Subtree( ) 217
SNMP_V3_PROXY_DESTROY_BACKOUT( ) 65 SNMP_View_Get_Subtree_Len( ) 217
SNMP_V3_PROXY_DESTROY_SET( ) 65 SNMP_View_Get_Type( ) 217
SNMP_V3_PROXY_DESTROY_TEST( ) 65 SNMP_View_Set_Status( ) 217
SNMP_V3_PROXY_DESTROY_UNDO( ) 65 SNMP_View_Set_StorageType( ) 217
SNMP_V3_PROXY_FINISHED( ) 65 SNMP_View_Set_Type( ) 217
SNMP_V3_PROXY_UPDATE_BACKOUT( ) 65 SNMPADDR_T 42
SNMP_V3_PROXY_UPDATE_SET( ) 65 SNMPADDR_T data type 46
SNMP_V3_PROXY_UPDATE_TEST( ) 65 snmpdefs.h 81
SNMP_V3_PROXY_UPDATE_UNDO( ) 65 snmptalk.h 41
SNMP_V3_TPARAM_CREATE_BACKOUT( ) 66 SNMPv1
SNMP_V3_TPARAM_CREATE_SET( ) 66 configuring 33
SNMP_V3_TPARAM_CREATE_TEST( ) 65 packets with SNMPv2 types 34
SNMP_V3_TPARAM_CREATE_UNDO( ) 66 traps 93
SNMP_V3_TPARAM_DESTROY_BACKOUT( ) 66 SNMPv2
SNMP_V3_TPARAM_DESTROY_SET( ) 66 configuring 33
SNMP_V3_TPARAM_DESTROY_TEST( ) 65 origins of 12
SNMP_V3_TPARAM_DESTROY_UNDO( ) 66 traps 93
SNMP_V3_TPARAM_FINISHED( ) 66 types in SNMPv1 packets 34
SNMP_V3_TPARAM_UPDATE_BACKOUT( ) 66 SNMPv3 51–67
SNMP_V3_TPARAM_UPDATE_SET( ) 66 access control 53
SNMP_V3_TPARAM_UPDATE_TEST( ) 65 authentication 66
SNMP_V3_TPARAM_UPDATE_UNDO( ) 66 configuring 34
SNMP_V3_USER_CREATE_BACKOUT( ) 66 configuring 33
SNMP_V3_USER_CREATE_SET( ) 66 contexts 51
SNMP_V3_USER_CREATE_TEST( ) 66 database, initializing the 60
SNMP_V3_USER_CREATE_UNDO( ) 66 engine ID 51
SNMP_V3_USER_DESTROY_BACKOUT( ) 66 notification MIB 35
SNMP_V3_USER_DESTROY_SET( ) 66 notifications 95
SNMP_V3_USER_DESTROY_TEST( ) 66 tables 53
SNMP_V3_USER_DESTROY_UNDO( ) 66 origins of 12
SNMP_V3_USER_FINISHED( ) 66 proxies
SNMP_V3_USER_UPDATE_BACKOUT( ) 66 configuring 38
SNMP_V3_USER_UPDATE_SET( ) 66 security mode 52
SNMP_V3_USER_UPDATE_TEST( ) 66 target MIB 35
SNMP_V3_USER_UPDATE_UNDO( ) 66 view scheme 96

228
Index

SNMPv3 Access Table field routines 214


SNMPv3 Access Table view routines 215
U
SNMPv3 data types 49 UI64_Add32( ) 218
SNMPv3 method routine macros 132 UI64_Add64( ) 218
SNMPv3 User Table field routines 212 ui64_async_set( ) 108
SNMPv3 User Table key routines 213 UI64_Compare( ) 218
stack 34 UI64_Copy( ) 218
std_next_async( ) 82, 107 UI64_High( ) 218
subagent 39 UI64_Increment( ) 218
creating 73 UI64_Low( ) 218
system routines, required 124 UI64_Set( ) 218
UI64_Sub64( ) 219
UI64_Zero( ) 219
T UINT_64_T data type 46
undoproc operation 105
tables 79 undoproc routine 115
access 62 undoproc_error( ) 116
community 64 undoproc_good( ) 116
context 62 undoproc_set( ) 116
group 62 undoproc_started( ) 116
notify 63 unsigned 64-bit integer routines 218
notify filter 63 user exits 131
notify filter profile 63 obsolete 132
proxy 64 writing 121
target address 62 user table 62
target params 63 user_private 98
user 62 user-exit 7
TABULAR 82 user-supplied code 121–137
tabular variables configuration macros 124
method routines, in 105 handlers 130
target address table 62 required routines 122
target MIB 35 RFC2275 view method routine macros 136
target params table 63 SNMPv3 method routine macros 132
target/src/wrn/wm/demo directory 10 system routines, required 124
test_TestAndIncr_async( ) 107
testproc 79
testproc operation 105
testproc routine 112
V
error values 113 v3_priv_aescfb128_decode( ) 68
testproc_error( ) 92, 114 v3_priv_aescfb128_encode( ) 68
testproc_good( ) 91, 114 validate_SNMP_community( ) 56
testproc_started( ) 114 VarBinds
timer routines 123 private field 88
TIMETICKS validating 87
bits32_t data type 45 variables
TRANSPORT_ROUTINE_T( ) 131 EBUFFER_T 73
traps 93 ENVOY_AX_CHUNK_T 73
authentication 95 ENVOY_AX_SASB_T 73
sending 94 method routines, in 105
TREENODE_T data type 48 OBJ_ID_T 73
troubleshooting variables, MIB 78
MIB compiler 139–140 vb_extract_row( )
typedefs row creation 92
data types, list of 45 VarBinds, grouping 87
types.h file vb_extract_row_loose( )
data type definitions 45 row creation 92
obsolete data types 46 VarBinds, grouping 87
vb_free_priv field 88

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

You might also like