www.pudn.com > RadiusSrv.rar > Radiusd.h, change:2003-10-22,size:2427b


#ifndef _RADIUS_SRV_D_H 
#define _RADIUS_SRV_D_H 
 
#include "../common/GKCommon.h" 
#include "libRadius.h" 
 
#ifndef NDEBUG 
#define REQUEST_MAGIC (0xdeadbeef) 
#endif 
 
typedef struct auth_req { 
#ifndef NDEBUG 
	uint32_t		magic; /* for debugging only */ 
#endif 
	RADIUS_PACKET		*packet; 
	RADIUS_PACKET		*proxy; 
	RADIUS_PACKET		*reply; 
	RADIUS_PACKET		*proxy_reply; 
	VALUE_PAIR		*config_items; 
	VALUE_PAIR		*username; 
	VALUE_PAIR		*password; 
	char			secret[32]; 
//	child_pid_t    		child_pid; 
	time_t			timestamp; 
	int			number; /* internal server number */ 
 
	/* 
	 *	We could almost keep a const char here instead of a 
	 *	_copy_ of the secret... but what if the RADCLIENT 
	 *	structure is freed because it was taken out of the 
	 *	config file and SIGHUPed? 
	 */ 
	char			proxysecret[32]; 
	int			proxy_is_replicate; 
	int			proxy_try_count; 
	time_t			proxy_next_try; 
 
	int                     simul_max; 
	int                     simul_count; 
	int                     simul_mpp; /* WEIRD: 1 is false, 2 is true */ 
 
	int			finished; 
	int			options; /* miscellanous options */ 
	void			**container; 
} REQUEST; 
 
 
#define RAD_REQUEST_OPTION_NONE            (0) 
#define RAD_REQUEST_OPTION_LOGGED_CHILD    (1 << 0) 
#define RAD_REQUEST_OPTION_DELAYED_REJECT  (1 << 1) 
#define RAD_REQUEST_OPTION_DONT_CACHE      (1 << 2) 
#define RAD_REQUEST_OPTION_REJECTED        (1 << 4) 
 
typedef struct radclient { 
	uint32_t		ipaddr; 
	uint32_t		netmask; 
	char			longname[256]; 
	u_char			secret[32]; 
	char			shortname[32]; 
	char			nastype[32]; 
	char			login[32]; 
	char			password[32]; 
	struct radclient	*next; 
} RADCLIENT; 
 
/* 
 *  Function handler for requests. 
 */ 
typedef		int (*RAD_REQUEST_FUNP)(REQUEST *); 
 
 
/* util.c */ 
void (*reset_signal(int signo, void (*func)(int)))(int); 
void		request_free(REQUEST **request); 
int		rad_mkdir(char *directory, int mode); 
int		rad_checkfilename(const char *filename); 
void		*rad_malloc(size_t size); /* calls exit(1) on error! */ 
void		xfree(const char *ptr); 
 
/* client.c */ 
int		read_clients_file(const char *file); 
RADCLIENT	*client_find(uint32_t ipno); 
const char	*client_name(uint32_t ipno); 
void		client_walk(void); 
void		clients_free(RADCLIENT *cl); 
 
/* auth.c */ 
char	*auth_name(char *buf, size_t buflen, REQUEST *request, int do_cli); 
int		rad_authenticate (REQUEST *); 
int		rad_check_password(REQUEST *request); 
 
#endif