summaryrefslogtreecommitdiffstats
path: root/contrib/bsnmp/lib
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2005-10-04 14:41:06 +0000
committerharti <harti@FreeBSD.org>2005-10-04 14:41:06 +0000
commitefb2dfa1774240830b3f74b7fe4ab8050cc1cda0 (patch)
tree939b9a00cfa4d79510a088859c9352b689740218 /contrib/bsnmp/lib
parent2b366eef52ee173d11c8c3b0570cd771e5c0044a (diff)
downloadFreeBSD-src-efb2dfa1774240830b3f74b7fe4ab8050cc1cda0.zip
FreeBSD-src-efb2dfa1774240830b3f74b7fe4ab8050cc1cda0.tar.gz
Virgin import of bsnmpd 1.11
Diffstat (limited to 'contrib/bsnmp/lib')
-rw-r--r--contrib/bsnmp/lib/Makefile.in20
-rw-r--r--contrib/bsnmp/lib/asn1.382
-rw-r--r--contrib/bsnmp/lib/asn1.c6
-rw-r--r--contrib/bsnmp/lib/asn1.h12
-rw-r--r--contrib/bsnmp/lib/bsnmpagent.3173
-rw-r--r--contrib/bsnmp/lib/bsnmpclient.3233
-rw-r--r--contrib/bsnmp/lib/bsnmplib.333
-rw-r--r--contrib/bsnmp/lib/snmp.c6
-rw-r--r--contrib/bsnmp/lib/snmpagent.c6
-rw-r--r--contrib/bsnmp/lib/snmpclient.c10
10 files changed, 357 insertions, 224 deletions
diff --git a/contrib/bsnmp/lib/Makefile.in b/contrib/bsnmp/lib/Makefile.in
new file mode 100644
index 0000000..0af159c
--- /dev/null
+++ b/contrib/bsnmp/lib/Makefile.in
@@ -0,0 +1,20 @@
+# Copyright (c) 2003-2003
+# Fraunhofer Institute for Open Communication Systems (FhG Fokus).
+# All rights reserved.
+#
+# Author: Harti Brandt <harti@freebsd.org>
+#
+# $Begemot: bsnmp/lib/Makefile.in,v 1.4 2004/08/06 08:46:47 brandt Exp $
+#
+SRCS= asn1.c snmp.c snmpagent.c snmpclient.c support.c
+INCS= asn1.h snmp.h snmpagent.h snmpclient.h
+MAN3= asn1.3 bsnmplib.3 bsnmpclient.3 bsnmpagent.3
+
+LIB= libbsnmp.la
+SHLIB_MAJOR= 2
+SHLIB_MINOR= 0
+
+CFLAGS+= -I$(srcdir)
+
+$(LIB): $(SRCS:.c=.lo)
+ $(LIBTOOL) --mode=link $(CC) $(LDLAGS) -o $@ $(SRCS:.c=.lo) -rpath $(libdir) -version-info $(SHLIB_MAJOR):$(SHLIB_MINOR)
diff --git a/contrib/bsnmp/lib/asn1.3 b/contrib/bsnmp/lib/asn1.3
index 017e61a..caa26af 100644
--- a/contrib/bsnmp/lib/asn1.3
+++ b/contrib/bsnmp/lib/asn1.3
@@ -1,4 +1,7 @@
.\"
+.\" Copyright (c) 2004-2005
+.\" Hartmut Brandt.
+.\" All rights reserved.
.\" Copyright (c) 2001-2003
.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
.\" All rights reserved.
@@ -26,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Begemot: bsnmp/lib/asn1.3,v 1.6 2005/02/25 11:55:57 brandt_h Exp $
+.\" $Begemot: bsnmp/lib/asn1.3,v 1.9 2005/10/04 08:46:49 brandt_h Exp $
.\"
-.Dd August 15, 2002
+.Dd October 4, 2005
.Dt ASN1 3
.Os
.Sh NAME
@@ -142,8 +145,8 @@ Begemot SNMP library
.Fn asn_oid2str "const struct asn_oid *oid"
.Sh DESCRIPTION
The ASN.1 library contains routines to handle ASN.1 encoding for SNMP.
-It supports only the restricted form of ASN.1 as required by SNMP. There
-are two basic structures used throughout the library:
+It supports only the restricted form of ASN.1 as required by SNMP.
+There are two basic structures used throughout the library:
.Bd -literal -offset indent
/* these restrictions are in the SMI */
#define ASN_MAXID 0xffffffff
@@ -176,17 +179,18 @@ struct asn_buf {
#define asn_ptr asn_u.ptr
.Ed
.Pp
-This structure is used to encode and decode ASN.1. It describes the output
+This structure is used to encode and decode ASN.1.
+It describes the output
buffer for encoding routines and the input buffer for decoding routines.
For encoding
.Fa asn_len
-holds the number of remaining free octets in the buffer. The first free byte
-is pointed to by
+holds the number of remaining free octets in the buffer.
+The first free byte is pointed to by
.Fa asn_ptr .
For decoding
.Fa asn_len
-holds the number of remaining bytes to decode. The next byte to decode is pointed
-to by
+holds the number of remaining bytes to decode.
+The next byte to decode is pointed to by
.Fa asn_cptr .
.Pp
Most of the functions return an error code
@@ -216,20 +220,20 @@ of error.
.Pp
The function
.Fn asn_get_header
-reads the next header from the input octet stream. It returns the tag
-in the variable pointed to by
+reads the next header from the input octet stream.
+It returns the tag in the variable pointed to by
.Fa type
(note that only single byte tags are supported) and the decoded length field
in the value pointed to by
.Fa lenp
-(this is restricted to a unsigned 32-bit value). All errors in this function
-are fatal and stop processing.
+(this is restricted to a unsigned 32-bit value).
+All errors in this function are fatal and stop processing.
.Pp
The function
.Fn asn_put_header
writes an ASN.1 header.
.Fa type
-is the tag to write and is restricted to one byte tags (i.e. tags
+is the tag to write and is restricted to one byte tags (i.e., tags
lesser or equal than 0x30).
.Fa len
is the length of the value and is restricted to 16-bit.
@@ -246,15 +250,18 @@ writes a header with the given tag
and space for the maximum supported length field and sets the pointer pointed
to by
.Fa ptr
-to the begin of this length field. This pointer must then be fed into
+to the begin of this length field.
+This pointer must then be fed into
.Fn asn_commit_header
-directly after writing the value to the buffer. The function will compute the
+directly after writing the value to the buffer.
+The function will compute the
length, insert it into the right place and shift the value if the resulting
length field is shorter than the estimated one.
.Pp
The function
.Fn asn_get_integer_raw
-is used to decode a signed integer value (32-bit). It assumes, that the
+is used to decode a signed integer value (32-bit).
+It assumes, that the
header of the integer has been decoded already.
.Fa len
is the length obtained from the ASN.1 header and the integer will be returned
@@ -263,8 +270,8 @@ in the value pointed to by
.Pp
The function
.Fn asn_get_integer
-decodes a complete 32-bit signed integer including the header. If the
-tag is wrong
+decodes a complete 32-bit signed integer including the header.
+If the tag is wrong
.Li ASN_ERR_TAG
is returned.
The function
@@ -273,14 +280,16 @@ encodes a 32-bit signed integer.
.Pp
The function
.Fn asn_get_octetstring_raw
-decodes the value field of an ASN.1 octet string. The length obtained from the
-header must be fed into the
+decodes the value field of an ASN.1 octet string.
+The length obtained from the header must be fed into the
.Fa len
argument and
.Fa out
-must point to a buffer to receive the octet string. On entry to the function
+must point to a buffer to receive the octet string.
+On entry to the function
.Fa outsize
-must point to the size of the buffer. On exit
+must point to the size of the buffer.
+On exit
.Fa outsize
will point to the number of octets decoded (if no error occurs this will be
equal to
@@ -291,7 +300,8 @@ decodes an octetstring including the header.
.Fa out
must point to a buffer to receive the string,
.Fa outsize
-must point to the size of the buffer. On exit of the function
+must point to the size of the buffer.
+On exit of the function
.Fa outsize
will point to the number of octets decoded.
The function
@@ -316,7 +326,8 @@ encodes a null.
.Pp
The function
.Fn asn_put_exception
-is used to encode an SNMPv2 exception. The exception type is
+is used to encode an SNMPv2 exception.
+The exception type is
.Fa type .
.Pp
The function
@@ -369,8 +380,8 @@ The function
.Fn asn_get_counter64_raw
decodes an unsigned 64-bit integer value.
.Fa len
-must be the value length from the header. The resulting value is
-stored into the variable pointed to by
+must be the value length from the header.
+The resulting value is stored into the variable pointed to by
.Fa res .
The function
.Fn asn_put_counter64
@@ -392,12 +403,12 @@ bytes in the input buffer.
.Pp
The function
.Fn asn_slice_oid
-splits a part out from an OID. It takes all the subids from the OID
-pointed to by
+splits a part out from an OID.
+It takes all the subids from the OID pointed to by
.Fa src
starting with the subid at position
.Fa from
-(the first subid beeing subid 0) up to, but not including, subid
+(the first subid being subid 0) up to, but not including, subid
.Fa to
and generates a new OID in
.Fa dest .
@@ -413,8 +424,8 @@ appends the OID
.Fa from
to the OID
.Fa to
-given that the resulting OID is not too long. If the maximum length is exceeded
-the result is undefined.
+given that the resulting OID is not too long.
+If the maximum length is exceeded the result is undefined.
.Pp
The function
.Fn asn_compare_oid
@@ -442,7 +453,8 @@ makes a printable string from
.Fa oid .
The buffer pointed to by
.Fa str
-must be large enough to hold the result. The constant
+must be large enough to hold the result.
+The constant
.Li ASN_OIDSTRLEN
is defined to be the length of the maximum string generated by this function
(including the trailing NUL).
@@ -452,7 +464,7 @@ makes a printable string from
.Fa oid
into a private buffer that is overwritten by each call.
.Sh DIAGNOSTICS
-When an error occures in any of the function the function pointed to
+When an error occurs in any of the function the function pointed to
by the global pointer
.Bd -literal -offset indent
extern void (*asn_error)(const struct asn_buf *, const char *, ...);
@@ -469,7 +481,7 @@ starting with
followed by the error message and an optional dump of the buffer.
.Sh SEE ALSO
.Xr gensnmptree 1 ,
-.Xr snmpd 1 ,
+.Xr bsnmpd 1 ,
.Xr bsnmpagent 3 ,
.Xr bsnmpclient 3 ,
.Xr bsnmplib 3
diff --git a/contrib/bsnmp/lib/asn1.c b/contrib/bsnmp/lib/asn1.c
index be9bf28..67c1e25 100644
--- a/contrib/bsnmp/lib/asn1.c
+++ b/contrib/bsnmp/lib/asn1.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Begemot: bsnmp/lib/asn1.c,v 1.28 2004/08/06 08:46:49 brandt Exp $
+ * $Begemot: bsnmp/lib/asn1.c,v 1.29 2005/10/04 11:21:31 brandt_h Exp $
*
* ASN.1 for SNMP.
*/
@@ -35,7 +35,11 @@
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
+#ifdef HAVE_STDINT_H
#include <stdint.h>
+#elif defined(HAVE_INTTYPES_H)
+#include <inttypes.h>
+#endif
#include <assert.h>
#include "asn1.h"
diff --git a/contrib/bsnmp/lib/asn1.h b/contrib/bsnmp/lib/asn1.h
index 0a7c040..9f7749a 100644
--- a/contrib/bsnmp/lib/asn1.h
+++ b/contrib/bsnmp/lib/asn1.h
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Begemot: bsnmp/lib/asn1.h,v 1.18 2004/08/06 08:46:50 brandt Exp $
+ * $Begemot: bsnmp/lib/asn1.h,v 1.19 2005/10/04 11:21:31 brandt_h Exp $
*
* ASN.1 for SNMP
*/
@@ -179,4 +179,14 @@ enum {
ASN_EXCEPT_ENDOFMIBVIEW = 0x02,
};
+#if !defined(INT32_MIN)
+#define INT32_MIN (-0x7fffffff-1)
+#endif
+#if !defined(INT32_MAX)
+#define INT32_MAX (0x7fffffff)
+#endif
+#if !defined(UINT32_MAX)
+#define UINT32_MAX (0xffffffff)
+#endif
+
#endif
diff --git a/contrib/bsnmp/lib/bsnmpagent.3 b/contrib/bsnmp/lib/bsnmpagent.3
index d563aa9..6e77635 100644
--- a/contrib/bsnmp/lib/bsnmpagent.3
+++ b/contrib/bsnmp/lib/bsnmpagent.3
@@ -1,4 +1,7 @@
.\"
+.\" Copyright (c) 2004-2005
+.\" Hartmut Brandt.
+.\" All rights reserved.
.\" Copyright (c) 2001-2003
.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
.\" All rights reserved.
@@ -26,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Begemot: bsnmp/lib/bsnmpagent.3,v 1.7 2005/02/25 11:55:58 brandt_h Exp $
+.\" $Begemot: bsnmp/lib/bsnmpagent.3,v 1.10 2005/10/04 08:46:49 brandt_h Exp $
.\"
-.Dd August 16, 2002
+.Dd October 4, 2005
.Dt BSNMPAGENT 3
.Os
.Sh NAME
@@ -87,14 +90,15 @@ Begemot SNMP library
.Fn snmp_dep_finish "struct snmp_context *ctx"
.Sh DESCRIPTION
The SNMP library contains routines to easily build SNMP agent applications
-that use SNMP versions 1 or 2. Note, however, that it may be even easier to
-build an
-.Xr snmpd 1
+that use SNMP versions 1 or 2.
+Note, however, that it may be even easier to build an
+.Xr bsnmpd 1
loadable module, that handles the new MIB (see
-.Xr snmpmod 3 ).
+.Xr snmpmod 3 ) .
.Pp
Most of the agent routines operate on a global array that the describes the
-complete MIB served by the agent. This array is held in the two variables:
+complete MIB served by the agent.
+This array is held in the two variables:
.Bd -literal -offset indent
extern struct snmp_node *tree;
extern u_int tree_size;
@@ -126,7 +130,8 @@ Base OID of the scalar or table column.
.It Va name
Name of this variable.
.It Va type
-Type of this variable. One of:
+Type of this variable.
+One of:
.Bd -literal -offset indent
enum snmp_node_type {
SNMP_NODE_LEAF = 1,
@@ -136,17 +141,20 @@ enum snmp_node_type {
.It Va syntax
The SNMP syntax of this variable.
.It Va op
-The user supplied handler for this variable. The handler is called with
-the following arguments:
+The user supplied handler for this variable.
+The handler is called with the following arguments:
.Bl -tag -width "ctx"
.It Fa ctx
A pointer to the context (see below).
.Li NULL .
.It Fa val
-The value to be set or retrieved. For GETNEXT and GETBULK operations the oid in
-this value is the current OID. The function (called in this case only for
+The value to be set or retrieved.
+For GETNEXT and GETBULK operations the oid in
+this value is the current OID.
+The function (called in this case only for
table rows) must find the lexically next existing OID within the same column and
-set the oid and value subfields accordingly. If the table column is exhausted the
+set the oid and value subfields accordingly.
+If the table column is exhausted the
function must return
.Li SNMP_ERR_NOSUCHNAME .
For all other operations the oid in
@@ -169,18 +177,20 @@ enum snmp_op {
.Ed
.El
.Pp
-The user handler must return an appropiate SNMP v2 error code. If the original
+The user handler must return an appropriate SNMP v2 error code.
+If the original
PDU was a version 1 PDU, the error code is mapped automatically.
.It Va flags
Currently only the flag
.Li SNMP_NODE_CANSET is defined and set for nodes, that can be written or
created.
.It Va index
-This word describes the index for table columns. Each part of the index
-takes 4 bits starting at bit 4. Bits 0 to 3 hold the number of index parts.
-This arrangment allows for tables with up to seven indexes. Each bit group
-contains the syntax for the index part. There are a number of macros to
-help in parsing this field:
+This word describes the index for table columns.
+Each part of the index takes 4 bits starting at bit 4.
+Bits 0 to 3 hold the number of index parts.
+This arrangement allows for tables with up to seven indexes.
+Each bit group contains the syntax for the index part.
+There are a number of macros to help in parsing this field:
.Bd -literal -offset indent
#define SNMP_INDEXES_MAX 7
#define SNMP_INDEX_SHIFT 4
@@ -197,8 +207,9 @@ This field may contain arbitrary data and is not used by the library.
The easiest way to construct the node table is
.Xr gensnmptree 1 .
Note, that one must be careful when changing the tree while executing a SET
-operation. Consult the sources for
-.Xr snmpd 1 .
+operation.
+Consult the sources for
+.Xr bsnmpd 1 .
.Pp
The global variable
.Va snmp_trace
@@ -218,7 +229,8 @@ enum {
.Pp
Setting a bit to true causes the library to call
.Fn snmp_debug
-in strategic places with a debug string. The library contains a default
+in strategic places with a debug string.
+The library contains a default
implementation for the debug function that prints a message to standard error.
.Pp
Many of the functions use a so called context:
@@ -234,8 +246,8 @@ struct snmp_context {
struct snmp_scratch {
void *ptr1;
void *ptr2;
- u_int32_t int1;
- u_int32_t int2;
+ uint32_t int1;
+ uint32_t int2;
};
.Ed
.Pp
@@ -243,15 +255,17 @@ The fields are used as follows:
.Bl -tag -width ".It Va var_index"
.It Va va_index
For the node operation callback this is the
-index of the variable binding that should be returned if an error occures.
-Set by the library. In all other functions this is undefined.
+index of the variable binding that should be returned if an error occurs.
+Set by the library.
+In all other functions this is undefined.
.It Va scratch
For the node operation callback this is a pointer to a per variable binding
-scratch area that can be used to implement the commit and rollback. Set
-by the library.
+scratch area that can be used to implement the commit and rollback.
+Set by the library.
.It Va dep
In the dependency callback function (see below) this is a pointer to the
-current dependency. Set by the library.
+current dependency.
+Set by the library.
.It Va data
This is the
.Fa data
@@ -267,21 +281,24 @@ executes an SNMP GETNEXT operation and the function
.Fn snmp_getbulk
executes an SNMP GETBULK operation.
For all three functions the response PDU is constructed and encoded
-on the fly. If everything is ok, the response PDU is returned in
+on the fly.
+If everything is ok, the response PDU is returned in
.Fa resp
and
.Fa resp_b .
The caller must call
.Fn snmp_pdu_free
-to free the response PDU in this case. One of the following values may be
-returned:
+to free the response PDU in this case.
+One of the following values may be returned:
.Bl -tag -width ".It Li SNMP_RET_ERR"
.It Li SNMP_RET_OK
Operation successful, response PDU may be sent.
.It Li SNMP_RET_IGN
-Operation failed, no response PDU constructed. Request is ignored.
+Operation failed, no response PDU constructed.
+Request is ignored.
.It Li SNMP_RET_ERR
-Error in operation. The error code and index have been set in
+Error in operation.
+The error code and index have been set in
.Fa pdu .
No response PDU has been constructed.
The caller may construct an error response PDU via
@@ -290,47 +307,56 @@ The caller may construct an error response PDU via
.Pp
The function
.Fn snmp_set
-executes an SNMP SET operation. The arguments are the same as for the previous
-three functions. The operation of this functions is, however, much more complex.
+executes an SNMP SET operation.
+The arguments are the same as for the previous
+three functions.
+The operation of this functions is, however, much more complex.
.Pp
-The SET operation occures in several stages:
+The SET operation occurs in several stages:
.Bl -enum -offset indent
.It
For each binding search the corresponding nodes, check that the
-variable is writeable and the syntax is ok. The writeable check can be done
-only for scalars. For columns it must be done in the node's operation callback
-function.
+variable is writeable and the syntax is ok.
+The writeable check can be done only for scalars.
+For columns it must be done in the node's operation callback function.
.It
For each binding call the node's operation callback with function SNMP_OP_SET.
-The callback may create dependencies or finalizers (see below). For simple
+The callback may create dependencies or finalizers (see below).
+For simple
scalars the scratch area may be enough to handle commit and rollback, for
-interdependend table columns dependencies may be necessary.
+interdependent table columns dependencies may be necessary.
.It
If the previous step fails at any point, the node's operation callback
functions are called for all bindings for which SNMP_OP_SET was executed
-with SNMP_OP_ROLLBACK, in the opposite order. This allows all variables to
-undo the effect of the SET operation. After this all the dependencies
-are freed
-and the finalizers are executed with a fail flag of 1. Then the function
+with SNMP_OP_ROLLBACK, in the opposite order.
+This allows all variables to undo the effect of the SET operation.
+After this all the dependencies are freed
+and the finalizers are executed with a fail flag of 1.
+Then the function
returns to the caller with an appropriate error indication.
.It
If the SET step was successful for all bindings, the dependency callbacks
are executed in the order in which the dependencies were created with an
-operation of SNMP_DEPOP_COMMIT. If any of the dependencies fails, all the
+operation of SNMP_DEPOP_COMMIT.
+If any of the dependencies fails, all the
committed dependencies are called again in the opposite order
-with SNMP_DEPOP_ROLLBACK. Than for all bindings from the last to the first
+with SNMP_DEPOP_ROLLBACK.
+Than for all bindings from the last to the first
the node's operation callback is called with SNMP_OP_ROLLBACK to undo
-the effect of SNMP_OP_SET. At the end the dependencies are freed
-and the finalizers are called with a fail flag
-of 1 and the function returns to the caller with an appropriate error indication.
+the effect of SNMP_OP_SET.
+At the end the dependencies are freed and the finalizers are called with
+a fail flag of 1 and the function returns to the caller with an appropriate
+error indication.
.It
If the dependency commits were successful, for each binding the node's
-operation callback is called with SNMP_OP_COMMIT. Any error returned from
+operation callback is called with SNMP_OP_COMMIT.
+Any error returned from
the callbacks is ignored (an error message is generated via
.Fn snmp_error ).
.It
Now the dependencies are freed and the finalizers are called
-with a fail flag of 0. For each dependency just before freeing it
+with a fail flag of 0.
+For each dependency just before freeing it
its callback is called with
.Li SNMP_DEPOP_FINISH.
Then the function returns
@@ -338,20 +364,26 @@ Then the function returns
.El
.Pp
There are to mechanisms to help in complex SET operations: dependencies and
-finalizers. A dependency is used if several bindings depend on each other.
+finalizers.
+A dependency is used if several bindings depend on each other.
A typical example is the creation of a conceptual row, which requires
-the setting of several columns to succeed. A dependency is identified by
-two OIDs. In the table case, the first oid is typically the table's base OID
-and the second one the index. Both of these can easily be generated from the
+the setting of several columns to succeed.
+A dependency is identified by
+two OIDs.
+In the table case, the first oid is typically the table's base OID
+and the second one the index.
+Both of these can easily be generated from the
variables OID with
.Fn asn_slice_oid .
The function
.Fn snmp_dep_lookup
tries to find a dependency based on these two OIDs and, if it cannot find one
-creates a new one. This means for the table example, that the function
+creates a new one.
+This means for the table example, that the function
returns the same dependency for each of the columns of the same table row.
This allows during the SNMP_OP_SET processing to collect all information
-about the row into the dependency. The arguments to
+about the row into the dependency.
+The arguments to
.Fn snmp_dep_lookup
are: the two OIDs to identify the dependency (they are copied into newly
created dependencies), the size of the structure to allocate and
@@ -369,16 +401,17 @@ freed correctly.
.Pp
The function
.Fn snmp_make_errresp
-makes an error response if an operation has failed. It takes the original
-request PDU (it will look only on the error code and index fields), the
-buffer containing the original PDU and a buffer for the error PDU. It copies
-the bindings field from the original PDUs buffer directly to the response
-PDU and thus does not depend on the decodability of this field. It may return
-the same values as the operation functions.
+makes an error response if an operation has failed.
+It takes the original request PDU (it will look only on the error code and
+index fields), the buffer containing the original PDU and a buffer for the
+error PDU.
+It copies the bindings field from the original PDUs buffer directly to
+the response PDU and thus does not depend on the decodability of this field.
+It may return the same values as the operation functions.
.Pp
The next four functions allow some parts of the SET operation to be executed.
This is only used in
-.Xr snmpd 1
+.Xr bsnmpd 1
to implement the configuration as a single transaction.
The function
.Fn snmp_init_context
@@ -395,12 +428,12 @@ The function
.Fn snmp_dep_finish
executes SNMP_DEPOP_FINISH for all dependencies.
.Sh DIAGNOSTICS
-If an error occures in any of the function an error indication as described
-above is returned. Additionally the functions may call snmp_error on unexected
-errors.
+If an error occurs in any of the function an error indication as described
+above is returned.
+Additionally the functions may call snmp_error on unexpected errors.
.Sh SEE ALSO
.Xr gensnmptree 1 ,
-.Xr snmpd 1 ,
+.Xr bsnmpd 1 ,
.Xr bsnmpclient 3 ,
.Xr bsnmplib 3 ,
.Xr snmpmod 3
diff --git a/contrib/bsnmp/lib/bsnmpclient.3 b/contrib/bsnmp/lib/bsnmpclient.3
index e932eba..ffcce83 100644
--- a/contrib/bsnmp/lib/bsnmpclient.3
+++ b/contrib/bsnmp/lib/bsnmpclient.3
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Begemot: bsnmp/lib/bsnmpclient.3,v 1.9 2005/05/23 11:10:12 brandt_h Exp $
+.\" $Begemot: bsnmp/lib/bsnmpclient.3,v 1.12 2005/10/04 08:46:50 brandt_h Exp $
.\"
-.Dd May 23, 2005
+.Dd October 4, 2005
.Dt BSNMPCLIENT 3
.Os
.Sh NAME
@@ -104,7 +104,8 @@ Begemot SNMP library
.Fn snmp_dialog "struct snmp_pdu *req" "struct snmp_pdu *resp"
.Sh DESCRIPTION
The SNMP library contains routines to easily build SNMP client applications
-that use SNMP versions 1 or 2. Most of the routines use a
+that use SNMP versions 1 or 2.
+Most of the routines use a
.Vt struct snmp_client :
.Bd -literal -offset indent
struct snmp_client {
@@ -145,9 +146,11 @@ struct snmp_client {
The fields of this structure are described below.
.Bl -tag -width "timeout_start"
.It Va version
-This is the version of SNMP to use. See
+This is the version of SNMP to use.
+See
.Xr bsnmplib 3
-for applicable values. The default version is
+for applicable values.
+The default version is
.Li SNMP_V2c .
.It Va trans
If this is
@@ -163,12 +166,14 @@ It uses the
.Va chost
field as the path to the server's socket for local sockets.
.It Va cport
-The SNMP agent's UDP port number. This may be a symbolic port number (from
-.Pa /etc/services
-or a numeric port number. If this field is
+The SNMP agent's UDP port number.
+This may be a symbolic port number (from
+.Pa /etc/services )
+or a numeric port number.
+If this field is
.Li NULL
-(the default) the standard SNMP port is used. This field should not be changed
-directly but rather by calling
+(the default) the standard SNMP port is used.
+This field should not be changed directly but rather by calling
.Fn snmp_client_set_port .
.It Va chost
The SNMP agent's host name, IP address or
@@ -178,46 +183,52 @@ If this is
.Li NULL
(the default)
.Li localhost
-is assumed. This field should not be changed directly but rather through
-calling
+is assumed.
+This field should not be changed directly but rather through calling
.Fn snmp_client_set_host .
.It Va read_community
This is the community name to be used for all requests except SET requests.
The default is
.Sq public .
.It Va write_community
-The community name to be used for SET requests. The default is
+The community name to be used for SET requests.
+The default is
.Sq private .
.It Va timeout
-The maximum time to wait for responses to requests. If the time elapses, the
-request is resent up to
+The maximum time to wait for responses to requests.
+If the time elapses, the request is resent up to
.Va retries
-times. The default is 3 seconds.
+times.
+The default is 3 seconds.
.It Va retries
-Number of times a request PDU is to be resent. If set to 0, the request is
-sent only once. The default is 3 retransmissions.
+Number of times a request PDU is to be resent.
+If set to 0, the request is sent only once.
+The default is 3 retransmissions.
.It Va dump_pdus
If set to a non-zero value all received and sent PDUs are dumped via
.Xr snmp_pdu_dump 3 .
The default is not to dump PDUs.
.It Va txbuflen
-The encoding buffer size to be allocated for transmitted PDUs. The default is
-10000 octets.
+The encoding buffer size to be allocated for transmitted PDUs.
+The default is 10000 octets.
.It Va rxbuflen
-The decoding buffer size to be allocated for received PDUs. This is the size
-of the maximum PDU that can be received. The default is 10000 octets.
+The decoding buffer size to be allocated for received PDUs.
+This is the size of the maximum PDU that can be received.
+The default is 10000 octets.
.It Va fd
After calling
.Fn snmp_open
this is the file socket file descriptor used for sending and receiving PDUs.
.It Va next_reqid
-The request id of the next PDU to send. Used internal by the library.
+The request id of the next PDU to send.
+Used internal by the library.
.It Va max_reqid
-The maximum request id to use for outging PDUs. The default is
+The maximum request id to use for outgoing PDUs.
+The default is
.Li INT32_MAX .
.It Va min_reqid
-The minimum request id to use for outgoing PDUs. Request ids are allocated
-linerily starting at
+The minimum request id to use for outgoing PDUs.
+Request ids are allocated linearily starting at
.Va min_reqid
up to
.Va max_reqid .
@@ -225,29 +236,30 @@ up to
If an error happens, this field is set to a printable string describing the
error.
.It Va timeout_start
-This field must point to a function setting up a one shot timeout. After the
-timeout has elapsed, the given callback function must be called with the
-user argument. The
+This field must point to a function setting up a one shot timeout.
+After the timeout has elapsed, the given callback function must be called
+with the user argument.
+The
.Fn timeout_start
function must return a
.Vt void *
identifying the timeout.
.It Va timeout_stop
-This field must be set to a function that stops a running timeout. The function
-will be called with the return value of the corresponding
+This field must be set to a function that stops a running timeout.
+The function will be called with the return value of the corresponding
.Fn timeout_start
function.
.It Va local_path
-If in local socket mode, the name of the clients socket. Not needed by the
-application.
+If in local socket mode, the name of the clients socket.
+Not needed by the application.
.El
.Pp
In the current implementation there is a global variable
.Pp
.D1 Vt extern struct snmp_client snmp_client ;
.Pp
-that is used by all the library functions. The first call into the library must
-be a call to
+that is used by all the library functions.
+The first call into the library must be a call to
.Fn snmp_client_init
to initialize this global variable to the default values.
After this call and before calling
@@ -271,23 +283,26 @@ If any of the arguments of the call is not
.Li NULL
the corresponding field in the global
.Va snmp_client
-is set from the argument. Otherwise the values that are already in that variable
-are used.
+is set from the argument.
+Otherwise the values that are already in that variable are used.
The function
.Fn snmp_close
closes the socket, stops all timeouts and frees all dynamically allocated
resources.
.Pp
-The next three functions are used to create request PDUs. The function
+The next three functions are used to create request PDUs.
+The function
.Fn snmp_pdu_create
initializes a PDU of type
.Va op .
-It does not allocate space for the PDU itself. This is the responsibility of
-the caller.
+It does not allocate space for the PDU itself.
+This is the responsibility of the caller.
.Fn snmp_add_binding
adds bindings to the PDU and returns the (zero based) index of the first new
-binding. The arguments are pairs of pointer to the OIDs and syntax constants,
-terminated by a NULL. The call
+binding.
+The arguments are pairs of pointer to the OIDs and syntax constants,
+terminated by a NULL.
+The call
.Bd -literal -offset indent
snmp_add_binding(&pdu,
&oid1, SNMP_SYNTAX_INTEGER,
@@ -297,15 +312,16 @@ snmp_add_binding(&pdu,
.Pp
adds two new bindings to the PDU and returns the index of the first one.
It is the responsibility of the caller to set the value part of the binding
-if neccesary. The functions returns -1 if the maximum number of bindings
-is exhausted.
+if necessary.
+The functions returns -1 if the maximum number of bindings is exhausted.
The function
.Fn snmp_oid_append
-can be used to construct variable OIDs for requests. It takes a pointer
-to an
+can be used to construct variable OIDs for requests.
+It takes a pointer to an
.Vt struct asn_oid
that is to be constructed, a format string, and a number of arguments
-the type of which depends on the format string. The format string is interpreted
+the type of which depends on the format string.
+The format string is interpreted
character by character in the following way:
.Bl -tag -width ".It Li ( Va N Ns Li )"
.It Li i
@@ -332,7 +348,8 @@ This format expects an argument of type
.Vt const char *
and appends
.Va size
-characters from the string to the OID. The string may contain
+characters from the string to the OID.
+The string may contain
.Li NUL
characters.
.It Li c
@@ -346,7 +363,8 @@ pointed to by the second argument.
.Pp
The function
.Fn snmp_pdu_check
-may be used to check a response PDU. A number of checks are performed
+may be used to check a response PDU.
+A number of checks are performed
(error code, equal number of bindings, syntaxes and values for SET PDUs).
The function returns +1 if everything is ok, 0 if a NOSUCHNAME or similar
error was detected, -1 if the response PDU had fatal errors
@@ -354,38 +372,43 @@ and -2 if
.Fa resp
is
.Li NULL
-(a timeout occured).
+(a timeout occurred).
.Pp
The function
.Fn snmp_pdu_send
-encodes and sends the given PDU. It records the PDU together with the callback
+encodes and sends the given PDU.
+It records the PDU together with the callback
and user pointers in an internal list and arranges for retransmission if no
-response is received. When a response is received or the retransmission count
+response is received.
+When a response is received or the retransmission count
is exceeded the callback
.Fa func
is called with the orignal request PDU, the response PDU and the user argument
.Fa uarg .
If the retransmit count is exceeded,
.Fa func
-is called with the original request PDU, the reponse pointer set to
+is called with the original request PDU, the response pointer set to
.Li NULL
and the user argument
.Fa uarg .
The caller should not free the request PDU until the callback function is
-called. The callback function must free the request PDU and the response
-PDU (if not
+called.
+The callback function must free the request PDU and the response PDU (if not
.Li NULL ).
.Pp
The function
.Fn snmp_receive
-tries to receive a PDU. If the argument is zero, the function polls to see
+tries to receive a PDU.
+If the argument is zero, the function polls to see
whether a packet is available, if the argument is non-zero, the function blocks
-until the next packet is received. The packet is delivered via the usual callback
+until the next packet is received.
+The packet is delivered via the usual callback
mechanism (non-response packets are silently dropped).
The function returns 0, if a packet was received and successfully dispatched,
--1 if an error occured or no packet was available (in polling mode).
+-1 if an error occurred or no packet was available (in polling mode).
.Pp
-The next two functions are used to retrieve tables from SNMP agents. The use
+The next two functions are used to retrieve tables from SNMP agents.
+They use
the following input structure, that describes the table:
.Bd -literal -offset indent
struct snmp_table {
@@ -394,7 +417,7 @@ struct snmp_table {
u_int max_iter;
size_t entry_size;
u_int index_size;
- u_int64_t req_mask;
+ uint64_t req_mask;
struct snmp_table_entry {
asn_subid_t subid;
@@ -410,15 +433,17 @@ The fields of this structure have the following meaning:
This is the base OID of the table.
.It Va last_change
Some tables have a scalar variable of type TIMETICKS attached to them,
-that holds the time when the table was last changed. This OID should be
-the OID of this variable (without the \&.0 index). When the table is retrieved
+that holds the time when the table was last changed.
+This OID should be the OID of this variable (without the \&.0 index).
+When the table is retrieved
with multiple GET requests, and the variable changes between two request,
the table fetch is restarted.
.It Va max_iter
Maximum number of tries to fetch the table.
.It Va entry_size
-The table fetching routines return a list of structure one for each table
-row. This variable is the size of one structure and used to
+The table fetching routines return a list of structures one for each table
+row.
+This variable is the size of one structure and used to
.Xr malloc 3
the structure.
.It Va index_size
@@ -427,19 +452,22 @@ This is the number of index columns in the table.
This is a bit mask with a 1 for each table column that is required.
Bit 0 corresponds to the first element (index 0) in the array
.Va entries ,
-bit 1 to the second (index 1) and so on. SNMP tables may be sparse. For sparse
-columns the bit should not be set. If the bit for a given column is set and
+bit 1 to the second (index 1) and so on.
+SNMP tables may be sparse.
+For sparse columns the bit should not be set.
+If the bit for a given column is set and
the column value cannot be retrieved for a given row, the table fetch is
-restarted assuming that the table is currently beeing modified by the agent.
+restarted assuming that the table is currently being modified by the agent.
The bits for the index columns are ignored.
.It Va entries
-This is a variable sized array of column descriptors. This array is terminated
-by an element with syntax
+This is a variable sized array of column descriptors.
+This array is terminated by an element with syntax
.Li SNMP_SYNTAX_NULL .
The first
.Va index_size
elements describe all the index columns of the table, the rest are normal
-columns. If for a the column at
+columns.
+If for the column at
.Ql entries[N]
the expression
.Ql req_mask & (1 << N)
@@ -447,12 +475,14 @@ yields true, the column is considered a required column.
The fields of this the array elements have the following meaning:
.Bl -tag -width "syntax"
.It Va subid
-This is the OID subid of the column. This is ignored for index entries. Index
-entries are decoded according to the
+This is the OID subid of the column.
+This is ignored for index entries.
+Index entries are decoded according to the
.Va syntax
field.
.It Va syntax
-This is the syntax of the column or index. A syntax of
+This is the syntax of the column or index.
+A syntax of
.Li SNMP_SYNTAX_NULL
terminates the array.
.It Va offset
@@ -465,10 +495,11 @@ macro.
.Pp
Both table fetching functions return TAILQ (see
.Xr queue 3 )
-of structures--one for each table row. These structures must start with a
+of structures--one for each table row.
+These structures must start with a
.Fn TAILQ_ENTRY
and a
-.Vt u_int64_t
+.Vt uint64_t
and are allocated via
.Xr malloc 3 .
The
@@ -476,29 +507,33 @@ The
argument of the table functions must point to a
.Fn TAILQ_HEAD .
The
-.Vt u_int64_t
+.Vt uint64_t
fields, usually called
.Va found
is used to indicate which of the columns have been found for the given
-row. It is encoded like the
+row.
+It is encoded like the
.Fa req_mask
field.
.Pp
The function
.Fn snmp_table_fetch
-synchronuosly fetches the given table. If everything is ok 0 is returned.
+synchronously fetches the given table.
+If everything is ok 0 is returned.
Otherwise the function returns -1 and sets an appropriate error string.
The function
.Fn snmp_table_fetch_async
-fetches the tables asynchronuosly. If either the entire table is fetch, or
-an error occures the callback function
+fetches the tables asynchronously.
+If either the entire table is fetch, or
+an error occurs the callback function
.Fa callback
is called with the callers arguments
.Fa list
and
.Fa uarg
and a parameter that is either 0 if the table was fetched, or
--1 if there was an error. The function itself returns -1 if it could not
+-1 if there was an error.
+The function itself returns -1 if it could not
initialize fetching of the table.
.Pp
The following table description is used to fetch the ATM interface table:
@@ -508,17 +543,17 @@ The following table description is used to fetch the ATM interface table:
*/
struct atmif {
TAILQ_ENTRY(atmif) link;
- u_int64_t found;
+ uint64_t found;
int32_t index;
u_char *ifname;
size_t ifnamelen;
- u_int32_t node_id;
- u_int32_t pcr;
+ uint32_t node_id;
+ uint32_t pcr;
int32_t media;
- u_int32_t vpi_bits;
- u_int32_t vci_bits;
- u_int32_t max_vpcs;
- u_int32_t max_vccs;
+ uint32_t vpi_bits;
+ uint32_t vci_bits;
+ uint32_t max_vpcs;
+ uint32_t max_vccs;
u_char *esi;
size_t esilen;
int32_t carrier;
@@ -568,15 +603,18 @@ static const struct snmp_table atmif_table = {
.Pp
The function
.Fn snmp_dialog
-is used to execute a synchonuous dialog with the agent. The request PDU
+is used to execute a synchonuous dialog with the agent.
+The request PDU
.Fa req
-is sent and the function blocks until the response PDU is received. Note,
+is sent and the function blocks until the response PDU is received.
+Note,
that asynchonuous receives are handled (i.e. callback functions of other send
-calls or table fetches may be called while in the function). The response
-PDU is returned in
+calls or table fetches may be called while in the function).
+The response PDU is returned in
.Fa resp .
-If no reponse could be received after all timeouts and retries, the function
-returns -1. If a response was received 0 is returned.
+If no response could be received after all timeouts and retries, the function
+returns -1.
+If a response was received 0 is returned.
.Pp
The function
.Fn snmp_parse_server
@@ -600,15 +638,16 @@ is the port in case of UDP transport.
The function returns 0 in the case of success and return -1 and sets
the error string in case of an error.
.Sh DIAGNOSTICS
-If an error occures in any of the function an error indication as described
-above is returned. Additionally the function sets a printable error string
+If an error occurs in any of the function an error indication as described
+above is returned.
+Additionally the function sets a printable error string
in the
.Va error
filed of
.Va snmp_client .
.Sh SEE ALSO
.Xr gensnmptree 1 ,
-.Xr snmpd 1 ,
+.Xr bsnmpd 1 ,
.Xr bsnmpagent 3 ,
.Xr bsnmplib 3
.Sh STANDARDS
diff --git a/contrib/bsnmp/lib/bsnmplib.3 b/contrib/bsnmp/lib/bsnmplib.3
index a0da293..4a1d140 100644
--- a/contrib/bsnmp/lib/bsnmplib.3
+++ b/contrib/bsnmp/lib/bsnmplib.3
@@ -1,4 +1,7 @@
.\"
+.\" Copyright (c) 2004-2005
+.\" Hartmut Brandt.
+.\" All rights reserved.
.\" Copyright (c) 2001-2003
.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
.\" All rights reserved.
@@ -26,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Begemot: bsnmp/lib/bsnmplib.3,v 1.6 2005/02/25 11:55:59 brandt_h Exp $
+.\" $Begemot: bsnmp/lib/bsnmplib.3,v 1.9 2005/10/04 08:46:51 brandt_h Exp $
.\"
-.Dd August 15, 2002
+.Dd October 4, 2005
.Dt BSNMPLIB 3
.Os
.Sh NAME
@@ -84,15 +87,15 @@ struct snmp_value {
} octetstring;
struct asn_oid oid;
u_char ipaddress[4];
- u_int32_t uint32; /* also gauge32, counter32,
+ uint32_t uint32; /* also gauge32, counter32,
unsigned32, timeticks */
- u_int64_t counter64;
+ uint64_t counter64;
} v;
};
.Ed
.Pp
-This structure represents one variable binding from an SNMP PDU. The
-field
+This structure represents one variable binding from an SNMP PDU.
+The field
.Fa var
is the ASN.1 of the variable that is bound.
.Fa syntax
@@ -178,8 +181,8 @@ is the type of the PDU.
.Pp
The function
.Fn snmp_value_free
-is used to free all the dynamic allocated contents of an SNMP value. It does
-not free the structure pointed to by
+is used to free all the dynamic allocated contents of an SNMP value.
+It does not free the structure pointed to by
.Fa value
itself.
.Pp
@@ -187,7 +190,7 @@ The function
.Fn snmp_value_parse
parses the ASCII representation of an SNMP value into its binary form.
This function is mainly used by the configuration file reader of
-.Xr snmpd 1 .
+.Xr bsnmpd 1 .
.Pp
The function
.Fn snmp_value_copy
@@ -197,14 +200,14 @@ to the structure pointed to by
.Fa to .
It assumes that
.Fa to
-is uninitialized and will overwrite its previous contents. It does not itself
-allocate the structure pointed to by
+is uninitialized and will overwrite its previous contents.
+It does not itself allocate the structure pointed to by
.Fa to .
.Pp
The function
.Fn snmp_pdu_free
-frees all the dynamically allocated components of the PDU. It does not itself
-free the structure pointed to by
+frees all the dynamically allocated components of the PDU.
+It does not itself free the structure pointed to by
.Fa pdu .
.Pp
The function
@@ -239,7 +242,7 @@ The function
.Fn TRUTH_OK
checks, whether its argument is a legal SNMP truth value.
.Sh DIAGNOSTICS
-When an error occures in any of the function the function pointed to
+When an error occurs in any of the function the function pointed to
by the global pointer
.Bd -literal -offset indent
extern void (*snmp_error)(const char *, ...);
@@ -291,7 +294,7 @@ Encoding failed.
.El
.Sh SEE ALSO
.Xr gensnmptree 1 ,
-.Xr snmpd 1 ,
+.Xr bsnmpd 1 ,
.Xr bsnmpagent 3 ,
.Xr bsnmpclient 3 ,
.Xr bsnmplib 3
diff --git a/contrib/bsnmp/lib/snmp.c b/contrib/bsnmp/lib/snmp.c
index 8a739af..b2700b1 100644
--- a/contrib/bsnmp/lib/snmp.c
+++ b/contrib/bsnmp/lib/snmp.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Begemot: bsnmp/lib/snmp.c,v 1.38 2004/08/06 08:46:53 brandt Exp $
+ * $Begemot: bsnmp/lib/snmp.c,v 1.40 2005/10/04 14:32:42 brandt_h Exp $
*
* SNMP
*/
@@ -36,7 +36,11 @@
#include <stdlib.h>
#include <stddef.h>
#include <stdarg.h>
+#ifdef HAVE_STDINT_H
#include <stdint.h>
+#elif defined(HAVE_INTTYPES_H)
+#include <inttypes.h>
+#endif
#include <string.h>
#include <ctype.h>
#include <netdb.h>
diff --git a/contrib/bsnmp/lib/snmpagent.c b/contrib/bsnmp/lib/snmpagent.c
index 38bc140..ca9ccbd 100644
--- a/contrib/bsnmp/lib/snmpagent.c
+++ b/contrib/bsnmp/lib/snmpagent.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Begemot: bsnmp/lib/snmpagent.c,v 1.19 2004/08/19 17:09:09 brandt Exp $
+ * $Begemot: bsnmp/lib/snmpagent.c,v 1.20 2005/10/04 11:21:33 brandt_h Exp $
*
* SNMP Agent functions
*/
@@ -36,7 +36,11 @@
#include <stdlib.h>
#include <stddef.h>
#include <stdarg.h>
+#ifdef HAVE_STDINT_H
#include <stdint.h>
+#elif defined(HAVE_INTTYPES_H)
+#include <inttypes.h>
+#endif
#include <string.h>
#include "asn1.h"
diff --git a/contrib/bsnmp/lib/snmpclient.c b/contrib/bsnmp/lib/snmpclient.c
index cfea071..fa794f3 100644
--- a/contrib/bsnmp/lib/snmpclient.c
+++ b/contrib/bsnmp/lib/snmpclient.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Begemot: bsnmp/lib/snmpclient.c,v 1.31 2005/05/23 11:10:13 brandt_h Exp $
+ * $Begemot: bsnmp/lib/snmpclient.c,v 1.34 2005/10/04 14:32:42 brandt_h Exp $
*
* Support functions for SNMP clients.
*/
@@ -48,7 +48,11 @@
#include <unistd.h>
#include <fcntl.h>
#include <netdb.h>
+#ifdef HAVE_STDINT_H
#include <stdint.h>
+#elif defined(HAVE_INTTYPES_H)
+#include <inttypes.h>
+#endif
#include <limits.h>
#ifdef HAVE_ERR_H
#include <err.h>
@@ -549,7 +553,7 @@ table_check_cons(struct tabwork *work)
/*
* Fetch a table. Returns 0 if ok, -1 on errors.
- * This is the synchronuous variant.
+ * This is the synchronous variant.
*/
int
snmp_table_fetch(const struct snmp_table *descr, void *list)
@@ -1561,7 +1565,7 @@ ok_get(const struct snmp_pdu * req, const struct snmp_pdu * resp)
}
/*
- * Check the reponse to a SET PDU. We check: - the error status must be 0 -
+ * Check the response to a SET PDU. We check: - the error status must be 0 -
* the number of bindings must be equal in response and request - the
* syntaxes must be the same in response and request - the OIDs must be the
* same in response and request
OpenPOWER on IntegriCloud