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