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