6.2   Application Programmer Interface Libraries

API libraries are outlined here in order to show the routines available to the SNMP agent designer. For more information on the syntax of these routines and application programmer interfaces, see F. SNMP Reference.

Also see the manual entry for m2Lib in the VxWorks Reference Manual.

snmpdLib - entry points to the SNMP v1/v2c agent

The routines in this file provide the general processing interface to the user code in the files snmpIoLib.c, as well as routine-calls to user-defined hooks (which can be in any file, but must be linked in with the agent at build-time; see 4.8 Hooks). The routines available to the user are:

snmpdPktProcess( )
 
process a packet returned by the transport
 
snmpdLog( )
 
log messgaes from the SNMP agent
 
snmpdViewEntrySet( )
 
install an entry in the view table
 
snmpdViewEntryRemove( )
 
remove an entry from the view table
 
snmpdTreeAdd( )
 
dynamically add a subtree to the SNMP agent MIB tree
 
snmpdTreeRemove( )
 
dynamically remove part of the SNMP agent MIB tree
 
snmpdTrapSend( )
 
general interface to trap facilities
 
snmpdInitFinish( )
 
complete the initialization of the agent
 
snmpdExit( )
 
exit the SNMP agent
 
snmpdContinue( )
 
continue processing of an SNMP packet
 
snmpdGroupByGetprocAndInstance( )
 
 
gather set of similar variable bindings
 
snmpdVbRowExtract( )
 
extract required pieces of a row for a SET operation
 
snmpdVbExtractRowLoose( )
 
incrementally extract pieces of a row for a set
 
snmpdPktLockGet( )
 
lock an SNMP packet
 

snmpEbufLib - extended-buffer manipulation functions

The routines in this file allow for SNMP buffer manipulation between TEST and SET method routines. Examine the method-routine sample code (see 4.2.2 $WIND_BASE/target/src/snmpv1/agent/) for examples of the usage of these routines.

EBufferClone( )
 
make a copy of an extended buffer
 
EBufferClean( )
 
release dynamic memory in an extended buffer
 
EBufferInitialize( )
 
place an extended buffer in a known state
 
EBufferSetup( )
 
attach an empty memory buffer to an extended buffer
 
EBufferPreLoad( )
 
attach a full memory buffer to an extended buffer
 
EBufferNext( )
 
return a pointer to the next unused byte of the buffer memory
 
EBufferStart( )
 
return a pointer to the first byte in the buffer memory
 
EBufferUsed( )
 
return the number of used bytes in the buffer memory
 
EBufferReset( )
 
reset the extended buffer
 
EBufferRemaining( )
 
return the number of unused bytes remaining in buffer memory
 

snmpBindLib - routines for binding values to variables in SNMP packets

The routines in this file are used when a trap is generated from the SNMP agent and variable information needs to be shipped to the Network Manager. This is accomplished bybinding the variables together with their values. For information on variable bindings, see 4.10 Access to MIB Variables( )

snmpProcLib - manipulate variable-bindings in an SNMP packet

The routines in this file can be invoked from the method routines to add or associate a value of a given type with a variable binding. The variable binding is used in the SNMP response packet, which is sent to the Network Management Station which originally issued the request.

getproc_started( )
 
indicate that a getproc operation has begun
 
getproc_good( )
 
indicate successful completion of a getproc procedure
 
getproc_error( )
 
indicate that a getproc operation encountered an error
 
nextproc_started( )
 
indicate that a nextproc operation has begun
 
nextproc_good( )
 
indicate successful completion of a nextproc procedure
 
nextproc_no_next( )
 
indicate that there exists no next instance
 
nextproc_error( )
 
indicate that a nextproc operation encountered an error
 
getproc_got_int32( )
 
indicate retrieval of a 32-bit integer
 
getproc_got_uint32( )
 
indicate retrieval of a 32-bit unsigned integer
 
getproc_got_ip_address( )
 
indicate retrieval of an IP address
 
getproc_got_empty( )
 
indicate retrieval of a null value
 
getproc_got_string( )
 
indicate retrieval of a string
 
testproc_started( )
 
indicate that a testproc operation has begun
 
testproc_good( )
 
indicate successful completion of a testproc procedure
 
testproc_error( )
 
indicate that a testproc operation encountered an error
 
setproc_started( )
 
indicate that a setproc operation has begun
 
setproc_good( )
 
indicate successful completion of a setproc procedure
 
setproc_error( )
 
indicate that a setproc operation encountered an error
 
undoproc_started( )
 
indicate that an undoproc operation has begun
 
undoproc_good( )
 
indicate successful completion of an undoproc operation
 
undoproc_error( )
 
indicate that an undproc operation encountered an error
 
getproc_got_uint64( )
 
indicate retrieval of a 64-bit unsigned integer
 
getproc_got_uint64_high_low( )
 
indicate retrieval of a 64-bit unsigned integer with high and low halves
 
getproc_nosuchins( )
 
indicate that no such instance exists
 
getproc_got_object_id( )
 
indicate retrieval of an object identifier
 
nextproc_next_instance( )
 
install instance part of next instance
 

snmpAuxLib - utility routines for object identifiers

The routines in this file provide a miscellanous set of functions that can be used by method routine writers.

ip_to_rlist( )
 
convert an IP address to an array of OID components
 
oidcmp( )
 
compare two object identifiers
 
oidcmp2( )
 
compare two object identifiers
 
oid_to_ip( )
 
convert an object identifier to an IP address
 

snmpIoLib - default transport routines for SNMP

This is a list of routines that must be provided by the agent designer. Templates of these routines are distribued with SNMP to illustrate the usage of the routines. For more information, see 5.2 Configuring snmpIoLib.

snmpIoInit( )
 
initialization routine for SNMP transport endpoint
 
snmpIoWrite( )
 
write a packet to the transport
 
snmpIoClose( )
 
close the transport endpoint.
 
snmpIoMain( )
 
main SNMP IO routine
 
snmpIoTrapSend( )
 
send a trap
 
snmpIoCommunityValidate( )
 
sample community validation routine
 
snmpdMemoryAlloc( )
 
allocate memory for the SNMP agent
 
snmpdMemoryFree( )
 
free memory allocated by the SNMP agent