Replace obsolete getpass()
[vpnc.git] / config.h
blobf92695fc4cc9e775325265909269aeaa0f328dbc
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_IF_MTU,
44 CONFIG_IKE_DH,
45 CONFIG_IPSEC_PFS,
46 CONFIG_IPSEC_GATEWAY,
47 CONFIG_IPSEC_TARGET_NETWORK,
48 CONFIG_IPSEC_ID,
49 CONFIG_IPSEC_SECRET,
50 CONFIG_IPSEC_SECRET_OBF,
51 CONFIG_XAUTH_USERNAME,
52 CONFIG_XAUTH_PASSWORD,
53 CONFIG_XAUTH_PASSWORD_OBF,
54 CONFIG_XAUTH_INTERACTIVE,
55 CONFIG_VENDOR,
56 CONFIG_NATT_MODE,
57 CONFIG_UDP_ENCAP_PORT,
58 CONFIG_DPD_IDLE,
59 CONFIG_AUTH_MODE,
60 CONFIG_CA_FILE,
61 CONFIG_CA_DIR,
62 LAST_CONFIG
65 enum hex_dump_enum {
66 DUMP_UINT8 = -1,
67 DUMP_UINT16 = -2,
68 DUMP_UINT32 = -4
71 enum vendor_enum {
72 VENDOR_CISCO,
73 VENDOR_NETSCREEN
76 enum natt_mode_enum {
77 NATT_NONE,
78 NATT_NORMAL,
79 NATT_FORCE,
80 NATT_CISCO_UDP
83 enum if_mode_enum {
84 IF_MODE_TUN,
85 IF_MODE_TAP
88 enum auth_mode_enum {
89 AUTH_MODE_PSK,
90 AUTH_MODE_RSA1,
91 AUTH_MODE_RSA2,
92 AUTH_MODE_CERT,
93 AUTH_MODE_HYBRID
96 extern const char *config[LAST_CONFIG];
98 extern enum vendor_enum opt_vendor;
99 extern int opt_debug;
100 extern int opt_nd;
101 extern int opt_1des, opt_no_encryption, opt_auth_mode;
102 extern enum natt_mode_enum opt_natt_mode;
103 extern enum if_mode_enum opt_if_mode;
104 extern uint16_t opt_udpencapport;
106 #define TIMESTAMP() ({ \
107 char st[20]; \
108 time_t t; \
109 struct tm *tm; \
110 t = time(NULL); \
111 tm = localtime(&t); \
112 strftime(st, sizeof(st), "%F %T", tm); \
113 st; \
116 #define DEBUGTOP(LVL, COMMAND) do { \
117 if (opt_debug >= (LVL)) { \
118 printf("\n"); \
119 COMMAND; \
120 printf(" [%s]\n", TIMESTAMP()); \
122 } while (0)
124 #define DEBUG(LVL, COMMAND) do { \
125 if (opt_debug >= (LVL)) { \
126 if (opt_debug > 1) \
127 printf(" "); \
128 COMMAND; \
130 } while (0)
132 extern void hex_dump(const char *str, const void *data, ssize_t len, const struct debug_strings *decode);
133 extern void do_config(int argc, char **argv);
134 extern char *vpnc_getpass(const char *prompt);
136 extern void (*logmsg)(int priority, const char *format, ...)
137 __attribute__ ((__format__ (__printf__, 2, 3)));
139 #endif