xref: /freebsd/sys/net/if_pflog.h (revision 3b3a8eb937bf8045231e8364bfd1b94cd4a95979)
1*3b3a8eb9SGleb Smirnoff /* $OpenBSD: if_pflog.h,v 1.13 2006/10/23 12:46:09 henning Exp $ */
2*3b3a8eb9SGleb Smirnoff /*
3*3b3a8eb9SGleb Smirnoff  * Copyright 2001 Niels Provos <provos@citi.umich.edu>
4*3b3a8eb9SGleb Smirnoff  * All rights reserved.
5*3b3a8eb9SGleb Smirnoff  *
6*3b3a8eb9SGleb Smirnoff  * Redistribution and use in source and binary forms, with or without
7*3b3a8eb9SGleb Smirnoff  * modification, are permitted provided that the following conditions
8*3b3a8eb9SGleb Smirnoff  * are met:
9*3b3a8eb9SGleb Smirnoff  * 1. Redistributions of source code must retain the above copyright
10*3b3a8eb9SGleb Smirnoff  *    notice, this list of conditions and the following disclaimer.
11*3b3a8eb9SGleb Smirnoff  * 2. Redistributions in binary form must reproduce the above copyright
12*3b3a8eb9SGleb Smirnoff  *    notice, this list of conditions and the following disclaimer in the
13*3b3a8eb9SGleb Smirnoff  *    documentation and/or other materials provided with the distribution.
14*3b3a8eb9SGleb Smirnoff  *
15*3b3a8eb9SGleb Smirnoff  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16*3b3a8eb9SGleb Smirnoff  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17*3b3a8eb9SGleb Smirnoff  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18*3b3a8eb9SGleb Smirnoff  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19*3b3a8eb9SGleb Smirnoff  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20*3b3a8eb9SGleb Smirnoff  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21*3b3a8eb9SGleb Smirnoff  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22*3b3a8eb9SGleb Smirnoff  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23*3b3a8eb9SGleb Smirnoff  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24*3b3a8eb9SGleb Smirnoff  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*3b3a8eb9SGleb Smirnoff  */
26*3b3a8eb9SGleb Smirnoff 
27*3b3a8eb9SGleb Smirnoff #ifndef _NET_IF_PFLOG_H_
28*3b3a8eb9SGleb Smirnoff #define	_NET_IF_PFLOG_H_
29*3b3a8eb9SGleb Smirnoff 
30*3b3a8eb9SGleb Smirnoff #define	PFLOGIFS_MAX	16
31*3b3a8eb9SGleb Smirnoff 
32*3b3a8eb9SGleb Smirnoff #define	PFLOG_RULESET_NAME_SIZE	16
33*3b3a8eb9SGleb Smirnoff 
34*3b3a8eb9SGleb Smirnoff struct pfloghdr {
35*3b3a8eb9SGleb Smirnoff 	u_int8_t	length;
36*3b3a8eb9SGleb Smirnoff 	sa_family_t	af;
37*3b3a8eb9SGleb Smirnoff 	u_int8_t	action;
38*3b3a8eb9SGleb Smirnoff 	u_int8_t	reason;
39*3b3a8eb9SGleb Smirnoff 	char		ifname[IFNAMSIZ];
40*3b3a8eb9SGleb Smirnoff 	char		ruleset[PFLOG_RULESET_NAME_SIZE];
41*3b3a8eb9SGleb Smirnoff 	u_int32_t	rulenr;
42*3b3a8eb9SGleb Smirnoff 	u_int32_t	subrulenr;
43*3b3a8eb9SGleb Smirnoff 	uid_t		uid;
44*3b3a8eb9SGleb Smirnoff 	pid_t		pid;
45*3b3a8eb9SGleb Smirnoff 	uid_t		rule_uid;
46*3b3a8eb9SGleb Smirnoff 	pid_t		rule_pid;
47*3b3a8eb9SGleb Smirnoff 	u_int8_t	dir;
48*3b3a8eb9SGleb Smirnoff 	u_int8_t	pad[3];
49*3b3a8eb9SGleb Smirnoff };
50*3b3a8eb9SGleb Smirnoff 
51*3b3a8eb9SGleb Smirnoff #define	PFLOG_HDRLEN		sizeof(struct pfloghdr)
52*3b3a8eb9SGleb Smirnoff /* minus pad, also used as a signature */
53*3b3a8eb9SGleb Smirnoff #define	PFLOG_REAL_HDRLEN	offsetof(struct pfloghdr, pad)
54*3b3a8eb9SGleb Smirnoff 
55*3b3a8eb9SGleb Smirnoff #ifdef _KERNEL
56*3b3a8eb9SGleb Smirnoff struct pf_rule;
57*3b3a8eb9SGleb Smirnoff struct pf_ruleset;
58*3b3a8eb9SGleb Smirnoff struct pfi_kif;
59*3b3a8eb9SGleb Smirnoff struct pf_pdesc;
60*3b3a8eb9SGleb Smirnoff 
61*3b3a8eb9SGleb Smirnoff #define	PFLOG_PACKET(i,a,b,c,d,e,f,g,h,di) do {		\
62*3b3a8eb9SGleb Smirnoff 	if (pflog_packet_ptr != NULL)			\
63*3b3a8eb9SGleb Smirnoff 		pflog_packet_ptr(i,a,b,c,d,e,f,g,h,di);	\
64*3b3a8eb9SGleb Smirnoff } while (0)
65*3b3a8eb9SGleb Smirnoff #endif /* _KERNEL */
66*3b3a8eb9SGleb Smirnoff #endif /* _NET_IF_PFLOG_H_ */
67