Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

snmp_send()

Send SNMP messages

Synopsis:

#include <sys/types.h>
#include <snmp/asn1.h>
#include <netinet/in.h>
#include <snmp/snmp_api.h>

extern int snmp_errno

int snmp_send( struct snmp_session * session,
               struct snmp_pdu * pdu );

Arguments:

session
A pointer to the snmp_session structure that identifies the SNMP session that you want to send the message on. This pointer was returned by a call to snmp_open().
pdu
A pointer to the snmp_pdu structure that defines the Protocol Data Unit that you want to send. Create this structure by calling snmp_pdu_create().

Library:

libsnmp

Use the -l snmp option to qcc to link against this library.

Description:

The snmp_send() function sends the PDU on the session provided. If necessary, some of the snmp_pdu structure data is set from the session defaults. A request corresponding to this PDU is added to the list of outstanding requests on this session and then the packet is sent.

This function frees pdu unless an error occurs.

Returns:

The request ID of the generated packet, if applicable, 1 if not applicable, or 0 if an error occurs (snmp_errno is set).

Errors:

If an error occurs, this function sets snmp_errno to one of:

SNMPERR_BAD_ADDRESS
A necessary entity in the pdu structure was omitted. These include:
SNMPERR_BAD_SESSION
The specified session wasn't open.
SNMPERR_GENERR
An error occurred forming the packet.

Classification:

SNMP

Safety:
Cancellation point Yes
Interrupt handler No
Signal handler No
Thread No

See also:

select(), snmp_close(), snmp_open(), snmp_pdu, snmp_pdu_create(), snmp_read(), snmp_select_info(), snmp_send(), snmp_session, snmp_timeout()

RFC 1157, FAQ in Internet newsgroup comp.protocols.snmp

Marshall T. Rose, The Simple Book: An Introduction to Internet Management, Revised 2nd ed. (Prentice-Hall, 1996, ISBN 0-13-451659-1)