2 * radiusd.h Structures, prototypes and global variables
3 * for the Cistron Radius server.
18 typedef pthread_t child_pid_t ;
19 #define child_kill pthread_kill
21 typedef pid_t child_pid_t;
22 #define child_kill kill
25 #define NO_SUCH_CHILD_PID (0)
27 typedef struct auth_req {
28 RADIUS_PACKET *packet;
31 RADIUS_PACKET *proxy_reply;
32 VALUE_PAIR *config_items;
36 child_pid_t child_pid;
39 /* Could almost keep a const char * here instead of a _copy_ of the
40 * secret... but what if the RADCLIENT structure is freed because it was
41 * taken out of the config file and SIGHUPed? */
43 int proxy_is_replicate;
45 time_t proxy_next_try;
48 struct auth_req *prev;
49 struct auth_req *next;
53 * Function handler for requests.
55 typedef int (*RAD_REQUEST_FUNP)(REQUEST *);
57 typedef struct radclient {
62 struct radclient *next;
73 typedef struct realm {
86 typedef struct pair_list {
91 struct pair_list *next;
94 #define DEBUG if(debug_flag)log_debug
95 #define DEBUG2 if (debug_flag > 1)log_debug
97 #define SECONDS_PER_DAY 86400
98 #define MAX_REQUEST_TIME 30
99 #define CLEANUP_DELAY 5
100 #define MAX_REQUESTS 256
101 /* FIXME: these two should be command-line options */
102 #define RETRY_DELAY 5
103 #define RETRY_COUNT 3
119 /* for paircompare_register */
120 typedef int (*COMPARE)(VALUE_PAIR *, VALUE_PAIR *, VALUE_PAIR *, VALUE_PAIR **);
125 extern const char *progname;
126 extern int debug_flag;
127 extern const char *radacct_dir;
128 extern const char *radlog_dir;
129 extern const char *radius_dir;
130 extern const char *radius_libdir;
131 extern uint32_t expiration_seconds;
132 extern int radius_pid;
134 extern int log_stripped_names;
135 extern int cache_passwd;
136 extern uint32_t myip;
137 extern int log_auth_detail;
139 extern int log_auth_pass;
140 extern int auth_port;
141 extern int acct_port;
142 extern int proxy_port;
146 * Function prototypes.
150 int rad_accounting(REQUEST *);
153 int radutmp_add(REQUEST *);
154 int radutmp_zap(uint32_t nas, int port, char *user, time_t t);
155 int radutmp_checksimul(char *name, VALUE_PAIR *, int maxsimul);
158 void debug_pair(FILE *, VALUE_PAIR *);
159 int log_err (char *);
160 void sig_cleanup(int);
161 void remove_from_request_list(REQUEST *);
162 int rad_respond (REQUEST *);
165 void (*reset_signal(int signo, void (*func)(int)))(int);
166 void request_free(REQUEST *request);
167 RADIUS_PACKET * build_reply(int code, REQUEST *request,
168 VALUE_PAIR *vps, const char *user_msg);
171 RADCLIENT *client_find(uint32_t ipno);
172 char *client_name(uint32_t ipno);
173 REALM *realm_find(const char *);
174 PAIR_LIST *pairlist_read(const char *file, int complain);
175 void pairlist_free(PAIR_LIST **);
176 int read_config_files(void);
179 int read_naslist_file(char *);
180 NAS *nas_find(uint32_t ipno);
181 char *nas_name(uint32_t ipno);
182 char *nas_name2(RADIUS_PACKET *r);
183 NAS *nas_findbyname(char *nasname);
189 int log(int, const char *, ...);
190 int log_debug(const char *, ...);
194 int pam_pass(char *name, char *passwd, const char *pamauth);
195 #define PAM_DEFAULT_TYPE "radius"
199 int replicate_send(REQUEST *request);
200 int proxy_send(REQUEST *request);
201 int proxy_receive(REQUEST *request);
202 struct timeval *proxy_setuptimeout(struct timeval *);
203 void proxy_retry(void);
206 char *auth_name(char *buf, size_t buflen, REQUEST *request, int do_cli);
207 int rad_authenticate (REQUEST *);
210 char *radius_xlate(char *output, size_t outputlen,
212 VALUE_PAIR *req, VALUE_PAIR *reply);
213 int radius_exec_program(const char *, VALUE_PAIR *, VALUE_PAIR **,
214 int, const char **user_msg);
217 int timestr_match(char *, time_t);
220 int paircompare_register(int attr, int otherattr, COMPARE func);
221 void paircompare_unregister(int attr, COMPARE func);
222 int paircmp(VALUE_PAIR *request, VALUE_PAIR *check,
224 void pair_builtincompare_init(void);
227 int radius_xlat2(char * out, int outlen, char *str,
228 REQUEST * request, VALUE_PAIR *reply);
230 #ifdef WITH_THREAD_POOL
232 extern int thread_pool_init(int num_threads);
233 extern int thread_pool_clean(void);