SESSION_API - Online Linux Manual PageSection : 3
Updated : 21 Oct 1999
Source : V5.5
Note : Net-SNMP
Version : 4.2 Berkeley Distribution

NAMEsnmp_sess_init, snmp_open, snmp_send, snmp_select_info, snmp_read, snmp_timeout, snmp_close, snmp_perror, snmp_sess_perror, snmp_error, snmp_api_errstring − session_api functions

SYNOPSIS#include <net-snmp/session_api.h> void snmp_sess_init ( struct snmp_session * ); struct snmp_session * snmp_open ( struct snmp_session *); /* Input parameter not used in active sessions */ int snmp_send ( struct snmp_session *session, struct snmp_pdu *pdu ); int snmp_select_info ( int *numfds, fd_set *fdset, struct timeval *timeout, int *block ); void snmp_read ( fd_set *fdset ); void snmp_timeout ( void ); int snmp_close ( struct snmp_session *session ); void snmp_error ( struct snmp_session *session, int *pcliberr, int *psnmperr, char **pperrstring ); char *snmp_api_errstring ( int snmperr ); void snmp_perror ( char * msg ); /* for parsing errors only */ void snmp_sess_perror (char * msg, struct snmp_session *); /* all other SNMP library errors */

DESCRIPTIONSnmp_sess_init prepares a struct snmp_session that sources transport characteristics and common information that will be used for a set of SNMP transactions. After this structure is passed to snmp_open to create an SNMP session, the structure is not used. Snmp_open returns a pointer to a newly-formed struct snmp_session object, which the application must use to reference the active SNMP session. Snmp_send takes as input a pointer to a struct snmp_pdu object. This structure contains information that describes a transaction that will be performed over an open session. Consult snmp_api.h for the definitions of these structures. Snmp_read, snmp_select_info, and snmp_timeout provide an interface for the use of the select(2) system call so that SNMP transactions can occur asynchronously. Snmp_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_select_info, select is called with the returned data. When select returns, snmp_read should be called with the fd_set returned from select to read each SNMP socket that has input. If select times out, snmp_timeout should be called to see if the timeout was intended for SNMP.

DIAGNOSTICSPrevious versions of the library used snmp_get_errno to read the global variable snmp_errno which may have held the error status within the SNMP library. The existing method snmp_perror should be used to log ASN.1 coding errors only. The new method snmp_sess_perror is provided to capture errors that occur during the processing of a particular SNMP session. Snmp_sess_perror calls snmp_error function to obtain the "C" library error errno , the SNMP library error snmperr , and the SNMP library detailed error message that is associated with an error that occurred during a given session. Note that in all cases except one, snmp_sess_perror should be handed the struct snmp_session * pointer returned from snmp_open. If snmp_open returns a null pointer, pass the INPUT struct snmp_session * pointer used to call snmp_open. Error return status from snmp_close and snmp_send is indicated by return of 0. A successful status will return a 1 for snmp_close and the request id of the packet for snmp_send. Upon successful return from snmp_send the pdu will be freed by the library. 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_PARSE SNMPERR_BAD_VERSION SNMPERR_NOAUTH_DESPRIV SNMPERR_ABORT SNMPERR_UNKNOWN_PDU SNMPERR_TIMEOUT A string representation of the error code can be obtained with snmp_api_errstring, and a standard error message may be printed using snmp_perror that functions like the perror standard routine.

SEE ALSOselect(2), snmp_api.h
0
Johanes Gumabo
Data Size   :   15,534 byte
man-snmp_send.3Build   :   2024-12-05, 20:55   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   2 / 193,267
Visitor ID   :     :  
Visitor IP   :   3.17.76.163   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.