]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/firewall-util.h
c39b34cf8f83c77fa3dbf3facc581e114490928f
[thirdparty/systemd.git] / src / shared / firewall-util.h
1 #pragma once
2
3 /***
4 This file is part of systemd.
5
6 Copyright 2015 Lennart Poettering
7
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
12
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
20 ***/
21
22 #include <stdbool.h>
23 #include <stdint.h>
24
25 #include "in-addr-util.h"
26
27 #ifdef HAVE_LIBIPTC
28
29 int fw_add_masquerade(
30 bool add,
31 int af,
32 int protocol,
33 const union in_addr_union *source,
34 unsigned source_prefixlen,
35 const char *out_interface,
36 const union in_addr_union *destination,
37 unsigned destination_prefixlen);
38
39 int fw_add_local_dnat(
40 bool add,
41 int af,
42 int protocol,
43 const char *in_interface,
44 const union in_addr_union *source,
45 unsigned source_prefixlen,
46 const union in_addr_union *destination,
47 unsigned destination_prefixlen,
48 uint16_t local_port,
49 const union in_addr_union *remote,
50 uint16_t remote_port,
51 const union in_addr_union *previous_remote);
52
53 #else
54
55 static inline int fw_add_masquerade(
56 bool add,
57 int af,
58 int protocol,
59 const union in_addr_union *source,
60 unsigned source_prefixlen,
61 const char *out_interface,
62 const union in_addr_union *destination,
63 unsigned destination_prefixlen) {
64 return -EOPNOTSUPP;
65 }
66
67 static inline int fw_add_local_dnat(
68 bool add,
69 int af,
70 int protocol,
71 const char *in_interface,
72 const union in_addr_union *source,
73 unsigned source_prefixlen,
74 const union in_addr_union *destination,
75 unsigned destination_prefixlen,
76 uint16_t local_port,
77 const union in_addr_union *remote,
78 uint16_t remote_port,
79 const union in_addr_union *previous_remote) {
80 return -EOPNOTSUPP;
81 }
82
83 #endif