Deleted Added
full compact
snmpmod.h (156067) snmpmod.h (216294)
1/*
2 * Copyright (c) 2001-2003
3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
4 * All rights reserved.
5 *
6 * Author: Harti Brandt <harti@freebsd.org>
7 *
8 * Redistribution and use in source and binary forms, with or without

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

327#define COMM_WRITE 2
328
329u_int comm_define(u_int, const char *descr, struct lmodule *, const char *str);
330const char * comm_string(u_int);
331
332/* community for current packet */
333extern u_int community;
334
1/*
2 * Copyright (c) 2001-2003
3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
4 * All rights reserved.
5 *
6 * Author: Harti Brandt <harti@freebsd.org>
7 *
8 * Redistribution and use in source and binary forms, with or without

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

327#define COMM_WRITE 2
328
329u_int comm_define(u_int, const char *descr, struct lmodule *, const char *str);
330const char * comm_string(u_int);
331
332/* community for current packet */
333extern u_int community;
334
335/*
335/*
336 * SNMP User-based Security Model data. Modified via the snmp_usm(3) module.
337 */
338struct snmpd_usmstat {
339 uint32_t unsupported_seclevels;
340 uint32_t not_in_time_windows;
341 uint32_t unknown_users;
342 uint32_t unknown_engine_ids;
343 uint32_t wrong_digests;
344 uint32_t decrypt_errors;
345};
346
347extern struct snmpd_usmstat snmpd_usmstats;
348struct snmpd_usmstat *bsnmpd_get_usm_stats(void);
349void bsnmpd_reset_usm_stats(void);
350
351struct usm_user {
352 struct snmp_user suser;
353 uint8_t user_engine_id[SNMP_ENGINE_ID_SIZ];
354 uint32_t user_engine_len;
355 char user_public[SNMP_ADM_STR32_SIZ];
356 uint32_t user_public_len;
357 int32_t status;
358 int32_t type;
359 SLIST_ENTRY(usm_user) up;
360};
361
362SLIST_HEAD(usm_userlist, usm_user);
363struct usm_user *usm_first_user(void);
364struct usm_user *usm_next_user(struct usm_user *);
365struct usm_user *usm_find_user(uint8_t *, uint32_t, char *);
366struct usm_user *usm_new_user(uint8_t *, uint32_t, char *);
367void usm_delete_user(struct usm_user *);
368void usm_flush_users(void);
369
370/* USM user for current packet */
371extern struct usm_user *usm_user;
372
373/*
374 * SNMP View-based Access Control Model data. Modified via the snmp_vacm(3) module.
375 */
376struct vacm_group;
377
378struct vacm_user {
379 /* Security user name from USM */
380 char secname[SNMP_ADM_STR32_SIZ];
381 int32_t sec_model;
382 /* Back pointer to user assigned group name */
383 struct vacm_group *group;
384 int32_t type;
385 int32_t status;
386 SLIST_ENTRY(vacm_user) vvu;
387 SLIST_ENTRY(vacm_user) vvg;
388};
389
390SLIST_HEAD(vacm_userlist, vacm_user);
391
392struct vacm_group {
393 char groupname[SNMP_ADM_STR32_SIZ];
394 struct vacm_userlist group_users;
395 SLIST_ENTRY(vacm_group) vge;
396};
397
398SLIST_HEAD(vacm_grouplist, vacm_group);
399
400struct vacm_access {
401 /* The group name is index, not a column in the table */
402 struct vacm_group *group;
403 char ctx_prefix[SNMP_ADM_STR32_SIZ];
404 int32_t sec_model;
405 int32_t sec_level;
406 int32_t ctx_match;
407 struct vacm_view *read_view;
408 struct vacm_view *write_view;
409 struct vacm_view *notify_view;
410 int32_t type;
411 int32_t status;
412 TAILQ_ENTRY(vacm_access) vva;
413};
414
415TAILQ_HEAD(vacm_accesslist, vacm_access);
416
417struct vacm_view {
418 char viewname[SNMP_ADM_STR32_SIZ]; /* key */
419 struct asn_oid subtree; /* key */
420 uint8_t mask[16];
421 uint8_t exclude;
422 int32_t type;
423 int32_t status;
424 SLIST_ENTRY(vacm_view) vvl;
425};
426
427SLIST_HEAD(vacm_viewlist, vacm_view);
428
429struct vacm_context {
430 /* The ID of the module that registered this context */
431 int32_t regid;
432 char ctxname[SNMP_ADM_STR32_SIZ];
433 SLIST_ENTRY(vacm_context) vcl;
434};
435
436SLIST_HEAD(vacm_contextlist, vacm_context);
437
438void vacm_groups_init(void);
439struct vacm_user *vacm_first_user(void);
440struct vacm_user *vacm_next_user(struct vacm_user *);
441struct vacm_user *vacm_new_user(int32_t, char *);
442int vacm_delete_user(struct vacm_user *);
443int vacm_user_set_group(struct vacm_user *, u_char *, u_int);
444struct vacm_access *vacm_first_access_rule(void);
445struct vacm_access *vacm_next_access_rule(struct vacm_access *);
446struct vacm_access *vacm_new_access_rule(char *, char *, int32_t, int32_t);
447int vacm_delete_access_rule(struct vacm_access *);
448struct vacm_view *vacm_first_view(void);
449struct vacm_view *vacm_next_view(struct vacm_view *);
450struct vacm_view *vacm_new_view(char *, struct asn_oid *);
451int vacm_delete_view(struct vacm_view *);
452struct vacm_context *vacm_first_context(void);
453struct vacm_context *vacm_next_context(struct vacm_context *);
454struct vacm_context *vacm_add_context(char *, int32_t);
455void vacm_flush_contexts(int32_t);
456
457/*
336 * Well known OIDs
337 */
338extern const struct asn_oid oid_zeroDotZero;
339
458 * Well known OIDs
459 */
460extern const struct asn_oid oid_zeroDotZero;
461
462/* SNMPv3 Engine Discovery */
463extern const struct asn_oid oid_usmUnknownEngineIDs;
464extern const struct asn_oid oid_usmNotInTimeWindows;
465
340/*
341 * Request ID ranges.
342 *
343 * A module can request a range of request ids and associate them with a
344 * type field. All ranges are deleted if a module is unloaded.
345 */
346u_int reqid_allocate(int size, struct lmodule *);
347int32_t reqid_next(u_int type);

--- 76 unchanged lines hidden ---
466/*
467 * Request ID ranges.
468 *
469 * A module can request a range of request ids and associate them with a
470 * type field. All ranges are deleted if a module is unloaded.
471 */
472u_int reqid_allocate(int size, struct lmodule *);
473int32_t reqid_next(u_int type);

--- 76 unchanged lines hidden ---