7 #include <freeradius-devel/ident.h>
8 RCSIDH(radius_snmp_h, "$Id$")
12 typedef enum smux_event_t {
13 SMUX_NONE, SMUX_CONNECT, SMUX_READ
16 extern int radius_snmp_init(CONF_SECTION *);
17 extern int smux_connect(void);
18 extern int smux_read(void);
21 * The RADIUS server snmp data structures.
23 typedef struct rad_snmp_server_t {
26 int32_t uptime; /* in hundredths of a second */
28 time_t last_reset_time;
31 int32_t total_requests;
32 int32_t total_invalid_requests;
33 int32_t total_dup_requests;
34 int32_t total_responses;
35 int32_t total_access_accepts;
36 int32_t total_access_rejects;
37 int32_t total_access_challenges;
38 int32_t total_malformed_requests;
39 int32_t total_bad_authenticators;
40 int32_t total_packets_dropped;
41 int32_t total_no_records;
42 int32_t total_unknown_types;
45 typedef struct rad_snmp_t {
46 rad_snmp_server_t auth;
47 #ifdef WITH_ACCOUNTING
48 rad_snmp_server_t acct;
50 smux_event_t smux_event;
51 const char *smux_password;
52 int snmp_write_access;
55 int smux_max_failures;
59 * Taken from RFC 2619 and RFC 2621
61 struct rad_snmp_client_entry_t {
64 /* Client ID (string ) */
66 uint32_t dup_requests;
71 uint32_t malformed_requests;
72 uint32_t bad_authenticators;
73 uint32_t packets_dropped;
74 uint32_t unknown_types;
77 extern rad_snmp_t rad_snmp;
79 #define RAD_SNMP_INC(_x) if (mainconfig.do_snmp) _x++
80 #ifdef WITH_ACCOUNTING
81 #define RAD_SNMP_TYPE_INC(_listener, _x) if (mainconfig.do_snmp) { \
82 if (_listener->type == RAD_LISTEN_AUTH) { \
84 } else { if (_listener->type == RAD_LISTEN_ACCT) \
85 rad_snmp.acct._x++; } }
87 #define RAD_SNMP_CLIENT_INC(_listener, _client, _x) if (mainconfig.do_snmp) { \
88 if (_listener->type == RAD_LISTEN_AUTH) { \
89 _client->auth->_x++; \
90 } else { if (_listener->type == RAD_LISTEN_ACCT) \
91 _client->acct->_x++; } }
93 #else /* WITH_ACCOUNTING */
95 #define RAD_SNMP_TYPE_INC(_listener, _x) if (mainconfig.do_snmp) { \
98 #define RAD_SNMP_CLIENT_INC(_listener, _client, _x) if (mainconfig.do_snmp) { \
99 _client->auth->_x++; }
105 #define RAD_SNMP_INC(_x)
106 #define RAD_SNMP_TYPE_INC(_listener, _x)
107 #define RAD_SNMP_CLIENT_INC(_listener, _client, _x)
109 #endif /* WITH_SNMP */
111 #endif /* _RADIUS_SNMP_H */