Port "use_tunneled_reply" fix for MS-CHAP from branch_1_1
[freeradius.git] / src / include / radius_snmp.h
1 #ifndef _RADIUS_SNMP_H
2 #define _RADIUS_SNMP_H
3 /*
4  * Version:     $Id$
5  */
6
7 #include <freeradius-devel/ident.h>
8 RCSIDH(radius_snmp_h, "$Id$")
9
10 #ifdef WITH_SNMP
11
12 typedef enum smux_event_t {
13   SMUX_NONE, SMUX_CONNECT, SMUX_READ
14 } smux_event_t;
15
16 extern void radius_snmp_init(void);
17 extern int smux_connect(void);
18 extern int smux_read(void);
19
20 /*
21  *      The RADIUS server snmp data structures.
22  */
23 typedef struct rad_snmp_server_t {
24         const char      *ident;
25         time_t          start_time;
26         int32_t         uptime; /* in hundredths of a second */
27
28         time_t          last_reset_time;
29         int32_t         reset_time;
30         int32_t         config_reset;
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;
43 } rad_snmp_server_t;
44
45 typedef struct rad_snmp_t {
46         rad_snmp_server_t auth;
47         rad_snmp_server_t acct;
48         smux_event_t      smux_event;
49         const char        *smux_password;
50         int               snmp_write_access;
51         int               smux_fd;
52         int               smux_failures;
53         int               smux_max_failures;
54 } rad_snmp_t;
55
56 /*
57  *  Taken from RFC 2619 and RFC 2621
58  */
59 typedef struct rad_snmp_client_entry_t {
60         int             index;
61         /* IP address */
62         /* Client ID (string ) */
63         int             access_requests;
64         int             dup_access_requests;
65         int             access_accepts;
66         int             access_rejects;
67         int             access_challenges;
68         int             auth_malformed_requests;
69         int             auth_bad_authenticators;
70         int             auth_packets_dropped;
71         int             auth_unknown_types;
72         int             acct_packets_dropped;
73         int             acct_requests;
74         int             acct_dup_requests;
75         int             acct_responses;
76         int             acct_bad_authenticators;
77         int             acct_malformed_requests;
78         int             acct_no_records;
79         int             acct_unknown_types;
80 } rad_snmp_client_entry_t;
81
82 extern rad_snmp_t       rad_snmp;
83
84 #define RAD_SNMP_INC(_x) if (mainconfig.do_snmp) _x++
85 #define RAD_SNMP_TYPE_INC(_listener, _x) if (mainconfig.do_snmp) { \
86                                      if (_listener->type == RAD_LISTEN_AUTH) { \
87                                        rad_snmp.auth._x++; \
88                                      } else { if (_listener->type == RAD_LISTEN_ACCT) \
89                                        rad_snmp.acct._x++; } } \
90
91
92 #else
93 #define  RAD_SNMP_INC(_x)
94 #define RAD_SNMP_TYPE_INC(_listener, _x)
95
96 #endif /* WITH_SNMP */
97
98 #endif /* _RADIUS_SNMP_H */