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