Deleted Added
full compact
bsnmplib.3 (216294) bsnmplib.3 (216594)
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.\"
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 ,
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 ,
53.Nm snmp_pdu_dump ,
54.Nm snmp_passwd_to_keys ,
55.Nm snmp_get_local_keys ,
56.Nm snmp_calc_keychange ,
57.Nm TRUTH_MK ,
58.Nm TRUTH_GET ,
59.Nm TRUTH_OK
60.Nd "SNMP decoding and encoding library"

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

78.Fn snmp_pdu_encode "struct snmp_pdu *pdu" "struct asn_buf *buf"
79.Ft enum snmp_code
80.Fn snmp_pdu_decode_header "struct snmp_pdu *pdu" "struct asn_buf *buf"
81.Ft enum snmp_code
82.Fn snmp_pdu_decode_scoped "struct asn_buf *buf" "struct snmp_pdu *pdu" "int32_t *ip"
83.Ft enum snmp_code
84.Fn snmp_pdu_decode_secmode "struct asn_buf *buf" "struct snmp_pdu *pdu"
85.Ft void
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
86.Fn snmp_pdu_dump "const struct snmp_pdu *pdu"
87.Ft enum snmp_code
88.Fn snmp_passwd_to_keys "struct snmp_user *user" "char *passwd"
89.Ft enum snmp_code
90.Fn snmp_get_local_keys "struct snmp_user *user" "uint8_t *eid" "uint32_t elen"
91.Ft enum snmp_code
92.Fn snmp_calc_keychange "struct snmp_user *user" "uint8_t *keychange"
93.Ft int

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

170 int32_t max_msg_size;
171};
172.Ed
173.Pp
174This structure represents an SNMP engine as specified by the SNMP Management
175Architecture described in RFC 3411.
176.Pp
177.Bd -literal -offset indent
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)
179#define SNMP_AUTH_KEY_SIZ 40
180#define SNMP_PRIV_KEY_SIZ 32
181
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
182struct snmp_user {
191struct snmp_user {
183 char sec_name[SNMP_USM_NAME_SIZ];
192 char sec_name[SNMP_ADM_STR32_SIZ];
184 enum snmp_authentication auth_proto;
185 enum snmp_privacy priv_proto;
186 uint8_t auth_key[SNMP_AUTH_KEY_SIZ];
187 uint8_t priv_key[SNMP_PRIV_KEY_SIZ];
188};
189.Ed
190.Pp
191This structure represents an SNMPv3 user as specified by the User-based

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

225
226#define SNMP_USM_AUTH_SIZE 12
227#define SNMP_USM_PRIV_SIZE 8
228
229#define SNMP_MSG_AUTH_FLAG 0x1
230#define SNMP_MSG_PRIV_FLAG 0x2
231#define SNMP_MSG_REPORT_FLAG 0x4
232
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
234
235struct snmp_pdu {
236 char community[SNMP_COMMUNITY_MAXLEN + 1];
237 enum snmp_version version;
238 u_int type;
239
240 /* SNMPv3 PDU header fields */
241 int32_t identifier;

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

291 SNMP_V3
292};
293.Ed
294and
295.Fa type
296is the type of the PDU.
297.Fa security_model
298is the security model used for SNMPv3 PDUs. The only supported
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
300.Pp
301The function
302.Fn snmp_value_free
303is used to free all the dynamic allocated contents of an SNMP value.
304It does not free the structure pointed to by
305.Fa value
306itself.
307.Pp

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

361The function
362.Fn snmp_pdu_decode_secmode
363verifies the authentication parameter contained in the PDU (if present) and
364if the PDU is encrypted, decrypts the PDU contents pointed to by
365.Fa buf .
366If successfull, a plain text scoped PDU is stored in the buffer.
367.Pp
368The function
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
369.Fn snmp_pdu_dump
370dumps the PDU in a human readable form by calling
371.Fn snmp_printf .
372.Pp
373The function
374.Fn snmp_passwd_to_keys
375calculates a binary private authentication key corresponding to a plain text human
376readable password string. The calculated key is placed in the

--- 113 unchanged lines hidden ---
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 ---