chiark / gitweb /
shared/log: read /proc/cmdline only in daemons
[elogind.git] / src / shared / fw-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 "in-addr-util.h"
25
26 #ifdef HAVE_LIBIPTC
27
28 int fw_add_masquerade(
29                 bool add,
30                 int af,
31                 int protocol,
32                 const union in_addr_union *source,
33                 unsigned source_prefixlen,
34                 const char *out_interface,
35                 const union in_addr_union *destination,
36                 unsigned destination_prefixlen);
37
38 int fw_add_local_dnat(
39                 bool add,
40                 int af,
41                 int protocol,
42                 const char *in_interface,
43                 const union in_addr_union *source,
44                 unsigned source_prefixlen,
45                 const union in_addr_union *destination,
46                 unsigned destination_prefixlen,
47                 uint16_t local_port,
48                 const union in_addr_union *remote,
49                 uint16_t remote_port,
50                 const union in_addr_union *previous_remote);
51
52 #else
53
54 static inline int fw_add_masquerade(
55                 bool add,
56                 int af,
57                 int protocol,
58                 const union in_addr_union *source,
59                 unsigned source_prefixlen,
60                 const char *out_interface,
61                 const union in_addr_union *destination,
62                 unsigned destination_prefixlen) {
63         return -ENOTSUP;
64 }
65
66 static inline int fw_add_local_dnat(
67                 bool add,
68                 int af,
69                 int protocol,
70                 const char *in_interface,
71                 const union in_addr_union *source,
72                 unsigned source_prefixlen,
73                 const union in_addr_union *destination,
74                 unsigned destination_prefixlen,
75                 uint16_t local_port,
76                 const union in_addr_union *remote,
77                 uint16_t remote_port,
78                 const union in_addr_union *previous_remote) {
79         return -ENOTSUP;
80 }
81
82 #endif