1 .TH "The Net-SNMP library" 3 "5 Mar 2003" "net-snmp" \" -*- nroff -*-
5 The Net-SNMP library \-
10 .RI "\fBmib parsing and datatype manipulation routines.\fP"
17 .RI "struct \fBsession_list\fP"
20 .RI "struct \fBsnmp_internal_session\fP"
27 .RI "#define \fBSNMP_NEED_REQUEST_LIST\fP"
30 .RI "#define \fBtimercmp\fP(tvp, uvp, cmp)"
33 .RI "#define \fBtimerclear\fP(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0"
36 .RI "#define \fBMAX_PACKET_LENGTH\fP (0x7fffffff)"
39 .RI "#define \fBNETSNMP_STREAM_QUEUE_LEN\fP 5"
42 .RI "#define \fBBSD4_2\fP"
45 .RI "#define \fBNFDBITS\fP (sizeof(fd_mask) * NBBY)"
48 .RI "#define \fBFD_SET\fP(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))"
51 .RI "#define \fBFD_CLR\fP(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))"
54 .RI "#define \fBFD_ISSET\fP(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))"
57 .RI "#define \fBFD_ZERO\fP(p) memset((p), 0, sizeof(*(p)))"
60 .RI "#define \fBDEFAULT_COMMUNITY\fP 'public'"
63 .RI "#define \fBDEFAULT_RETRIES\fP 5"
66 .RI "#define \fBDEFAULT_TIMEOUT\fP 1000000L"
69 .RI "#define \fBDEFAULT_REMPORT\fP SNMP_PORT"
72 .RI "#define \fBDEFAULT_ENTERPRISE\fP default_enterprise"
75 .RI "#define \fBDEFAULT_TIME\fP 0"
78 .RI "#define \fBMAXIMUM_PACKET_SIZE\fP 0x7fffffff"
81 .RI "#define \fBDEBUGPRINTPDUTYPE\fP(token, type)"
84 .RI "#define \fBERROR_STAT_LENGTH\fP 11"
91 .RI "typedef long \fBfd_mask\fP"
98 .RI "int \fBsnmp_build\fP (u_char **pkt, size_t *pkt_len, size_t *offset, netsnmp_session *pss, netsnmp_pdu *pdu)"
101 .RI "int \fBsnmp_get_errno\fP (void)"
104 .RI "void \fBsnmp_synch_reset\fP (netsnmp_session *notused)"
107 .RI "void \fBsnmp_synch_setup\fP (netsnmp_session *notused)"
110 .RI "const char * \fBstrerror\fP (int err)"
113 .RI "long \fBsnmp_get_next_reqid\fP (void)"
116 .RI "long \fBsnmp_get_next_msgid\fP (void)"
119 .RI "long \fBsnmp_get_next_sessid\fP (void)"
122 .RI "long \fBsnmp_get_next_transid\fP (void)"
125 .RI "void \fBsnmp_perror\fP (const char *prog_string)"
128 .RI "void \fBsnmp_set_detail\fP (const char *detail_string)"
131 .RI "const char * \fBsnmp_api_errstring\fP (int snmp_errnumber)"
134 .RI "void \fBsnmp_error\fP (netsnmp_session *psess, int *p_errno, int *p_snmp_errno, char **p_str)"
137 .RI "void \fBsnmp_sess_error\fP (void *sessp, int *p_errno, int *p_snmp_errno, char **p_str)"
140 .RI "void \fBnetsnmp_sess_log_error\fP (int priority, const char *prog_string, netsnmp_session *ss)"
143 .RI "void \fBsnmp_sess_perror\fP (const char *prog_string, netsnmp_session *ss)"
146 .RI "void \fBsnmp_sess_init\fP (netsnmp_session *session)"
149 .RI "void \fBinit_snmp_enums\fP (void)"
152 .RI "void \fBinit_snmp\fP (const char *type)"
155 .RI "void \fBsnmp_store\fP (const char *type)"
158 .RI "void \fBsnmp_shutdown\fP (const char *type)"
161 .RI "netsnmp_session * \fBsnmp_open\fP (netsnmp_session *session)"
164 .RI "netsnmp_session * \fBsnmp_open_ex\fP (netsnmp_session *session, int(*fpre_parse)(netsnmp_session *, netsnmp_transport *, void *, int), int(*fparse)(netsnmp_session *, netsnmp_pdu *, u_char *, size_t), int(*fpost_parse)(netsnmp_session *, netsnmp_pdu *, int), int(*fbuild)(netsnmp_session *, netsnmp_pdu *, u_char *, size_t *), int(*frbuild)(netsnmp_session *, netsnmp_pdu *, u_char **, size_t *, size_t *), int(*fcheck)(u_char *, size_t))"
167 .RI "int \fBsnmpv3_engineID_probe\fP (struct session_list *slp, netsnmp_session *in_session)"
170 .RI "netsnmp_session * \fBsnmp_add\fP (netsnmp_session *in_session, netsnmp_transport *transport, int(*fpre_parse)(netsnmp_session *, netsnmp_transport *, void *, int), int(*fpost_parse)(netsnmp_session *, netsnmp_pdu *, int))"
173 .RI "netsnmp_session * \fBsnmp_add_full\fP (netsnmp_session *in_session, netsnmp_transport *transport, int(*fpre_parse)(netsnmp_session *, netsnmp_transport *, void *, int), int(*fparse)(netsnmp_session *, netsnmp_pdu *, u_char *, size_t), int(*fpost_parse)(netsnmp_session *, netsnmp_pdu *, int), int(*fbuild)(netsnmp_session *, netsnmp_pdu *, u_char *, size_t *), int(*frbuild)(netsnmp_session *, netsnmp_pdu *, u_char **, size_t *, size_t *), int(*fcheck)(u_char *, size_t), netsnmp_pdu *(*fcreate_pdu)(netsnmp_transport *, void *, size_t))"
176 .RI "void * \fBsnmp_sess_add_ex\fP (netsnmp_session *in_session, netsnmp_transport *transport, int(*fpre_parse)(netsnmp_session *, netsnmp_transport *, void *, int), int(*fparse)(netsnmp_session *, netsnmp_pdu *, u_char *, size_t), int(*fpost_parse)(netsnmp_session *, netsnmp_pdu *, int), int(*fbuild)(netsnmp_session *, netsnmp_pdu *, u_char *, size_t *), int(*frbuild)(netsnmp_session *, netsnmp_pdu *, u_char **, size_t *, size_t *), int(*fcheck)(u_char *, size_t), netsnmp_pdu *(*fcreate_pdu)(netsnmp_transport *, void *, size_t))"
179 .RI "void * \fBsnmp_sess_add\fP (netsnmp_session *in_session, netsnmp_transport *transport, int(*fpre_parse)(netsnmp_session *, netsnmp_transport *, void *, int), int(*fpost_parse)(netsnmp_session *, netsnmp_pdu *, int))"
182 .RI "void * \fBsnmp_sess_open\fP (netsnmp_session *pss)"
185 .RI "int \fBcreate_user_from_session\fP (netsnmp_session *session)"
188 .RI "int \fBsnmp_sess_close\fP (void *sessp)"
191 .RI "int \fBsnmp_close\fP (netsnmp_session *session)"
194 .RI "int \fBsnmp_close_sessions\fP (void)"
197 .RI "int \fBsnmpv3_packet_build\fP (netsnmp_session *session, netsnmp_pdu *pdu, u_char *packet, size_t *out_length, u_char *pdu_data, size_t pdu_data_len)"
200 .RI "u_char * \fBsnmp_pdu_build\fP (netsnmp_pdu *pdu, u_char *cp, size_t *out_length)"
203 .RI "int \fBsnmpv3_parse\fP (netsnmp_pdu *pdu, u_char *data, size_t *length, u_char **after_header, netsnmp_session *sess)"
206 .RI "int \fBsnmpv3_make_report\fP (netsnmp_pdu *pdu, int error)"
209 .RI "int \fBsnmpv3_get_report_type\fP (netsnmp_pdu *pdu)"
212 .RI "int \fBsnmp_pdu_parse\fP (netsnmp_pdu *pdu, u_char *data, size_t *length)"
215 .RI "u_char * \fBsnmpv3_scopedPDU_parse\fP (netsnmp_pdu *pdu, u_char *cp, size_t *length)"
218 .RI "int \fBsnmp_send\fP (netsnmp_session *session, netsnmp_pdu *pdu)"
221 .RI "int \fBsnmp_sess_send\fP (void *sessp, netsnmp_pdu *pdu)"
224 .RI "int \fBsnmp_async_send\fP (netsnmp_session *session, netsnmp_pdu *pdu, snmp_callback callback, void *cb_data)"
227 .RI "int \fBsnmp_sess_async_send\fP (void *sessp, netsnmp_pdu *pdu, snmp_callback callback, void *cb_data)"
230 .RI "void \fBsnmp_free_var\fP (netsnmp_variable_list *var)"
233 .RI "void \fBsnmp_free_varbind\fP (netsnmp_variable_list *var)"
236 .RI "void \fBsnmp_free_pdu\fP (netsnmp_pdu *pdu)"
239 .RI "netsnmp_pdu * \fBsnmp_create_sess_pdu\fP (netsnmp_transport *transport, void *opaque, size_t olength)"
242 .RI "void \fBsnmp_read\fP (fd_set *fdset)"
245 .RI "int \fB_sess_read\fP (void *sessp, fd_set *fdset)"
248 .RI "int \fBsnmp_sess_read\fP (void *sessp, fd_set *fdset)"
251 .RI "int \fBsnmp_select_info\fP (int *numfds, fd_set *fdset, struct timeval *timeout, int *block)"
254 .RI "int \fBsnmp_sess_select_info\fP (void *sessp, int *numfds, fd_set *fdset, struct timeval *timeout, int *block)"
257 .RI "void \fBsnmp_timeout\fP (void)"
260 .RI "void \fBsnmp_sess_timeout\fP (void *sessp)"
263 .RI "int \fBsnmp_oid_ncompare\fP (const oid *in_name1, size_t len1, const oid *in_name2, size_t len2, size_t max_len)"
266 .RI "int \fBsnmp_oid_compare\fP (const oid *in_name1, size_t len1, const oid *in_name2, size_t len2)"
268 .RI "\fIlexicographical compare two object identifiers.\fP"
270 .RI "int \fBsnmp_oidtree_compare\fP (const oid *in_name1, size_t len1, const oid *in_name2, size_t len2)"
272 .RI "\fICompares 2 OIDs to determine if they are equal up until the shortest length.\fP"
274 .RI "int \fBnetsnmp_oid_equals\fP (const oid *in_name1, size_t len1, const oid *in_name2, size_t len2)"
276 .RI "\fICompares 2 OIDs to determine if they are exactly equal.\fP"
278 .RI "int \fBnetsnmp_oid_is_subtree\fP (const oid *in_name1, size_t len1, const oid *in_name2, size_t len2)"
280 .RI "\fIIdentical to netsnmp_oid_equals, except only the length up to len1 is compared.\fP"
282 .RI "int \fBnetsnmp_oid_find_prefix\fP (const oid *in_name1, size_t len1, const oid *in_name2, size_t len2)"
284 .RI "\fIGiven two OIDs, determine the common prefix to them both.\fP"
286 .RI "netsnmp_variable_list * \fBsnmp_pdu_add_variable\fP (netsnmp_pdu *pdu, oid *name, size_t name_length, u_char type, const u_char *value, size_t len)"
289 .RI "netsnmp_variable_list * \fBsnmp_varlist_add_variable\fP (netsnmp_variable_list **varlist, oid *name, size_t name_length, u_char type, const u_char *value, size_t len)"
292 .RI "int \fBsnmp_add_var\fP (netsnmp_pdu *pdu, oid *name, size_t name_length, char type, const char *value)"
295 .RI "void * \fBsnmp_sess_pointer\fP (netsnmp_session *session)"
298 .RI "netsnmp_session * \fBsnmp_sess_session\fP (void *sessp)"
301 .RI "netsnmp_transport * \fBsnmp_sess_transport\fP (void *sessp)"
304 .RI "void \fBsnmp_sess_transport_set\fP (void *sp, netsnmp_transport *t)"
307 .RI "oid * \fBsnmp_duplicate_objid\fP (const oid *objToCopy, size_t objToCopyLen)"
310 .RI "u_int \fBsnmp_increment_statistic\fP (int which)"
313 .RI "u_int \fBsnmp_increment_statistic_by\fP (int which, int count)"
316 .RI "u_int \fBsnmp_get_statistic\fP (int which)"
319 .RI "void \fBsnmp_init_statistics\fP (void)"
326 .RI "session_list * \fBSessions\fP = NULL"
329 .RI "int \fBsnmp_errno\fP = 0"
332 .SH "DEFINE DOCUMENTATION"
334 .SS "#define DEBUGPRINTPDUTYPE(token, type)"
341 DEBUGDUMPSECTION(token, 'PDU-GET'); \
343 case SNMP_MSG_GETNEXT: \
344 DEBUGDUMPSECTION(token, 'PDU-GETNEXT'); \
346 case SNMP_MSG_RESPONSE: \
347 DEBUGDUMPSECTION(token, 'PDU-RESPONSE'); \
350 DEBUGDUMPSECTION(token, 'PDU-SET'); \
352 case SNMP_MSG_GETBULK: \
353 DEBUGDUMPSECTION(token, 'PDU-GETBULK'); \
355 case SNMP_MSG_INFORM: \
356 DEBUGDUMPSECTION(token, 'PDU-INFORM'); \
358 case SNMP_MSG_TRAP2: \
359 DEBUGDUMPSECTION(token, 'PDU-TRAP2'); \
361 case SNMP_MSG_REPORT: \
362 DEBUGDUMPSECTION(token, 'PDU-REPORT'); \
365 DEBUGDUMPSECTION(token, 'PDU-UNKNOWN'); \
370 Definition at line 364 of file snmp_api.c.
371 .SS "#define timercmp(tvp, uvp, cmp)"
377 ((tvp)->tv_sec cmp (uvp)->tv_sec || \
378 ((tvp)->tv_sec == (uvp)->tv_sec && \
380 (tvp)->tv_usec cmp (uvp)->tv_usec))
383 Definition at line 135 of file snmp_api.c.
384 .SH "FUNCTION DOCUMENTATION"
386 .SS "int netsnmp_oid_equals (const oid * in_name1, size_t len1, const oid * in_name2, size_t len2)"
388 Compares 2 OIDs to determine if they are exactly equal.
390 This should be faster than doing a snmp_oid_compare for different length OIDs, since the length is checked first and if != returns immediately. Might be very slighly faster if lengths are ==.
396 A pointer to the first oid.
399 length of the first OID (in segments, not bytes)
402 A pointer to the second oid.
405 length of the second OID (in segments, not bytes)
409 0 if they are equal, 1 if they are not.
411 Definition at line 6044 of file snmp_api.c.
412 .SS "int netsnmp_oid_find_prefix (const oid * in_name1, size_t len1, const oid * in_name2, size_t len2)"
414 Given two OIDs, determine the common prefix to them both.
420 A pointer to the first oid.
423 Length of the first oid.
426 A pointer to the second oid.
429 Length of the second oid.
433 length of largest common index of commonality. 1 = first, 0 if none * or -1 on error.
435 Definition at line 6100 of file snmp_api.c.
436 .SS "int netsnmp_oid_is_subtree (const oid * in_name1, size_t len1, const oid * in_name2, size_t len2)"
438 Identical to netsnmp_oid_equals, except only the length up to len1 is compared.
440 Functionally, this determines if in_name2 is equal or a subtree of in_name1
446 A pointer to the first oid.
449 length of the first OID (in segments, not bytes)
452 A pointer to the second oid.
455 length of the second OID (in segments, not bytes)
459 0 if one is a common prefix of the other.
461 Definition at line 6080 of file snmp_api.c.
462 .SS "int snmp_oid_compare (const oid * in_name1, size_t len1, const oid * in_name2, size_t len2)"
464 lexicographical compare two object identifiers.
466 Caution: this method is called often by command responder applications (ie, agent).
470 -1 if name1 < name2, 0 if name1 = name2, 1 if name1 > name2
472 Definition at line 5976 of file snmp_api.c.
473 .SS "int snmp_oidtree_compare (const oid * in_name1, size_t len1, const oid * in_name2, size_t len2)"
475 Compares 2 OIDs to determine if they are equal up until the shortest length.
481 A pointer to the first oid.
484 length of the first OID (in segments, not bytes)
487 A pointer to the second oid.
490 length of the second OID (in segments, not bytes)
494 0 if they are equal, 1 if in_name1 is > in_name2, or -1 if <.
496 Definition at line 6025 of file snmp_api.c.