xref: /netbsd-src/sys/net/npf/if_npflog.h (revision 39013e66c1ab98cbf1ceb3a94595880d6763083b)
1*923e6ee2Schristos /*
2*923e6ee2Schristos  * Copyright 2001 Niels Provos <provos@citi.umich.edu>
3*923e6ee2Schristos  * All rights reserved.
4*923e6ee2Schristos  *
5*923e6ee2Schristos  * Redistribution and use in source and binary forms, with or without
6*923e6ee2Schristos  * modification, are permitted provided that the following conditions
7*923e6ee2Schristos  * are met:
8*923e6ee2Schristos  * 1. Redistributions of source code must retain the above copyright
9*923e6ee2Schristos  *    notice, this list of conditions and the following disclaimer.
10*923e6ee2Schristos  * 2. Redistributions in binary form must reproduce the above copyright
11*923e6ee2Schristos  *    notice, this list of conditions and the following disclaimer in the
12*923e6ee2Schristos  *    documentation and/or other materials provided with the distribution.
13*923e6ee2Schristos  *
14*923e6ee2Schristos  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15*923e6ee2Schristos  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16*923e6ee2Schristos  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17*923e6ee2Schristos  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18*923e6ee2Schristos  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19*923e6ee2Schristos  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20*923e6ee2Schristos  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21*923e6ee2Schristos  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22*923e6ee2Schristos  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23*923e6ee2Schristos  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24*923e6ee2Schristos  */
25*923e6ee2Schristos #ifndef _NET_NPF_IF_NPFLOG_H_
26*923e6ee2Schristos #define _NET_NPF_IF_NPFLOG_H_
27*923e6ee2Schristos 
28*923e6ee2Schristos #ifndef _KERNEL
29*923e6ee2Schristos #error "not supposed to be exposed to userland"
30*923e6ee2Schristos #endif
31*923e6ee2Schristos 
32*923e6ee2Schristos #define NPFLOG_RULESET_NAME_SIZE	16
33*923e6ee2Schristos 
34*923e6ee2Schristos /*
35*923e6ee2Schristos  * For now, we use a header compatible with pflog.
36*923e6ee2Schristos  * This will be improved in the future.
37*923e6ee2Schristos  */
38*923e6ee2Schristos 
39*923e6ee2Schristos struct npfloghdr {
40*923e6ee2Schristos 	uint8_t		length;
41*923e6ee2Schristos 	sa_family_t	af;
42*923e6ee2Schristos 	uint8_t		action;
43*923e6ee2Schristos 	uint8_t		reason;
44*923e6ee2Schristos 	char		ifname[IFNAMSIZ];
45*923e6ee2Schristos 	char		ruleset[NPFLOG_RULESET_NAME_SIZE];
46*923e6ee2Schristos 	uint32_t	rulenr;
47*923e6ee2Schristos 	uint32_t	subrulenr;
48*923e6ee2Schristos 	uint32_t	uid;
49*923e6ee2Schristos 	uint32_t	pid;
50*923e6ee2Schristos 	uint32_t	rule_uid;
51*923e6ee2Schristos 	uint32_t	rule_pid;
52*923e6ee2Schristos 	uint8_t		dir;
53*923e6ee2Schristos 	uint8_t		pad[3];
54*923e6ee2Schristos };
55*923e6ee2Schristos 
56*923e6ee2Schristos #define DLT_NPFLOG	DLT_PFLOG
57*923e6ee2Schristos 
58*923e6ee2Schristos #define NPFLOG_HDRLEN		sizeof(struct npfloghdr)
59*923e6ee2Schristos #define NPFLOG_REAL_HDRLEN	offsetof(struct npfloghdr, pad)
60*923e6ee2Schristos 
61*923e6ee2Schristos #endif /* _NET_NPF_IF_NPFLOG_H_ */
62