Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

snmpd.conf(5n)

snmpd(8n)

snmpsetup(8n)

snmpext(3n)

Name

snmpextregister, snmpextgetreq, snmpextrespond, snmpexterror − library routines available for building the Extended ULTRIX SNMP Agent (Extended Agent)

Syntax

#include <protocols/snmp.h>
#include <protocols/snmperrs.h>
 struct objident {
shortncmp;/* number of components */
unsigned longcmp[SNMPMXID];/* components */
};
 struct snmpareg {
shortoidtype;/* object id type */
objidentoid;/* object id/*
};
 struct snmparspdat {
shorttype;/* response data type */
shortoctets;/* number of octets in response data */
char*rspdat;/* response data */
};
 snmpextregister(reg, community)
struct snmpareg *reg;
char *community;
 snmpextgetreq(reqoid, reqinst)
objident *reqoid;
objident *reqinst;
 snmpextrespond(reqoid, rspinst, rspdat)
objident *reqoid;
objident *rspinst;
struct snmparspdat *rspdat;
 snmpexterror(error)
long error;

Description

The following library routines are available for building the Extended Agent:

snmpextregister
Used to register the Extended Agent’s Management Information Base (MIB) to the ULTRIX SNMP Agent (Agent).  The reg parameter is provided by the caller with the object identifiers to be registered. The community parameter is provided by the caller with the community name (a null-terminated string). 

This library routine waits for a registration confirmation from the Agent.  The process is blocked until the confirmation arrives.  When the confirmation arrives, the routine returns the status of the registration. 

The program issues this call before any other Extended SNMP Library calls.  It does this because the snmpextregister library routine creates a UNIX domain socket to the Agent on behalf of the caller.

snmpextgetreq
Used to receive a request for a MIB variable from the Agent.  If there is no outstanding request from the Agent, the process is blocked until a request arrives from the Agent.

When the Extended Agent receives a request from the Agent, the reqoid parameter contains the object identifier for the requested variable.  The reqinst parameter contains the object instance identifier for the requested variable.  If the request does not contains an object instance, the reqinst->ncmp record contains a zero. 

snmpextrespond
Used to return the requested variable to the Agent.  The reqoid parameter is the object identifier from the snmpextgetreq library call. The rspinst parameter is the object instance associated with the returning variable.  If there is no object instance associated with the returning variable, a null parameter must be supplied.  The rspdat parameter is the returning variable. 

Note that the Agent maintains a configurable timer for outstanding requests to the Extended Agent.  Therefore, the Extended Agent must be able to respond within the Agent’s timeout interval in order to prevent a premature timeout in the Agent. 

See the /etc/snmpd.conf file for your system’s default timeout value.

snmpexterror
Used to return an error to the Agent.  The error parameter is the error code to be returned to the Agent.  The error code is one of the following:

NOERR—successful SNMP get-next-request end-of-table.  This happens when the requested instance does not exist. 

NOSUCH—Unknown requested object identifier. 

GENERRS—Generic error. 

BADVAL—Bad variable value. 

Restrictions

For the snmpextregister routine, the object identifier must have the prefix 1.3.6.1 to be registered.  If it does not, the registration is rejected.

Return Values

If an error occurs, a negative value is returned. 

Diagnostics

[BADVERSION]
Bad or obsolete protocol version

[BINDERR] Failed to bind the socket

[GENSUC] MIB successfully registered

[NOSOCK] Socket does not exist

[NOSVC] MIB registration was rejected

[PKTLENERR] Maximum size message exceeded or community name is too large

[RCV_ERR] Reception failed

[SND_ERR] Transmission failed

Files

/etc/snmpd.conf SNMP configuration file

See Also

snmpd.conf(5n), snmpd(8n), snmpsetup(8n)
Guide to Network Programming

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026