OpenVPN
clinat.h
Go to the documentation of this file.
1/*
2 * OpenVPN -- An application to securely tunnel IP networks
3 * over a single TCP/UDP port, with support for SSL/TLS-based
4 * session authentication and key exchange,
5 * packet encryption, packet authentication, and
6 * packet compression.
7 *
8 * Copyright (C) 2002-2025 OpenVPN Inc <sales@openvpn.net>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 * as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, see <https://www.gnu.org/licenses/>.
21 */
22
23#if !defined(CLINAT_H)
24#define CLINAT_H
25
26#include "buffer.h"
27
28#define MAX_CLIENT_NAT 64
29
30#define CN_OUTGOING 0
31#define CN_INCOMING 1
32
34{
35#define CN_SNAT 0
36#define CN_DNAT 1
37 int type;
38 in_addr_t network;
39 in_addr_t netmask;
40 in_addr_t foreign_network;
41};
42
48
50
52 const struct client_nat_option_list *src, struct gc_arena *gc);
53
55 const struct client_nat_option_list *src);
56
57void print_client_nat_list(const struct client_nat_option_list *list, int msglevel);
58
59void add_client_nat_to_option_list(struct client_nat_option_list *dest, const char *type,
60 const char *network, const char *netmask,
61 const char *foreign_network, int msglevel);
62
63void client_nat_transform(const struct client_nat_option_list *list, struct buffer *ipbuf,
64 const int direction);
65
66#endif /* if !defined(CLINAT_H) */
void print_client_nat_list(const struct client_nat_option_list *list, int msglevel)
Definition clinat.c:50
void client_nat_transform(const struct client_nat_option_list *list, struct buffer *ipbuf, const int direction)
Definition clinat.c:184
#define MAX_CLIENT_NAT
Definition clinat.h:28
void add_client_nat_to_option_list(struct client_nat_option_list *dest, const char *type, const char *network, const char *netmask, const char *foreign_network, int msglevel)
Definition clinat.c:102
struct client_nat_option_list * new_client_nat_list(struct gc_arena *gc)
Definition clinat.c:71
struct client_nat_option_list * clone_client_nat_option_list(const struct client_nat_option_list *src, struct gc_arena *gc)
Definition clinat.c:79
void copy_client_nat_option_list(struct client_nat_option_list *dest, const struct client_nat_option_list *src)
Definition clinat.c:88
Wrapper structure for dynamically allocated memory.
Definition buffer.h:60
Definition clinat.h:34
int type
Definition clinat.h:37
in_addr_t network
Definition clinat.h:38
in_addr_t foreign_network
Definition clinat.h:40
in_addr_t netmask
Definition clinat.h:39
struct client_nat_entry entries[MAX_CLIENT_NAT]
Definition clinat.h:46
Garbage collection arena used to keep track of dynamically allocated memory.
Definition buffer.h:116
struct gc_arena gc
Definition test_ssl.c:131