1 .\" /***********************************************************
2 .\" Copyright 1989 by Carnegie Mellon University
4 .\" All Rights Reserved
6 .\" Permission to use, copy, modify, and distribute this software and its
7 .\" documentation for any purpose and without fee is hereby granted,
8 .\" provided that the above copyright notice appear in all copies and that
9 .\" both that copyright notice and this permission notice appear in
10 .\" supporting documentation, and that the name of CMU not be
11 .\" used in advertising or publicity pertaining to distribution of the
12 .\" software without specific, written prior permission.
14 .\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
15 .\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
16 .\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
17 .\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18 .\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
19 .\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
21 .\" ******************************************************************/
22 .TH SNMP_SESS_API 3 "21 Oct 1999"
25 snmp_sess_init, snmp_sess_open, snmp_sess_session,
26 snmp_sess_send, snmp_sess_async_send,
27 snmp_sess_select_info, snmp_sess_read,
28 snmp_sess_timeout, snmp_sess_close, snmp_sess_error - session functions
32 #include <netinet/in.h>
36 #include <ucd-snmp/snmp.h>
38 #include <ucd-snmp/snmp_impl.h>
40 #include <ucd-snmp/asn1.h>
42 #include <ucd-snmp/snmp_api.h>
44 void snmp_sess_init ( struct snmp_session * );
46 void * snmp_sess_open ( struct snmp_session * );
48 struct snmp_session * snmp_sess_session ( void * );
50 int snmp_sess_send ( void * opaque,
52 struct snmp_pdu *pdu );
55 int snmp_sess_async_send ( void * opaque,
60 snmp_callback callback, void * callbackData );
63 int snmp_sess_select_info ( void * opaque,
65 int *numfds, fd_set *fdset,
68 struct timeval *timeout, int *block );
71 void snmp_sess_read ( void * opaque, fd_set *fdset );
74 void snmp_sess_timeout ( void * opaque );
76 int snmp_sess_close ( void * opaque );
78 void snmp_sess_error ( void * opaque,
86 These functions define a subset of the API that can be used
87 to manage single SNMP sessions in a multi-threaded application.
90 these functions are single session versions of the traditional
93 Note that these functions use an
95 pointer to identify a single session in lieu of a
100 prepares a struct snmp_session that sources transport characteristics
101 and common information that will be used for a set of SNMP transactions.
102 After this structure is passed to
104 to create an SNMP session, the structure is not used.
106 SNMP sessions that are created with
108 are not affected by and should not be used with
114 Use the other functions described here with similar capabilities.
119 each take as input a pointer to a struct snmp_session object.
120 This structure contains information for a set of transactions that
121 will share similar transport characteristics.
123 takes the opaque session handle and returns a pointer to
124 its associated struct snmp_session.
128 .I snmp_sess_async_send
129 each take as input an additional pointer to a struct snmp_pdu object.
130 This structure contains information that describes a transaction
131 that will be performed over an open session.
133 Consult snmp_api.h for the definitions of these structures.
135 .I Snmp_sess_select_info, snmp_sess_read,
138 provide an interface for the use of the
140 system call so that SNMP transactions for a single session can occur asynchronously.
142 .I Snmp_sess_select_info
143 is given the information that would have been passed to
145 in the absence of SNMP. For example, this might include window update information.
146 This information is modified so that SNMP will get the service it requires from the
159 respectively. The only exception is that timeout must always point to an allocated (but perhaps uninitialized)
163 would have been passed as NULL,
167 is treated as undefined. This same rule applies upon return from
171 .I snmp_sess_select_info, select
172 is called with the returned data. When select returns,
178 This will read any input from this session's SNMP socket.
183 should be called to see if the timeout was intended for SNMP.
186 Error return status from
188 is indicated by return of a null pointer.
189 Error return status from
193 is indicated by return of 0. A successful status will return a 1.
195 Further information can be obtained by using
197 to see what type of error has occurred.
198 This function returns the SNMP "snmp_errno" variable,
199 the value of the system "errno" variable,
200 and a string interpretation of both variables.
201 The string must be freed after use by the caller.
203 For errors returned by
205 use the corresponding function
210 Consult snmp_api.h for the complete set of SNMP library
212 The SNMP library error value
214 can be one of the following values:
216 .IP SNMPERR_GENERR \w'SNMPERR_BAD_REPETITIONS'u+2n
217 A generic error occurred.
218 .IP SNMPERR_BAD_LOCPORT \w'SNMPERR_BAD_REPETITIONS'u+2n
219 The local port was bad because it had already been
220 allocated or permission was denied.
221 .IP SNMPERR_BAD_ADDRESS \w'SNMPERR_BAD_REPETITIONS'u+2n
222 The host name or address given was not useable.
223 .IP SNMPERR_BAD_SESSION \w'SNMPERR_BAD_REPETITIONS'u+2n
224 The specified session was not open.
225 .IP SNMPERR_TOO_LONG \w'SNMPERR_BAD_REPETITIONS'u+2n
226 .IP SNMPERR_NO_SOCKET \w'SNMPERR_BAD_REPETITIONS'u+2n
227 .IP SNMPERR_V2_IN_V1 \w'SNMPERR_BAD_REPETITIONS'u+2n
228 .IP SNMPERR_V1_IN_V2 \w'SNMPERR_BAD_REPETITIONS'u+2n
229 .IP SNMPERR_BAD_REPEATERS \w'SNMPERR_BAD_REPETITIONS'u+2n
230 .IP SNMPERR_BAD_REPETITIONS \w'SNMPERR_BAD_REPETITIONS'u+2n
231 .IP SNMPERR_BAD_ASN1_BUILD \w'SNMPERR_BAD_REPETITIONS'u+2n
232 .IP SNMPERR_BAD_SENDTO \w'SNMPERR_BAD_REPETITIONS'u+2n
233 .IP SNMPERR_BAD_RCVFROM \w'SNMPERR_BAD_REPETITIONS'u+2n
234 .IP SNMPERR_BAD_PARSE \w'SNMPERR_BAD_REPETITIONS'u+2n
235 .IP SNMPERR_BAD_VERSION \w'SNMPERR_BAD_REPETITIONS'u+2n
236 .IP SNMPERR_BAD_COMMUNITY \w'SNMPERR_BAD_REPETITIONS'u+2n
237 .IP SNMPERR_NOAUTH_DESPRIV \w'SNMPERR_BAD_REPETITIONS'u+2n
238 .IP SNMPERR_ABORT \w'SNMPERR_BAD_REPETITIONS'u+2n
239 .IP SNMPERR_UNKNOWN_PDU \w'SNMPERR_BAD_REPETITIONS'u+2n
240 .IP SNMPERR_TIMEOUT \w'SNMPERR_BAD_REPETITIONS'u+2n
244 select(2), snmp_api(3), snmp_api.h