1 /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 #pragma once 3 4 #include <stdbool.h> 5 #include <stdint.h> 6 7 #include "in-addr-util.h" 8 9 typedef struct FirewallContext FirewallContext; 10 11 int fw_ctx_new(FirewallContext **ret); 12 FirewallContext *fw_ctx_free(FirewallContext *ctx); 13 14 DEFINE_TRIVIAL_CLEANUP_FUNC(FirewallContext *, fw_ctx_free); 15 16 int fw_add_masquerade( 17 FirewallContext **ctx, 18 bool add, 19 int af, 20 const union in_addr_union *source, 21 unsigned source_prefixlen); 22 23 int fw_add_local_dnat( 24 FirewallContext **ctx, 25 bool add, 26 int af, 27 int protocol, 28 uint16_t local_port, 29 const union in_addr_union *remote, 30 uint16_t remote_port, 31 const union in_addr_union *previous_remote); 32