Stefan Seyfried <seife+obs@b1-systems.com>
[vpnc.git] / config.h
blob1e30ae5c7d59e07b382883be06c0e0c8f261414b
1 /* IPSec VPN client compatible with Cisco equipment.
2 Copyright (C) 2004-2005 Maurice Massar
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 $Id$
21 #ifndef __CONFIG_H__
22 #define __CONFIG_H__
24 #include <unistd.h>
25 #include <inttypes.h>
27 #include "vpnc-debug.h"
29 enum config_enum {
30 CONFIG_SCRIPT,
31 CONFIG_DEBUG,
32 CONFIG_DOMAIN,
33 CONFIG_ENABLE_1DES,
34 CONFIG_ENABLE_NO_ENCRYPTION,
35 CONFIG_ND,
36 CONFIG_NON_INTERACTIVE,
37 CONFIG_PID_FILE,
38 CONFIG_LOCAL_ADDR,
39 CONFIG_LOCAL_PORT,
40 CONFIG_VERSION,
41 CONFIG_IF_NAME,
42 CONFIG_IF_MODE,
43 CONFIG_IKE_DH,
44 CONFIG_IPSEC_PFS,
45 CONFIG_IPSEC_GATEWAY,
46 CONFIG_IPSEC_TARGET_NETWORK,
47 CONFIG_IPSEC_ID,
48 CONFIG_IPSEC_SECRET,
49 CONFIG_IPSEC_SECRET_OBF,
50 CONFIG_XAUTH_USERNAME,
51 CONFIG_XAUTH_PASSWORD,
52 CONFIG_XAUTH_PASSWORD_OBF,
53 CONFIG_XAUTH_INTERACTIVE,
54 CONFIG_VENDOR,
55 CONFIG_NATT_MODE,
56 CONFIG_UDP_ENCAP_PORT,
57 CONFIG_DPD_IDLE,
58 CONFIG_AUTH_MODE,
59 CONFIG_CA_FILE,
60 CONFIG_CA_DIR,
61 LAST_CONFIG
64 enum hex_dump_enum {
65 DUMP_UINT8 = -1,
66 DUMP_UINT16 = -2,
67 DUMP_UINT32 = -4
70 enum vendor_enum {
71 VENDOR_CISCO,
72 VENDOR_NETSCREEN
75 enum natt_mode_enum {
76 NATT_NONE,
77 NATT_NORMAL,
78 NATT_FORCE,
79 NATT_CISCO_UDP
82 enum if_mode_enum {
83 IF_MODE_TUN,
84 IF_MODE_TAP
87 enum auth_mode_enum {
88 AUTH_MODE_PSK,
89 AUTH_MODE_RSA1,
90 AUTH_MODE_RSA2,
91 AUTH_MODE_CERT,
92 AUTH_MODE_HYBRID
95 extern const char *config[LAST_CONFIG];
97 extern enum vendor_enum opt_vendor;
98 extern int opt_debug;
99 extern int opt_nd;
100 extern int opt_1des, opt_no_encryption, opt_auth_mode;
101 extern enum natt_mode_enum opt_natt_mode;
102 extern enum if_mode_enum opt_if_mode;
103 extern uint16_t opt_udpencapport;
105 #define TIMESTAMP() ({ \
106 char st[20]; \
107 time_t t; \
108 struct tm *tm; \
109 t = time(NULL); \
110 tm = localtime(&t); \
111 strftime(st, sizeof(st), "%F %T", tm); \
112 st; \
115 #define DEBUGTOP(LVL, COMMAND) do { \
116 if (opt_debug >= (LVL)) { \
117 printf("\n"); \
118 COMMAND; \
119 printf(" [%s]\n", TIMESTAMP()); \
121 } while (0)
123 #define DEBUG(LVL, COMMAND) do { \
124 if (opt_debug >= (LVL)) { \
125 if (opt_debug > 1) \
126 printf(" "); \
127 COMMAND; \
129 } while (0)
131 extern void hex_dump(const char *str, const void *data, ssize_t len, const struct debug_strings *decode);
132 extern void do_config(int argc, char **argv);
134 #endif