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