Deleted Added
full compact
bsnmpclient.3 (208483) bsnmpclient.3 (216294)
1.\"
2.\" Copyright (c) 2004-2005
3.\" Hartmut Brandt.
4.\" All rights reserved.
5.\" Copyright (c) 2001-2003
6.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
7.\" All rights reserved.
8.\"

--- 17 unchanged lines hidden (view full) ---

26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" $Begemot: bsnmp/lib/bsnmpclient.3,v 1.12 2005/10/04 08:46:50 brandt_h Exp $
33.\"
1.\"
2.\" Copyright (c) 2004-2005
3.\" Hartmut Brandt.
4.\" All rights reserved.
5.\" Copyright (c) 2001-2003
6.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
7.\" All rights reserved.
8.\"

--- 17 unchanged lines hidden (view full) ---

26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" $Begemot: bsnmp/lib/bsnmpclient.3,v 1.12 2005/10/04 08:46:50 brandt_h Exp $
33.\"
34.Dd October 4, 2005
34.Dd September 9, 2010
35.Dt BSNMPCLIENT 3
36.Os
37.Sh NAME
38.Nm snmp_client ,
39.Nm snmp_send_cb_f ,
40.Nm snmp_timeout_cb_f ,
41.Nm snmp_timeout_start_f ,
42.Nm snmp_timeout_stop_f ,

--- 4 unchanged lines hidden (view full) ---

47.Nm snmp_pdu_check ,
48.Nm snmp_pdu_send ,
49.Nm snmp_oid_append ,
50.Nm snmp_parse_server ,
51.Nm snmp_receive ,
52.Nm snmp_table_cb_f ,
53.Nm snmp_table_fetch ,
54.Nm snmp_table_fetch_async ,
35.Dt BSNMPCLIENT 3
36.Os
37.Sh NAME
38.Nm snmp_client ,
39.Nm snmp_send_cb_f ,
40.Nm snmp_timeout_cb_f ,
41.Nm snmp_timeout_start_f ,
42.Nm snmp_timeout_stop_f ,

--- 4 unchanged lines hidden (view full) ---

47.Nm snmp_pdu_check ,
48.Nm snmp_pdu_send ,
49.Nm snmp_oid_append ,
50.Nm snmp_parse_server ,
51.Nm snmp_receive ,
52.Nm snmp_table_cb_f ,
53.Nm snmp_table_fetch ,
54.Nm snmp_table_fetch_async ,
55.Nm snmp_dialog
55.Nm snmp_dialog ,
56.Nm snmp_discover_engine
56.Nd "SNMP client library"
57.Sh LIBRARY
58Begemot SNMP library
59.Pq libbsnmp, -lbsnmp
60.Sh SYNOPSIS
61.In asn1.h
62.In snmp.h
63.In snmpclient.h

--- 33 unchanged lines hidden (view full) ---

97.Ft typedef void
98.Fn (*snmp_table_cb_f) "void *list" "void *arg" "int res"
99.Ft int
100.Fn snmp_table_fetch "const struct snmp_table *descr" "void *list"
101.Ft int
102.Fn snmp_table_fetch_async "const struct snmp_table *descr" "void *list" "snmp_table_cb_f callback" "void *uarg"
103.Ft int
104.Fn snmp_dialog "struct snmp_pdu *req" "struct snmp_pdu *resp"
57.Nd "SNMP client library"
58.Sh LIBRARY
59Begemot SNMP library
60.Pq libbsnmp, -lbsnmp
61.Sh SYNOPSIS
62.In asn1.h
63.In snmp.h
64.In snmpclient.h

--- 33 unchanged lines hidden (view full) ---

98.Ft typedef void
99.Fn (*snmp_table_cb_f) "void *list" "void *arg" "int res"
100.Ft int
101.Fn snmp_table_fetch "const struct snmp_table *descr" "void *list"
102.Ft int
103.Fn snmp_table_fetch_async "const struct snmp_table *descr" "void *list" "snmp_table_cb_f callback" "void *uarg"
104.Ft int
105.Fn snmp_dialog "struct snmp_pdu *req" "struct snmp_pdu *resp"
106.Ft int
107.Fn snmp_discover_engine "void"
105.Sh DESCRIPTION
106The SNMP library contains routines to easily build SNMP client applications
108.Sh DESCRIPTION
109The SNMP library contains routines to easily build SNMP client applications
107that use SNMP versions 1 or 2.
110that use SNMP versions 1, 2 or 3.
108Most of the routines use a
109.Vt struct snmp_client :
110.Bd -literal -offset indent
111struct snmp_client {
111Most of the routines use a
112.Vt struct snmp_client :
113.Bd -literal -offset indent
114struct snmp_client {
112 enum snmp_version version;
113 int trans; /* transport type to use */
115 enum snmp_version version;
116 int trans; /* which transport to use */
114
115 /* these two are read-only for the application */
117
118 /* these two are read-only for the application */
116 char *cport; /* port number as string */
117 char *chost; /* host name or IP address as string */
119 char *cport; /* port number as string */
120 char *chost; /* host name or IP address as string */
118
121
119 char read_community[SNMP_COMMUNITY_MAXLEN + 1];
120 char write_community[SNMP_COMMUNITY_MAXLEN + 1];
122 char read_community[SNMP_COMMUNITY_MAXLEN + 1];
123 char write_community[SNMP_COMMUNITY_MAXLEN + 1];
121
124
122 struct timeval timeout;
123 u_int retries;
125 /* SNMPv3 specific fields */
126 int32_t identifier;
127 int32_t security_model;
128 struct snmp_engine engine;
129 struct snmp_user user;
124
130
125 int dump_pdus;
131 /* SNMPv3 Access control - VACM*/
132 uint32_t clen;
133 uint8_t cengine[SNMP_ENGINE_ID_SIZ];
134 char cname[SNMP_CONTEXT_NAME_SIZ];
126
135
127 size_t txbuflen;
128 size_t rxbuflen;
136 struct timeval timeout;
137 u_int retries;
129
138
130 int fd;
139 int dump_pdus;
131
140
132 int32_t next_reqid;
133 int32_t max_reqid;
134 int32_t min_reqid;
141 size_t txbuflen;
142 size_t rxbuflen;
135
143
136 char error[SNMP_STRERROR_LEN];
144 int fd;
137
145
138 snmp_timeout_start_f timeout_start;
139 snmp_timeout_stop_f timeout_stop;
146 int32_t next_reqid;
147 int32_t max_reqid;
148 int32_t min_reqid;
140
149
141 /* private */
142 char local_path[sizeof(SNMP_LOCAL_PATH)];
150 char error[SNMP_STRERROR_LEN];
151
152 snmp_timeout_start_f timeout_start;
153 snmp_timeout_stop_f timeout_stop;
154
155 char local_path[sizeof(SNMP_LOCAL_PATH)];
143};
144.Ed
145.Pp
146The fields of this structure are described below.
147.Bl -tag -width "timeout_start"
148.It Va version
149This is the version of SNMP to use.
150See

--- 38 unchanged lines hidden (view full) ---

189.It Va read_community
190This is the community name to be used for all requests except SET requests.
191The default is
192.Sq public .
193.It Va write_community
194The community name to be used for SET requests.
195The default is
196.Sq private .
156};
157.Ed
158.Pp
159The fields of this structure are described below.
160.Bl -tag -width "timeout_start"
161.It Va version
162This is the version of SNMP to use.
163See

--- 38 unchanged lines hidden (view full) ---

202.It Va read_community
203This is the community name to be used for all requests except SET requests.
204The default is
205.Sq public .
206.It Va write_community
207The community name to be used for SET requests.
208The default is
209.Sq private .
210.It Va identifier
211The message indentifier value to be used with SNMPv3 PDUs. Incremented with
212each transmitted PDU.
213.It Va security_model
214The security model to be used with SNMPv3 PDUs. Currently only User-Based
215Security model specified by RFC 3414 (value 3) is supported.
216.It Va engine
217The authorative SNMP engine parameters to be used with SNMPv3 PDUs.
218.It Va user
219The USM SNMP user credentials to be used with SNMPv3 PDUs.
220.It Va clen
221The length of the context engine id to be used with SNMPv3 PDUs.
222.It Va cengine
223The context engine id to be used with SNMPv3 PDUs. Default is empty.
224.It Va cname
225The context name to be used with SNMPv3 PDUs. Default is
226.Sq "" .
197.It Va timeout
198The maximum time to wait for responses to requests.
199If the time elapses, the request is resent up to
200.Va retries
201times.
202The default is 3 seconds.
203.It Va retries
204Number of times a request PDU is to be resent.

--- 407 unchanged lines hidden (view full) ---

612calls or table fetches may be called while in the function).
613The response PDU is returned in
614.Fa resp .
615If no response could be received after all timeouts and retries, the function
616returns -1.
617If a response was received 0 is returned.
618.Pp
619The function
227.It Va timeout
228The maximum time to wait for responses to requests.
229If the time elapses, the request is resent up to
230.Va retries
231times.
232The default is 3 seconds.
233.It Va retries
234Number of times a request PDU is to be resent.

--- 407 unchanged lines hidden (view full) ---

642calls or table fetches may be called while in the function).
643The response PDU is returned in
644.Fa resp .
645If no response could be received after all timeouts and retries, the function
646returns -1.
647If a response was received 0 is returned.
648.Pp
649The function
650.Fn snmp_discover_engine
651is used to discover the authorative snmpEngineId of a remote SNMPv3 agent.
652A request PDU with empty USM user name is sent and the client's engine
653parameters are set according to the snmpEngine parameters received in the
654response PDU.
655If the client is configured to use authentication and/or privacy and the
656snmpEngineBoots and/or snmpEngineTime in the response had zero values, an
657additional request (possibly encrypted) with the appropriate user credentials
658is sent to fetch the missing values.
659Note, that the function blocks until the discovery proccess is completed.
660If no response could be received after all timeouts and retries, or the
661response contained errors the function returns -1.
662If the discovery proccess was completed 0 is returned.
663.Pp
664The function
620.Fn snmp_parse_server
621is used to parse an SNMP server specification string and fill in the
622fields of a
623.Vt struct snmp_client .
624The syntax of a server specification is
625.Pp
626.D1 [trans::][community@][server][:port]
627.Pp

--- 31 unchanged lines hidden ---
665.Fn snmp_parse_server
666is used to parse an SNMP server specification string and fill in the
667fields of a
668.Vt struct snmp_client .
669The syntax of a server specification is
670.Pp
671.D1 [trans::][community@][server][:port]
672.Pp

--- 31 unchanged lines hidden ---