1 /*	$FreeBSD$	*/
2 
3 /*
4  * Copyright (C) 2012 by Darren Reed.
5  *
6  * See the IPFILTER.LICENCE file for details on licencing.
7  *
8  * $FreeBSD$
9  * Id: ip_auth.h,v 2.16.2.2 2006/03/16 06:45:49 darrenr Exp $
10  *
11  */
12 #ifndef	__IP_AUTH_H__
13 #define	__IP_AUTH_H__
14 
15 #define FR_NUMAUTH      32
16 
17 typedef struct  frauth {
18 	int	fra_age;
19 	int	fra_len;
20 	int	fra_index;
21 	u_32_t	fra_pass;
22 	fr_info_t	fra_info;
23 	char	*fra_buf;
24 	u_32_t	fra_flx;
25 #ifdef	MENTAT
26 	queue_t	*fra_q;
27 	mb_t	*fra_m;
28 #endif
29 } frauth_t;
30 
31 typedef	struct	frauthent  {
32 	struct	frentry	fae_fr;
33 	struct	frauthent	*fae_next;
34 	struct	frauthent	**fae_pnext;
35 	u_long	fae_age;
36 	int	fae_ref;
37 } frauthent_t;
38 
39 typedef struct  ipf_authstat {
40 	U_QUAD_T	fas_hits;
41 	U_QUAD_T	fas_miss;
42 	u_long		fas_nospace;
43 	u_long		fas_added;
44 	u_long		fas_sendfail;
45 	u_long		fas_sendok;
46 	u_long		fas_queok;
47 	u_long		fas_quefail;
48 	u_long		fas_expire;
49 	frauthent_t	*fas_faelist;
50 } ipf_authstat_t;
51 
52 typedef	struct ipf_auth_softc_s {
53 	ipfrwlock_t	ipf_authlk;
54 	ipfmutex_t	ipf_auth_mx;
55 	int		ipf_auth_size;
56 	int		ipf_auth_used;
57 	int		ipf_auth_replies;
58 	int		ipf_auth_defaultage;
59 	int		ipf_auth_lock;
60 	ipf_authstat_t	ipf_auth_stats;
61 	frauth_t	*ipf_auth;
62 	mb_t		**ipf_auth_pkts;
63 	int		ipf_auth_start;
64 	int		ipf_auth_end;
65 	int		ipf_auth_next;
66 	frauthent_t	*ipf_auth_entries;
67 	frentry_t	*ipf_auth_ip;
68 	frentry_t	*ipf_auth_rules;
69 } ipf_auth_softc_t;
70 
71 extern	frentry_t *ipf_auth_check __P((fr_info_t *, u_32_t *));
72 extern	void	ipf_auth_expire __P((ipf_main_softc_t *));
73 extern	int	ipf_auth_ioctl __P((ipf_main_softc_t *, caddr_t, ioctlcmd_t,
74 				    int, int, void *));
75 extern	int	ipf_auth_init __P((void));
76 extern	int	ipf_auth_main_load __P((void));
77 extern	int	ipf_auth_main_unload __P((void));
78 extern	void	ipf_auth_soft_destroy __P((ipf_main_softc_t *, void *));
79 extern	void	*ipf_auth_soft_create __P((ipf_main_softc_t *));
80 extern	int	ipf_auth_new __P((mb_t *, fr_info_t *));
81 extern	int	ipf_auth_precmd __P((ipf_main_softc_t *, ioctlcmd_t,
82 				     frentry_t *, frentry_t **));
83 extern	void	ipf_auth_unload __P((ipf_main_softc_t *));
84 extern	int	ipf_auth_waiting __P((ipf_main_softc_t *));
85 extern	void	ipf_auth_setlock __P((void *, int));
86 extern	int	ipf_auth_soft_init __P((ipf_main_softc_t *, void *));
87 extern	int	ipf_auth_soft_fini __P((ipf_main_softc_t *, void *));
88 extern	u_32_t	ipf_auth_pre_scanlist __P((ipf_main_softc_t *, fr_info_t *,
89 					   u_32_t));
90 extern	frentry_t **ipf_auth_rulehead __P((ipf_main_softc_t *));
91 
92 #endif	/* __IP_AUTH_H__ */
93