xref: /illumos-gate/usr/src/uts/common/inet/ipf/ipmon.h (revision 7c478bd9)
1 /*
2  * Copyright (C) 1993-2001 by Darren Reed.
3  *
4  * See the IPFILTER.LICENCE file for details on licencing.
5  *
6  * @(#)ip_fil.h	1.35 6/5/96
7  * $Id: ipmon.h,v 2.6 2002/12/27 16:07:15 darrenr Exp $
8  */
9 
10 
11 typedef	struct	action	{
12 	struct	action	*a_next;
13 	int	ac_mflag;	/* collection of things to compare */
14 	int	ac_direction;
15 	char	ac_group[FR_GROUPLEN];
16 	int	ac_proto;
17 	int	ac_rule;
18 	int	ac_packet;
19 	int	ac_second;
20 	int	ac_result;
21 	int	ac_tag;
22 	u_32_t	ac_sip;
23 	u_32_t	ac_smsk;
24 	u_32_t	ac_dip;
25 	u_32_t	ac_dmsk;
26 	u_short	ac_sport;
27 	u_short	ac_dport;
28 	char	*ac_exec;
29 	char	*ac_run;
30 	char	*ac_iface;
31 	/*
32 	 * used with ac_packet/ac_second
33 	 */
34 	struct	timeval	ac_last;
35 	int	ac_pktcnt;
36 } action_t;
37 
38 #define	ac_lastsec	ac_last.tv_sec
39 #define	ac_lastusec	ac_last.tv_usec
40 
41 #define	IPMAC_DIRECTION	0x0001
42 #define	IPMAC_DSTIP	0x0002
43 #define	IPMAC_DSTPORT	0x0004
44 #define	IPMAC_EVERY	0x0008
45 #define	IPMAC_EXECUTE	0x0010
46 #define	IPMAC_GROUP	0x0020
47 #define	IPMAC_INTERFACE	0x0040
48 #define	IPMAC_PROTOCOL	0x0080
49 #define	IPMAC_RESULT	0x0100
50 #define	IPMAC_RULE	0x0200
51 #define	IPMAC_SRCIP	0x0400
52 #define	IPMAC_SRCPORT	0x0800
53 #define	IPMAC_TAG	0x1000
54 
55 #define	IPMR_BLOCK	1
56 #define	IPMR_PASS	2
57 #define	IPMR_NOMATCH	3
58 #define	IPMR_SHORT	4
59 #define	IPMR_LOG	5
60 
61 #define	OPT_SYSLOG	0x001
62 #define	OPT_RESOLVE	0x002
63 #define	OPT_HEXBODY	0x004
64 #define	OPT_VERBOSE	0x008
65 #define	OPT_HEXHDR	0x010
66 #define	OPT_TAIL	0x020
67 #define	OPT_NAT		0x080
68 #define	OPT_STATE	0x100
69 #define	OPT_FILTER	0x200
70 #define	OPT_PORTNUM	0x400
71 #define	OPT_LOGALL	(OPT_NAT|OPT_STATE|OPT_FILTER)
72 
73 #define	HOSTNAME_V4(a,b)	hostname((a), 4, (u_32_t *)&(b))
74 
75 #ifndef	LOGFAC
76 #define	LOGFAC	LOG_LOCAL0
77 #endif
78 
79 extern	int	load_config __P((char *));
80 extern	void	dumphex __P((FILE *, int, char *, int));
81 extern	void	check_action __P((char *, int, char *));
82 extern	char	*getword __P((int));
83