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