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-2023 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, write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23 
24 #if !defined(CLINAT_H)
25 #define CLINAT_H
26 
27 #include "buffer.h"
28 
29 #define MAX_CLIENT_NAT 64
30 
31 #define CN_OUTGOING 0
32 #define CN_INCOMING 1
33 
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 
44  int n;
46 };
47 
49 
51 
53 
54 void print_client_nat_list(const struct client_nat_option_list *list, int msglevel);
55 
57  const char *type,
58  const char *network,
59  const char *netmask,
60  const char *foreign_network,
61  int msglevel);
62 
63 void client_nat_transform(const struct client_nat_option_list *list,
64  struct buffer *ipbuf,
65  const int direction);
66 
67 #endif /* if !defined(CLINAT_H) */
client_nat_option_list::n
int n
Definition: clinat.h:44
print_client_nat_list
void print_client_nat_list(const struct client_nat_option_list *list, int msglevel)
Definition: clinat.c:52
client_nat_option_list
Definition: clinat.h:43
copy_client_nat_option_list
void copy_client_nat_option_list(struct client_nat_option_list *dest, const struct client_nat_option_list *src)
Definition: clinat.c:92
client_nat_option_list::entries
struct client_nat_entry entries[MAX_CLIENT_NAT]
Definition: clinat.h:45
client_nat_entry::netmask
in_addr_t netmask
Definition: clinat.h:39
client_nat_transform
void client_nat_transform(const struct client_nat_option_list *list, struct buffer *ipbuf, const int direction)
Definition: clinat.c:193
client_nat_entry::type
int type
Definition: clinat.h:37
buffer
Wrapper structure for dynamically allocated memory.
Definition: buffer.h:60
client_nat_entry::foreign_network
in_addr_t foreign_network
Definition: clinat.h:40
buffer.h
gc_arena
Garbage collection arena used to keep track of dynamically allocated memory.
Definition: buffer.h:116
clone_client_nat_option_list
struct client_nat_option_list * clone_client_nat_option_list(const struct client_nat_option_list *src, struct gc_arena *gc)
Definition: clinat.c:83
client_nat_entry::network
in_addr_t network
Definition: clinat.h:38
add_client_nat_to_option_list
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:106
client_nat_entry
Definition: clinat.h:34
MAX_CLIENT_NAT
#define MAX_CLIENT_NAT
Definition: clinat.h:29
new_client_nat_list
struct client_nat_option_list * new_client_nat_list(struct gc_arena *gc)
Definition: clinat.c:75