smux_wait Subroutine

Purpose

Waits for a message from the Simple Network Management Protocol (SNMP) agent.

Library

SNMP Library (libsnmp.a)

Syntax

#include <isode/snmp/smux.h>

int smux_wait ( event,  isecs)
struct type_SMUX_PDUs **event;
int isecs;

Description

The smux_wait subroutine waits for a period of seconds, designated by the value of the isecs parameter, and returns the protocol data unit (PDU) received. The smux_wait subroutine waits on the socket descriptor that is initialized in a smux_init subroutine and maintained in the SMUX subroutines. The smux_wait subroutine waits up to isecs seconds. If the value of the isecs parameter is 0, the smux_wait subroutine returns only the first packet received. If the value of the isecs parameter is less than 0, the smux_wait subroutine waits indefinitely for the next message or returns a message already received. If no data is received, the smux_wait subroutine returns an error message of NOTOK and sets the smux_errno variable to the inProgress value. If the smux_wait subroutine is successful, it returns the first PDU waiting to be received. If a close PDU is received, the subroutine will automatically close the TCP connection and return OK.

This subroutine is part of the SNMP Application Programming Interface in the TCP/IP facility.

Parameters

Item Description
event Points to a pointer of type_SMUX_PDUs. This holds the PDUs received by the smux_wait subroutine.
isecs Specifies an integer value equal to the number of seconds to wait for a message.

Return Values

If the subroutine is successful, the value OK is returned. Otherwise, the return value is NOTOK.

Error Codes

If the subroutine is unsuccessful, the smux_errno global variable is set to one of the following values:

Value Description
parameterMissing Indicates that the event parameter value was null.
inProgress Indicates that there was nothing for the subroutine to receive.
invalidOperation Indicates that the smux_init subroutine was not called or failed to operate.
youLoseBig Indicates an error occurred in the SNMP code. The TCP connection was closed.