1 /* $Id: ssp_pf2.h,v 3.3 2009/11/27 01:39:40 fknobbe Exp $ 2 * 3 * Copyright (c) 2003 Hector Paterno <apaterno@dsnsecurity.com> 4 * Copyright (c) 2004, 2005 Olaf Schreck <chakl@syscall.de> 5 * Copyright (c) 2009 Olli Hauer <ohauer@gmx.de> 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * 30 * ssp_pf2.h 31 * 32 * Purpose: 33 * See inside ssp_pf2.c 34 * 35 * 36 */ 37 38 #ifndef USE_SSP_PF 39 #if defined(OpenBSD) || defined(FreeBSD) || defined(NetBSD) 40 41 #ifndef __SSP_PF2_H__ 42 #define __SSP_PF2_H__ 43 44 #define PFDEV "/dev/pf" 45 46 #include <sys/file.h> 47 #include <net/if.h> 48 #ifdef __DragonFly__ 49 #include <net/pf/pfvar.h> 50 #else 51 #include <net/pfvar.h> 52 #endif 53 #include <errno.h> 54 55 typedef struct _pf2data 56 { 57 char anchorname[PF_ANCHOR_NAME_SIZE]; 58 char tablein[PF_TABLE_NAME_SIZE]; 59 char tableout[PF_TABLE_NAME_SIZE]; 60 unsigned int kill; 61 } PF2DATA; 62 63 /* opt parsing routine defines and structs */ 64 65 #define MAX_OPT_NAME 16 66 #define MAX_OPT_VALUE 16 67 68 typedef struct _opt_pf2 69 { 70 char name[MAX_OPT_NAME]; /* Option Name */ 71 union 72 { 73 char value_s[MAX_OPT_VALUE]; /* String Value */ 74 int value_d; /* Integer Value */ 75 }v; 76 int vt; /* Value type */ 77 } 78 opt_pf2; 79 80 enum { PF2_OPT_ANCHOR, PF2_OPT_TABLE, PF2_OPT_KILL }; 81 enum { PF2_KILL_STATE_ALL, PF2_KILL_STATE_DIR, PF2_KILL_STATE_NO }; 82 83 void PF2Parse(char *,char *,unsigned long,DATALIST *); 84 void PF2Block(BLOCKINFO *, void *,unsigned long); 85 int pf2_kill_states(int, const char *, int, int); 86 int lookup_anchor(int, const char *); 87 int lookup_table(int, const char *, const char *); 88 89 #endif /* __SSP_PF2_H__ */ 90 91 #endif /* OpenBSD || FreeBSD || NetBSD */ 92 #endif /* !USE_SSP_PF */ 93