Deleted Added
full compact
1.\"
2.\" Copyright (c) 2010 The FreeBSD Foundation
3.\" All rights reserved.
4.\"
5.\" Portions of this documentation were written by Shteryana Sotirova Shopova
6.\" under sponsorship from the FreeBSD Foundation.
7.\"
8.\" Copyright (c) 2004-2005

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

32.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36.\" SUCH DAMAGE.
37.\"
38.\" $Begemot: bsnmp/lib/bsnmplib.3,v 1.9 2005/10/04 08:46:51 brandt_h Exp $
39.\"
40.Dd September 9, 2010
40.Dd December 19, 2010
41.Dt BSNMPLIB 3
42.Os
43.Sh NAME
44.Nm snmp_value_free ,
45.Nm snmp_value_parse ,
46.Nm snmp_value_copy ,
47.Nm snmp_pdu_free ,
48.Nm snmp_pdu_decode ,
49.Nm snmp_pdu_encode ,
50.Nm snmp_pdu_decode_header ,
51.Nm snmp_pdu_decode_scoped ,
52.Nm snmp_pdu_decode_secmode ,
53.Nm snmp_pdu_init_secparams ,
54.Nm snmp_pdu_dump ,
55.Nm snmp_passwd_to_keys ,
56.Nm snmp_get_local_keys ,
57.Nm snmp_calc_keychange ,
58.Nm TRUTH_MK ,
59.Nm TRUTH_GET ,
60.Nm TRUTH_OK
61.Nd "SNMP decoding and encoding library"

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

79.Fn snmp_pdu_encode "struct snmp_pdu *pdu" "struct asn_buf *buf"
80.Ft enum snmp_code
81.Fn snmp_pdu_decode_header "struct snmp_pdu *pdu" "struct asn_buf *buf"
82.Ft enum snmp_code
83.Fn snmp_pdu_decode_scoped "struct asn_buf *buf" "struct snmp_pdu *pdu" "int32_t *ip"
84.Ft enum snmp_code
85.Fn snmp_pdu_decode_secmode "struct asn_buf *buf" "struct snmp_pdu *pdu"
86.Ft void
87.Fn snmp_pdu_init_secparams "struct snmp_pdu *pdu"
88.Ft void
89.Fn snmp_pdu_dump "const struct snmp_pdu *pdu"
90.Ft enum snmp_code
91.Fn snmp_passwd_to_keys "struct snmp_user *user" "char *passwd"
92.Ft enum snmp_code
93.Fn snmp_get_local_keys "struct snmp_user *user" "uint8_t *eid" "uint32_t elen"
94.Ft enum snmp_code
95.Fn snmp_calc_keychange "struct snmp_user *user" "uint8_t *keychange"
96.Ft int

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

173 int32_t max_msg_size;
174};
175.Ed
176.Pp
177This structure represents an SNMP engine as specified by the SNMP Management
178Architecture described in RFC 3411.
179.Pp
180.Bd -literal -offset indent
178#define SNMP_USM_NAME_SIZ (32 + 1)
181#define SNMP_ADM_STR32_SIZ (32 + 1)
182#define SNMP_AUTH_KEY_SIZ 40
183#define SNMP_PRIV_KEY_SIZ 32
184
185enum snmp_usm_level {
186 SNMP_noAuthNoPriv = 1,
187 SNMP_authNoPriv = 2,
188 SNMP_authPriv = 3
189};
190
191struct snmp_user {
183 char sec_name[SNMP_USM_NAME_SIZ];
192 char sec_name[SNMP_ADM_STR32_SIZ];
193 enum snmp_authentication auth_proto;
194 enum snmp_privacy priv_proto;
195 uint8_t auth_key[SNMP_AUTH_KEY_SIZ];
196 uint8_t priv_key[SNMP_PRIV_KEY_SIZ];
197};
198.Ed
199.Pp
200This structure represents an SNMPv3 user as specified by the User-based

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

234
235#define SNMP_USM_AUTH_SIZE 12
236#define SNMP_USM_PRIV_SIZE 8
237
238#define SNMP_MSG_AUTH_FLAG 0x1
239#define SNMP_MSG_PRIV_FLAG 0x2
240#define SNMP_MSG_REPORT_FLAG 0x4
241
233#define SNMP_SECMODEL_USM 3
242#define SNMP_MPM_SNMP_V1 0
243#define SNMP_MPM_SNMP_V2c 1
244#define SNMP_MPM_SNMP_V3 3
245
246struct snmp_pdu {
247 char community[SNMP_COMMUNITY_MAXLEN + 1];
248 enum snmp_version version;
249 u_int type;
250
251 /* SNMPv3 PDU header fields */
252 int32_t identifier;

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

302 SNMP_V3
303};
304.Ed
305and
306.Fa type
307is the type of the PDU.
308.Fa security_model
309is the security model used for SNMPv3 PDUs. The only supported
299value currently is 3 (User-based Security Model).
310value currently is 3 (User-based Security Model). Additional values for any,
311unknown, SNMPv1 and SNMPv2c security models are also enumerated
312.Bd -literal -offset indent
313enum snmp_secmodel {
314 SNMP_SECMODEL_ANY = 0,
315 SNMP_SECMODEL_SNMPv1 = 1,
316 SNMP_SECMODEL_SNMPv2c = 2,
317 SNMP_SECMODEL_USM = 3,
318 SNMP_SECMODEL_UNKNOWN
319};
320.Ed
321.Pp
322The function
323.Fn snmp_value_free
324is used to free all the dynamic allocated contents of an SNMP value.
325It does not free the structure pointed to by
326.Fa value
327itself.
328.Pp

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

382The function
383.Fn snmp_pdu_decode_secmode
384verifies the authentication parameter contained in the PDU (if present) and
385if the PDU is encrypted, decrypts the PDU contents pointed to by
386.Fa buf .
387If successfull, a plain text scoped PDU is stored in the buffer.
388.Pp
389The function
390.Fn snmp_pdu_init_secparams
391calculates the initialization vector for the privacy protocol in use before
392the PDU pointed to by
393.Fa pdu
394may be encrypted or decrypted.
395.Pp
396The function
397.Fn snmp_pdu_dump
398dumps the PDU in a human readable form by calling
399.Fn snmp_printf .
400.Pp
401The function
402.Fn snmp_passwd_to_keys
403calculates a binary private authentication key corresponding to a plain text human
404readable password string. The calculated key is placed in the

--- 113 unchanged lines hidden ---