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-2010 OpenVPN Technologies, 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 20 * along with this program (see the file COPYING included with this 21 * distribution); if not, write to the Free Software Foundation, Inc., 22 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 */ 24 25#ifndef INIT_H 26#define INIT_H 27 28#include "openvpn.h" 29 30/* 31 * Baseline maximum number of events 32 * to wait for. 33 */ 34#define BASE_N_EVENTS 4 35 36void context_clear (struct context *c); 37void context_clear_1 (struct context *c); 38void context_clear_2 (struct context *c); 39void context_init_1 (struct context *c); 40void context_clear_all_except_first_time (struct context *c); 41 42bool init_static (void); 43 44void uninit_static (void); 45 46#define IVM_LEVEL_1 (1<<0) 47#define IVM_LEVEL_2 (1<<1) 48void init_verb_mute (struct context *c, unsigned int flags); 49 50void init_options_dev (struct options *options); 51 52bool print_openssl_info (const struct options *options); 53 54bool do_genkey (const struct options *options); 55 56bool do_persist_tuntap (const struct options *options); 57 58void pre_setup (const struct options *options); 59 60void init_instance_handle_signals (struct context *c, const struct env_set *env, const unsigned int flags); 61 62void init_instance (struct context *c, const struct env_set *env, const unsigned int flags); 63 64void do_route (const struct options *options, 65 struct route_list *route_list, 66 struct route_ipv6_list *route_ipv6_list, 67 const struct tuntap *tt, 68 const struct plugin_list *plugins, 69 struct env_set *es); 70 71void close_instance (struct context *c); 72 73bool do_test_crypto (const struct options *o); 74 75void context_gc_free (struct context *c); 76 77void do_up (struct context *c, 78 bool pulled_options, 79 unsigned int option_types_found); 80 81unsigned int pull_permission_mask (const struct context *c); 82 83const char *format_common_name (struct context *c, struct gc_arena *gc); 84 85void reset_coarse_timers (struct context *c); 86 87void do_deferred_options (struct context *c, const unsigned int found); 88 89void inherit_context_child (struct context *dest, 90 const struct context *src); 91 92void inherit_context_top (struct context *dest, 93 const struct context *src); 94 95#define CC_GC_FREE (1<<0) 96#define CC_USR1_TO_HUP (1<<1) 97#define CC_HARD_USR1_TO_HUP (1<<2) 98#define CC_NO_CLOSE (1<<3) 99 100void close_context (struct context *c, int sig, unsigned int flags); 101 102struct context_buffers *init_context_buffers (const struct frame *frame); 103 104void free_context_buffers (struct context_buffers *b); 105 106#define ISC_ERRORS (1<<0) 107#define ISC_SERVER (1<<1) 108void initialization_sequence_completed (struct context *c, const unsigned int flags); 109 110#ifdef ENABLE_MANAGEMENT 111 112void init_management (struct context *c); 113bool open_management (struct context *c); 114void close_management (void); 115 116void management_show_net_callback (void *arg, const int msglevel); 117 118#endif 119 120void init_management_callback_p2p (struct context *c); 121void uninit_management_callback (void); 122 123#ifdef ENABLE_PLUGIN 124void init_plugins (struct context *c); 125void open_plugins (struct context *c, const bool import_options, int init_point); 126#endif 127 128#endif 129