1 /* IPSec VPN client compatible with Cisco equipment. 2 Copyright (C) 2004-2005 Maurice Massar 3 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. 8 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. 13 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 17 18 $Id: config.h 312 2008-06-15 18:09:42Z Joerg Mayer $ 19 */ 20 21 #ifndef __CONFIG_H__ 22 #define __CONFIG_H__ 23 24 #include <unistd.h> 25 #include <inttypes.h> 26 27 #include "vpnc-debug.h" 28 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 62 }; 63 64 enum hex_dump_enum { 65 DUMP_UINT8 = -1, 66 DUMP_UINT16 = -2, 67 DUMP_UINT32 = -4 68 }; 69 70 enum vendor_enum { 71 VENDOR_CISCO, 72 VENDOR_NETSCREEN 73 }; 74 75 enum natt_mode_enum { 76 NATT_NONE, 77 NATT_NORMAL, 78 NATT_FORCE, 79 NATT_CISCO_UDP 80 }; 81 82 enum if_mode_enum { 83 IF_MODE_TUN, 84 IF_MODE_TAP 85 }; 86 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 93 }; 94 95 extern const char *config[LAST_CONFIG]; 96 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; 104 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; \ 113 }) 114 115 #define DEBUGTOP(LVL, COMMAND) do { \ 116 if (opt_debug >= (LVL)) { \ 117 printf("\n"); \ 118 COMMAND; \ 119 printf(" [%s]\n", TIMESTAMP()); \ 120 } \ 121 } while (0) 122 123 #define DEBUG(LVL, COMMAND) do { \ 124 if (opt_debug >= (LVL)) { \ 125 if (opt_debug > 1) \ 126 printf(" "); \ 127 COMMAND; \ 128 } \ 129 } while (0) 130 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); 133 134 #endif 135