xref: /illumos-gate/usr/src/uts/common/inet/ipf/ipmon.h (revision ab25eeb5)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * Copyright (C) 1993-2001 by Darren Reed.
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * See the IPFILTER.LICENCE file for details on licencing.
57c478bd9Sstevel@tonic-gate  *
67c478bd9Sstevel@tonic-gate  * @(#)ip_fil.h	1.35 6/5/96
7*ab25eeb5Syz  * $Id: ipmon.h,v 2.8 2003/07/25 22:16:20 darrenr Exp $
87c478bd9Sstevel@tonic-gate  */
97c478bd9Sstevel@tonic-gate 
107c478bd9Sstevel@tonic-gate 
11*ab25eeb5Syz typedef	struct	ipmon_action	{
12*ab25eeb5Syz 	struct	ipmon_action	*ac_next;
137c478bd9Sstevel@tonic-gate 	int	ac_mflag;	/* collection of things to compare */
14*ab25eeb5Syz 	int	ac_dflag;	/* flags to compliment the doing fields */
15*ab25eeb5Syz 	int	ac_syslog;	/* = 1 to syslog rules. */
16*ab25eeb5Syz 	char	*ac_savefile;	/* filename to save log records to */
17*ab25eeb5Syz 	FILE	*ac_savefp;
187c478bd9Sstevel@tonic-gate 	int	ac_direction;
197c478bd9Sstevel@tonic-gate 	char	ac_group[FR_GROUPLEN];
20*ab25eeb5Syz 	char	ac_nattag[16];
21*ab25eeb5Syz 	u_32_t	ac_logtag;
22*ab25eeb5Syz 	int	ac_type;	/* nat/state/ipf */
237c478bd9Sstevel@tonic-gate 	int	ac_proto;
247c478bd9Sstevel@tonic-gate 	int	ac_rule;
257c478bd9Sstevel@tonic-gate 	int	ac_packet;
267c478bd9Sstevel@tonic-gate 	int	ac_second;
277c478bd9Sstevel@tonic-gate 	int	ac_result;
287c478bd9Sstevel@tonic-gate 	u_32_t	ac_sip;
297c478bd9Sstevel@tonic-gate 	u_32_t	ac_smsk;
307c478bd9Sstevel@tonic-gate 	u_32_t	ac_dip;
317c478bd9Sstevel@tonic-gate 	u_32_t	ac_dmsk;
327c478bd9Sstevel@tonic-gate 	u_short	ac_sport;
337c478bd9Sstevel@tonic-gate 	u_short	ac_dport;
34*ab25eeb5Syz 	char	*ac_exec;	/* execute argument */
35*ab25eeb5Syz 	char	*ac_run;	/* actual command that gets run */
367c478bd9Sstevel@tonic-gate 	char	*ac_iface;
377c478bd9Sstevel@tonic-gate 	/*
387c478bd9Sstevel@tonic-gate 	 * used with ac_packet/ac_second
397c478bd9Sstevel@tonic-gate 	 */
407c478bd9Sstevel@tonic-gate 	struct	timeval	ac_last;
417c478bd9Sstevel@tonic-gate 	int	ac_pktcnt;
42*ab25eeb5Syz } ipmon_action_t;
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate #define	ac_lastsec	ac_last.tv_sec
457c478bd9Sstevel@tonic-gate #define	ac_lastusec	ac_last.tv_usec
467c478bd9Sstevel@tonic-gate 
47*ab25eeb5Syz /*
48*ab25eeb5Syz  * Flags indicating what fields to do matching upon (ac_mflag).
49*ab25eeb5Syz  */
507c478bd9Sstevel@tonic-gate #define	IPMAC_DIRECTION	0x0001
517c478bd9Sstevel@tonic-gate #define	IPMAC_DSTIP	0x0002
527c478bd9Sstevel@tonic-gate #define	IPMAC_DSTPORT	0x0004
537c478bd9Sstevel@tonic-gate #define	IPMAC_EVERY	0x0008
54*ab25eeb5Syz #define	IPMAC_GROUP	0x0010
55*ab25eeb5Syz #define	IPMAC_INTERFACE	0x0020
56*ab25eeb5Syz #define	IPMAC_LOGTAG	0x0040
57*ab25eeb5Syz #define	IPMAC_NATTAG	0x0080
58*ab25eeb5Syz #define	IPMAC_PROTOCOL	0x0100
59*ab25eeb5Syz #define	IPMAC_RESULT	0x0200
60*ab25eeb5Syz #define	IPMAC_RULE	0x0400
61*ab25eeb5Syz #define	IPMAC_SRCIP	0x0800
62*ab25eeb5Syz #define	IPMAC_SRCPORT	0x1000
63*ab25eeb5Syz #define	IPMAC_TYPE	0x2000
64*ab25eeb5Syz #define	IPMAC_WITH	0x4000
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate #define	IPMR_BLOCK	1
677c478bd9Sstevel@tonic-gate #define	IPMR_PASS	2
687c478bd9Sstevel@tonic-gate #define	IPMR_NOMATCH	3
69*ab25eeb5Syz #define	IPMR_LOG	4
70*ab25eeb5Syz 
71*ab25eeb5Syz #define	IPMDO_SAVERAW	0x0001
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate #define	OPT_SYSLOG	0x001
747c478bd9Sstevel@tonic-gate #define	OPT_RESOLVE	0x002
757c478bd9Sstevel@tonic-gate #define	OPT_HEXBODY	0x004
767c478bd9Sstevel@tonic-gate #define	OPT_VERBOSE	0x008
777c478bd9Sstevel@tonic-gate #define	OPT_HEXHDR	0x010
787c478bd9Sstevel@tonic-gate #define	OPT_TAIL	0x020
797c478bd9Sstevel@tonic-gate #define	OPT_NAT		0x080
807c478bd9Sstevel@tonic-gate #define	OPT_STATE	0x100
817c478bd9Sstevel@tonic-gate #define	OPT_FILTER	0x200
827c478bd9Sstevel@tonic-gate #define	OPT_PORTNUM	0x400
837c478bd9Sstevel@tonic-gate #define	OPT_LOGALL	(OPT_NAT|OPT_STATE|OPT_FILTER)
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate #define	HOSTNAME_V4(a,b)	hostname((a), 4, (u_32_t *)&(b))
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate #ifndef	LOGFAC
887c478bd9Sstevel@tonic-gate #define	LOGFAC	LOG_LOCAL0
897c478bd9Sstevel@tonic-gate #endif
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate extern	int	load_config __P((char *));
927c478bd9Sstevel@tonic-gate extern	void	dumphex __P((FILE *, int, char *, int));
93*ab25eeb5Syz extern	int	check_action __P((char *, char *, int, int));
947c478bd9Sstevel@tonic-gate extern	char	*getword __P((int));
95