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