OpenVPN
init.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-2018 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 #ifndef INIT_H
25 #define INIT_H
26 
27 #include "openvpn.h"
28 
29 /*
30  * Baseline maximum number of events
31  * to wait for.
32  */
33 #define BASE_N_EVENTS 4
34 
35 void context_clear(struct context *c);
36 
37 void context_clear_1(struct context *c);
38 
39 void context_clear_2(struct context *c);
40 
41 void context_init_1(struct context *c);
42 
44 
45 bool init_static(void);
46 
47 void uninit_static(void);
48 
49 #define IVM_LEVEL_1 (1<<0)
50 #define IVM_LEVEL_2 (1<<1)
51 void init_verb_mute(struct context *c, unsigned int flags);
52 
53 void init_options_dev(struct options *options);
54 
55 bool print_openssl_info(const struct options *options);
56 
57 bool do_genkey(const struct options *options);
58 
59 bool do_persist_tuntap(const struct options *options);
60 
61 bool possibly_become_daemon(const struct options *options);
62 
63 void pre_setup(const struct options *options);
64 
65 void init_instance_handle_signals(struct context *c, const struct env_set *env, const unsigned int flags);
66 
67 void init_instance(struct context *c, const struct env_set *env, const unsigned int flags);
68 
72 void init_query_passwords(const struct context *c);
73 
74 void do_route(const struct options *options,
75  struct route_list *route_list,
77  const struct tuntap *tt,
78  const struct plugin_list *plugins,
79  struct env_set *es);
80 
81 void close_instance(struct context *c);
82 
83 bool do_test_crypto(const struct options *o);
84 
85 void context_gc_free(struct context *c);
86 
87 bool do_up(struct context *c,
88  bool pulled_options,
89  unsigned int option_types_found);
90 
91 unsigned int pull_permission_mask(const struct context *c);
92 
93 const char *format_common_name(struct context *c, struct gc_arena *gc);
94 
95 void reset_coarse_timers(struct context *c);
96 
97 bool do_deferred_options(struct context *c, const unsigned int found);
98 
100  const struct context *src);
101 
102 void inherit_context_top(struct context *dest,
103  const struct context *src);
104 
105 #define CC_GC_FREE (1<<0)
106 #define CC_USR1_TO_HUP (1<<1)
107 #define CC_HARD_USR1_TO_HUP (1<<2)
108 #define CC_NO_CLOSE (1<<3)
109 
110 void close_context(struct context *c, int sig, unsigned int flags);
111 
112 struct context_buffers *init_context_buffers(const struct frame *frame);
113 
114 void free_context_buffers(struct context_buffers *b);
115 
116 #define ISC_ERRORS (1<<0)
117 #define ISC_SERVER (1<<1)
118 void initialization_sequence_completed(struct context *c, const unsigned int flags);
119 
120 #ifdef ENABLE_MANAGEMENT
121 
122 void init_management(struct context *c);
123 
124 bool open_management(struct context *c);
125 
126 void close_management(void);
127 
128 void management_show_net_callback(void *arg, const int msglevel);
129 
130 #endif
131 
132 void init_management_callback_p2p(struct context *c);
133 
134 void uninit_management_callback(void);
135 
136 #ifdef ENABLE_PLUGIN
137 void init_plugins(struct context *c);
138 
139 void open_plugins(struct context *c, const bool import_options, int init_point);
140 
141 #endif
142 
143 #endif /* ifndef INIT_H */
void init_instance(struct context *c, const struct env_set *env, const unsigned int flags)
Definition: init.c:3954
Definition: tun.h:131
bool possibly_become_daemon(const struct options *options)
Definition: init.c:1101
Contains all state information for one tunnel.
Definition: openvpn.h:498
Packet geometry parameters.
Definition: mtu.h:93
struct env_set * es
Set of environment variables.
Definition: openvpn.h:521
void init_instance_handle_signals(struct context *c, const struct env_set *env, const unsigned int flags)
Definition: init.c:3932
void initialization_sequence_completed(struct context *c, const unsigned int flags)
Definition: init.c:1466
bool do_genkey(const struct options *options)
Definition: init.c:1029
void init_management_callback_p2p(struct context *c)
Definition: init.c:3821
void init_options_dev(struct options *options)
Definition: init.c:981
struct signal_info * sig
Internal error signaling object.
Definition: openvpn.h:523
bool do_persist_tuntap(const struct options *options)
Definition: init.c:1061
struct context_buffers * init_context_buffers(const struct frame *frame)
Definition: init.c:3145
void do_route(const struct options *options, struct route_list *route_list, struct route_ipv6_list *route_ipv6_list, const struct tuntap *tt, const struct plugin_list *plugins, struct env_set *es)
Definition: init.c:1585
void uninit_static(void)
Definition: init.c:940
bool init_static(void)
Definition: init.c:702
void close_instance(struct context *c)
Definition: init.c:4270
list flags
bool do_test_crypto(const struct options *o)
Definition: init.c:4531
void close_context(struct context *c, int sig, unsigned int flags)
Definition: init.c:4472
bool print_openssl_info(const struct options *options)
Definition: init.c:991
bool do_deferred_options(struct context *c, const unsigned int found)
Definition: init.c:2141
void init_management(struct context *c)
Definition: init.c:3844
bool open_management(struct context *c)
Definition: init.c:3853
bool do_up(struct context *c, bool pulled_options, unsigned int option_types_found)
Definition: init.c:2029
void context_clear_1(struct context *c)
Definition: init.c:76
void uninit_management_callback(void)
Definition: init.c:3917
unsigned int pull_permission_mask(const struct context *c)
Definition: init.c:2106
void context_init_1(struct context *c)
Definition: init.c:616
void context_clear(struct context *c)
Definition: init.c:70
void pre_setup(const struct options *options)
Definition: init.c:1230
void init_verb_mute(struct context *c, unsigned int flags)
Definition: init.c:958
void init_query_passwords(const struct context *c)
Query for private key and auth-user-pass username/passwords.
Definition: init.c:531
void close_management(void)
Definition: init.c:3904
void management_show_net_callback(void *arg, const int msglevel)
Definition: init.c:3768
void inherit_context_top(struct context *dest, const struct context *src)
Definition: init.c:4420
void context_clear_2(struct context *c)
Definition: init.c:82
void context_clear_all_except_first_time(struct context *c)
Definition: init.c:88
struct plugin_list * plugins
List of plug-ins.
Definition: openvpn.h:525
void inherit_context_child(struct context *dest, const struct context *src)
Definition: init.c:4348
void context_gc_free(struct context *c)
Definition: init.c:663
void init_plugins(struct context *c)
Definition: init.c:3689
void reset_coarse_timers(struct context *c)
Definition: init.c:1258
void open_plugins(struct context *c, const bool import_options, int init_point)
Definition: init.c:3699
Garbage collection arena used to keep track of dynamically allocated memory.
Definition: buffer.h:116
const char * format_common_name(struct context *c, struct gc_arena *gc)
Definition: init.c:1219
struct gc_arena gc
Garbage collection arena for allocations done in the scope of this context structure.
Definition: openvpn.h:517
char * dest
Definition: compat-lz4.h:431
void free_context_buffers(struct context_buffers *b)
Definition: init.c:3168