]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/firewall-util.h
tree-wide: drop 'This file is part of systemd' blurb
[thirdparty/systemd.git] / src / shared / firewall-util.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5 Copyright 2015 Lennart Poettering
6 ***/
7
8 #include <stdbool.h>
9 #include <stdint.h>
10
11 #include "in-addr-util.h"
12
13 #if HAVE_LIBIPTC
14
15 int fw_add_masquerade(
16 bool add,
17 int af,
18 int protocol,
19 const union in_addr_union *source,
20 unsigned source_prefixlen,
21 const char *out_interface,
22 const union in_addr_union *destination,
23 unsigned destination_prefixlen);
24
25 int fw_add_local_dnat(
26 bool add,
27 int af,
28 int protocol,
29 const char *in_interface,
30 const union in_addr_union *source,
31 unsigned source_prefixlen,
32 const union in_addr_union *destination,
33 unsigned destination_prefixlen,
34 uint16_t local_port,
35 const union in_addr_union *remote,
36 uint16_t remote_port,
37 const union in_addr_union *previous_remote);
38
39 #else
40
41 static inline int fw_add_masquerade(
42 bool add,
43 int af,
44 int protocol,
45 const union in_addr_union *source,
46 unsigned source_prefixlen,
47 const char *out_interface,
48 const union in_addr_union *destination,
49 unsigned destination_prefixlen) {
50 return -EOPNOTSUPP;
51 }
52
53 static inline int fw_add_local_dnat(
54 bool add,
55 int af,
56 int protocol,
57 const char *in_interface,
58 const union in_addr_union *source,
59 unsigned source_prefixlen,
60 const union in_addr_union *destination,
61 unsigned destination_prefixlen,
62 uint16_t local_port,
63 const union in_addr_union *remote,
64 uint16_t remote_port,
65 const union in_addr_union *previous_remote) {
66 return -EOPNOTSUPP;
67 }
68
69 #endif