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