1
2/*
3 * Copyright (c) 2001 Daniel Hartmeier
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 *    - Redistributions of source code must retain the above copyright
11 *      notice, this list of conditions and the following disclaimer.
12 *    - Redistributions in binary form must reproduce the above
13 *      copyright notice, this list of conditions and the following
14 *      disclaimer in the documentation and/or other materials provided
15 *      with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
27 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 *
30 * @(#) Header: /tcpdump/master/tcpdump/pf.h,v 1.2 2004/04/02 06:36:25 guy Exp (LBL)
31 */
32
33/*	from $OpenBSD: pfvar.h,v 1.170 2003/08/22 21:50:34 david Exp $ */
34
35enum	{ PF_INOUT=0, PF_IN=1, PF_OUT=2 };
36enum	{ PF_PASS=0, PF_DROP=1, PF_SCRUB=2, PF_NAT=3, PF_NONAT=4,
37	  PF_BINAT=5, PF_NOBINAT=6, PF_RDR=7, PF_NORDR=8, PF_SYNPROXY_DROP=9 };
38
39/* Reasons code for passing/dropping a packet */
40#define PFRES_MATCH	0		/* Explicit match of a rule */
41#define PFRES_BADOFF	1		/* Bad offset for pull_hdr */
42#define PFRES_FRAG	2		/* Dropping following fragment */
43#define PFRES_SHORT	3		/* Dropping short packet */
44#define PFRES_NORM	4		/* Dropping by normalizer */
45#define PFRES_MEMORY	5		/* Dropped due to lacking mem */
46#define PFRES_MAX	6		/* total+1 */
47
48#define PFRES_NAMES { \
49	"match", \
50	"bad-offset", \
51	"fragment", \
52	"short", \
53	"normalize", \
54	"memory", \
55	NULL \
56}
57
58#define PF_RULESET_NAME_SIZE	16
59
60/*	from $OpenBSD: if_pflog.h,v 1.9 2003/07/15 20:27:27 dhartmei Exp $ */
61
62#ifndef IFNAMSIZ
63#define	IFNAMSIZ	16
64#endif
65
66struct pfloghdr {
67	u_int8_t	length;
68	u_int8_t	af;
69	u_int8_t	action;
70	u_int8_t	reason;
71	char		ifname[IFNAMSIZ];
72	char		ruleset[PF_RULESET_NAME_SIZE];
73	u_int32_t	rulenr;
74	u_int32_t	subrulenr;
75	u_int8_t	dir;
76	u_int8_t	pad[3];
77};
78#define PFLOG_HDRLEN		sizeof(struct pfloghdr)
79