1223637Sbz/* $OpenBSD: if_pflog.h,v 1.13 2006/10/23 12:46:09 henning 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_
28223637Sbz#define	_NET_IF_PFLOG_H_
29126258Smlaier
30171168Smlaier#define	PFLOGIFS_MAX	16
31171168Smlaier
32223637Sbz#define	PFLOG_RULESET_NAME_SIZE	16
33126258Smlaier
34126258Smlaierstruct pfloghdr {
35126258Smlaier	u_int8_t	length;
36126258Smlaier	sa_family_t	af;
37126258Smlaier	u_int8_t	action;
38126258Smlaier	u_int8_t	reason;
39126258Smlaier	char		ifname[IFNAMSIZ];
40145836Smlaier	char		ruleset[PFLOG_RULESET_NAME_SIZE];
41126258Smlaier	u_int32_t	rulenr;
42126258Smlaier	u_int32_t	subrulenr;
43171168Smlaier	uid_t		uid;
44171168Smlaier	pid_t		pid;
45171168Smlaier	uid_t		rule_uid;
46171168Smlaier	pid_t		rule_pid;
47126258Smlaier	u_int8_t	dir;
48126258Smlaier	u_int8_t	pad[3];
49126258Smlaier};
50126258Smlaier
51223637Sbz#define	PFLOG_HDRLEN		sizeof(struct pfloghdr)
52126258Smlaier/* minus pad, also used as a signature */
53223637Sbz#define	PFLOG_REAL_HDRLEN	offsetof(struct pfloghdr, pad)
54126258Smlaier
55126258Smlaier#ifdef _KERNEL
56156500Syarstruct pf_rule;
57156500Syarstruct pf_ruleset;
58156500Syarstruct pfi_kif;
59171168Smlaierstruct pf_pdesc;
60155337Smlaier
61240233Sglebius#define	PFLOG_PACKET(i,a,b,c,d,e,f,g,h,di) do {		\
62223637Sbz	if (pflog_packet_ptr != NULL)			\
63240233Sglebius		pflog_packet_ptr(i,a,b,c,d,e,f,g,h,di);	\
64155337Smlaier} while (0)
65126258Smlaier#endif /* _KERNEL */
66126258Smlaier#endif /* _NET_IF_PFLOG_H_ */
67