Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/snmp_select_info.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/snmp_select_info.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/snmp_select_info.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/snmp_select_info.html on line 8

snmp_select_info()

Get information that select() needs for SNMP

Synopsis:

#include <sys/types.h>
#include <sys/select.h>
#include <sys/time.h>
#include <snmp/snmp_api.h>

int snmp_select_info( int * numfds, 
                      struct fd_set * fdset,
                      struct timeval * timeout, 
                      int * block );

Arguments:

numfds
The number of significant file descriptors in fdset.
fdset
A pointer to a set of file descriptors that contains all of the file descriptors that you've opened for SNMP. If activity occurs on any of these file descriptors, you should call snmp_read() with that file-descriptor set.
timeout
A pointer to a timeval structure that defines the longest time that SNMP can wait for a timeout. You should call select() with the minimum time between timeout and any other timeouts necessary. You should check this on each invocation of select(). If a timeout is received, you should call snmp_timeout() to see if the timeout was for SNMP. (The snmp_timeout() function is idempotent.)

You must provide the timeout, even if block is 1 (see below).

block
Governs the behavior of select():

Library:

libsnmp

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

Description:

The snmp_select_info() function is used to return information about what SNMP requires from a select() call.

Asynchronous SNMP transactions:

To have SNMP transactions occur asynchronously, you can invoke the functions snmp_select_info(), snmp_timeout(), and snmp_read() in conjunction with the system call select(). For more information, see select().

For asynchronous transactions, invoke snmp_select_info() with the information you would have passed to select() in the absence of SNMP. The snmp_select_info() function modifies the information, which is subsequently passed to select().

Parameters to select(): Corresponding parameters to snmp_select_info():
nfds numfds
readfds fdset
timeout timeout—must point to an allocated (but not necessarily initialized) timeval structure.

The following code segment shows how to use these SNMP functions in conjunction with select():

FD_ZERO(&fdset);
numfds=sd+1;
FD_SET(sd,&fdset);
block=0;
tvp=&timeout;
timerclear(tvp);
tvp->tv_sec = 5;

snmp_select_info(&numfds, &fdset, tvp, &block);

if(block==1)
{
  tvp = NULL;
}
count = select(numfds, &fdset, 0, 0, tvp);

if(count==0)
  snmp_timeout();
if(count>0)
  snmp_read(&fdset);

Returns:

The number of open sockets (i.e. the number of open sessions).

Classification:

SNMP

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

See also:

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

Based on 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)


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/snmp_select_info.html on line 257

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/snmp_select_info.html on line 257