summaryrefslogtreecommitdiff
path: root/sbin/ipf/ipf.h
blob: 164bacda75f6d8e0e7a76952863d9e00d1ad3be0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*	$OpenBSD: ipf.h,v 1.15 2001/01/17 05:00:59 fgsch Exp $	*/

/*
 * Copyright (C) 1993-2000 by Darren Reed.
 *
 * Redistribution and use in source and binary forms are permitted
 * provided that this notice is preserved and due credit is given
 * to the original author and the contributors.
 *
 * @(#)ipf.h	1.12 6/5/96
 * $IPFilter: ipf.h,v 2.9.2.2 2000/05/06 11:20:20 darrenr Exp $
 */

#ifndef	__IPF_H__
#define	__IPF_H__

#ifndef	SOLARIS
#define	SOLARIS	(defined(sun) && (defined(__svr4__) || defined(__SVR4)))
#endif
#define	OPT_REMOVE	0x000001
#define	OPT_DEBUG	0x000002
#define	OPT_OUTQUE	FR_OUTQUE	/* 0x00004 */
#define	OPT_INQUE	FR_INQUE	/* 0x00008 */
#define	OPT_LOG		FR_LOG		/* 0x00010 */
#define	OPT_SHOWLIST	0x000020
#define	OPT_VERBOSE	0x000040
#define	OPT_DONOTHING	0x000080
#define	OPT_HITS	0x000100
#define	OPT_BRIEF	0x000200
#define OPT_ACCNT	FR_ACCOUNT	/* 0x0400 */
#define	OPT_FRSTATES	FR_KEEPFRAG	/* 0x0800 */
#define	OPT_IPSTATES	FR_KEEPSTATE	/* 0x1000 */
#define	OPT_INACTIVE	FR_INACTIVE	/* 0x2000 */
#define	OPT_SHOWLINENO	0x004000
#define	OPT_PRINTFR	0x008000
#define	OPT_ZERORULEST	0x010000
#define	OPT_SAVEOUT	0x020000
#define	OPT_AUTHSTATS	0x040000
#define	OPT_RAW		0x080000
#define	OPT_NAT		0x100000
#define	OPT_GROUPS	0x200000
#define	OPT_STATETOP	0x400000
#define	OPT_FLUSH	0x800000
#define	OPT_CLEAR	0x1000000
#define	OPT_NODO	0x80000000

#define	OPT_STAT	OPT_FRSTATES
#define	OPT_LIST	OPT_SHOWLIST


#ifndef __P
# ifdef	__STDC__
#  define	__P(x)	x
# else
#  define	__P(x)	()
# endif
#endif

struct frpcmp;

#ifdef	ultrix
extern	char	*strdup __P((char *));
#endif

extern	struct	frentry	*parse __P((char *, int));

extern	void	printfr __P((struct frentry *));
extern	void	binprint __P((struct frentry *)), initparse __P((void));
extern	int	portnum __P((char *, u_short *, int));


struct	ipopt_names	{
	int	on_value;
	int	on_bit;
	int	on_siz;
	char	*on_name;
};


extern	char	*proto;
extern	char	flagset[];
extern	u_char	flags[];

extern	u_char	tcp_flags __P((char *, u_char *, int));
extern	int	countbits __P((u_32_t));
extern	int	ratoi __P((char *, int *, int, int));
extern	int	ratoui __P((char *, u_int *, u_int, u_int));
extern	int	hostmask __P((char ***, u_32_t *, u_32_t *, u_short *, int *,
			      u_short *, int));
extern	int	ports __P((char ***, u_short *, int *, u_short *, int));
extern	char	*portname __P((int, int));
extern	u_32_t	buildopts __P((char *, char *, int));
extern	int	genmask __P((char *, u_32_t *));
extern	int	hostnum __P((u_32_t *, char *, int));
extern	u_32_t	optname __P((char ***, u_short *, int));
extern	void	printpacket __P((ip_t *));
extern	void	printportcmp __P((int, struct frpcmp *));
extern	void	printhostmask __P((int, u_32_t *, u_32_t *));
extern	void	printbuf __P((char *, int, int));
#if SOLARIS
extern	int	inet_aton __P((const char *, struct in_addr *));
extern	int	gethostname __P((char *, int ));
extern	void	sync __P((void));
#endif

#if defined(sun) && !SOLARIS
# define	STRERROR(x)	sys_errlist[x]
extern	char	*sys_errlist[];
#else
# define	STRERROR(x)	strerror(x)
#endif

#ifndef	MIN
#define	MIN(a,b)	((a) > (b) ? (b) : (a))
#endif

#endif /* __IPF_H__ */