if_pflog.h revision 126258
1126258Smlaier/* $OpenBSD: if_pflog.h,v 1.9 2003/07/15 20:27:27 dhartmei Exp $ */ 2126258Smlaier/* 3126258Smlaier * Copyright 2001 Niels Provos <provos@citi.umich.edu> 4126258Smlaier * All rights reserved. 5126258Smlaier * 6126258Smlaier * Redistribution and use in source and binary forms, with or without 7126258Smlaier * modification, are permitted provided that the following conditions 8126258Smlaier * are met: 9126258Smlaier * 1. Redistributions of source code must retain the above copyright 10126258Smlaier * notice, this list of conditions and the following disclaimer. 11126258Smlaier * 2. Redistributions in binary form must reproduce the above copyright 12126258Smlaier * notice, this list of conditions and the following disclaimer in the 13126258Smlaier * documentation and/or other materials provided with the distribution. 14126258Smlaier * 15126258Smlaier * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16126258Smlaier * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17126258Smlaier * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18126258Smlaier * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19126258Smlaier * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20126258Smlaier * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21126258Smlaier * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22126258Smlaier * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23126258Smlaier * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24126258Smlaier * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25126258Smlaier */ 26126258Smlaier 27126258Smlaier#ifndef _NET_IF_PFLOG_H_ 28126258Smlaier#define _NET_IF_PFLOG_H_ 29126258Smlaier 30126258Smlaierstruct pflog_softc { 31126258Smlaier struct ifnet sc_if; /* the interface */ 32126258Smlaier}; 33126258Smlaier 34126258Smlaier/* XXX keep in sync with pfvar.h */ 35126258Smlaier#ifndef PF_RULESET_NAME_SIZE 36126258Smlaier#define PF_RULESET_NAME_SIZE 16 37126258Smlaier#endif 38126258Smlaier 39126258Smlaierstruct pfloghdr { 40126258Smlaier u_int8_t length; 41126258Smlaier sa_family_t af; 42126258Smlaier u_int8_t action; 43126258Smlaier u_int8_t reason; 44126258Smlaier char ifname[IFNAMSIZ]; 45126258Smlaier char ruleset[PF_RULESET_NAME_SIZE]; 46126258Smlaier u_int32_t rulenr; 47126258Smlaier u_int32_t subrulenr; 48126258Smlaier u_int8_t dir; 49126258Smlaier u_int8_t pad[3]; 50126258Smlaier}; 51126258Smlaier 52126258Smlaier#define PFLOG_HDRLEN sizeof(struct pfloghdr) 53126258Smlaier/* minus pad, also used as a signature */ 54126258Smlaier#define PFLOG_REAL_HDRLEN offsetof(struct pfloghdr, pad); 55126258Smlaier 56126258Smlaier/* XXX remove later when old format logs are no longer needed */ 57126258Smlaierstruct old_pfloghdr { 58126258Smlaier u_int32_t af; 59126258Smlaier char ifname[IFNAMSIZ]; 60126258Smlaier short rnr; 61126258Smlaier u_short reason; 62126258Smlaier u_short action; 63126258Smlaier u_short dir; 64126258Smlaier}; 65126258Smlaier#define OLD_PFLOG_HDRLEN sizeof(struct old_pfloghdr) 66126258Smlaier 67126258Smlaier#ifdef _KERNEL 68126258Smlaier 69126258Smlaier#if NPFLOG > 0 70126258Smlaier#define PFLOG_PACKET(i,x,a,b,c,d,e,f,g) pflog_packet(i,a,b,c,d,e,f,g) 71126258Smlaier#else 72126258Smlaier#define PFLOG_PACKET(i,x,a,b,c,d,e,f,g) ((void)0) 73126258Smlaier#endif /* NPFLOG > 0 */ 74126258Smlaier#endif /* _KERNEL */ 75126258Smlaier#endif /* _NET_IF_PFLOG_H_ */ 76