1145522Sdarrenr/*	$FreeBSD$	*/
2145522Sdarrenr
353642Sguido/*
4255332Scy * Copyright (C) 2012 by Darren Reed.
553642Sguido *
680482Sdarrenr * See the IPFILTER.LICENCE file for details on licencing.
753642Sguido *
857126Sguido * $FreeBSD$
9161356Sguido * Id: ip_auth.h,v 2.16.2.2 2006/03/16 06:45:49 darrenr Exp $
1053642Sguido *
1153642Sguido */
1253642Sguido#ifndef	__IP_AUTH_H__
1353642Sguido#define	__IP_AUTH_H__
1453642Sguido
1553642Sguido#define FR_NUMAUTH      32
1653642Sguido
1753642Sguidotypedef struct  frauth {
1853642Sguido	int	fra_age;
19145522Sdarrenr	int	fra_len;
2053642Sguido	int	fra_index;
2153642Sguido	u_32_t	fra_pass;
2253642Sguido	fr_info_t	fra_info;
23145522Sdarrenr	char	*fra_buf;
24255332Scy	u_32_t	fra_flx;
25145522Sdarrenr#ifdef	MENTAT
2653642Sguido	queue_t	*fra_q;
27161356Sguido	mb_t	*fra_m;
2853642Sguido#endif
2953642Sguido} frauth_t;
3053642Sguido
3153642Sguidotypedef	struct	frauthent  {
3253642Sguido	struct	frentry	fae_fr;
3353642Sguido	struct	frauthent	*fae_next;
34170268Sdarrenr	struct	frauthent	**fae_pnext;
3553642Sguido	u_long	fae_age;
36170268Sdarrenr	int	fae_ref;
3753642Sguido} frauthent_t;
3853642Sguido
39255332Scytypedef struct  ipf_authstat {
4053642Sguido	U_QUAD_T	fas_hits;
4153642Sguido	U_QUAD_T	fas_miss;
4253642Sguido	u_long		fas_nospace;
4353642Sguido	u_long		fas_added;
4453642Sguido	u_long		fas_sendfail;
4553642Sguido	u_long		fas_sendok;
4653642Sguido	u_long		fas_queok;
4753642Sguido	u_long		fas_quefail;
4853642Sguido	u_long		fas_expire;
4953642Sguido	frauthent_t	*fas_faelist;
50255332Scy} ipf_authstat_t;
5153642Sguido
52266829Scytypedef	struct ipf_auth_softc_s {
53266829Scy	ipfrwlock_t	ipf_authlk;
54266829Scy	ipfmutex_t	ipf_auth_mx;
55266829Scy	int		ipf_auth_size;
56266829Scy	int		ipf_auth_used;
57266829Scy	int		ipf_auth_replies;
58266829Scy	int		ipf_auth_defaultage;
59266829Scy	int		ipf_auth_lock;
60266829Scy	ipf_authstat_t	ipf_auth_stats;
61266829Scy	frauth_t	*ipf_auth;
62266829Scy	mb_t		**ipf_auth_pkts;
63266829Scy	int		ipf_auth_start;
64266829Scy	int		ipf_auth_end;
65266829Scy	int		ipf_auth_next;
66266829Scy	frauthent_t	*ipf_auth_entries;
67266829Scy	frentry_t	*ipf_auth_ip;
68266829Scy	frentry_t	*ipf_auth_rules;
69266829Scy} ipf_auth_softc_t;
7053642Sguido
71255332Scyextern	frentry_t *ipf_auth_check __P((fr_info_t *, u_32_t *));
72255332Scyextern	void	ipf_auth_expire __P((ipf_main_softc_t *));
73255332Scyextern	int	ipf_auth_ioctl __P((ipf_main_softc_t *, caddr_t, ioctlcmd_t,
74255332Scy				    int, int, void *));
75255332Scyextern	int	ipf_auth_init __P((void));
76255332Scyextern	int	ipf_auth_main_load __P((void));
77255332Scyextern	int	ipf_auth_main_unload __P((void));
78255332Scyextern	void	ipf_auth_soft_destroy __P((ipf_main_softc_t *, void *));
79255332Scyextern	void	*ipf_auth_soft_create __P((ipf_main_softc_t *));
80255332Scyextern	int	ipf_auth_new __P((mb_t *, fr_info_t *));
81255332Scyextern	int	ipf_auth_precmd __P((ipf_main_softc_t *, ioctlcmd_t,
82255332Scy				     frentry_t *, frentry_t **));
83255332Scyextern	void	ipf_auth_unload __P((ipf_main_softc_t *));
84255332Scyextern	int	ipf_auth_waiting __P((ipf_main_softc_t *));
85255332Scyextern	void	ipf_auth_setlock __P((void *, int));
86255332Scyextern	int	ipf_auth_soft_init __P((ipf_main_softc_t *, void *));
87255332Scyextern	int	ipf_auth_soft_fini __P((ipf_main_softc_t *, void *));
88255332Scyextern	u_32_t	ipf_auth_pre_scanlist __P((ipf_main_softc_t *, fr_info_t *,
89255332Scy					   u_32_t));
90255332Scyextern	frentry_t **ipf_auth_rulehead __P((ipf_main_softc_t *));
91145522Sdarrenr
9253642Sguido#endif	/* __IP_AUTH_H__ */
93