1/*	$FreeBSD$	*/
2
3/*
4 * Copyright (C) 1993-2001 by Darren Reed.
5 *
6 * See the IPFILTER.LICENCE file for details on licencing.
7 *
8 * @(#)ip_fil.h	1.35 6/5/96
9 * $Id: ipmon.h,v 2.8.2.1 2006/03/21 16:13:31 darrenr Exp $
10 */
11
12
13typedef	struct	ipmon_action	{
14	struct	ipmon_action	*ac_next;
15	int	ac_mflag;	/* collection of things to compare */
16	int	ac_dflag;	/* flags to compliment the doing fields */
17	int	ac_syslog;	/* = 1 to syslog rules. */
18	char	*ac_savefile;	/* filename to save log records to */
19	FILE	*ac_savefp;
20	int	ac_direction;
21	char	ac_group[FR_GROUPLEN];
22	char	ac_nattag[16];
23	u_32_t	ac_logtag;
24	int	ac_type;	/* nat/state/ipf */
25	int	ac_proto;
26	int	ac_rule;
27	int	ac_packet;
28	int	ac_second;
29	int	ac_result;
30	u_32_t	ac_sip;
31	u_32_t	ac_smsk;
32	u_32_t	ac_dip;
33	u_32_t	ac_dmsk;
34	u_short	ac_sport;
35	u_short	ac_dport;
36	char	*ac_exec;	/* execute argument */
37	char	*ac_run;	/* actual command that gets run */
38	char	*ac_iface;
39	/*
40	 * used with ac_packet/ac_second
41	 */
42	struct	timeval	ac_last;
43	int	ac_pktcnt;
44} ipmon_action_t;
45
46#define	ac_lastsec	ac_last.tv_sec
47#define	ac_lastusec	ac_last.tv_usec
48
49/*
50 * Flags indicating what fields to do matching upon (ac_mflag).
51 */
52#define	IPMAC_DIRECTION	0x0001
53#define	IPMAC_DSTIP	0x0002
54#define	IPMAC_DSTPORT	0x0004
55#define	IPMAC_EVERY	0x0008
56#define	IPMAC_GROUP	0x0010
57#define	IPMAC_INTERFACE	0x0020
58#define	IPMAC_LOGTAG	0x0040
59#define	IPMAC_NATTAG	0x0080
60#define	IPMAC_PROTOCOL	0x0100
61#define	IPMAC_RESULT	0x0200
62#define	IPMAC_RULE	0x0400
63#define	IPMAC_SRCIP	0x0800
64#define	IPMAC_SRCPORT	0x1000
65#define	IPMAC_TYPE	0x2000
66#define	IPMAC_WITH	0x4000
67
68#define	IPMR_BLOCK	1
69#define	IPMR_PASS	2
70#define	IPMR_NOMATCH	3
71#define	IPMR_LOG	4
72
73#define	IPMDO_SAVERAW	0x0001
74
75#define	OPT_SYSLOG	0x001
76#define	OPT_RESOLVE	0x002
77#define	OPT_HEXBODY	0x004
78#define	OPT_VERBOSE	0x008
79#define	OPT_HEXHDR	0x010
80#define	OPT_TAIL	0x020
81#define	OPT_NAT		0x080
82#define	OPT_STATE	0x100
83#define	OPT_FILTER	0x200
84#define	OPT_PORTNUM	0x400
85#define	OPT_LOGALL	(OPT_NAT|OPT_STATE|OPT_FILTER)
86
87#define	HOSTNAME_V4(a,b)	hostname((a), 4, (u_32_t *)&(b))
88
89#ifndef	LOGFAC
90#define	LOGFAC	LOG_LOCAL0
91#endif
92
93extern	int	load_config __P((char *));
94extern	void	dumphex __P((FILE *, int, char *, int));
95extern	int	check_action __P((char *, char *, int, int));
96extern	char	*getword __P((int));
97extern	int	fac_findname __P((char *));
98