5 * realms.h Structures, prototypes and global variables
8 * Version: $Id: realms.h,v 1.1 2010/08/14 04:13:52 faust Exp $
12 #include <freeradius/ident.h>
13 RCSIDH(realms_h, "$Id: realms.h,v 1.1 2010/08/14 04:13:52 faust Exp $")
15 #define HOME_TYPE_INVALID (0)
16 #define HOME_TYPE_AUTH (1)
17 #define HOME_TYPE_ACCT (2)
19 #define HOME_TYPE_COA (3)
22 #define HOME_PING_CHECK_NONE (0)
23 #define HOME_PING_CHECK_STATUS_SERVER (1)
24 #define HOME_PING_CHECK_REQUEST (2)
26 #define HOME_STATE_ALIVE (0)
27 #define HOME_STATE_ZOMBIE (1)
28 #define HOME_STATE_IS_DEAD (2)
30 typedef struct home_server {
34 const char *server; /* for internal proxying */
39 int type; /* auth/acct */
42 * Maybe also have list of source IP/ports, && socket?
52 int max_outstanding; /* don't overload it */
53 int currently_outstanding;
54 int message_authenticator;
56 struct timeval revive_time;
57 struct timeval zombie_period_start;
58 int zombie_period; /* unresponsive for T, mark it dead */
63 const char *ping_user_name;
64 const char *ping_user_password;
67 int num_pings_to_alive;
68 int num_received_pings;
71 int revive_interval; /* if it doesn't support pings */
82 fr_ipaddr_t src_ipaddr; /* preferred source IP address */
91 typedef enum home_pool_type_t {
92 HOME_POOL_INVALID = 0,
93 HOME_POOL_LOAD_BALANCE,
95 HOME_POOL_CLIENT_BALANCE,
96 HOME_POOL_CLIENT_PORT_BALANCE,
97 HOME_POOL_KEYED_BALANCE
101 typedef struct home_pool_t {
103 home_pool_type_t type;
108 const char *virtual_server; /* for pre/post-proxy */
110 home_server *fallback;
112 int num_home_servers;
113 home_server *servers[1];
117 typedef struct _realm {
122 home_pool_t *auth_pool;
123 home_pool_t *acct_pool;
126 int realms_init(CONF_SECTION *config);
127 void realms_free(void);
128 REALM *realm_find(const char *name); /* name is from a packet */
129 REALM *realm_find2(const char *name); /* ... with name taken from realm_find */
131 home_server *home_server_ldb(const char *realmname, home_pool_t *pool, REQUEST *request);
132 home_server *home_server_find(fr_ipaddr_t *ipaddr, int port);
133 int home_server_create_listeners(void *head);
135 home_server *home_server_byname(const char *name, int type);
138 home_server *home_server_bynumber(int number);
140 home_pool_t *home_pool_byname(const char *name, int type);
142 #endif /* REALMS_H */