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