xref: /freebsd/sys/netpfil/ipfw/nat64/ip_fw_nat64.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1d8caf56eSAndrey V. Elsukov /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3002cae78SAndrey V. Elsukov  *
4002cae78SAndrey V. Elsukov  * Copyright (c) 2015-2019 Yandex LLC
5002cae78SAndrey V. Elsukov  * Copyright (c) 2015-2019 Andrey V. Elsukov <ae@FreeBSD.org>
6d8caf56eSAndrey V. Elsukov  *
7d8caf56eSAndrey V. Elsukov  * Redistribution and use in source and binary forms, with or without
8d8caf56eSAndrey V. Elsukov  * modification, are permitted provided that the following conditions
9d8caf56eSAndrey V. Elsukov  * are met:
10d8caf56eSAndrey V. Elsukov  *
11d8caf56eSAndrey V. Elsukov  * 1. Redistributions of source code must retain the above copyright
12d8caf56eSAndrey V. Elsukov  *    notice, this list of conditions and the following disclaimer.
13d8caf56eSAndrey V. Elsukov  * 2. Redistributions in binary form must reproduce the above copyright
14d8caf56eSAndrey V. Elsukov  *    notice, this list of conditions and the following disclaimer in the
15d8caf56eSAndrey V. Elsukov  *    documentation and/or other materials provided with the distribution.
16d8caf56eSAndrey V. Elsukov  *
17d8caf56eSAndrey V. Elsukov  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18d8caf56eSAndrey V. Elsukov  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19d8caf56eSAndrey V. Elsukov  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20d8caf56eSAndrey V. Elsukov  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21d8caf56eSAndrey V. Elsukov  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22d8caf56eSAndrey V. Elsukov  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23d8caf56eSAndrey V. Elsukov  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24d8caf56eSAndrey V. Elsukov  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25d8caf56eSAndrey V. Elsukov  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26d8caf56eSAndrey V. Elsukov  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27d8caf56eSAndrey V. Elsukov  */
28d8caf56eSAndrey V. Elsukov 
29d8caf56eSAndrey V. Elsukov #ifndef	_IP_FW_NAT64_H_
30d8caf56eSAndrey V. Elsukov #define	_IP_FW_NAT64_H_
31d8caf56eSAndrey V. Elsukov 
32d8caf56eSAndrey V. Elsukov #define	DPRINTF(mask, fmt, ...)	\
33782360deSAndrey V. Elsukov     if (V_nat64_debug & (mask))	\
34d8caf56eSAndrey V. Elsukov 	printf("NAT64: %s: " fmt "\n", __func__, ## __VA_ARGS__)
35d8caf56eSAndrey V. Elsukov #define	DP_GENERIC	0x0001
36d8caf56eSAndrey V. Elsukov #define	DP_OBJ		0x0002
37d8caf56eSAndrey V. Elsukov #define	DP_JQUEUE	0x0004
38d8caf56eSAndrey V. Elsukov #define	DP_STATE	0x0008
39d8caf56eSAndrey V. Elsukov #define	DP_DROPS	0x0010
40d8caf56eSAndrey V. Elsukov #define	DP_ALL		0xFFFF
41782360deSAndrey V. Elsukov 
42782360deSAndrey V. Elsukov VNET_DECLARE(int, nat64_debug);
43782360deSAndrey V. Elsukov #define	V_nat64_debug		VNET(nat64_debug)
44d8caf56eSAndrey V. Elsukov 
45d8caf56eSAndrey V. Elsukov #if 0
46d8caf56eSAndrey V. Elsukov #define	NAT64NOINLINE	__noinline
47d8caf56eSAndrey V. Elsukov #else
48d8caf56eSAndrey V. Elsukov #define	NAT64NOINLINE
49d8caf56eSAndrey V. Elsukov #endif
50d8caf56eSAndrey V. Elsukov 
51d8caf56eSAndrey V. Elsukov int	nat64stl_init(struct ip_fw_chain *ch, int first);
52d8caf56eSAndrey V. Elsukov void	nat64stl_uninit(struct ip_fw_chain *ch, int last);
53d8caf56eSAndrey V. Elsukov int	nat64lsn_init(struct ip_fw_chain *ch, int first);
54d8caf56eSAndrey V. Elsukov void	nat64lsn_uninit(struct ip_fw_chain *ch, int last);
555c04f73eSAndrey V. Elsukov int	nat64clat_init(struct ip_fw_chain *ch, int first);
565c04f73eSAndrey V. Elsukov void	nat64clat_uninit(struct ip_fw_chain *ch, int last);
57d8caf56eSAndrey V. Elsukov 
58782360deSAndrey V. Elsukov #endif /* _IP_FW_NAT64_H_ */
59