snmpmod.3 (216294) | snmpmod.3 (216594) |
---|---|
1.\" 2.\" Copyright (c) 2004-2005 3.\" Hartmut Brandt. 4.\" All rights reserved. 5.\" Copyright (c) 2001-2003 6.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus). 7.\" All rights reserved. 8.\" --- 17 unchanged lines hidden (view full) --- 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" $Begemot: bsnmp/snmpd/snmpmod.3,v 1.14 2005/10/04 13:30:35 brandt_h Exp $ 33.\" | 1.\" 2.\" Copyright (c) 2004-2005 3.\" Hartmut Brandt. 4.\" All rights reserved. 5.\" Copyright (c) 2001-2003 6.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus). 7.\" All rights reserved. 8.\" --- 17 unchanged lines hidden (view full) --- 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" $Begemot: bsnmp/snmpd/snmpmod.3,v 1.14 2005/10/04 13:30:35 brandt_h Exp $ 33.\" |
34.Dd September 9, 2010 | 34.Dd December 19, 2010 |
35.Dt SNMPMOD 3 36.Os 37.Sh NAME 38.Nm INSERT_OBJECT_OID_LINK_INDEX , 39.Nm INSERT_OBJECT_INT_LINK_INDEX , 40.Nm FIND_OBJECT_OID_LINK_INDEX , 41.Nm NEXT_OBJECT_OID_LINK_INDEX , 42.Nm FIND_OBJECT_INT_LINK_INDEX , --- 35 unchanged lines hidden (view full) --- 78.Nm or_unregister , 79.Nm buf_alloc , 80.Nm buf_size , 81.Nm snmp_input_start , 82.Nm snmp_input_finish , 83.Nm snmp_output , 84.Nm snmp_send_port , 85.Nm snmp_send_trap , | 35.Dt SNMPMOD 3 36.Os 37.Sh NAME 38.Nm INSERT_OBJECT_OID_LINK_INDEX , 39.Nm INSERT_OBJECT_INT_LINK_INDEX , 40.Nm FIND_OBJECT_OID_LINK_INDEX , 41.Nm NEXT_OBJECT_OID_LINK_INDEX , 42.Nm FIND_OBJECT_INT_LINK_INDEX , --- 35 unchanged lines hidden (view full) --- 78.Nm or_unregister , 79.Nm buf_alloc , 80.Nm buf_size , 81.Nm snmp_input_start , 82.Nm snmp_input_finish , 83.Nm snmp_output , 84.Nm snmp_send_port , 85.Nm snmp_send_trap , |
86.Nm snmp_pdu_auth_access |
|
86.Nm string_save , 87.Nm string_commit , 88.Nm string_rollback , 89.Nm string_get , 90.Nm string_get_max , 91.Nm string_free , 92.Nm ip_save , 93.Nm ip_rollback , 94.Nm ip_commit , 95.Nm ip_get , 96.Nm oid_save , 97.Nm oid_rollback , 98.Nm oid_commit , 99.Nm oid_get , 100.Nm index_decode , 101.Nm index_compare , 102.Nm index_compare_off , 103.Nm index_append , 104.Nm index_append_off, | 87.Nm string_save , 88.Nm string_commit , 89.Nm string_rollback , 90.Nm string_get , 91.Nm string_get_max , 92.Nm string_free , 93.Nm ip_save , 94.Nm ip_rollback , 95.Nm ip_commit , 96.Nm ip_get , 97.Nm oid_save , 98.Nm oid_rollback , 99.Nm oid_commit , 100.Nm oid_get , 101.Nm index_decode , 102.Nm index_compare , 103.Nm index_compare_off , 104.Nm index_append , 105.Nm index_append_off, |
106.Nm snmpd_usmstats, |
|
105.Nm bsnmpd_get_usm_stats, 106.Nm bsnmpd_reset_usm_stats, 107.Nm usm_first_user, 108.Nm usm_next_user, 109.Nm usm_find_user, 110.Nm usm_new_user, 111.Nm usm_delete_user, 112.Nm usm_flush_users, 113.Nm usm_user | 107.Nm bsnmpd_get_usm_stats, 108.Nm bsnmpd_reset_usm_stats, 109.Nm usm_first_user, 110.Nm usm_next_user, 111.Nm usm_find_user, 112.Nm usm_new_user, 113.Nm usm_delete_user, 114.Nm usm_flush_users, 115.Nm usm_user |
116.Nm snmpd_target_stat 117.Nm bsnmpd_get_target_stats 118.Nm target_first_address 119.Nm target_next_address 120.Nm target_new_address 121.Nm target_activate_address 122.Nm target_delete_address 123.Nm target_first_param 124.Nm target_next_param 125.Nm target_new_param 126.Nm target_delete_param 127.Nm target_first_notify 128.Nm target_next_notify 129.Nm target_new_notify 130.Nm target_delete_notify 131.Nm target_flush_all 132.Nm target_address 133.Nm target_param 134.Nm target_notify |
|
114.Nd "SNMP daemon loadable module interface" 115.Sh LIBRARY 116Begemot SNMP library 117.Pq libbsnmp, -lbsnmp 118.Sh SYNOPSIS 119.In bsnmp/snmpmod.h 120.Fn INSERT_OBJECT_OID_LINK_INDEX "PTR" "LIST" "LINK" "INDEX" 121.Fn INSERT_OBJECT_INT_LINK_INDEX "PTR" "LIST" "LINK" "INDEX" --- 74 unchanged lines hidden (view full) --- 196.Fc 197.Ft void 198.Fo snmp_send_port 199.Fa "void *trans" "const struct asn_oid *port" 200.Fa "struct snmp_pdu *pdu" "const struct sockaddr *addr" "socklen_t addrlen" 201.Fc 202.Ft void 203.Fn snmp_send_trap "const struct asn_oid *oid" "..." | 135.Nd "SNMP daemon loadable module interface" 136.Sh LIBRARY 137Begemot SNMP library 138.Pq libbsnmp, -lbsnmp 139.Sh SYNOPSIS 140.In bsnmp/snmpmod.h 141.Fn INSERT_OBJECT_OID_LINK_INDEX "PTR" "LIST" "LINK" "INDEX" 142.Fn INSERT_OBJECT_INT_LINK_INDEX "PTR" "LIST" "LINK" "INDEX" --- 74 unchanged lines hidden (view full) --- 217.Fc 218.Ft void 219.Fo snmp_send_port 220.Fa "void *trans" "const struct asn_oid *port" 221.Fa "struct snmp_pdu *pdu" "const struct sockaddr *addr" "socklen_t addrlen" 222.Fc 223.Ft void 224.Fn snmp_send_trap "const struct asn_oid *oid" "..." |
225.Ft enum snmp_code 226.Fn snmp_pdu_auth_access "struct snmp_pdu *pdu" "int32_t *ip" |
|
204.Ft int 205.Fn string_save "struct snmp_value *val" "struct snmp_context *ctx" "ssize_t req_size" "u_char **strp" 206.Ft void 207.Fn string_commit "struct snmp_context *ctx" 208.Ft void 209.Fn string_rollback "struct snmp_context *ctx" "u_char **strp" 210.Ft int 211.Fn string_get "struct snmp_value *val" "const u_char *str" "ssize_t len" --- 22 unchanged lines hidden (view full) --- 234.Ft int 235.Fn index_compare "const struct asn_oid *oid1" "u_int sub" "const struct asn_oid *oid2" 236.Ft int 237.Fn index_compare_off "const struct asn_oid *oid1" "u_int sub" "const struct asn_oid *oid2" "u_int off" 238.Ft void 239.Fn index_append "struct asn_oid *dst" "u_int sub" "const struct asn_oid *src" 240.Ft void 241.Fn index_append_off "struct asn_oid *dst" "u_int sub" "const struct asn_oid *src" "u_int off" | 227.Ft int 228.Fn string_save "struct snmp_value *val" "struct snmp_context *ctx" "ssize_t req_size" "u_char **strp" 229.Ft void 230.Fn string_commit "struct snmp_context *ctx" 231.Ft void 232.Fn string_rollback "struct snmp_context *ctx" "u_char **strp" 233.Ft int 234.Fn string_get "struct snmp_value *val" "const u_char *str" "ssize_t len" --- 22 unchanged lines hidden (view full) --- 257.Ft int 258.Fn index_compare "const struct asn_oid *oid1" "u_int sub" "const struct asn_oid *oid2" 259.Ft int 260.Fn index_compare_off "const struct asn_oid *oid1" "u_int sub" "const struct asn_oid *oid2" "u_int off" 261.Ft void 262.Fn index_append "struct asn_oid *dst" "u_int sub" "const struct asn_oid *src" 263.Ft void 264.Fn index_append_off "struct asn_oid *dst" "u_int sub" "const struct asn_oid *src" "u_int off" |
265.Vt extern struct snmpd_usmstat snmpd_usmstats ; |
|
242.Ft struct snmpd_usmstat * 243.Fn bsnmpd_get_usm_stats "void" 244.Ft void 245.Fn bsnmpd_reset_usm_stats "void" 246.Ft struct usm_user * 247.Fn usm_first_user "void" 248.Ft struct usm_user * 249.Fn usm_next_user "struct usm_user *uuser" 250.Ft struct usm_user * 251.Fn usm_find_user "uint8_t *engine" "uint32_t elen" "char *uname" 252.Ft struct usm_user * 253.Fn usm_new_user "uint8_t *engine" "uint32_t elen" "char *uname" 254.Ft void 255.Fn usm_delete_user "struct usm_user *" 256.Ft void 257.Fn usm_flush_users "void" 258.Vt extern struct usm_user *usm_user; | 266.Ft struct snmpd_usmstat * 267.Fn bsnmpd_get_usm_stats "void" 268.Ft void 269.Fn bsnmpd_reset_usm_stats "void" 270.Ft struct usm_user * 271.Fn usm_first_user "void" 272.Ft struct usm_user * 273.Fn usm_next_user "struct usm_user *uuser" 274.Ft struct usm_user * 275.Fn usm_find_user "uint8_t *engine" "uint32_t elen" "char *uname" 276.Ft struct usm_user * 277.Fn usm_new_user "uint8_t *engine" "uint32_t elen" "char *uname" 278.Ft void 279.Fn usm_delete_user "struct usm_user *" 280.Ft void 281.Fn usm_flush_users "void" 282.Vt extern struct usm_user *usm_user; |
283.Ft struct snmpd_target_stats * 284.Fn bsnmpd_get_target_stats "void" 285.Ft struct target_address * 286.Fn target_first_address "void" 287.Ft struct target_address * 288.Fn target_next_address "struct target_address *" 289.Ft struct target_address * 290.Fn target_new_address "char *" 291.Ft int 292.Fn target_activate_address "struct target_address *" 293.Ft int 294.Fn target_delete_address "struct target_address *" 295.Ft struct target_param * 296.Fn target_first_param "void" 297.Ft struct target_param * 298.Fn target_next_param "struct target_param *" 299.Ft struct target_param * 300.Fn target_new_param "char *" 301.Ft int 302.Fn target_delete_param "struct target_param *" 303.Ft struct target_notify * 304.Fn target_first_notify "void" 305.Ft struct target_notify * 306.Fn target_next_notify "struct target_notify *" 307.Ft struct target_notify * 308.Fn target_new_notify "char *" 309.Ft int 310.Fn target_delete_notify "struct target_notify *" 311.Ft void 312.Fn target_flush_all "void" |
|
259.Vt extern const struct asn_oid oid_usmUnknownEngineIDs; 260.Vt extern const struct asn_oid oid_usmNotInTimeWindows; 261.Sh DESCRIPTION 262The 263.Xr bsnmpd 1 264SNMP daemon implements a minimal MIB which consists of the system group, part 265of the SNMP MIB, a private configuration MIB, a trap destination table, a 266UDP port table, a community table, a module table, a statistics group and --- 331 unchanged lines hidden (view full) --- 598clears the statistics of the USM group. 599.Pp 600A global list of configured USM users is maintained by the daemon. 601.Bd -literal -offset indent 602struct usm_user { 603 struct snmp_user suser; 604 uint8_t user_engine_id[SNMP_ENGINE_ID_SIZ]; 605 uint32_t user_engine_len; | 313.Vt extern const struct asn_oid oid_usmUnknownEngineIDs; 314.Vt extern const struct asn_oid oid_usmNotInTimeWindows; 315.Sh DESCRIPTION 316The 317.Xr bsnmpd 1 318SNMP daemon implements a minimal MIB which consists of the system group, part 319of the SNMP MIB, a private configuration MIB, a trap destination table, a 320UDP port table, a community table, a module table, a statistics group and --- 331 unchanged lines hidden (view full) --- 652clears the statistics of the USM group. 653.Pp 654A global list of configured USM users is maintained by the daemon. 655.Bd -literal -offset indent 656struct usm_user { 657 struct snmp_user suser; 658 uint8_t user_engine_id[SNMP_ENGINE_ID_SIZ]; 659 uint32_t user_engine_len; |
606 char user_public[SNMP_USM_NAME_SIZ]; | 660 char user_public[SNMP_ADM_STR32_SIZ]; |
607 uint32_t user_public_len; 608 int32_t status; 609 int32_t type; 610 SLIST_ENTRY(usm_user) up; 611}; 612.Ed 613This structure represents an USM user. The daemon only responds to SNMPv3 PDUs 614with user credentials matching an USM user entry in its global list. --- 20 unchanged lines hidden (view full) --- 635.Fn usm_find_user 636returns the USM user entry matching the given 637.Fa engine 638and 639.Fa uname 640or 641.Li NULL 642if an user with the specified name and engine id is not present in the list. | 661 uint32_t user_public_len; 662 int32_t status; 663 int32_t type; 664 SLIST_ENTRY(usm_user) up; 665}; 666.Ed 667This structure represents an USM user. The daemon only responds to SNMPv3 PDUs 668with user credentials matching an USM user entry in its global list. --- 20 unchanged lines hidden (view full) --- 689.Fn usm_find_user 690returns the USM user entry matching the given 691.Fa engine 692and 693.Fa uname 694or 695.Li NULL 696if an user with the specified name and engine id is not present in the list. |
697.Ss THE MANAGEMENT TARGET GROUP 698The Management Target group holds target address information used when sending 699SNMPv3 notifications. 700.Pp 701The scalar statistics of the Management Target group are held in the global 702variable 703.Va snmpd_target_stats : 704.Bd -literal -offset indent 705struct snmpd_target_stats { 706 uint32_t unavail_contexts; 707 uint32_t unknown_contexts; 708}; 709.Ed 710.Fn bsnmpd_get_target_stats 711returns a pointer to the global structure containing the statistics. 712.Pp 713Three global lists of configured management target addresses, parameters and 714notifications respectively are maintained by the daemon. 715.Bd -literal -offset indent 716struct target_address { 717 char name[SNMP_ADM_STR32_SIZ]; 718 uint8_t address[SNMP_UDP_ADDR_SIZ]; 719 int32_t timeout; 720 int32_t retry; 721 char taglist[SNMP_TAG_SIZ]; 722 char paramname[SNMP_ADM_STR32_SIZ]; 723 int32_t type; 724 int32_t socket; 725 int32_t status; 726 SLIST_ENTRY(target_address) ta; 727}; 728.Ed 729This structure represents a SNMPv3 Management Target address. Each time a SNMP 730TRAP is send the daemon will send the Trap to all active Management Target 731addresses in its global list. 732.Bd -literal -offset indent 733struct target_param { 734 char name[SNMP_ADM_STR32_SIZ]; 735 int32_t mpmodel; 736 int32_t sec_model; 737 char secname[SNMP_ADM_STR32_SIZ]; 738 enum snmp_usm_level sec_level; 739 int32_t type; 740 int32_t status; 741 SLIST_ENTRY(target_param) tp; 742}; 743.Ed 744This structure represents the information used to generate SNMP messages to the 745associated SNMPv3 Management Target addresses. 746.Bd -literal -offset indent 747struct target_notify { 748 char name[SNMP_ADM_STR32_SIZ]; 749 char taglist[SNMP_TAG_SIZ]; 750 int32_t notify_type; 751 int32_t type; 752 int32_t status; 753 SLIST_ENTRY(target_notify) tn; 754}; 755.Ed 756This structure represents Notification Tag entries - SNMP notifications are sent 757to the Target address for each entry in the Management Target Address list that 758has a tag matching the specified tag in this structure. 759.Pp 760The daemon does not create or remove entries in the Management Target group 761lists, it gives an interface to external loadable module(s) to manage the lists. 762.Fn target_new_address 763adds a target address entry, and 764.Fn target_delete_address 765deletes an existing entry from the target address list. 766.Fn target_activate_address 767creates a socket associated with the target address entry so that SNMP 768notifications may actually be send to that target address. 769.Fn target_first_address 770will return a pointer to the first target address entry in the list, while 771.Fn target_next_address 772will return a pointer to the next target address of a given entry if one exists. 773.Fn target_new_param 774adds a target parameters' entry, and 775.Fn target_delete_param 776deletes an existing entry from the target parameters list. 777.Fn target_first_param 778will return a pointer to the first target parameters' entry in the list, while 779.Fn target_next_param 780will return a pointer to the next target parameters of a given entry if one 781exists. 782.Fn target_new_notify 783adds a notification target entry, and 784.Fn target_delete_notify 785deletes an existing entry from the notification target list. 786.Fn target_first_notify 787will return a pointer to the first notification target entry in the list, while 788.Fn target_next_notify 789will return a pointer to the next notification target of a given entry if one 790exists. 791.Fn target_flush_all 792is used to remove all configured data from the three global Management Target 793Group lists. |
|
643.Ss WELL KNOWN OIDS 644The global variable 645.Va oid_zeroDotZero 646contains the OID 0.0. 647The global variables 648.Va oid_usmUnknownEngineIDs 649.Va oid_usmNotInTimeWindows 650contains the OIDs 1.3.6.1.6.3.15.1.1.4.0 and 1.3.6.1.6.3.15.1.1.2.0 used --- 184 unchanged lines hidden (view full) --- 835The function 836.Fn snmp_send_trap 837sends a trap to all trap destinations. 838The arguments are the 839.Fa oid 840identifying the trap and a NULL-terminated list of 841.Vt struct snmp_value 842pointers that are to be inserted into the trap binding list. | 794.Ss WELL KNOWN OIDS 795The global variable 796.Va oid_zeroDotZero 797contains the OID 0.0. 798The global variables 799.Va oid_usmUnknownEngineIDs 800.Va oid_usmNotInTimeWindows 801contains the OIDs 1.3.6.1.6.3.15.1.1.4.0 and 1.3.6.1.6.3.15.1.1.2.0 used --- 184 unchanged lines hidden (view full) --- 986The function 987.Fn snmp_send_trap 988sends a trap to all trap destinations. 989The arguments are the 990.Fa oid 991identifying the trap and a NULL-terminated list of 992.Vt struct snmp_value 993pointers that are to be inserted into the trap binding list. |
994.Fn snmp_pdu_auth_access 995verifies whether access to the object IDs contained in the 996.Fa pdu 997 should be granted or denied, according to the configured View-Based Access 998rules. 999.Fa ip 1000contains the index of the first varbinding to which access was denied, or 0 if 1001access to all varbindings in the PDU is granted. |
|
843.Ss SIMPLE ACTION SUPPORT 844For simple scalar variables that need no dependencies a number of support 845functions is available to handle the set, commit, rollback and get. 846.Pp 847The following functions are used for OCTET STRING scalars, either NUL terminated 848or not: 849.Bl -tag -width "XXXXXXXXX" 850.It Fn string_save --- 175 unchanged lines hidden --- | 1002.Ss SIMPLE ACTION SUPPORT 1003For simple scalar variables that need no dependencies a number of support 1004functions is available to handle the set, commit, rollback and get. 1005.Pp 1006The following functions are used for OCTET STRING scalars, either NUL terminated 1007or not: 1008.Bl -tag -width "XXXXXXXXX" 1009.It Fn string_save --- 175 unchanged lines hidden --- |