snmp_sess_init,     snmp_sess_open,     snmp_sess_session,
       snmp_sess_send,                      snmp_sess_async_send,
       snmp_sess_select_info,  snmp_sess_read, snmp_sess_timeout,
       snmp_sess_close, snmp_sess_error - session functions


SYNOPSIS

       #include <sys/types>
       #include <netinet/in.h>
       #include <sys/time.h>
       #include <ucd-snmp/snmp.h>
       #include <ucd-snmp/snmp_impl.h>
       #include <ucd-snmp/asn1.h>
       #include <ucd-snmp/snmp_api.h>

       void snmp_sess_init ( struct snmp_session * );

       void * snmp_sess_open ( struct snmp_session * );

       struct snmp_session * snmp_sess_session ( void * );

       int snmp_sess_send ( void * opaque,
              struct snmp_pdu *pdu );

       int snmp_sess_async_send ( void * opaque,
              struct snmp_pdu *pdu,
              snmp_callback callback, void * callbackData );

       int snmp_sess_select_info ( void * opaque,
              int *numfds, fd_set *fdset,
              struct timeval *timeout, int *block );

       void snmp_sess_read ( void * opaque, fd_set *fdset );

       void snmp_sess_timeout ( void * opaque );

       int snmp_sess_close ( void * opaque );

       void snmp_sess_error ( void * opaque,
              int *pcliberr, int *psnmperr, char **pperrstring );


DESCRIPTION

       These  functions  define  a  subset of the API that can be
       used to manage single SNMP sessions  in  a  multi-threaded
       application.   Except  for  snmp_sess_session, these func­
       tions are single session versions of the traditional  SNMP
       library API.

       Note  that  these functions use an Opaque pointer to iden­
       tify a single session in lieu of a session pointer.

       Snmp_sess_init prepares a struct snmp_session that sources
       transport characteristics and common information that will

       ture is passed to snmp_open to create an SNMP session, the
       structure is not used.

       SNMP sessions that are created with snmp_sess_open are not
       affected  by and should not be used with snmp_select_info,
       snmp_read, snmp_timeout, nor snmp_close.   Use  the  other
       functions described here with similar capabilities.

       Snmp_sess_init  and  snmp_sess_open  each  take as input a
       pointer to a struct snmp_session object.   This  structure
       contains  information  for a set of transactions that will
       share similar transport  characteristics.   Snmp_sess_ses­
       sion takes the opaque session handle and returns a pointer
       to its associated struct snmp_session.

       Snmp_sess_send and snmp_sess_async_send each take as input
       an  additional  pointer to a struct snmp_pdu object.  This
       structure contains information that describes  a  transac­
       tion that will be performed over an open session.

       Consult  snmp_api.h  for  the  definitions of these struc­
       tures.

       Snmp_sess_select_info, snmp_sess_read, and snmp_sess_time­
       out provide an interface for the use of the select(2) sys­
       tem call so that SNMP transactions for  a  single  session
       can occur asynchronously.

       Snmp_sess_select_info  is given the information that would
       have been passed to select in the absence  of  SNMP.   For
       example,  this  might  include  window update information.
       This information is modified so that  SNMP  will  get  the
       service  it  requires  from  the  call to select.  In this
       case, numfds, fdset, and timeout correspond to  the  nfds,
       readfds,  and  timeout  arguments to select, respectively.
       The only exception is that timeout must always point to an
       allocated  (but perhaps uninitialized) struct timeval.  If
       timeout would have been passed as NULL, block  is  set  to
       true, and timeout is treated as undefined.  This same rule
       applies upon return from snmp_select_info.

       After calling snmp_sess_select_info, select is called with
       the returned data.  When select returns, snmp_sess_read is
       called with the fd_set returned from  select.   This  will
       read any input from this session's SNMP socket.  If select
       times out, snmp_sess_timeout should be called  to  see  if
       the timeout was intended for SNMP.


DIAGNOSTICS

       Error  return  status  from snmp_sess_open is indicated by
       return of  a  null  pointer.   Error  return  status  from
       snmp_sess_close  and snmp_sess_send is indicated by return
       of 0.  A successful status will return a 1.

       snmp_sess_error  to  see  what type of error has occurred.
       This function returns the SNMP "snmp_errno" variable,  the
       value  of the system "errno" variable, and a string inter­
       pretation of both variables.  The  string  must  be  freed
       after use by the caller.

       For errors returned by snmp_sess_open, use the correspond­
       ing function snmp_error instead of snmp_sess_error.

       Consult snmp_api.h for the complete set  of  SNMP  library
       error values.  The SNMP library error value snmperr can be
       one of the following values:

         SNMPERR_GENERR           A generic error occurred.

         SNMPERR_BAD_LOCPORT      The local port was bad  because
                                  it  had  already been allocated
                                  or permission was denied.

         SNMPERR_BAD_ADDRESS      The host name or address  given
                                  was not useable.

         SNMPERR_BAD_SESSION      The  specified  session was not
                                  open.

         SNMPERR_TOO_LONG

         SNMPERR_NO_SOCKET

         SNMPERR_V2_IN_V1

         SNMPERR_V1_IN_V2

         SNMPERR_BAD_REPEATERS

         SNMPERR_BAD_REPETITIONS

         SNMPERR_BAD_ASN1_BUILD

         SNMPERR_BAD_SENDTO

         SNMPERR_BAD_RCVFROM

         SNMPERR_BAD_PARSE

         SNMPERR_BAD_VERSION

         SNMPERR_BAD_COMMUNITY

         SNMPERR_NOAUTH_DESPRIV

         SNMPERR_ABORT


         SNMPERR_TIMEOUT


SEE ALSO

       select(2), snmp_api(3), snmp_api.h


Man(1) output converted with man2html